Removing older packages from branch

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/branches/CV3_20080911_r5764@5881 6f19259b-4bc3-4df7-8a09-765794883524
diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscBaseBoardManufacturer.uni b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscBaseBoardManufacturer.uni
deleted file mode 100644
index 14a6893..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscBaseBoardManufacturer.uni
+++ /dev/null
Binary files differ
diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscBaseBoardManufacturerData.c b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscBaseBoardManufacturerData.c
deleted file mode 100644
index 9536c88..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscBaseBoardManufacturerData.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  MiscBaseBoardManufacturerData.c

-  

-Abstract: 

-

-  This driver parses the mMiscSubclassDataTable structure and reports

-  any generated data to the DataHub.

-

---*/

-

-#include "MiscSubclassDriver.h"

-

-//

-// Static (possibly build generated) Bios Vendor data.

-//

-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_BASE_BOARD_MANUFACTURER_DATA, MiscBaseBoardManufacturer) = {

-  STRING_TOKEN(STR_MISC_BASE_BOARD_MANUFACTURER),

-  STRING_TOKEN(STR_MISC_BASE_BOARD_PRODUCT_NAME),

-  STRING_TOKEN(STR_MISC_BASE_BOARD_VERSION),

-  STRING_TOKEN(STR_MISC_BASE_BOARD_SERIAL_NUMBER),

-  STRING_TOKEN(STR_MISC_BASE_BOARD_ASSET_TAG),

-  STRING_TOKEN(STR_MISC_BASE_BOARD_CHASSIS_LOCATION),

-  {                         // BaseBoardFeatureFlags

-    1,                      // Motherboard

-    0,                      // RequiresDaughterCard

-    0,                      // Removable

-    1,                      // Replaceable,

-    0,                      // HotSwappable

-    0,                      // Reserved

-  },

-  EfiBaseBoardTypeUnknown,  // BaseBoardType

-  {                         // BaseBoardChassisLink

-    EFI_MISC_SUBCLASS_GUID, // ProducerName

-    1,                      // Instance

-    1,                      // SubInstance

-  },

-  0,                        // BaseBoardNumberLinks

-  {                         // LinkN

-    EFI_MISC_SUBCLASS_GUID, // ProducerName

-    1,                      // Instance

-    1,                      // SubInstance

-  },

-};

-

-/* eof - MiscBaseBoardManufacturerData.c */

diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscBiosVendor.uni b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscBiosVendor.uni
deleted file mode 100644
index b1e7e52..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscBiosVendor.uni
+++ /dev/null
Binary files differ
diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscBiosVendorData.c b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscBiosVendorData.c
deleted file mode 100644
index 3187aba..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscBiosVendorData.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  MiscBiosVendorData.c

-  

-Abstract: 

-

-  This driver parses the mMiscSubclassDataTable structure and reports

-  any generated data to the DataHub.

-

---*/

-

-#include "MiscSubclassDriver.h"

-

-//

-// Static (possibly build generated) Bios Vendor data.

-//

-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_BIOS_VENDOR_DATA, MiscBiosVendor) = {

-  STRING_TOKEN(STR_MISC_BIOS_VENDOR),       // BiosVendor

-  STRING_TOKEN(STR_MISC_BIOS_VERSION),      // BiosVersion

-  STRING_TOKEN(STR_MISC_BIOS_RELEASE_DATE), // BiosReleaseDate

-  0xBABE, // BiosStartingAddress

-  {       // BiosPhysicalDeviceSize

-    2,    // Value

-    3,    // Exponent

-  },

-  {       // BiosCharacteristics1

-    0,    // Reserved1                         :2

-    0,    // Unknown                           :1

-    1,    // BiosCharacteristicsNotSupported   :1

-    0,    // IsaIsSupported                    :1

-    0,    // McaIsSupported                    :1

-    0,    // EisaIsSupported                   :1

-    0,    // PciIsSupported                    :1

-    0,    // PcmciaIsSupported                 :1

-    0,    // PlugAndPlayIsSupported            :1

-    0,    // ApmIsSupported                    :1

-    0,    // BiosIsUpgradable                  :1

-    0,    // BiosShadowingAllowed              :1

-    0,    // VlVesaIsSupported                 :1

-    0,    // EscdSupportIsAvailable            :1

-    0,    // BootFromCdIsSupported             :1

-    0,    // SelectableBootIsSupported         :1

-    0,    // RomBiosIsSocketed                 :1

-    0,    // BootFromPcmciaIsSupported         :1

-    0,    // EDDSpecificationIsSupported       :1

-    0,    // JapaneseNecFloppyIsSupported      :1

-    0,    // JapaneseToshibaFloppyIsSupported  :1

-    0,    // Floppy525_360IsSupported          :1

-    0,    // Floppy525_12IsSupported           :1

-    0,    // Floppy35_720IsSupported           :1

-    0,    // Floppy35_288IsSupported           :1

-    0,    // PrintScreenIsSupported            :1

-    0,    // Keyboard8042IsSupported           :1

-    0,    // SerialIsSupported                 :1

-    0,    // PrinterIsSupported                :1

-    0,    // CgaMonoIsSupported                :1

-    0,    // NecPc98                           :1

-    0,    // AcpiIsSupported                   :1

-    0,    // UsbLegacyIsSupported              :1

-    0,    // AgpIsSupported                    :1

-    0,    // I20BootIsSupported                :1

-    0,    // Ls120BootIsSupported              :1

-    0,    // AtapiZipDriveBootIsSupported      :1

-    0,    // Boot1394IsSupported               :1

-    0,    // SmartBatteryIsSupported           :1

-    0,    // BiosBootSpecIsSupported           :1

-    0,    // FunctionKeyNetworkBootIsSupported :1

-    0     // Reserved                          :22

-  },

-  {       // BiosCharacteristics2

-    0,    // BiosReserved                      :16

-    0,    // SystemReserved                    :16

-    0     // Reserved                          :32

-  },

-};

-

-/* eof - MiscBiosVendorData.c */

diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscBootInformationData.c b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscBootInformationData.c
deleted file mode 100644
index 1bf280b..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscBootInformationData.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  MiscBootInformationData.c

-  

-Abstract: 

-

-  This driver parses the mMiscSubclassDataTable structure and reports

-  any generated data to the DataHub.

-

---*/

-

-#include "MiscSubclassDriver.h"

-

-//

-// Static (possibly build generated) Bios Vendor data.

-//

-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_BOOT_INFORMATION_STATUS_DATA, BootInformationStatus) = {

-  EfiBootInformationStatusNoError,  // BootInformationStatus

-  0                                 // BootInformationData

-};

-

-/* eof - MiscBootInformationData.c */

diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscChassisManufacturer.uni b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscChassisManufacturer.uni
deleted file mode 100644
index 67bee85..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscChassisManufacturer.uni
+++ /dev/null
Binary files differ
diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscChassisManufacturerData.c b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscChassisManufacturerData.c
deleted file mode 100644
index 5c657ee..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscChassisManufacturerData.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  MiscChassisManufacturerData.c

-  

-Abstract: 

-

-  This driver parses the mMiscSubclassDataTable structure and reports

-  any generated data to the DataHub.

-

---*/

-

-#include "MiscSubclassDriver.h"

-

-//

-// Static (possibly build generated) Chassis Manufacturer data.

-//

-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_CHASSIS_MANUFACTURER_DATA, MiscChassisManufacturer) = {

-  STRING_TOKEN(STR_MISC_CHASSIS_MANUFACTURER),  // ChassisManufactrurer

-  STRING_TOKEN(STR_MISC_CHASSIS_VERSION),       // ChassisVersion

-  STRING_TOKEN(STR_MISC_CHASSIS_SERIAL_NUMBER), // ChassisSerialNumber

-  STRING_TOKEN(STR_MISC_CHASSIS_ASSET_TAG),     // ChassisAssetTag

-  {                               // ChassisTypeStatus

-    EfiMiscChassisTypeOther,      // ChassisType

-    0,                            // ChassisLockPresent

-    0                             // Reserved

-  },

-  EfiChassisStateOther,           // ChassisBootupState

-  EfiChassisStateOther,           // ChassisPowerSupplyState

-  EfiChassisStateOther,           // ChassisThermalState

-  EfiChassisSecurityStatusOther,  // ChassisSecurityState

-  0                               // ChassisOemDefined

-};

-

-/* eof - MiscChassisManufacaturerData.c */

diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscDevicePath.h b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscDevicePath.h
deleted file mode 100644
index dd78a7a..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscDevicePath.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/*++

- 

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  MiscDevicePath.h

-

-Abstract:

-

-  Misc class required EFI Device Path definitions (Ports, slots & 

-  onboard devices)

-

---*/

-

-#ifndef _MISC_DEVICE_PATH_H

-#define _MISC_DEVICE_PATH_H

-

-

-#pragma pack(1)

-//

-// USB

-//

-

-/* For reference:

-#define USB1_1_STR  "ACPI(PNP0A03,0)/PCI(1D,0)."

-#define USB1_2_STR  "ACPI(PNP0A03,0)/PCI(1D,1)."

-#define USB1_3_STR  "ACPI(PNP0A03,0)/PCI(1D,2)."

-#define USB2_1_STR  "ACPI(PNP0A03,0)/PCI(1D,7)." 

-*/

-

-//

-// #define acpi { 0x02, 0x01, 0x00, 0x0C, 0x0a0341d0, 0x00000000 }

-// #define pci( device,function)  { 0x01, 0x01, 0x00, 0x06, device, function }

-// #define end  { 0xFF, 0xFF, 0x00, 0x04 }

-//

-#define DP_ACPI \

-  { \

-    ACPI_DEVICE_PATH, ACPI_DP, (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), (UINT8) \

-      ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8), EISA_PNP_ID (0x0A03), 0 \

-  }

-#define DP_PCI(device, function) \

-  { \

-    HARDWARE_DEVICE_PATH, HW_PCI_DP, (UINT8) (sizeof (PCI_DEVICE_PATH)), (UINT8) \

-      ((sizeof (PCI_DEVICE_PATH)) >> 8), function, device \

-  }

-#define DP_END \

-  { \

-    END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, END_DEVICE_PATH_LENGTH, 0 \

-  }

-

-#define DP_LPC(eisaid, function) \

-  { \

-    ACPI_DEVICE_PATH, ACPI_DP, (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), (UINT8) \

-      ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8), EISA_PNP_ID (eisaid), function \

-  }

-

-//

-// Shanmu >> moved to TianoDevicePath.h

-//

-

-/*

-typedef struct _USB_PORT_DEVICE_PATH

-{

-  ACPI_HID_DEVICE_PATH    PciRootBridgeDevicePath;

-  PCI_DEVICE_PATH      PciBusDevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  EndDevicePath;

-} USB_PORT_DEVICE_PATH;

-

-

-//IDE ??I am not sure. Should this be ATAPI_DEVICE_PATH

-typedef struct _IDE_DEVICE_PATH

-{

-  ACPI_HID_DEVICE_PATH    PciRootBridgeDevicePath;

-  PCI_DEVICE_PATH      PciBusDevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  EndDevicePath;

-} IDE_DEVICE_PATH;

-

-//RMC Connector

-typedef struct _RMC_CONN_DEVICE_PATH

-{

-  ACPI_HID_DEVICE_PATH    PciRootBridgeDevicePath;

-  PCI_DEVICE_PATH      PciBridgeDevicePath;

-  PCI_DEVICE_PATH      PciBusDevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  EndDevicePath;

-} RMC_CONN_DEVICE_PATH;

-

-//static RMC_CONN_DEVICE_PATH mRmcConnDevicePath = { acpi, pci( 0x1E,0x00 ),pci( 0x0A,0x00 ), end };

-

-//RIDE

-typedef struct _RIDE_DEVICE_PATH

-{

-  ACPI_HID_DEVICE_PATH    PciRootBridgeDevicePath;

-  PCI_DEVICE_PATH      PciBridgeDevicePath;

-  PCI_DEVICE_PATH      PciBusDevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  EndDevicePath;

-} RIDE_DEVICE_PATH;

-

-//static RIDE_DEVICE_PATH mRideDevicePath = { acpi, pci( 0x1E,0x00 ),pci( 0x02,0x00 ), end };

-

-//Gigabit NIC

-//typedef struct _GB_NIC_DEVICE_PATH

-//{

-//  ACPI_HID_DEVICE_PATH      PciRootBridgeDevicePath;

-//  PCI_DEVICE_PATH            PciBridgeDevicePath;

-//  PCI_DEVICE_PATH            PciXBridgeDevicePath;

-//  PCI_DEVICE_PATH            PciXBusDevicePath;

-//  EFI_DEVICE_PATH_PROTOCOL  EndDevicePath;

-//} GB_NIC_DEVICE_PATH;

-

-//static GB_NIC_DEVICE_PATH mGbNicDevicePath = { acpi, pci( 0x03,0x00 ),pci( 0x1F,0x00 ),pci( 0x07,0x00 ), end };

-

-

-//P/S2 Connector

-typedef struct _PS2_CONN_DEVICE_PATH

-{

-  ACPI_HID_DEVICE_PATH    PciRootBridgeDevicePath;

-  PCI_DEVICE_PATH      LpcBridgeDevicePath;

-  ACPI_HID_DEVICE_PATH    LpcBusDevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  EndDevicePath;

-} PS2_CONN_DEVICE_PATH;

-

-//static PS2_CONN_DEVICE_PATH mPs2KeyboardDevicePath   = { acpi, pci( 0x1F,0x00 ),lpc( 0x0303,0 ), end };

-//static PS2_CONN_DEVICE_PATH mPs2MouseDevicePath      = { acpi, pci( 0x1F,0x00 ),lpc( 0x0303,1 ), end };

-

-//Serial Port Connector

-typedef struct _SERIAL_CONN_DEVICE_PATH

-{

-  ACPI_HID_DEVICE_PATH    PciRootBridgeDevicePath;

-  PCI_DEVICE_PATH      LpcBridgeDevicePath;

-  ACPI_HID_DEVICE_PATH    LpcBusDevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  EndDevicePath;

-} SERIAL_CONN_DEVICE_PATH;

-

-//static SERIAL_CONN_DEVICE_PATH mCom1DevicePath   = { acpi, pci( 0x1F,0x00 ),lpc( 0x0501,0 ), end };

-//static SERIAL_CONN_DEVICE_PATH mCom2DevicePath   = { acpi, pci( 0x1F,0x00 ),lpc( 0x0501,1 ), end };

-

-//Parallel Port Connector

-typedef struct _PARALLEL_CONN_DEVICE_PATH

-{

-  ACPI_HID_DEVICE_PATH    PciRootBridgeDevicePath;

-  PCI_DEVICE_PATH      LpcBridgeDevicePath;

-  ACPI_HID_DEVICE_PATH    LpcBusDevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  EndDevicePath;

-} PARALLEL_CONN_DEVICE_PATH;

-

-//static PARALLEL_CONN_DEVICE_PATH mLpt1DevicePath   = { acpi, pci( 0x1F,0x00 ),lpc( 0x0401,0 ), end };

-

-//Floopy Connector

-typedef struct _FLOOPY_CONN_DEVICE_PATH

-{

-  ACPI_HID_DEVICE_PATH    PciRootBridgeDevicePath;

-  PCI_DEVICE_PATH      LpcBridgeDevicePath;

-  ACPI_HID_DEVICE_PATH    LpcBusDevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  EndDevicePath;

-} FLOOPY_CONN_DEVICE_PATH;

-

-//static FLOOPY_CONN_DEVICE_PATH mFloopyADevicePath   = { acpi, pci( 0x1F,0x00 ),lpc( 0x0604,0 ), end };

-//static FLOOPY_CONN_DEVICE_PATH mFloopyBDevicePath   = { acpi, pci( 0x1F,0x00 ),lpc( 0x0604,1 ), end };

-

-*/

-

-//

-// End Shanmu

-//

-#pragma pack()

-

-#endif

diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscNumberOfInstallableLanguagesData.c b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscNumberOfInstallableLanguagesData.c
deleted file mode 100644
index 0084259..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscNumberOfInstallableLanguagesData.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  MiscNumberOfInstallableLanguagesData.c

-  

-Abstract: 

-

-  This driver parses the mMiscSubclassDataTable structure and reports

-  any generated data to the DataHub.

-

---*/

-

-#include "MiscSubclassDriver.h"

-

-//

-// Static (possibly build generated) Bios Vendor data.

-//

-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES_DATA, NumberOfInstallableLanguages) = {

-  1,    // NumberOfInstallableLanguages

-  {     // LanguageFlags

-    0,  // AbbreviatedLanguageFormat

-    0   // Reserved

-  },

-  0,    // CurrentLanguageNumber

-};

-

-/* eof - MiscNumberOfInstallableLanguagesData.c */

diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscOemString.uni b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscOemString.uni
deleted file mode 100644
index fb79bdb..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscOemString.uni
+++ /dev/null
Binary files differ
diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscOemStringData.c b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscOemStringData.c
deleted file mode 100644
index fdfbd1f..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscOemStringData.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-  

-    MiscOemStringData.c

-  

-Abstract: 

-

-  This driver parses the mMiscSubclassDataTable structure and reports

-  any generated data to the DataHub.

-

---*/

-

-#include "MiscSubclassDriver.h"

-

-//

-// Static (possibly build generated) Bios Vendor data.

-//

-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_OEM_STRING_DATA, OemString) = {

-  STRING_TOKEN(STR_MISC_OEM_STRING)

-};

-

-/* eof - MiscOemStringData.c */

diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscPortInternalConnectorDesignator.uni b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscPortInternalConnectorDesignator.uni
deleted file mode 100644
index b6a617b..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscPortInternalConnectorDesignator.uni
+++ /dev/null
Binary files differ
diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscPortInternalConnectorDesignatorData.c b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscPortInternalConnectorDesignatorData.c
deleted file mode 100644
index d886a9d..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscPortInternalConnectorDesignatorData.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  MiscPortInternalConnectorDesignatorData.c

-  

-Abstract: 

-

-  This driver parses the mMiscSubclassDataTable structure and reports

-  any generated data to the DataHub.

-

---*/

-

-#include "MiscSubclassDriver.h"

-

-//

-// Static (possibly build generated) Bios Vendor data.

-//

-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortInternalConnectorDesignator) = {

-  STRING_TOKEN(STR_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR),  // PortInternalConnectorDesignator

-  STRING_TOKEN(STR_MISC_PORT_EXTERNAL_CONNECTOR_DESIGNATOR),  // PortExternalConnectorDesignator

-  EfiPortConnectorTypeOther,  // PortInternalConnectorType

-  EfiPortConnectorTypeOther,  // PortExternalConnectorType

-  EfiPortTypeNone,            // PortType

-  0                           // PortPath

-};

-

-//

-// Static (possibly build generated) Bios Vendor data.

-//

-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortKeyboard) = {

-  STRING_TOKEN (STR_MISC_PORT_INTERNAL_KEYBOARD),   // PortInternalConnectorDesignator

-  STRING_TOKEN (STR_MISC_PORT_EXTERNAL_KEYBOARD),   // PortExternalConnectorDesignator

-  EfiPortConnectorTypeNone, // PortInternalConnectorType

-  EfiPortConnectorTypePS2,  // PortExternalConnectorType

-  EfiPortTypeKeyboard,      // PortType

-  // mPs2KbyboardDevicePath                          // PortPath

-  //

-  0

-};

-

-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortMouse) = {

-  STRING_TOKEN (STR_MISC_PORT_INTERNAL_MOUSE),      // PortInternalConnectorDesignator

-  STRING_TOKEN (STR_MISC_PORT_EXTERNAL_MOUSE),      // PortExternalConnectorDesignator

-  EfiPortConnectorTypeNone, // PortInternalConnectorType

-  EfiPortConnectorTypePS2,  // PortExternalConnectorType

-  EfiPortTypeMouse,         // PortType

-  // mPs2MouseDevicePath                // PortPath

-  //

-  0

-};

-

-

-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortCom1) = {

-  STRING_TOKEN(STR_MISC_PORT_INTERNAL_COM1),

-  STRING_TOKEN(STR_MISC_PORT_EXTERNAL_COM1),

-  EfiPortConnectorTypeNone,

-  EfiPortConnectorTypeDB9Female,

-  EfiPortTypeSerial16550ACompatible,

-  0

-};

-

-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortCom2) = {

-  STRING_TOKEN(STR_MISC_PORT_INTERNAL_COM2),

-  STRING_TOKEN(STR_MISC_PORT_EXTERNAL_COM2),

-  EfiPortConnectorTypeNone,

-  EfiPortConnectorTypeDB9Female,

-  EfiPortTypeSerial16550ACompatible,

-  0

-};

-

-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortExtensionPower) = {

-  STRING_TOKEN(STR_MISC_PORT_INTERNAL_EXTENSION_POWER),

-  STRING_TOKEN(STR_MISC_PORT_EXTERNAL_EXTENSION_POWER),

-  EfiPortConnectorTypeOther,

-  EfiPortConnectorTypeNone,

-  EfiPortTypeOther,

-  0

-};

-

-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortFloppy) = {

-  STRING_TOKEN(STR_MISC_PORT_INTERNAL_FLOPPY),

-  STRING_TOKEN(STR_MISC_PORT_EXTERNAL_FLOPPY),

-  EfiPortConnectorTypeOnboardFloppy,

-  EfiPortConnectorTypeNone,

-  EfiPortTypeOther,

-  0

-};

-

-/* eof - MiscPortInternalConnectorDesignatorData.c */

diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscPortInternalConnectorDesignatorFunction.c b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscPortInternalConnectorDesignatorFunction.c
deleted file mode 100644
index 35351aa..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscPortInternalConnectorDesignatorFunction.c
+++ /dev/null
@@ -1,266 +0,0 @@
-/*++

- 

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  MiscPortInternalConnectorDesignatorFunction.c

-  

-Abstract: 

-

-  This driver parses the mMiscSubclassDataTable structure and reports

-  any generated data to the DataHub.

-

---*/

-

-#include "MiscSubclassDriver.h"

-

-//

-//

-//

-MISC_SUBCLASS_TABLE_FUNCTION (

-  MiscPortInternalConnectorDesignator

-  )

-/*++

-Description:

-

-  This function makes boot time changes to the contents of the

-  MiscPortConnectorInformation (Type 8).

-

-Parameters:

-

-  RecordType

-    Type of record to be processed from the Data Table.

-    mMiscSubclassDataTable[].RecordType

-

-  RecordLen

-    Size of static RecordData from the Data Table.

-    mMiscSubclassDataTable[].RecordLen

-

-  RecordData

-    Pointer to copy of RecordData from the Data Table.  Changes made

-    to this copy will be written to the Data Hub but will not alter

-    the contents of the static Data Table.

-

-  LogRecordData

-    Set *LogRecordData to TRUE to log RecordData to Data Hub.

-    Set *LogRecordData to FALSE when there is no more data to log.

-

-Returns:

-

-  EFI_SUCCESS

-    All parameters were valid and *RecordData and *LogRecordData have

-    been set.

-

-  EFI_UNSUPPORTED

-    Unexpected RecordType value.

-

-  EFI_INVALID_PARAMETER

-    One of the following parameter conditions was true:

-      RecordLen was zero.

-      RecordData was NULL.

-      LogRecordData was NULL.

---*/

-{

-  STATIC BOOLEAN                    Done                    = FALSE;

-  STATIC PS2_CONN_DEVICE_PATH       mPs2KeyboardDevicePath  = { DP_ACPI, DP_PCI (0x1F, 0x00), DP_LPC (0x0303, 0), DP_END };

-  STATIC PS2_CONN_DEVICE_PATH       mPs2MouseDevicePath     = { DP_ACPI, DP_PCI (0x1F, 0x00), DP_LPC (0x0303, 1), DP_END };

-  STATIC SERIAL_CONN_DEVICE_PATH    mCom1DevicePath         = { DP_ACPI, DP_PCI (0x1F, 0x00), DP_LPC (0x0501, 0), DP_END };

-  STATIC SERIAL_CONN_DEVICE_PATH    mCom2DevicePath         = { DP_ACPI, DP_PCI (0x1F, 0x00), DP_LPC (0x0501, 1), DP_END };

-  STATIC PARALLEL_CONN_DEVICE_PATH  mLpt1DevicePath         = { DP_ACPI, DP_PCI (0x1F, 0x00), DP_LPC (0x0401, 0), DP_END };

-  STATIC FLOOPY_CONN_DEVICE_PATH    mFloopyADevicePath      = { DP_ACPI, DP_PCI (0x1F, 0x00), DP_LPC (0x0604, 0), DP_END };

-  STATIC FLOOPY_CONN_DEVICE_PATH    mFloopyBDevicePath      = { DP_ACPI, DP_PCI (0x1F, 0x00), DP_LPC (0x0604, 1), DP_END };

-  STATIC USB_PORT_DEVICE_PATH       mUsb0DevicePath         = { DP_ACPI, DP_PCI (0x1d, 0x00), DP_END };

-  STATIC USB_PORT_DEVICE_PATH       mUsb1DevicePath         = { DP_ACPI, DP_PCI (0x1d, 0x01), DP_END };

-  STATIC USB_PORT_DEVICE_PATH       mUsb2DevicePath         = { DP_ACPI, DP_PCI (0x1d, 0x02), DP_END };

-  STATIC USB_PORT_DEVICE_PATH       mUsb3DevicePath         = { DP_ACPI, DP_PCI (0x1d, 0x07), DP_END };

-  STATIC IDE_DEVICE_PATH            mIdeDevicePath          = { DP_ACPI, DP_PCI (0x1F, 0x01), DP_END };

-  STATIC GB_NIC_DEVICE_PATH         mGbNicDevicePath        = { DP_ACPI, DP_PCI( 0x03,0x00 ),DP_PCI( 0x1F,0x00 ),DP_PCI( 0x07,0x00 ), DP_END };

-  EFI_DEVICE_PATH_PROTOCOL          EndDevicePath           = DP_END;

-

-  //

-  // First check for invalid parameters.

-  //

-  // Shanmu >> to fix the Device Path Issue...

-  // if (RecordLen == 0 || RecordData == NULL || LogRecordData == NULL) {

-  //

-  if (*RecordLen == 0 || RecordData == NULL || LogRecordData == NULL) {

-    //

-    // End Shanmu

-    //

-    return EFI_INVALID_PARAMETER;

-  }

-  //

-  // Then check for unsupported RecordType.

-  //

-  if (RecordType != EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_RECORD_NUMBER) {

-    return EFI_UNSUPPORTED;

-  }

-  //

-  // Is this the first time through this function?

-  //

-  if (!Done) {

-    //

-    // Yes, this is the first time.  Inspect/Change the contents of the

-    // RecordData structure.

-    //

-    //

-    // Device path is only updated here as it was not taking that in static data

-    //

-    // Shanmu >> to fix the Device Path Issue...

-    //

-

-    /*

-    switch (((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortInternalConnectorDesignator) 

-    {

-      case STR_MISC_PORT_INTERNAL_MOUSE:

-        {

-          (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mPs2MouseDevicePath);          

-        }break;

-      case STR_MISC_PORT_INTERNAL_KEYBOARD:

-        {

-          (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mPs2KeyboardDevicePath);          

-        }break;

-      case STR_MISC_PORT_INTERNAL_COM1:

-        {

-          (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mCom1DevicePath);          

-        }break;

-      case STR_MISC_PORT_INTERNAL_COM2:

-        {

-          (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mCom2DevicePath);          

-        }break;

-      case STR_MISC_PORT_INTERNAL_LPT1:

-        {

-          (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mLpt1DevicePath);          

-        }break;

-      case STR_MISC_PORT_INTERNAL_USB1:

-        {

-          (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mUsb0DevicePath);          

-        }break;

-      case STR_MISC_PORT_INTERNAL_USB2:

-        {

-          (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mUsb1DevicePath);          

-        }break;

-      case STR_MISC_PORT_INTERNAL_USB3:

-        {

-          (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mUsb2DevicePath);          

-        }break;

-      case STR_MISC_PORT_INTERNAL_NETWORK:

-        {

-          (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mGbNicDevicePath);          

-        }break;

-      case STR_MISC_PORT_INTERNAL_FLOPPY:

-        {

-          (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mFloopyADevicePath);          

-        }break;

-      case STR_MISC_PORT_INTERNAL_IDE1:

-        {

-          (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mIdeDevicePath);          

-        }break;

-      case STR_MISC_PORT_INTERNAL_IDE2:

-        {

-          (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mIdeDevicePath);          

-        }break;

-      default:

-        {

-          (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = EndDevicePath;

-        }break;    

-    }

-    */

-    switch (((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortInternalConnectorDesignator) {

-    case STR_MISC_PORT_INTERNAL_MOUSE:

-      {

-        CopyMem (

-          &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortPath,

-          &mPs2MouseDevicePath,

-          GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mPs2MouseDevicePath)

-          );

-        *RecordLen = *RecordLen - sizeof (EFI_MISC_PORT_DEVICE_PATH) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mPs2MouseDevicePath);

-      }

-      break;

-

-    case STR_MISC_PORT_INTERNAL_KEYBOARD:

-      {

-        CopyMem (

-          &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortPath,

-          &mPs2KeyboardDevicePath,

-          GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mPs2KeyboardDevicePath)

-          );

-        *RecordLen = *RecordLen - sizeof (EFI_MISC_PORT_DEVICE_PATH) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mPs2KeyboardDevicePath);

-      }

-      break;

-

-    case STR_MISC_PORT_INTERNAL_COM1:

-      {

-        CopyMem (

-          &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortPath,

-          &mCom1DevicePath,

-          GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mCom1DevicePath)

-          );

-        *RecordLen = *RecordLen - sizeof (EFI_MISC_PORT_DEVICE_PATH) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mCom1DevicePath);

-      }

-      break;

-

-    case STR_MISC_PORT_INTERNAL_COM2:

-      {

-        CopyMem (

-          &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortPath,

-          &mCom2DevicePath,

-          GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mCom2DevicePath)

-          );

-        *RecordLen = *RecordLen - sizeof (EFI_MISC_PORT_DEVICE_PATH) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mCom2DevicePath);

-      }

-      break;

-

-    case STR_MISC_PORT_INTERNAL_FLOPPY:

-      {

-        CopyMem (

-          &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortPath,

-          &mFloopyADevicePath,

-          GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mFloopyADevicePath)

-          );

-        *RecordLen = *RecordLen - sizeof (EFI_MISC_PORT_DEVICE_PATH) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mFloopyADevicePath);

-      }

-      break;

-

-    default:

-      {

-        CopyMem (

-          &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortPath,

-          &EndDevicePath,

-          GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &EndDevicePath)

-          );

-        *RecordLen = *RecordLen - sizeof (EFI_MISC_PORT_DEVICE_PATH) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &EndDevicePath);

-      }

-      break;

-    }

-    //

-    // End Shanmu

-    //

-    // Set Done flag to TRUE for next pass through this function.

-    // Set *LogRecordData to TRUE so data will get logged to Data Hub.

-    //

-    Done            = TRUE;

-    *LogRecordData  = TRUE;

-  } else {

-    //

-    // No, this is the second time.  Reset the state of the Done flag

-    // to FALSE and tell the data logger that there is no more data

-    // to be logged for this record type.  If any memory allocations

-    // were made by earlier passes, they must be released now.

-    //

-    Done            = FALSE;

-    *LogRecordData  = FALSE;

-  }

-

-  return EFI_SUCCESS;

-}

-

-/* eof - MiscSystemManufacturerFunction.c */

diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscResetCapabilitiesData.c b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscResetCapabilitiesData.c
deleted file mode 100644
index 6e0c1bb..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscResetCapabilitiesData.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-  

-    MiscResetCapabilitiesData.c

-  

-Abstract: 

-

-  This driver parses the mMiscSubclassDataTable structure and reports

-  any generated data to the DataHub.

-

---*/

-

-#include "MiscSubclassDriver.h"

-

-//

-// Static (possibly build generated) Bios Vendor data.

-//

-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_RESET_CAPABILITIES, MiscResetCapabilities) = {

-  {     // ResetCapabilities

-    0,  // Status

-    0,  // BootOption

-    0,  // BootOptionOnLimit

-    0,  // WatchdogTimerPresent

-    0   // Reserved

-  },

-  0,    // ResetCount

-  0,    // ResetLimit

-  0,    // ResetTimerInterval

-  0     // ResetTimeout

-};

-

-/* eof - MiscResetCapabilities.c */

diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriver.dxs b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriver.dxs
deleted file mode 100644
index 8ac3bf9..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriver.dxs
+++ /dev/null
@@ -1,26 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  MiscSubclassDriver.dxs

-

-Abstract:

-

-  Dependency expression file for MiscSubclass Driver.

-  

---*/

-

-#include <DxeDepex.h>

-

-DEPENDENCY_START

-  EFI_DATA_HUB_PROTOCOL_GUID AND EFI_HII_PROTOCOL_GUID

-DEPENDENCY_END

diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriver.h b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriver.h
deleted file mode 100644
index 32f591f..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriver.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  MiscSubclassDriver.h

-

-Abstract:

-

-  Header file for MiscSubclass Driver.

-

---*/

-

-#ifndef _MISC_SUBCLASS_DRIVER_H

-#define _MISC_SUBCLASS_DRIVER_H

-

-

-#include <MiscDevicePath.h>

-

-//

-// Autogen string file

-//

-#include <MiscSubclassStrDefs.h>

-

-//

-// Data table entry update function.

-//

-typedef 

-EFI_STATUS 

-(EFIAPI EFI_MISC_SUBCLASS_DATA_FUNCTION) (

-  IN UINT16                         RecordType,

-  IN UINT32                         *RecordLen,

-  IN OUT EFI_MISC_SUBCLASS_RECORDS  *RecordData,

-  OUT BOOLEAN                       *LogRecordData

-  );

-

-//

-// Data table entry definition.

-//

-typedef struct {

-  UINT16                          RecordType;

-  UINT32                          RecordLen;

-  VOID                            *RecordData;

-  EFI_MISC_SUBCLASS_DATA_FUNCTION *Function;

-} EFI_MISC_SUBCLASS_DATA_TABLE;

-

-//

-// Data Table extern definitions.

-//

-#define MISC_SUBCLASS_TABLE_EXTERNS(NAME1, NAME2) \

-  extern NAME1 NAME2 ## Data; \

-  extern EFI_MISC_SUBCLASS_DATA_FUNCTION NAME2 ## Function

-

-//

-// Data Table entries

-//

-#define MISC_SUBCLASS_TABLE_ENTRY_DATA_ONLY(NAME1, NAME2) { \

-	  NAME1 ##  _RECORD_NUMBER, sizeof (NAME1 ## _DATA), &NAME2 ## Data, NULL \

-  }

-

-#define MISC_SUBCLASS_TABLE_ENTRY_FUNCTION_ONLY(NAME1, NAME2) \

-  { \

-    NAME1 ##  _RECORD_NUMBER, 0, NULL, &NAME2 ## Function \

-  }

-

-#define MISC_SUBCLASS_TABLE_ENTRY_DATA_AND_FUNCTION(NAME1, NAME2, NAME3) \

-  { \

-    NAME1 ##  _RECORD_NUMBER, sizeof (NAME1 ## _DATA), &NAME2 ## Data, &NAME3 ## Function \

-  }

-

-//

-// Global definition macros.

-//

-#define MISC_SUBCLASS_TABLE_DATA(NAME1, NAME2)  NAME1 NAME2 ## Data

-

-#define MISC_SUBCLASS_TABLE_FUNCTION(NAME2) \

-  EFI_STATUS EFIAPI NAME2 ## Function ( \

-  IN UINT16 RecordType, \

-  IN UINT32 *RecordLen, \

-  IN OUT EFI_MISC_SUBCLASS_RECORDS * RecordData, \

-  OUT BOOLEAN *LogRecordData \

-  )

-

-//

-// Data Table Array

-//

-extern EFI_MISC_SUBCLASS_DATA_TABLE mMiscSubclassDataTable[];

-

-//

-// Data Table Array Entries

-//

-extern UINTN  mMiscSubclassDataTableEntries;

-

-#endif /* _MISC_SUBCLASS_DRIVER_H */

-

-/* eof - MiscSubclassDriver.h */

diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriver.msa b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriver.msa
deleted file mode 100644
index 981acf4..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriver.msa
+++ /dev/null
@@ -1,167 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">

-  <MsaHeader>

-    <ModuleName>MiscSubclass</ModuleName>

-    <ModuleType>DXE_DRIVER</ModuleType>

-    <GuidValue>4A9B9DB8-EC62-4A92-818F-8AA0246D246E</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>Misc Sub class driver</Abstract>

-    <Description>

-      Parses the MiscSubclassDataTable and reports any generated data to the DataHub.

-      All .uni file who tagged with "ToolCode="DUMMY"" in following file list is included by

-      MiscSubclassDriver.uni file, the StrGather tool will expand MiscSubclassDriver.uni file

-      and parse all .uni file.

-    </Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>MiscSubclass</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>HiiLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiDriverEntryPoint</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseMemoryLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>MemoryAllocationLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiBootServicesTableLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DevicePathLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename ToolCode="DUMMY">MiscBaseBoardManufacturer.uni</Filename>

-    <Filename ToolCode="DUMMY">MiscBiosVendor.uni</Filename>

-    <Filename ToolCode="DUMMY">MiscChassisManufacturer.uni</Filename>

-    <Filename ToolCode="DUMMY">MiscOemString.uni</Filename>

-    <Filename ToolCode="DUMMY">MiscPortInternalConnectorDesignator.uni</Filename>

-    <Filename ToolCode="DUMMY">MiscSystemLanguageString.uni</Filename>

-    <Filename ToolCode="DUMMY">MiscSystemManufacturer.uni</Filename>

-    <Filename ToolCode="DUMMY">MiscSystemOptionString.uni</Filename>

-    <Filename ToolCode="DUMMY">MiscSystemSlotDesignation.uni</Filename>

-    <Filename>MiscSubclassDriver.uni</Filename>

-    <Filename>MiscDevicePath.h</Filename>

-    <Filename>MiscSubclassDriver.h</Filename>

-    <Filename>MiscSubclassDriverEntryPoint.c</Filename>

-    <Filename>MiscSubclassDriverDataTable.c</Filename>

-    <Filename>MiscBaseBoardManufacturerData.c</Filename>

-    <Filename>MiscBiosVendorData.c</Filename>

-    <Filename>MiscBootInformationData.c</Filename>

-    <Filename>MiscChassisManufacturerData.c</Filename>

-    <Filename>MiscNumberOfInstallableLanguagesData.c</Filename>

-    <Filename>MiscOemStringData.c</Filename>

-    <Filename>MiscPortInternalConnectorDesignatorData.c</Filename>

-    <Filename>MiscResetCapabilitiesData.c</Filename>

-    <Filename>MiscSystemLanguageStringData.c</Filename>

-    <Filename>MiscSystemManufacturerData.c</Filename>

-    <Filename>MiscSystemManufacturerFunction.c</Filename>

-    <Filename>MiscSystemOptionStringData.c</Filename>

-    <Filename>MiscSystemSlotDesignationData.c</Filename>

-    <Filename>MiscPortInternalConnectorDesignatorFunction.c</Filename>

-    <Filename>MiscSubclassDriver.dxs</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <Protocols>

-    <Protocol Usage="ALWAYS_CONSUMED">

-      <ProtocolCName>gEfiDataHubProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="ALWAYS_CONSUMED">

-      <ProtocolCName>gEfiHiiProtocolGuid</ProtocolCName>

-    </Protocol>

-    <ProtocolNotify Usage="SOMETIMES_CONSUMED">

-      <ProtocolNotifyCName>gEfiWinNtIoProtocolGuid</ProtocolNotifyCName>

-    </ProtocolNotify>

-  </Protocols>

-  <DataHubs>

-    <DataHubRecord Usage="ALWAYS_PRODUCED">

-      <DataHubCName>MiscPortKeyboard</DataHubCName>

-    </DataHubRecord>

-    <DataHubRecord Usage="ALWAYS_PRODUCED">

-      <DataHubCName>MiscPortMouse</DataHubCName>

-    </DataHubRecord>

-    <DataHubRecord Usage="ALWAYS_PRODUCED">

-      <DataHubCName>MiscPortCom1</DataHubCName>

-    </DataHubRecord>

-    <DataHubRecord Usage="ALWAYS_PRODUCED">

-      <DataHubCName>MiscPortCom2</DataHubCName>

-    </DataHubRecord>

-    <DataHubRecord Usage="ALWAYS_PRODUCED">

-      <DataHubCName>MiscBiosVendor</DataHubCName>

-    </DataHubRecord>

-    <DataHubRecord Usage="ALWAYS_PRODUCED">

-      <DataHubCName>MiscSystemManufacturer</DataHubCName>

-    </DataHubRecord>

-    <DataHubRecord Usage="ALWAYS_PRODUCED">

-      <DataHubCName>MiscBaseBoardManufacturer</DataHubCName>

-    </DataHubRecord>

-    <DataHubRecord Usage="ALWAYS_PRODUCED">

-      <DataHubCName>MiscChassisManufacturer</DataHubCName>

-    </DataHubRecord>

-    <DataHubRecord Usage="ALWAYS_PRODUCED">

-      <DataHubCName>MiscSystemSlotDesignation</DataHubCName>

-    </DataHubRecord>

-    <DataHubRecord Usage="ALWAYS_PRODUCED">

-      <DataHubCName>OemString</DataHubCName>

-    </DataHubRecord>

-    <DataHubRecord Usage="ALWAYS_PRODUCED">

-      <DataHubCName>SystemOptionString</DataHubCName>

-    </DataHubRecord>

-    <DataHubRecord Usage="SOMETIMES_PRODUCED">

-      <DataHubCName>MemorySubClassData</DataHubCName>

-    </DataHubRecord>

-  </DataHubs>

-  <Guids>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiMiscSubClassGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="SOMETIMES_CONSUMED">

-      <GuidCName>gEfiProcessorSubClassGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="SOMETIMES_CONSUMED">

-      <GuidCName>gEfiMemoryProducerGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="SOMETIMES_CONSUMED">

-      <GuidCName>gEfiMemorySubClassGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="SOMETIMES_CONSUMED">

-      <GuidCName>gEfiWinNtMemoryGuid</GuidCName>

-    </GuidCNames>

-  </Guids>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-    <Extern>

-      <ModuleEntryPoint>MiscSubclassDriverEntryPoint</ModuleEntryPoint>

-    </Extern>

-  </Externs>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriver.uni b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriver.uni
deleted file mode 100644
index bae6862..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriver.uni
+++ /dev/null
Binary files differ
diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriverDataTable.c b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriverDataTable.c
deleted file mode 100644
index bbade9b..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriverDataTable.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  MiscSubclassDriverDataTable.c

-  

-Abstract: 

-

-  This driver parses the mMiscSubclassDataTable structure and reports

-  any generated data to the DataHub.

-

---*/

-

-#include "MiscSubclassDriver.h"

-

-//

-// External definitions referenced by Data Table entries.

-//

-MISC_SUBCLASS_TABLE_EXTERNS (

-  EFI_MISC_CHASSIS_MANUFACTURER_DATA,

-  MiscChassisManufacturer

-  );

-MISC_SUBCLASS_TABLE_EXTERNS (

-  EFI_MISC_BIOS_VENDOR_DATA,

-  MiscBiosVendor

-  );

-MISC_SUBCLASS_TABLE_EXTERNS (

-  EFI_MISC_SYSTEM_MANUFACTURER_DATA,

-  MiscSystemManufacturer

-  );

-MISC_SUBCLASS_TABLE_EXTERNS (

-  EFI_MISC_BASE_BOARD_MANUFACTURER_DATA,

-  MiscBaseBoardManufacturer

-  );

-MISC_SUBCLASS_TABLE_EXTERNS (

-  EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA,

-  MiscPortInternalConnectorDesignator

-  );

-MISC_SUBCLASS_TABLE_EXTERNS (

-  EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA,

-  MiscPortKeyboard

-  );

-MISC_SUBCLASS_TABLE_EXTERNS (

-  EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA,

-  MiscPortMouse

-  );

-MISC_SUBCLASS_TABLE_EXTERNS (

-  EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA,

-  MiscPortCom1

-  );

-MISC_SUBCLASS_TABLE_EXTERNS (

-  EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA,

-  MiscPortCom2

-  );

-MISC_SUBCLASS_TABLE_EXTERNS (

-  EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA,

-  MiscSystemSlotDesignation

-  );

-MISC_SUBCLASS_TABLE_EXTERNS (

-  EFI_MISC_OEM_STRING_DATA,

-  OemString

-  );

-MISC_SUBCLASS_TABLE_EXTERNS (

-  EFI_MISC_SYSTEM_OPTION_STRING_DATA,

-  SystemOptionString

-  );

-

-//

-// Data Table.

-//

-EFI_MISC_SUBCLASS_DATA_TABLE  mMiscSubclassDataTable[] = {

-  MISC_SUBCLASS_TABLE_ENTRY_DATA_AND_FUNCTION(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR, MiscPortKeyboard, MiscPortInternalConnectorDesignator),

-  MISC_SUBCLASS_TABLE_ENTRY_DATA_AND_FUNCTION(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR, MiscPortMouse, MiscPortInternalConnectorDesignator),

-  MISC_SUBCLASS_TABLE_ENTRY_DATA_AND_FUNCTION(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR, MiscPortCom1, MiscPortInternalConnectorDesignator),

-  MISC_SUBCLASS_TABLE_ENTRY_DATA_AND_FUNCTION(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR, MiscPortCom2, MiscPortInternalConnectorDesignator),

-  MISC_SUBCLASS_TABLE_ENTRY_DATA_ONLY(EFI_MISC_BIOS_VENDOR, MiscBiosVendor),

-  MISC_SUBCLASS_TABLE_ENTRY_DATA_ONLY(EFI_MISC_SYSTEM_MANUFACTURER, MiscSystemManufacturer),

-  MISC_SUBCLASS_TABLE_ENTRY_DATA_ONLY(EFI_MISC_BASE_BOARD_MANUFACTURER, MiscBaseBoardManufacturer),

-  MISC_SUBCLASS_TABLE_ENTRY_DATA_ONLY(EFI_MISC_CHASSIS_MANUFACTURER, MiscChassisManufacturer),

-  MISC_SUBCLASS_TABLE_ENTRY_DATA_ONLY(EFI_MISC_SYSTEM_SLOT_DESIGNATION, MiscSystemSlotDesignation),

-  MISC_SUBCLASS_TABLE_ENTRY_DATA_ONLY(EFI_MISC_OEM_STRING, OemString),

-  MISC_SUBCLASS_TABLE_ENTRY_DATA_ONLY(EFI_MISC_SYSTEM_OPTION_STRING, SystemOptionString),

-};

-

-//

-// Number of Data Table entries.

-//

-UINTN mMiscSubclassDataTableEntries = (sizeof mMiscSubclassDataTable) / sizeof (EFI_MISC_SUBCLASS_DATA_TABLE);

-

-/* eof - MiscSubclassDriverDataTable.c */

diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriverEntryPoint.c b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriverEntryPoint.c
deleted file mode 100644
index 03eb74f..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriverEntryPoint.c
+++ /dev/null
@@ -1,518 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  MiscSubclassDriverEntryPoint.c

-

-Abstract:

-

-  This driver parses the mMiscSubclassDataTable structure and reports

-  any generated data to the DataHub.

-

---*/

-

-#include "MiscSubclassDriver.h"

-

-

-extern UINT8  MiscSubclassStrings[];

-

-VOID

-EFIAPI

-WinNtIoProtocolNotifyFunction (

-  IN EFI_EVENT                Event,

-  IN VOID                     *Context

-  );

-

-//

-//

-//

-EFI_STATUS

-LogRecordDataToDataHub (

-  EFI_DATA_HUB_PROTOCOL *DataHub,

-  UINT32                RecordType,

-  UINT32                RecordLen,

-  VOID                  *RecordData

-  )

-/*++

-Description:

-

-Parameters:

-

-  DataHub

-    %%TBD

-

-  RecordType

-    %%TBD

-

-  RecordLen

-    %%TBD

-

-  RecordData

-    %%TBD

-

-Returns:

-

-  EFI_INVALID_PARAMETER

-

-  EFI_SUCCESS

-

-  Other Data Hub errors

-

---*/

-{

-  EFI_MISC_SUBCLASS_DRIVER_DATA MiscSubclass;

-  EFI_STATUS                    EfiStatus;

-

-  //

-  // Do nothing if data parameters are not valid.

-  //

-  if (RecordLen == 0 || RecordData == NULL) {

-    DEBUG (

-      (EFI_D_ERROR,

-      "RecordLen == %d  RecordData == %xh\n",

-      RecordLen,

-      RecordData)

-      );

-

-    return EFI_INVALID_PARAMETER;

-  }

-  //

-  // Assemble Data Hub record.

-  //

-  MiscSubclass.Header.Version     = EFI_MISC_SUBCLASS_VERSION;

-  MiscSubclass.Header.HeaderSize  = sizeof (EFI_SUBCLASS_TYPE1_HEADER);

-  MiscSubclass.Header.Instance    = 1;

-  MiscSubclass.Header.SubInstance = 1;

-  MiscSubclass.Header.RecordType  = RecordType;

-

-  CopyMem (

-    &MiscSubclass.Record,

-    RecordData,

-    RecordLen

-    );

-

-  //

-  // Log Data Hub record.

-  //

-  EfiStatus = DataHub->LogData (

-                        DataHub,

-                        &gEfiMiscSubClassGuid,

-                        &gEfiMiscSubClassGuid,

-                        EFI_DATA_RECORD_CLASS_DATA,

-                        &MiscSubclass,

-                        sizeof (EFI_SUBCLASS_TYPE1_HEADER) + RecordLen

-                        );

-

-  if (EFI_ERROR (EfiStatus)) {

-    DEBUG (

-      (EFI_D_ERROR,

-      "LogData(%d bytes) == %r\n",

-      sizeof (EFI_SUBCLASS_TYPE1_HEADER) + RecordLen,

-      EfiStatus)

-      );

-  }

-

-  return EfiStatus;

-}

-

-

-EFI_STATUS

-EFIAPI

-MiscSubclassDriverEntryPoint (

-  IN EFI_HANDLE         ImageHandle,

-  IN EFI_SYSTEM_TABLE   *SystemTable

-  )

-/*++

-Description:

-

-  Standard EFI driver point.  This driver parses the mMiscSubclassDataTable

-  structure and reports any generated data to the DataHub.

-

-Arguments:

-

-  ImageHandle

-    Handle for the image of this driver

-

-  SystemTable

-    Pointer to the EFI System Table

-

-Returns:

-

-  EFI_SUCCESS

-    The data was successfully reported to the Data Hub.

-

---*/

-{

-  EFI_MISC_SUBCLASS_DRIVER_DATA RecordData;

-  EFI_DATA_HUB_PROTOCOL         *DataHub;

-  EFI_HII_PROTOCOL              *Hii;

-  EFI_HII_PACKAGES              *PackageList;

-  EFI_HII_HANDLE                HiiHandle;

-  EFI_STATUS                    EfiStatus;

-  UINTN                         Index;

-  BOOLEAN                       LogRecordData;

-  EFI_EVENT                     Event;

-  VOID                          *Registration;

-

-

-  //

-  // Initialize constant portion of subclass header.

-  //

-  RecordData.Header.Version     = EFI_MISC_SUBCLASS_VERSION;

-  RecordData.Header.HeaderSize  = sizeof (EFI_SUBCLASS_TYPE1_HEADER);

-  RecordData.Header.Instance    = 1;

-  RecordData.Header.SubInstance = 1;

-

-  //

-  // Locate data hub protocol.

-  //

-  EfiStatus = gBS->LocateProtocol (&gEfiDataHubProtocolGuid, NULL, &DataHub);

-

-  if (EFI_ERROR (EfiStatus)) {

-    DEBUG ((EFI_D_ERROR, "Could not locate DataHub protocol.  %r\n", EfiStatus));

-    return EfiStatus;

-  } else if (DataHub == NULL) {

-    DEBUG ((EFI_D_ERROR, "LocateProtocol(DataHub) returned NULL pointer!\n"));

-    return EFI_DEVICE_ERROR;

-  }

-  //

-  // Locate hii protocol.

-  //

-  EfiStatus = gBS->LocateProtocol (&gEfiHiiProtocolGuid, NULL, &Hii);

-

-  if (EFI_ERROR (EfiStatus)) {

-    DEBUG ((EFI_D_ERROR, "Could not locate Hii protocol.  %r\n", EfiStatus));

-    return EfiStatus;

-  } else if (Hii == NULL) {

-    DEBUG ((EFI_D_ERROR, "LocateProtocol(Hii) returned NULL pointer!\n"));

-    return EFI_DEVICE_ERROR;

-  }

-  //

-  // Add our default strings to the HII database. They will be modified later.

-  //

-  PackageList = PreparePackages (1, &gEfiMiscSubClassGuid, MiscSubclassStrings);

-  EfiStatus   = Hii->NewPack (Hii, PackageList, &HiiHandle);

-  FreePool (PackageList);

-

-  if (EFI_ERROR (EfiStatus)) {

-    DEBUG ((EFI_D_ERROR, "Could not log default strings to Hii.  %r\n", EfiStatus));

-    return EfiStatus;

-  }

-  //

-  //

-  //

-  for (Index = 0; Index < mMiscSubclassDataTableEntries; ++Index) {

-    //

-    // Stupidity check!  Do nothing if RecordLen is zero.

-    // %%TBD - Should this be an error or a mechanism for ignoring

-    // records in the Data Table?

-    //

-    if (mMiscSubclassDataTable[Index].RecordLen == 0) {

-      DEBUG (

-        (EFI_D_ERROR,

-        "mMiscSubclassDataTable[%d].RecordLen == 0\n",

-        Index)

-        );

-

-      continue;

-    }

-    //

-    // Initialize per-record portion of subclass header and

-    // copy static data into data portion of subclass record.

-    //

-    RecordData.Header.RecordType = mMiscSubclassDataTable[Index].RecordType;

-

-    if (mMiscSubclassDataTable[Index].RecordData == NULL) {

-      ZeroMem (

-        &RecordData.Record,

-        mMiscSubclassDataTable[Index].RecordLen

-        );

-    } else {

-      CopyMem (

-        &RecordData.Record,

-        mMiscSubclassDataTable[Index].RecordData,

-        mMiscSubclassDataTable[Index].RecordLen

-        );

-    }

-    //

-    // If the entry does not have a function pointer, just log the data.

-    //

-    if (mMiscSubclassDataTable[Index].Function == NULL) {

-      //

-      // Log RecordData to Data Hub.

-      //

-      EfiStatus = DataHub->LogData (

-                            DataHub,

-                            &gEfiMiscSubClassGuid,

-                            &gEfiMiscSubClassGuid,

-                            EFI_DATA_RECORD_CLASS_DATA,

-                            &RecordData,

-                            sizeof (EFI_SUBCLASS_TYPE1_HEADER) + mMiscSubclassDataTable[Index].RecordLen

-                            );

-

-      if (EFI_ERROR (EfiStatus)) {

-        DEBUG (

-          (EFI_D_ERROR,

-          "LogData(%d bytes) == %r\n",

-          sizeof (EFI_SUBCLASS_TYPE1_HEADER) + mMiscSubclassDataTable[Index].RecordLen,

-          EfiStatus)

-          );

-      }

-

-      continue;

-    }

-    //

-    // The entry has a valid function pointer.

-    // Keep calling the function and logging data until there

-    // is no more data to log.

-    //

-    for (;;) {

-      //

-      //

-      //

-      EfiStatus = (*mMiscSubclassDataTable[Index].Function)

-        (

-          mMiscSubclassDataTable[Index].RecordType, &mMiscSubclassDataTable[Index].RecordLen, &RecordData.Record, &

-            LogRecordData

-        );

-

-      //

-      //

-      //

-      if (EFI_ERROR (EfiStatus)) {

-        break;

-      }

-

-      if (!LogRecordData) {

-        break;

-      }

-      //

-      //

-      //

-      EfiStatus = DataHub->LogData (

-                            DataHub,

-                            &gEfiMiscSubClassGuid,

-                            &gEfiMiscSubClassGuid,

-                            EFI_DATA_RECORD_CLASS_DATA,

-                            &RecordData,

-                            sizeof (EFI_SUBCLASS_TYPE1_HEADER) + mMiscSubclassDataTable[Index].RecordLen

-                            );

-

-      if (EFI_ERROR (EfiStatus)) {

-        DEBUG (

-          (EFI_D_ERROR,

-          "LogData(%d bytes) == %r\n",

-          sizeof (EFI_SUBCLASS_TYPE1_HEADER) + mMiscSubclassDataTable[Index].RecordLen,

-          EfiStatus)

-          );

-      }

-    }

-  }

-  //

-  // Install notify function to fetch memory data through WinNtIo protocol and store to data hub.

-  //

-  EfiStatus = gBS->CreateEvent (

-                    EVT_NOTIFY_SIGNAL,

-                    TPL_CALLBACK,

-                    WinNtIoProtocolNotifyFunction,

-                    ImageHandle,

-                    &Event

-                    );

-  ASSERT (!EFI_ERROR (EfiStatus));

-

-  EfiStatus = gBS->RegisterProtocolNotify (

-                    &gEfiWinNtIoProtocolGuid,

-                    Event,

-                    &Registration

-                    );

-  ASSERT (!EFI_ERROR (EfiStatus));

-

-  return EFI_SUCCESS;

-}

-

-UINTN

-Atoi (

-  CHAR16  *String

-  )

-/*++

-

-Routine Description:

-  Convert a unicode string to a UINTN

-

-Arguments:

-  String - Unicode string.

-

-Returns:

-  UINTN of the number represented by String.

-

---*/

-{

-  UINTN   Number;

-  CHAR16  *Str;

-

-  //

-  // skip preceeding white space

-  //

-  Str = String;

-  while ((*Str) && (*Str == ' ' || *Str == '"')) {

-    Str++;

-  }

-  //

-  // Convert ot a Number

-  //

-  Number = 0;

-  while (*Str != '\0') {

-    if ((*Str >= '0') && (*Str <= '9')) {

-      Number = (Number * 10) +*Str - '0';

-    } else {

-      break;

-    }

-

-    Str++;

-  }

-

-  return Number;

-}

-

-VOID

-EFIAPI

-WinNtIoProtocolNotifyFunction (

-  IN EFI_EVENT                Event,

-  IN VOID                     *Context

-  )

-/*++

-

-Routine Description:

-  This function will log memory size data to data hub.

-

-Arguments:

-Event        - Event whose notification function is being invoked.

-Context      - Pointer to the notification function's context.

-

-Returns:

-    EFI_STATUS.

-

---*/

-{

-  EFI_STATUS                      Status;

-  EFI_MEMORY_SUBCLASS_DRIVER_DATA MemorySubClassData;

-  EFI_DATA_RECORD_HEADER          *Record;

-  EFI_SUBCLASS_TYPE1_HEADER       *DataHeader;

-  UINTN                           HandleCount;

-  UINTN                           HandleIndex;

-  UINT64                          MonotonicCount;

-  BOOLEAN                         RecordFound;

-  EFI_HANDLE                      *HandleBuffer;

-  EFI_WIN_NT_IO_PROTOCOL          *WinNtIo;

-  EFI_DATA_HUB_PROTOCOL           *DataHub;

-  UINT64                          TotalMemorySize;

-

-  DataHub         = NULL;

-  MonotonicCount  = 0;

-  RecordFound     = FALSE;

-

-  //

-  // Retrieve the list of all handles from the handle database.

-  //

-  Status = gBS->LocateHandleBuffer (

-                  AllHandles,

-                  &gEfiWinNtIoProtocolGuid,

-                  NULL,

-                  &HandleCount,

-                  &HandleBuffer

-                  );

-  if (EFI_ERROR (Status)) {

-    return ;

-  }

-  //

-  // Locate DataHub protocol.

-  //

-  Status = gBS->LocateProtocol (&gEfiDataHubProtocolGuid, NULL, &DataHub);

-  if (EFI_ERROR (Status)) {

-    return ;

-  }

-  //

-  // Search the Handle array to find the meory size information.

-  //

-  for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {

-    Status = gBS->OpenProtocol (

-                    HandleBuffer[HandleIndex],

-                    &gEfiWinNtIoProtocolGuid,

-                    &WinNtIo,

-                    Context,

-                    NULL,

-                    EFI_OPEN_PROTOCOL_GET_PROTOCOL

-                    );

-    if (EFI_ERROR (Status)) {

-      continue;

-    }

-

-    if ((WinNtIo->WinNtThunk->Signature == EFI_WIN_NT_THUNK_PROTOCOL_SIGNATURE) &&

-        CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtMemoryGuid)

-          ) {

-      //

-      // Check if this record has been stored in data hub.

-      //

-      do {

-        Status = DataHub->GetNextRecord (DataHub, &MonotonicCount, NULL, &Record);

-        if (Record->DataRecordClass == EFI_DATA_RECORD_CLASS_DATA) {

-          DataHeader = (EFI_SUBCLASS_TYPE1_HEADER *) (Record + 1);

-          if (CompareGuid (&Record->DataRecordGuid, &gEfiProcessorSubClassGuid) &&

-              (DataHeader->RecordType == EFI_MEMORY_ARRAY_START_ADDRESS_RECORD_NUMBER)

-              ) {

-            RecordFound = TRUE;

-          }

-        }

-      } while (MonotonicCount != 0);

-

-      if (RecordFound) {

-        RecordFound = FALSE;

-        continue;

-      }

-      //

-      // Initialize data record.

-      //

-      MemorySubClassData.Header.Instance    = 1;

-      MemorySubClassData.Header.SubInstance = EFI_SUBCLASS_INSTANCE_NON_APPLICABLE;

-      MemorySubClassData.Header.RecordType  = EFI_MEMORY_ARRAY_START_ADDRESS_RECORD_NUMBER;

-

-      TotalMemorySize                       = (UINT64) Atoi (WinNtIo->EnvString);

-

-      MemorySubClassData.Record.ArrayStartAddress.MemoryArrayStartAddress               = 0;

-      MemorySubClassData.Record.ArrayStartAddress.MemoryArrayEndAddress                 = LShiftU64 (TotalMemorySize, 20) - 1;

-      MemorySubClassData.Record.ArrayStartAddress.PhysicalMemoryArrayLink.ProducerName  = gEfiMemoryProducerGuid;

-      MemorySubClassData.Record.ArrayStartAddress.PhysicalMemoryArrayLink.Instance      = 1;

-      MemorySubClassData.Record.ArrayStartAddress.PhysicalMemoryArrayLink.SubInstance = EFI_SUBCLASS_INSTANCE_NON_APPLICABLE;

-      MemorySubClassData.Record.ArrayStartAddress.MemoryArrayPartitionWidth = 0;

-

-      //

-      // Store memory size data record to data hub.

-      //

-      Status = DataHub->LogData (

-                          DataHub,

-                          &gEfiMemorySubClassGuid,

-                          &gEfiMemoryProducerGuid,

-                          EFI_DATA_RECORD_CLASS_DATA,

-                          &MemorySubClassData,

-                          sizeof (EFI_SUBCLASS_TYPE1_HEADER) + sizeof (EFI_MEMORY_ARRAY_START_ADDRESS_DATA)

-                          );

-    }

-

-    gBS->CloseProtocol (

-          HandleBuffer[HandleIndex],

-          &gEfiWinNtIoProtocolGuid,

-          Context,

-          NULL

-          );

-  }

-}

-

diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemLanguageString.uni b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemLanguageString.uni
deleted file mode 100644
index 36dacf0..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemLanguageString.uni
+++ /dev/null
Binary files differ
diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemLanguageStringData.c b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemLanguageStringData.c
deleted file mode 100644
index ef52513..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemLanguageStringData.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  MiscSystemLanguageStringData.c

-  

-Abstract: 

-

-  This driver parses the mMiscSubclassDataTable structure and reports

-  any generated data to the DataHub.

-

---*/

-

-#include "MiscSubclassDriver.h"

-

-//

-// Static (possibly build generated) Bios Vendor data.

-//

-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_SYSTEM_LANGUAGE_STRING_DATA, SystemLanguageString) = {

-  0,

-  STRING_TOKEN(STR_MISC_SYSTEM_LANGUAGE_STRING)

-};

-

-/* eof - MiscSystemLanguageStringData.c */

diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemManufacturer.uni b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemManufacturer.uni
deleted file mode 100644
index 204588e..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemManufacturer.uni
+++ /dev/null
Binary files differ
diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemManufacturerData.c b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemManufacturerData.c
deleted file mode 100644
index be53e39..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemManufacturerData.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  MiscSystemManufacturerData.c

-  

-Abstract: 

-

-  This driver parses the mMiscSubclassDataTable structure and reports

-  any generated data to the DataHub.

-

---*/

-

-#include "MiscSubclassDriver.h"

-

-//

-// Static (possibly build generated) System Manufacturer data.

-//

-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_SYSTEM_MANUFACTURER_DATA, MiscSystemManufacturer)

-= {

-  STRING_TOKEN(STR_MISC_SYSTEM_MANUFACTURER),

-  // SystemManufactrurer

-  STRING_TOKEN(STR_MISC_SYSTEM_PRODUCT_NAME),

-  // SystemProductName

-  STRING_TOKEN(STR_MISC_SYSTEM_VERSION),

-  // SystemVersion

-  STRING_TOKEN(STR_MISC_SYSTEM_SERIAL_NUMBER),

-  // SystemSerialNumber

-  {

-    0xbadfaced,

-    0xdead,

-    0xbeef,

-    0x13,

-    0x13,

-    0x13,

-    0x13,

-    0x13,

-    0x13,

-    0x13,

-    0x13

-  },

-  // SystemUuid

-  EfiSystemWakeupTypePowerSwitch  // SystemWakeupType

-};

-

-/* eof - MiscSystemManufacturerData.c */

diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemManufacturerFunction.c b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemManufacturerFunction.c
deleted file mode 100644
index ddd749b..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemManufacturerFunction.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  MiscSystemManufacturerFunction.c

-  

-Abstract: 

-

-  This driver parses the mMiscSubclassDataTable structure and reports

-  any generated data to the DataHub.

-

---*/

-

-#include "MiscSubclassDriver.h"

-

-//

-//

-//

-MISC_SUBCLASS_TABLE_FUNCTION (

-  MiscSystemManufacturer

-  )

-/*++

-Description:

-

-  This function makes boot time changes to the contents of the

-  MiscSystemManufacturer (Type 13).

-

-Parameters:

-

-  RecordType

-    Type of record to be processed from the Data Table.

-    mMiscSubclassDataTable[].RecordType

-

-  RecordLen

-    Size of static RecordData from the Data Table.

-    mMiscSubclassDataTable[].RecordLen

-

-  RecordData

-    Pointer to copy of RecordData from the Data Table.  Changes made

-    to this copy will be written to the Data Hub but will not alter

-    the contents of the static Data Table.

-

-  LogRecordData

-    Set *LogRecordData to TRUE to log RecordData to Data Hub.

-    Set *LogRecordData to FALSE when there is no more data to log.

-

-Returns:

-

-  EFI_SUCCESS

-    All parameters were valid and *RecordData and *LogRecordData have

-    been set.

-

-  EFI_UNSUPPORTED

-    Unexpected RecordType value.

-

-  EFI_INVALID_PARAMETER

-    One of the following parameter conditions was true:

-      RecordLen was zero.

-      RecordData was NULL.

-      LogRecordData was NULL.

---*/

-{

-  STATIC BOOLEAN  Done = FALSE;

-

-  //

-  // First check for invalid parameters.

-  //

-  if (*RecordLen == 0 || RecordData == NULL || LogRecordData == NULL) {

-    return EFI_INVALID_PARAMETER;

-  }

-  //

-  // Then check for unsupported RecordType.

-  //

-  if (RecordType != EFI_MISC_SYSTEM_MANUFACTURER_RECORD_NUMBER) {

-    return EFI_UNSUPPORTED;

-  }

-  //

-  // Is this the first time through this function?

-  //

-  if (!Done) {

-    //

-    // Yes, this is the first time.  Inspect/Change the contents of the

-    // RecordData structure.

-    //

-    //

-    // Set system GUID.

-    //

-    // ((EFI_MISC_SYSTEM_MANUFACTURER_DATA *)RecordData)->SystemUuid = %%TBD

-    //

-    // Set power-on type.

-    //

-    // ((EFI_MISC_SYSTEM_MANUFACTURER_DATA *)RecordData)->SystemWakeupType = %%TBD

-    //

-    // Set Done flag to TRUE for next pass through this function.

-    // Set *LogRecordData to TRUE so data will get logged to Data Hub.

-    //

-    Done            = TRUE;

-    *LogRecordData  = TRUE;

-  } else {

-    //

-    // No, this is the second time.  Reset the state of the Done flag

-    // to FALSE and tell the data logger that there is no more data

-    // to be logged for this record type.  If any memory allocations

-    // were made by earlier passes, they must be released now.

-    //

-    Done            = FALSE;

-    *LogRecordData  = FALSE;

-  }

-

-  return EFI_SUCCESS;

-}

-

-/* eof - MiscSystemManufacturerFunction.c */

diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemOptionString.uni b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemOptionString.uni
deleted file mode 100644
index 617578d..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemOptionString.uni
+++ /dev/null
Binary files differ
diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemOptionStringData.c b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemOptionStringData.c
deleted file mode 100644
index 8c00350..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemOptionStringData.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  MiscSystemOptionStringData.c

-  

-Abstract: 

-

-  This driver parses the mMiscSubclassDataTable structure and reports

-  any generated data to the DataHub.

-

---*/

-

-#include "MiscSubclassDriver.h"

-

-//

-// Static (possibly build generated) Bios Vendor data.

-//

-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_SYSTEM_OPTION_STRING_DATA, SystemOptionString) = {

-  STRING_TOKEN(STR_MISC_SYSTEM_OPTION_STRING)

-};

-

-/* eof - MiscSystemOptionStringData.c */

diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemSlotDesignation.uni b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemSlotDesignation.uni
deleted file mode 100644
index f279ff9..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemSlotDesignation.uni
+++ /dev/null
Binary files differ
diff --git a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemSlotDesignationData.c b/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemSlotDesignationData.c
deleted file mode 100644
index d5e1474..0000000
--- a/EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSystemSlotDesignationData.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-  

-    MiscSystemSlotDesignationData.c

-  

-Abstract: 

-

-  This driver parses the mMiscSubclassDataTable structure and reports

-  any generated data to the DataHub.

-

---*/

-

-#include "MiscSubclassDriver.h"

-

-//

-// Static (possibly build generated) Bios Vendor data.

-//

-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotDesignation) = {

-  STRING_TOKEN(STR_MISC_SYSTEM_SLOT_DESIGNATION),   // SlotDesignation

-  EfiSlotTypeOther,         // SlotType

-  EfiSlotDataBusWidthOther, // SlotDataBusWidth

-  EfiSlotUsageOther,        // SlotUsage

-  EfiSlotLengthOther,       // SlotLength

-  0,                        // SlotId

-  {                         // SlotCharacteristics

-    0,                      // CharacteristicsUnknown  :1;

-    0,                      // Provides50Volts         :1;

-    0,                      // Provides33Volts         :1;

-    0,                      // SharedSlot              :1;

-    0,                      // PcCard16Supported       :1;

-    0,                      // CardBusSupported        :1;

-    0,                      // ZoomVideoSupported      :1;

-    0,                      // ModemRingResumeSupported:1;

-    0,                      // PmeSignalSupported      :1;

-    0,                      // HotPlugDevicesSupported :1;

-    0,                      // SmbusSignalSupported    :1;

-    0                       // Reserved                :21;

-  },

-  0                         // SlotDevicePath

-};

-

-/* eof - MiscSystemSlotsData.c */

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/BdsPlatform.c b/EdkNt32Pkg/Dxe/PlatformBds/BdsPlatform.c
deleted file mode 100644
index 89dbef0..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/BdsPlatform.c
+++ /dev/null
@@ -1,517 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  BdsPlatform.c

-

-Abstract:

-

-  This file include all platform action which can be customized

-  by IBV/OEM.

-

---*/

-

-#include "Generic/Bds.h"

-#include "BdsPlatform.h"

-#include "Generic/String.h"

-#include "Generic/Language.h"

-#include "Generic/FrontPage.h"

-

-CHAR16  mFirmwareVendor[] = L"TianoCore.org";

-

-//

-// BDS Platform Functions

-//

-VOID

-PlatformBdsInit (

-  IN EFI_BDS_ARCH_PROTOCOL_INSTANCE  *PrivateData

-  )

-/*++

-

-Routine Description:

-

-  Platform Bds init. Incude the platform firmware vendor, revision

-  and so crc check.

-

-Arguments:

-

-  PrivateData  - The EFI_BDS_ARCH_PROTOCOL_INSTANCE instance

-

-Returns:

-

-  None.

-

---*/

-{

-  //

-  // set firmwarevendor, here can be IBV/OEM customize

-  //

-  gST->FirmwareVendor = AllocateRuntimeCopyPool (

-                          sizeof (mFirmwareVendor),

-                          &mFirmwareVendor

-                          );

-  ASSERT (gST->FirmwareVendor != NULL);

-

-  gST->FirmwareRevision = EFI_FIRMWARE_REVISION;

-

-  //

-  // Fixup Tasble CRC after we updated Firmware Vendor and Revision

-  //

-  gBS->CalculateCrc32 ((VOID *) gST, sizeof (EFI_SYSTEM_TABLE), &gST->Hdr.CRC32);

-

-  //

-  // Initialize the platform specific string and language

-  //

-  InitializeStringSupport ();

-  InitializeLanguage (TRUE);

-  InitializeFrontPage (FALSE);

-

-}

-

-EFI_STATUS

-PlatformBdsConnectConsole (

-  IN BDS_CONSOLE_CONNECT_ENTRY   *PlatformConsole

-  )

-/*++

-

-Routine Description:

-

-  Connect the predefined platform default console device. Always try to find

-  and enable the vga device if have.

-

-Arguments:

-

-  PlatformConsole         - Predfined platform default console device array.

- 

-Returns:

-

-  EFI_SUCCESS             - Success connect at least one ConIn and ConOut 

-                            device, there must have one ConOut device is 

-                            active vga device.

-  

-  EFI_STATUS              - Return the status of 

-                            BdsLibConnectAllDefaultConsoles ()

-

---*/

-{

-  EFI_STATUS  Status;

-  UINTN       Index;

-

-  Index   = 0;

-  Status  = EFI_SUCCESS;

-

-  //

-  // Have chance to connect the platform default console,

-  // the platform default console is the minimue device group

-  // the platform should support

-  //

-  while (PlatformConsole[Index].DevicePath != NULL) {

-    //

-    // Update the console variable with the connect type

-    //

-    if ((PlatformConsole[Index].ConnectType & CONSOLE_IN) == CONSOLE_IN) {

-      BdsLibUpdateConsoleVariable (L"ConIn", PlatformConsole[Index].DevicePath, NULL);

-    }

-

-    if ((PlatformConsole[Index].ConnectType & CONSOLE_OUT) == CONSOLE_OUT) {

-      BdsLibUpdateConsoleVariable (L"ConOut", PlatformConsole[Index].DevicePath, NULL);

-    }

-

-    if ((PlatformConsole[Index].ConnectType & STD_ERROR) == STD_ERROR) {

-      BdsLibUpdateConsoleVariable (L"ErrOut", PlatformConsole[Index].DevicePath, NULL);

-    }

-

-    Index++;

-  }

-  //

-  // Connect the all the default console with current cosole variable

-  //

-  Status = BdsLibConnectAllDefaultConsoles ();

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  return EFI_SUCCESS;

-}

-

-VOID

-PlatformBdsConnectSequence (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  Connect with predeined platform connect sequence, 

-  the OEM/IBV can customize with their own connect sequence.

-  

-Arguments:

-

-  None.

- 

-Returns:

-

-  None.

-  

---*/

-{

-  UINTN Index;

-

-  Index = 0;

-

-  //

-  // Here we can get the customized platform connect sequence

-  // Notes: we can connect with new variable which record the

-  // last time boots connect device path sequence

-  //

-  while (gPlatformConnectSequence[Index] != NULL) {

-    //

-    // Build the platform boot option

-    //

-    BdsLibConnectDevicePath (gPlatformConnectSequence[Index]);

-    Index++;

-  }

-

-}

-

-VOID

-PlatformBdsGetDriverOption (

-  IN OUT LIST_ENTRY              *BdsDriverLists

-  )

-/*++

-

-Routine Description:

-

-  Load the predefined driver option, OEM/IBV can customize this

-  to load their own drivers

-  

-Arguments:

-

-  BdsDriverLists  - The header of the driver option link list.

- 

-Returns:

-

-  None.

-  

---*/

-{

-  UINTN Index;

-

-  Index = 0;

-

-  //

-  // Here we can get the customized platform driver option

-  //

-  while (gPlatformDriverOption[Index] != NULL) {

-    //

-    // Build the platform boot option

-    //

-    BdsLibRegisterNewOption (BdsDriverLists, gPlatformDriverOption[Index], NULL, L"DriverOrder");

-    Index++;

-  }

-

-}

-

-VOID

-PlatformBdsDiagnostics (

-  IN EXTENDMEM_COVERAGE_LEVEL    MemoryTestLevel,

-  IN BOOLEAN                     QuietBoot

-  )

-/*++

-

-Routine Description:

-

-  Perform the platform diagnostic, such like test memory. OEM/IBV also

-  can customize this fuction to support specific platform diagnostic.

-  

-Arguments:

-

-  MemoryTestLevel  - The memory test intensive level

-  

-  QuietBoot        - Indicate if need to enable the quiet boot

- 

-Returns:

-

-  None.

-  

---*/

-{

-  EFI_STATUS  Status;

-

-  //

-  // Here we can decide if we need to show

-  // the diagnostics screen

-  // Notes: this quiet boot code should be remove

-  // from the graphic lib

-  //

-  if (QuietBoot) {

-    EnableQuietBoot (&gEfiDefaultBmpLogoGuid);

-    //

-    // Perform system diagnostic

-    //

-    Status = BdsMemoryTest (MemoryTestLevel);

-    if (EFI_ERROR (Status)) {

-      DisableQuietBoot ();

-    }

-

-    return ;

-  }

-  //

-  // Perform system diagnostic

-  //

-  Status = BdsMemoryTest (MemoryTestLevel);

-}

-

-VOID

-PlatformBdsPolicyBehavior (

-  IN EFI_BDS_ARCH_PROTOCOL_INSTANCE  *PrivateData,

-  IN OUT LIST_ENTRY                  *DriverOptionList,

-  IN OUT LIST_ENTRY                  *BootOptionList

-  )

-/*++

-

-Routine Description:

-

-  The function will excute with as the platform policy, current policy

-  is driven by boot mode. IBV/OEM can customize this code for their specific

-  policy action.

-  

-Arguments:

-

-  PrivateData      - The EFI_BDS_ARCH_PROTOCOL_INSTANCE instance

-  

-  DriverOptionList - The header of the driver option link list

-  

-  BootOptionList   - The header of the boot option link list

- 

-Returns:

-

-  None.

-  

---*/

-{

-  EFI_STATUS  Status;

-  UINT16      Timeout;

-

-  //

-  // Init the time out value

-  //

-  Timeout = BdsLibGetTimeout ();

-

-  //

-  // Load the driver option as the driver option list

-  //

-  PlatformBdsGetDriverOption (DriverOptionList);

-

-  //

-  // Get current Boot Mode

-  //

-  PrivateData->BootMode = GetBootModeHob();

-

-  //

-  // Go the different platform policy with different boot mode

-  // Notes: this part code can be change with the table policy

-  //

-  switch (PrivateData->BootMode) {

-

-  case BOOT_ASSUMING_NO_CONFIGURATION_CHANGES:

-  case BOOT_WITH_MINIMAL_CONFIGURATION:

-    //

-    // In no-configuration boot mode, we can connect the

-    // console directly.

-    //

-    BdsLibConnectAllDefaultConsoles ();

-    PlatformBdsDiagnostics (IGNORE, TRUE);

-

-    //

-    // Perform some platform specific connect sequence

-    //

-    PlatformBdsConnectSequence ();

-

-    //

-    // Notes: current time out = 0 can not enter the

-    // front page

-    //

-    PlatformBdsEnterFrontPage (Timeout, FALSE);

-

-    //

-    // Check the boot option with the boot option list

-    //

-    BdsLibBuildOptionFromVar (BootOptionList, L"BootOrder");

-    break;

-

-  case BOOT_ON_FLASH_UPDATE:

-    //

-    // Boot with the specific configuration

-    //

-    PlatformBdsConnectConsole (gPlatformConsole);

-    PlatformBdsDiagnostics (EXTENSIVE, FALSE);

-    BdsLibConnectAll ();

-    ProcessCapsules (BOOT_ON_FLASH_UPDATE);

-    break;

-

-  case BOOT_IN_RECOVERY_MODE:

-    //

-    // In recovery mode, just connect platform console

-    // and show up the front page

-    //

-    PlatformBdsConnectConsole (gPlatformConsole);

-    PlatformBdsDiagnostics (EXTENSIVE, FALSE);

-

-    //

-    // In recovery boot mode, we still enter to the

-    // frong page now

-    //

-    PlatformBdsEnterFrontPage (Timeout, FALSE);

-    break;

-

-  case BOOT_WITH_FULL_CONFIGURATION:

-  case BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS:

-  case BOOT_WITH_DEFAULT_SETTINGS:

-  default:

-    //

-    // Connect platform console

-    //

-    Status = PlatformBdsConnectConsole (gPlatformConsole);

-    if (EFI_ERROR (Status)) {

-      //

-      // Here OEM/IBV can customize with defined action

-      //

-      PlatformBdsNoConsoleAction ();

-    }

-

-    PlatformBdsDiagnostics (IGNORE, TRUE);

-

-    //

-    // Perform some platform specific connect sequence

-    //

-    PlatformBdsConnectSequence ();

-

-    //

-    // Give one chance to enter the setup if we

-    // have the time out

-    //

-    PlatformBdsEnterFrontPage (Timeout, FALSE);

-

-    //

-    // Here we have enough time to do the enumeration of boot device

-    //

-    BdsLibEnumerateAllBootOption (BootOptionList);

-    break;

-  }

-

-  return ;

-

-}

-

-VOID

-PlatformBdsBootSuccess (

-  IN  BDS_COMMON_OPTION *Option

-  )

-/*++

-

-Routine Description:

-  

-  Hook point after a boot attempt succeeds. We don't expect a boot option to

-  return, so the EFI 1.0 specification defines that you will default to an

-  interactive mode and stop processing the BootOrder list in this case. This

-  is alos a platform implementation and can be customized by IBV/OEM.

-

-Arguments:

-

-  Option - Pointer to Boot Option that succeeded to boot.

-

-Returns:

-  

-  None.

-

---*/

-{

-  CHAR16  *TmpStr;

-

-  //

-  // If Boot returned with EFI_SUCCESS and there is not in the boot device

-  // select loop then we need to pop up a UI and wait for user input.

-  //

-  TmpStr = GetStringById (STRING_TOKEN (STR_BOOT_SUCCEEDED));

-  if (TmpStr != NULL) {

-    BdsLibOutputStrings (gST->ConOut, TmpStr, Option->Description, L"\n\r", NULL);

-    FreePool (TmpStr);

-  }

-}

-

-VOID

-PlatformBdsBootFail (

-  IN  BDS_COMMON_OPTION  *Option,

-  IN  EFI_STATUS         Status,

-  IN  CHAR16             *ExitData,

-  IN  UINTN              ExitDataSize

-  )

-/*++

-

-Routine Description:

-  

-  Hook point after a boot attempt fails.

-

-Arguments:

-  

-  Option - Pointer to Boot Option that failed to boot.

-

-  Status - Status returned from failed boot.

-

-  ExitData - Exit data returned from failed boot.

-

-  ExitDataSize - Exit data size returned from failed boot.

-

-Returns:

-  

-  None.

-

---*/

-{

-  CHAR16  *TmpStr;

-

-  //

-  // If Boot returned with failed status then we need to pop up a UI and wait

-  // for user input.

-  //

-  TmpStr = GetStringById (STRING_TOKEN (STR_BOOT_FAILED));

-  if (TmpStr != NULL) {

-    BdsLibOutputStrings (gST->ConOut, TmpStr, Option->Description, L"\n\r", NULL);

-    FreePool (TmpStr);

-  }

-

-}

-

-EFI_STATUS

-PlatformBdsNoConsoleAction (

-  VOID

-  )

-/*++

-

-Routine Description:

-  

-  This function is remained for IBV/OEM to do some platform action,

-  if there no console device can be connected.

-

-Arguments:

-  

-  None.

-  

-Returns:

-  

-  EFI_SUCCESS      - Direct return success now.

-

---*/

-{

-  return EFI_SUCCESS;

-}

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/BdsPlatform.h b/EdkNt32Pkg/Dxe/PlatformBds/BdsPlatform.h
deleted file mode 100644
index 81c61ed..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/BdsPlatform.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name: 

-

-  BdsPlatform.h

-

-Abstract:

-

-  Head file for BDS Platform specific code

-

---*/

-

-#ifndef _BDS_PLATFORM_H

-#define _BDS_PLATFORM_H

-

-#include "IndustryStandard/Pci22.h"

-

-extern BDS_CONSOLE_CONNECT_ENTRY  gPlatformConsole[];

-extern EFI_DEVICE_PATH_PROTOCOL   *gPlatformConnectSequence[];

-extern EFI_DEVICE_PATH_PROTOCOL   *gPlatformDriverOption[];

-

-#define gEndEntire \

-  { \

-    END_DEVICE_PATH_TYPE,\

-    END_ENTIRE_DEVICE_PATH_SUBTYPE,\

-    END_DEVICE_PATH_LENGTH,\

-    0\

-  }

-

-typedef struct {

-  VENDOR_DEVICE_PATH  VendorDevicePath;

-  UINT32              Instance;

-} WIN_NT_VENDOR_DEVICE_PATH_NODE;

-

-//

-// Below is the platform console device path

-//

-typedef struct {

-  VENDOR_DEVICE_PATH              NtBus;

-  WIN_NT_VENDOR_DEVICE_PATH_NODE  SerialDevice;

-  UART_DEVICE_PATH                Uart;

-  VENDOR_DEVICE_PATH              TerminalType;

-  EFI_DEVICE_PATH_PROTOCOL        End;

-} NT_ISA_SERIAL_DEVICE_PATH;

-

-typedef struct {

-  VENDOR_DEVICE_PATH              NtBus;

-  WIN_NT_VENDOR_DEVICE_PATH_NODE  NtUgaDevice;

-  EFI_DEVICE_PATH_PROTOCOL        End;

-} NT_PLATFORM_UGA_DEVICE_PATH;

-

-typedef struct {

-  VENDOR_DEVICE_PATH              NtBus;

-  WIN_NT_VENDOR_DEVICE_PATH_NODE  NtGopDevice;

-  EFI_DEVICE_PATH_PROTOCOL        End;

-} NT_PLATFORM_GOP_DEVICE_PATH;

-

-//

-// Platform BDS Functions

-//

-VOID

-PlatformBdsInit (

-  IN EFI_BDS_ARCH_PROTOCOL_INSTANCE  *PrivateData

-  )

-;

-

-VOID

-PlatformBdsPolicyBehavior (

-  IN EFI_BDS_ARCH_PROTOCOL_INSTANCE  *PrivateData,

-  IN LIST_ENTRY                      *DriverOptionList,

-  IN LIST_ENTRY                      *BootOptionList

-  )

-;

-

-VOID

-PlatformBdsGetDriverOption (

-  IN LIST_ENTRY               *BdsDriverLists

-  )

-;

-

-EFI_STATUS

-BdsMemoryTest (

-  EXTENDMEM_COVERAGE_LEVEL Level

-  )

-;

-

-EFI_STATUS

-PlatformBdsShowProgress (

-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground,

-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground,

-  CHAR16                        *Title,

-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor,

-  UINTN                         Progress,

-  UINTN                         PreviousValue

-  )

-;

-

-VOID

-PlatformBdsConnectSequence (

-  VOID

-  )

-;

-

-VOID

-PlatformBdsBootFail (

-  IN  BDS_COMMON_OPTION  *Option,

-  IN  EFI_STATUS         Status,

-  IN  CHAR16             *ExitData,

-  IN  UINTN              ExitDataSize

-  )

-;

-

-VOID

-PlatformBdsBootSuccess (

-  IN  BDS_COMMON_OPTION *Option

-  )

-;

-

-EFI_STATUS

-ProcessCapsules (

-  EFI_BOOT_MODE BootMode

-  )

-;

-

-EFI_STATUS

-PlatformBdsConnectConsole (

-  IN BDS_CONSOLE_CONNECT_ENTRY   *PlatformConsole

-  )

-;

-

-EFI_STATUS

-PlatformBdsNoConsoleAction (

-  VOID

-  )

-;

-

-#endif // _BDS_PLATFORM_H

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/Bds.dxs b/EdkNt32Pkg/Dxe/PlatformBds/Generic/Bds.dxs
deleted file mode 100644
index 63355ef..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/Bds.dxs
+++ /dev/null
@@ -1,26 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  Bds.dxs

-

-Abstract:

-

-  Dependency expression source file.  This driver produces an arch protocol, so

-  must dipatch early.

-  

---*/

-#include <DxeDepex.h>

-

-DEPENDENCY_START

-  EFI_HII_PROTOCOL_GUID

-DEPENDENCY_END
\ No newline at end of file
diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/Bds.h b/EdkNt32Pkg/Dxe/PlatformBds/Generic/Bds.h
deleted file mode 100644
index 2d9d199..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/Bds.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  Bds.h

-

-Abstract:

-

-  Head file for BDS Architectural Protocol implementation

-

-Revision History

-

---*/

-

-#ifndef _BDS_H

-#define _BDS_H

-

-//

-// Bds AP Context data

-//

-#define EFI_BDS_ARCH_PROTOCOL_INSTANCE_SIGNATURE  EFI_SIGNATURE_32 ('B', 'd', 's', 'A')

-typedef struct {

-  UINTN                     Signature;

-

-  EFI_HANDLE                Handle;

-

-  EFI_BDS_ARCH_PROTOCOL     Bds;

-

-  //

-  // Save the current boot mode

-  //

-  EFI_BOOT_MODE             BootMode;

-

-  //

-  // Set true if boot with default settings

-  //

-  BOOLEAN                   DefaultBoot;

-

-  //

-  // The system default timeout for choose the boot option

-  //

-  UINT16                    TimeoutDefault;

-

-  //

-  // Memory Test Level

-  //

-  EXTENDMEM_COVERAGE_LEVEL  MemoryTestLevel;

-

-} EFI_BDS_ARCH_PROTOCOL_INSTANCE;

-

-#define EFI_BDS_ARCH_PROTOCOL_INSTANCE_FROM_THIS(_this) \

-  CR (_this, \

-      EFI_BDS_ARCH_PROTOCOL_INSTANCE, \

-      Bds, \

-      EFI_BDS_ARCH_PROTOCOL_INSTANCE_SIGNATURE \

-      )

-

-//

-// Prototypes

-//

-EFI_STATUS

-EFIAPI

-BdsInitialize (

-  IN EFI_HANDLE                     ImageHandle,

-  IN EFI_SYSTEM_TABLE               *SystemTable

-  );

-

-EFI_STATUS

-EFIAPI

-BdsEntry (

-  IN  EFI_BDS_ARCH_PROTOCOL *This

-  );

-

-#endif

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BdsEntry.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BdsEntry.c
deleted file mode 100644
index 6979db0..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BdsEntry.c
+++ /dev/null
@@ -1,355 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  BdsEntry.c

-

-Abstract:

-

-  The entry of the bds

-

---*/

-

-#include "Bds.h"

-#include "BdsPlatform.h"

-#include "FrontPage.h"

-

-EFI_BDS_ARCH_PROTOCOL_INSTANCE  gBdsInstanceTemplate = {

-  EFI_BDS_ARCH_PROTOCOL_INSTANCE_SIGNATURE,

-  NULL,

-  BdsEntry,

-  0xFFFF,

-  TRUE,

-  EXTENSIVE

-};

-

-UINT16                          *mBootNext = NULL;

-

-EFI_HANDLE                      mBdsImageHandle;

-

-EFI_STATUS

-EFIAPI

-BdsInitialize (

-  IN EFI_HANDLE                            ImageHandle,

-  IN EFI_SYSTEM_TABLE                      *SystemTable

-  )

-/*++

-

-Routine Description:

-

-  Install Boot Device Selection Protocol

-

-Arguments:

-  

-  (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)

-

-Returns:

-

-  EFI_SUCEESS - BDS has finished initializing.

-                Rerun the 

-                dispatcher and recall BDS.Entry

-

-  Other       - Return value from EfiLibAllocatePool()

-                or gBS->InstallProtocolInterface

-

---*/

-{

-  EFI_STATUS  Status;

-

-  mBdsImageHandle = ImageHandle;

-

-  //

-  // Install protocol interface

-  //

-  Status = gBS->InstallProtocolInterface (

-                  &gBdsInstanceTemplate.Handle,

-                  &gEfiBdsArchProtocolGuid,

-                  EFI_NATIVE_INTERFACE,

-                  &gBdsInstanceTemplate.Bds

-                  );

-  ASSERT_EFI_ERROR (Status);

-

-  return Status;

-}

-

-VOID

-BdsBootDeviceSelect (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  In the loop of attempt to boot for the boot order

-

-Arguments:

-  

-  None.

-

-Returns:

-

-  None.

-  

---*/

-{

-  EFI_STATUS        Status;

-  LIST_ENTRY        *Link;

-  BDS_COMMON_OPTION *BootOption;

-  UINTN             ExitDataSize;

-  CHAR16            *ExitData;

-  UINT16            Timeout;

-  LIST_ENTRY        BootLists;

-  CHAR16            Buffer[20];

-  BOOLEAN           BootNextExist;

-  LIST_ENTRY        *LinkBootNext;

-

-  //

-  // Got the latest boot option

-  //

-  BootNextExist = FALSE;

-  LinkBootNext  = NULL;

-  InitializeListHead (&BootLists);

-

-  //

-  // First check the boot next option

-  //

-  ZeroMem (Buffer, sizeof (Buffer));

-

-  if (mBootNext != NULL) {

-    //

-    // Indicate we have the boot next variable, so this time

-    // boot will always have this boot option

-    //

-    BootNextExist = TRUE;

-

-    //

-    // Clear the this variable so it's only exist in this time boot

-    //

-    gRT->SetVariable (

-          L"BootNext",

-          &gEfiGlobalVariableGuid,

-          EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,

-          0,

-          mBootNext

-          );

-

-    //

-    // Add the boot next boot option

-    //

-    UnicodeSPrint (Buffer, sizeof (Buffer), L"Boot%04x", *mBootNext);

-    BootOption = BdsLibVariableToOption (&BootLists, Buffer);

-  }

-  //

-  // Parse the boot order to get boot option

-  //

-  BdsLibBuildOptionFromVar (&BootLists, L"BootOrder");

-  Link = BootLists.ForwardLink;

-

-  //

-  // Parameter check, make sure the loop will be valid

-  //

-  if (Link == NULL) {

-    return ;

-  }

-  //

-  // Here we make the boot in a loop, every boot success will

-  // return to the front page

-  //

-  for (;;) {

-    //

-    // Check the boot option list first

-    //

-    if (Link == &BootLists) {

-      //

-      // There are two ways to enter here:

-      // 1. There is no active boot option, give user chance to

-      //    add new boot option

-      // 2. All the active boot option processed, and there is no

-      //    one is success to boot, then we back here to allow user

-      //    add new active boot option

-      //

-      Timeout = 0xffff;

-      PlatformBdsEnterFrontPage (Timeout, FALSE);

-      InitializeListHead (&BootLists);

-      BdsLibBuildOptionFromVar (&BootLists, L"BootOrder");

-      Link = BootLists.ForwardLink;

-      continue;

-    }

-    //

-    // Get the boot option from the link list

-    //

-    BootOption = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);

-

-    //

-    // According to EFI Specification, if a load option is not marked

-    // as LOAD_OPTION_ACTIVE, the boot manager will not automatically

-    // load the option.

-    //

-    if (!IS_LOAD_OPTION_TYPE (BootOption->Attribute, LOAD_OPTION_ACTIVE)) {

-      //

-      // skip the header of the link list, becuase it has no boot option

-      //

-      Link = Link->ForwardLink;

-      continue;

-    }

-    //

-    // Make sure the boot option device path connected,

-    // but ignore the BBS device path

-    //

-    if (DevicePathType (BootOption->DevicePath) != BBS_DEVICE_PATH) {

-      //

-      // Notes: the internal shell can not been connected with device path

-      // so we do not check the status here

-      //

-      BdsLibConnectDevicePath (BootOption->DevicePath);

-    }

-    //

-    // All the driver options should have been processed since

-    // now boot will be performed.

-    //

-    Status = BdsLibBootViaBootOption (BootOption, BootOption->DevicePath, &ExitDataSize, &ExitData);

-    if (EFI_ERROR (Status)) {

-      //

-      // Call platform action to indicate the boot fail

-      //

-      PlatformBdsBootFail (BootOption, Status, ExitData, ExitDataSize);

-

-      //

-      // Check the next boot option

-      //

-      Link = Link->ForwardLink;

-

-    } else {

-      //

-      // Call platform action to indicate the boot success

-      //

-      PlatformBdsBootSuccess (BootOption);

-

-      //

-      // Boot success, then stop process the boot order, and

-      // present the boot manager menu, front page

-      //

-      Timeout = 0xffff;

-      PlatformBdsEnterFrontPage (Timeout, FALSE);

-

-      //

-      // Rescan the boot option list, avoid pertential risk of the boot

-      // option change in front page

-      //

-      if (BootNextExist) {

-        LinkBootNext = BootLists.ForwardLink;

-      }

-

-      InitializeListHead (&BootLists);

-      if (LinkBootNext != NULL) {

-        //

-        // Reserve the boot next option

-        //

-        InsertTailList (&BootLists, LinkBootNext);

-      }

-

-      BdsLibBuildOptionFromVar (&BootLists, L"BootOrder");

-      Link = BootLists.ForwardLink;

-    }

-  }

-

-  return ;

-

-}

-

-EFI_STATUS

-EFIAPI

-BdsEntry (

-  IN EFI_BDS_ARCH_PROTOCOL  *This

-  )

-/*++

-

-Routine Description:

-

-  Service routine for BdsInstance->Entry(). Devices are connected, the 

-  consoles are initialized, and the boot options are tried. 

-

-Arguments:

-

-  This - Protocol Instance structure.

-

-Returns:

-

-  EFI_SUCEESS - BDS->Entry has finished executing. 

-                

---*/

-{

-  EFI_BDS_ARCH_PROTOCOL_INSTANCE  *PrivateData;

-  LIST_ENTRY                      DriverOptionList;

-  LIST_ENTRY                      BootOptionList;

-  UINTN                           BootNextSize;

-

-  //

-  // Insert the performance probe

-  //

-  PERF_END (0, DXE_TOK, NULL, 0);

-  PERF_START (0, BDS_TOK, NULL, 0);

-

-  //

-  // Initialize the global system boot option and driver option

-  //

-  InitializeListHead (&DriverOptionList);

-  InitializeListHead (&BootOptionList);

-

-  //

-  // Get the BDS private data

-  //

-  PrivateData = EFI_BDS_ARCH_PROTOCOL_INSTANCE_FROM_THIS (This);

-

-  //

-  // Do the platform init, can be customized by OEM/IBV

-  //

-  PERF_START (0, "PlatformBds", "BDS", 0);

-  PlatformBdsInit (PrivateData);

-

-  //

-  // Set up the device list based on EFI 1.1 variables

-  // process Driver#### and Load the driver's in the

-  // driver option list

-  //

-  BdsLibBuildOptionFromVar (&DriverOptionList, L"DriverOrder");

-  if (!IsListEmpty (&DriverOptionList)) {

-    BdsLibLoadDrivers (&DriverOptionList);

-  }

-  //

-  // Check if we have the boot next option

-  //

-  mBootNext = BdsLibGetVariableAndSize (

-                L"BootNext",

-                &gEfiGlobalVariableGuid,

-                &BootNextSize

-                );

-

-  //

-  // Setup some platform policy here

-  //

-  PlatformBdsPolicyBehavior (PrivateData, &DriverOptionList, &BootOptionList);

-  PERF_END (0, "PlatformBds", "BDS", 0);

-

-  //

-  // BDS select the boot device to load OS

-  //

-  BdsBootDeviceSelect ();

-

-  //

-  // Only assert here since this is the right behavior, we should never

-  // return back to DxeCore.

-  //

-  ASSERT (FALSE);

-

-  return EFI_SUCCESS;

-}

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BBSsupport.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BBSsupport.c
deleted file mode 100644
index 37c0475..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BBSsupport.c
+++ /dev/null
@@ -1,1601 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  BBSsupport.c

-

-Abstract:

-

-  This function deal with the legacy boot option, it create, delete

-  and manage the legacy boot option, all legacy boot option is getting from

-  the legacy BBS table.

-

---*/

-

-#include "BBSsupport.h"

-

-EFI_DEVICE_PATH_PROTOCOL  EndDevicePath[] = {

-  END_DEVICE_PATH_TYPE,

-  END_ENTIRE_DEVICE_PATH_SUBTYPE,

-  END_DEVICE_PATH_LENGTH,

-  0

-};

-

-VOID

-AsciiToUnicodeSize (

-  IN UINT8              *a,

-  IN UINTN              Size,

-  OUT UINT16            *u

-  )

-/*++

-

-  Routine Description:

-

-    Translate the first n characters of an Ascii string to

-    Unicode characters. The count n is indicated by parameter

-    Size. If Size is greater than the length of string, then

-    the entire string is translated.

-

-  Arguments:

-

-    a         - Pointer to input Ascii string.

-    Size      - The number of characters to translate.

-    u         - Pointer to output Unicode string buffer.

-

-  Returns:

-

-    None

-

---*/

-{

-  UINTN i;

-

-  i = 0;

-  while (a[i] != 0) {

-    u[i] = (CHAR16) a[i];

-    if (i == Size) {

-      break;

-    }

-

-    i++;

-  }

-  u[i] = 0;

-}

-

-VOID

-BdsBuildLegacyDevNameString (

-  IN BBS_TABLE                 *CurBBSEntry,

-  IN UINTN                     Index,

-  IN UINTN                     BufSize,

-  OUT CHAR16                   *BootString

-  )

-{

-  CHAR16  *Fmt;

-  CHAR16  *Type;

-  UINT8   *StringDesc;

-  CHAR16  temp[80];

-

-  switch (Index) {

-  //

-  // Primary Master

-  //

-  case 1:

-    Fmt = L"Primary Master %s";

-    break;

-

- //

- // Primary Slave

- //

-  case 2:

-    Fmt = L"Primary Slave %s";

-    break;

-

-  //

-  // Secondary Master

-  //

-  case 3:

-    Fmt = L"Secondary Master %s";

-    break;

-

-  //

-  // Secondary Slave

-  //

-  case 4:

-    Fmt = L"Secondary Slave %s";

-    break;

-

-  default:

-    Fmt = L"%s";

-    break;

-  }

-

-  switch (CurBBSEntry->DeviceType) {

-  case BBS_FLOPPY:

-    Type = L"Floppy";

-    break;

-

-  case BBS_HARDDISK:

-    Type = L"Harddisk";

-    break;

-

-  case BBS_CDROM:

-    Type = L"CDROM";

-    break;

-

-  case BBS_PCMCIA:

-    Type = L"PCMCIAe";

-    break;

-

-  case BBS_USB:

-    Type = L"USB";

-    break;

-

-  case BBS_EMBED_NETWORK:

-    Type = L"Network";

-    break;

-

-  case BBS_BEV_DEVICE:

-    Type = L"BEVe";

-    break;

-

-  case BBS_UNKNOWN:

-  default:

-    Type = L"Unknown";

-    break;

-  }

-  //

-  // If current BBS entry has its description then use it.

-  //

-  StringDesc = (UINT8 *) (UINTN) ((CurBBSEntry->DescStringSegment << 4) + CurBBSEntry->DescStringOffset);

-  if (NULL != StringDesc) {

-    //

-    // Only get fisrt 32 characters, this is suggested by BBS spec

-    //

-    AsciiToUnicodeSize (StringDesc, 32, temp);

-    Fmt   = L"%s";

-    Type  = temp;

-  }

-

-  UnicodeSPrint (BootString, BufSize, Fmt, Type);

-}

-

-EFI_STATUS

-BdsCreateLegacyBootOption (

-  IN BBS_TABLE                        *CurrentBbsEntry,

-  IN EFI_DEVICE_PATH_PROTOCOL         *CurrentBbsDevPath,

-  IN UINTN                            Index,

-  IN OUT UINT16                       **BootOrderList,

-  IN OUT UINTN                        *BootOrderListSize

-  )

-/*++

-

-  Routine Description:

-

-    Create a legacy boot option for the specified entry of

-    BBS table, save it as variable, and append it to the boot

-    order list.

-

-  Arguments:

-

-    CurrentBbsEntry        - Pointer to current BBS table.

-    CurrentBbsDevPath      - Pointer to the Device Path Protocol instance of BBS

-    Index                  - Index of the specified entry in BBS table.

-    BootOrderList          - On input, the original boot order list.

-                             On output, the new boot order list attached with the

-                             created node.

-    BootOrderListSize      - On input, the original size of boot order list.

-                           - On output, the size of new boot order list.

-

-  Returns:

-

-    EFI_SUCCESS            - Boot Option successfully created.

-    EFI_OUT_OF_RESOURCES   - Fail to allocate necessary memory.

-    Other                  - Error occurs while setting variable.

-

---*/

-{

-  EFI_STATUS  Status;

-  UINT16      CurrentBootOptionNo;

-  UINT16      BootString[10];

-  UINT16      BootDesc[100];

-  UINT16      *NewBootOrderList;

-  UINTN       BufferSize;

-  VOID        *Buffer;

-  UINT8       *Ptr;

-  UINT16      CurrentBbsDevPathSize;

-  UINTN       BootOrderIndex;

-  UINTN       BootOrderLastIndex;

-  UINTN       ArrayIndex;

-  BOOLEAN     IndexNotFound;

-

-  if (NULL == (*BootOrderList)) {

-    CurrentBootOptionNo = 0;

-  } else {

-    for (ArrayIndex = 0; ArrayIndex < (UINTN) (*BootOrderListSize / sizeof (UINT16)); ArrayIndex++) {

-      IndexNotFound = TRUE;

-      for (BootOrderIndex = 0; BootOrderIndex < (UINTN) (*BootOrderListSize / sizeof (UINT16)); BootOrderIndex++) {

-        if ((*BootOrderList)[BootOrderIndex] == ArrayIndex) {

-          IndexNotFound = FALSE;

-          break;

-        }

-      }

-

-      if (!IndexNotFound) {

-        continue;

-      } else {

-        break;

-      }

-    }

-

-    CurrentBootOptionNo = (UINT16) ArrayIndex;

-  }

-

-  UnicodeSPrint (

-    BootString,

-    sizeof (BootString),

-    L"Boot%04x",

-    CurrentBootOptionNo

-    );

-

-  BdsBuildLegacyDevNameString (CurrentBbsEntry, Index, sizeof (BootDesc), BootDesc);

-

-  CurrentBbsDevPathSize = (UINT16) (GetDevicePathSize (CurrentBbsDevPath));

-

-  BufferSize = sizeof (UINT32) +

-    sizeof (UINT16) +

-    StrSize (BootDesc) +

-    CurrentBbsDevPathSize +

-    sizeof (BBS_TABLE) +

-    sizeof (UINT16);

-

-  Buffer = AllocateZeroPool (BufferSize);

-  if (Buffer == NULL) {

-    return EFI_OUT_OF_RESOURCES;

-  }

-

-  Ptr               = (UINT8 *) Buffer;

-

-  *((UINT32 *) Ptr) = LOAD_OPTION_ACTIVE;

-  Ptr += sizeof (UINT32);

-

-  *((UINT16 *) Ptr) = CurrentBbsDevPathSize;

-  Ptr += sizeof (UINT16);

-

-  CopyMem (

-    Ptr,

-    BootDesc,

-    StrSize (BootDesc)

-    );

-  Ptr += StrSize (BootDesc);

-

-  CopyMem (

-    Ptr,

-    CurrentBbsDevPath,

-    CurrentBbsDevPathSize

-    );

-  Ptr += CurrentBbsDevPathSize;

-

-  CopyMem (

-    Ptr,

-    CurrentBbsEntry,

-    sizeof (BBS_TABLE)

-    );

-

-  Ptr += sizeof (BBS_TABLE);

-  *((UINT16 *) Ptr) = (UINT16) Index;

-

-  Status = gRT->SetVariable (

-                  BootString,

-                  &gEfiGlobalVariableGuid,

-                  VAR_FLAG,

-                  BufferSize,

-                  Buffer

-                  );

-

-  SafeFreePool (Buffer);

-  Buffer = NULL;

-

-  NewBootOrderList = AllocateZeroPool (*BootOrderListSize + sizeof (UINT16));

-  if (NULL == NewBootOrderList) {

-    return EFI_OUT_OF_RESOURCES;

-  }

-

-  if (NULL != *BootOrderList) {

-    CopyMem (NewBootOrderList, *BootOrderList, *BootOrderListSize);

-  }

-

-  SafeFreePool (*BootOrderList);

-

-  BootOrderLastIndex                    = (UINTN) (*BootOrderListSize / sizeof (UINT16));

-  NewBootOrderList[BootOrderLastIndex]  = CurrentBootOptionNo;

-  *BootOrderListSize += sizeof (UINT16);

-  *BootOrderList = NewBootOrderList;

-

-  return Status;

-}

-

-BOOLEAN

-BdsIsLegacyBootOption (

-  IN UINT8                 *BootOptionVar,

-  OUT BBS_TABLE            **BbsEntry,

-  OUT UINT16               *BbsIndex

-  )

-{

-  UINT8                     *Ptr;

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;

-  BOOLEAN                   Ret;

-  UINT16                    DevPathLen;

-

-  Ptr = BootOptionVar;

-  Ptr += sizeof (UINT32);

-  DevPathLen = *(UINT16 *) Ptr;

-  Ptr += sizeof (UINT16);

-  Ptr += StrSize ((UINT16 *) Ptr);

-  DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) Ptr;

-  if ((BBS_DEVICE_PATH == DevicePath->Type) && (BBS_BBS_DP == DevicePath->SubType)) {

-    Ptr += DevPathLen;

-    *BbsEntry = (BBS_TABLE *) Ptr;

-    Ptr += sizeof (BBS_TABLE);

-    *BbsIndex = *(UINT16 *) Ptr;

-    Ret       = TRUE;

-  } else {

-    *BbsEntry = NULL;

-    Ret       = FALSE;

-  }

-

-  return Ret;

-}

-

-EFI_STATUS

-BdsDeleteBootOption (

-  IN UINTN                       OptionNumber,

-  IN OUT UINT16                  *BootOrder,

-  IN OUT UINTN                   *BootOrderSize

-  )

-{

-  UINT16      BootOption[100];

-  UINTN       Index;

-  EFI_STATUS  Status;

-  UINTN       Index2Del;

-

-  Status    = EFI_SUCCESS;

-  Index2Del = 0;

-

-  UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", OptionNumber);

-  Status = EfiLibDeleteVariable (BootOption, &gEfiGlobalVariableGuid);

-  //

-  // adjust boot order array

-  //

-  for (Index = 0; Index < *BootOrderSize / sizeof (UINT16); Index++) {

-    if (BootOrder[Index] == OptionNumber) {

-      Index2Del = Index;

-      break;

-    }

-  }

-

-  if (Index != *BootOrderSize / sizeof (UINT16)) {

-    for (Index = 0; Index < *BootOrderSize / sizeof (UINT16) - 1; Index++) {

-      if (Index >= Index2Del) {

-        BootOrder[Index] = BootOrder[Index + 1];

-      }

-    }

-

-    *BootOrderSize -= sizeof (UINT16);

-  }

-

-  return Status;

-

-}

-

-EFI_STATUS

-BdsDeleteAllInvalidLegacyBootOptions (

-  VOID

-  )

-/*++

-

-  Routine Description:

-

-    Delete all the invalid legacy boot options.

-

-  Arguments:

-

-    None.

-

-  Returns:

-

-    EFI_SUCCESS            - All invalide legacy boot options are deleted.

-    EFI_OUT_OF_RESOURCES   - Fail to allocate necessary memory.

-    EFI_NOT_FOUND          - Fail to retrive variable of boot order.

-    Other                  - Error occurs while setting variable or locating

-                             protocol.

-

---*/

-{

-  UINT16                    *BootOrder;

-  UINT8                     *BootOptionVar;

-  UINTN                     BootOrderSize;

-  UINTN                     BootOptionSize;

-  EFI_STATUS                Status;

-  UINT16                    HddCount;

-  UINT16                    BbsCount;

-  HDD_INFO                  *LocalHddInfo;

-  BBS_TABLE                 *LocalBbsTable;

-  BBS_TABLE                 *BbsEntry;

-  UINT16                    BbsIndex;

-  EFI_LEGACY_BIOS_PROTOCOL  *LegacyBios;

-  UINTN                     Index;

-  UINT16                    BootOption[10];

-  UINT16                    BootDesc[100];

-  BOOLEAN                   DescStringMatch;

-

-  Status        = EFI_SUCCESS;

-  BootOrder     = NULL;

-  BootOrderSize = 0;

-  HddCount      = 0;

-  BbsCount      = 0;

-  LocalHddInfo  = NULL;

-  LocalBbsTable = NULL;

-  BbsEntry      = NULL;

-

-  Status        = EfiLibLocateProtocol (&gEfiLegacyBiosProtocolGuid, &LegacyBios);

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  LegacyBios->GetBbsInfo (

-                LegacyBios,

-                &HddCount,

-                &LocalHddInfo,

-                &BbsCount,

-                &LocalBbsTable

-                );

-

-  BootOrder = BdsLibGetVariableAndSize (

-                L"BootOrder",

-                &gEfiGlobalVariableGuid,

-                &BootOrderSize

-                );

-  if (NULL == BootOrder) {

-    return EFI_NOT_FOUND;

-  }

-

-  Index = 0;

-  while (Index < BootOrderSize / sizeof (UINT16)) {

-    UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", BootOrder[Index]);

-    BootOptionVar = BdsLibGetVariableAndSize (

-                      BootOption,

-                      &gEfiGlobalVariableGuid,

-                      &BootOptionSize

-                      );

-    if (NULL == BootOptionVar) {

-      SafeFreePool (BootOrder);

-      return EFI_OUT_OF_RESOURCES;

-    }

-

-    if (!BdsIsLegacyBootOption (BootOptionVar, &BbsEntry, &BbsIndex)) {

-      SafeFreePool (BootOptionVar);

-      Index++;

-      continue;

-    }

-

-    //

-    // Check if BBS Description String is changed

-    //

-    DescStringMatch = FALSE;

-

-    BdsBuildLegacyDevNameString (

-      &LocalBbsTable[BbsIndex],

-      BbsIndex,

-      sizeof(BootDesc),

-      BootDesc

-      );

-

-    if (StrCmp (BootDesc, (UINT16*)(BootOptionVar + sizeof (UINT32) + sizeof (UINT16))) == 0) {

-      DescStringMatch = TRUE;

-    }

-

-    if (!((LocalBbsTable[BbsIndex].BootPriority == BBS_IGNORE_ENTRY) ||

-          (LocalBbsTable[BbsIndex].BootPriority == BBS_DO_NOT_BOOT_FROM) ||

-          (LocalBbsTable[BbsIndex].BootPriority == BBS_LOWEST_PRIORITY)) &&

-        (LocalBbsTable[BbsIndex].DeviceType == BbsEntry->DeviceType) &&

-        DescStringMatch) {

-      Index++;

-      continue;

-    }

-

-    SafeFreePool (BootOptionVar);

-    //

-    // should delete

-    //

-    BdsDeleteBootOption (

-      BootOrder[Index],

-      BootOrder,

-      &BootOrderSize

-      );

-  }

-

-  if (BootOrderSize) {

-    Status = gRT->SetVariable (

-                    L"BootOrder",

-                    &gEfiGlobalVariableGuid,

-                    VAR_FLAG,

-                    BootOrderSize,

-                    BootOrder

-                    );

-  } else {

-    EfiLibDeleteVariable (L"BootOrder", &gEfiGlobalVariableGuid);

-  }

-

-  SafeFreePool (BootOrder);

-

-  return Status;

-}

-

-BOOLEAN

-BdsFindLegacyBootOptionByDevType (

-  IN UINT16                 *BootOrder,

-  IN UINTN                  BootOptionNum,

-  IN UINT16                 DevType,

-  OUT UINT32                *Attribute,

-  OUT UINT16                *BbsIndex,

-  OUT UINTN                 *OptionNumber

-  )

-{

-  UINTN     Index;

-  UINTN     BootOrderIndex;

-  UINT16    BootOption[100];

-  UINTN     BootOptionSize;

-  UINT8     *BootOptionVar;

-  BBS_TABLE *BbsEntry;

-  BOOLEAN   Found;

-

-  BbsEntry  = NULL;

-  Found     = FALSE;

-

-  if (NULL == BootOrder) {

-    return Found;

-  }

-

-  for (BootOrderIndex = 0; BootOrderIndex < BootOptionNum; BootOrderIndex++) {

-    Index = (UINTN) BootOrder[BootOrderIndex];

-    UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", Index);

-    BootOptionVar = BdsLibGetVariableAndSize (

-                      BootOption,

-                      &gEfiGlobalVariableGuid,

-                      &BootOptionSize

-                      );

-    if (NULL == BootOptionVar) {

-      continue;

-    }

-

-    if (!BdsIsLegacyBootOption (BootOptionVar, &BbsEntry, BbsIndex)) {

-      SafeFreePool (BootOptionVar);

-      continue;

-    }

-

-    if (BbsEntry->DeviceType != DevType) {

-      SafeFreePool (BootOptionVar);

-      continue;

-    }

-

-    *Attribute    = *(UINT32 *) BootOptionVar;

-    *OptionNumber = Index;

-    Found         = TRUE;

-    SafeFreePool (BootOptionVar);

-    break;

-  }

-

-  return Found;

-}

-

-EFI_STATUS

-BdsCreateOneLegacyBootOption (

-  IN BBS_TABLE              *BbsItem,

-  IN UINTN                  Index,

-  IN OUT UINT16             **BootOrderList,

-  IN OUT UINTN              *BootOrderListSize

-  )

-{

-  BBS_BBS_DEVICE_PATH       BbsDevPathNode;

-  EFI_STATUS                Status;

-  EFI_DEVICE_PATH_PROTOCOL  *DevPath;

-

-  DevPath                       = NULL;

-

-  BbsDevPathNode.Header.Type    = BBS_DEVICE_PATH;

-  BbsDevPathNode.Header.SubType = BBS_BBS_DP;

-  SetDevicePathNodeLength (&BbsDevPathNode.Header, sizeof (BBS_BBS_DEVICE_PATH));

-  BbsDevPathNode.DeviceType = BbsItem->DeviceType;

-  CopyMem (&BbsDevPathNode.StatusFlag, &BbsItem->StatusFlags, sizeof (UINT16));

-

-  DevPath = AppendDevicePathNode (

-              EndDevicePath,

-              (EFI_DEVICE_PATH_PROTOCOL *) &BbsDevPathNode

-              );

-  if (NULL == DevPath) {

-    return EFI_OUT_OF_RESOURCES;

-  }

-

-  Status = BdsCreateLegacyBootOption (

-            BbsItem,

-            DevPath,

-            Index,

-            BootOrderList,

-            BootOrderListSize

-            );

-  BbsItem->BootPriority = 0x00;

-

-  FreePool (DevPath);

-

-  return Status;

-}

-

-EFI_STATUS

-BdsAddNonExistingLegacyBootOptions (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  Add the legacy boot options from BBS table if they do not exist.

-

-Arguments:

-

-  None.

-

-Returns:

-

-  EFI_SUCCESS       - The boot options are added successfully or they are already in boot options.

-  others            - An error occurred when creating legacy boot options.

-

---*/

-{

-  UINT16                    *BootOrder;

-  UINTN                     BootOrderSize;

-  EFI_STATUS                Status;

-  UINT16                    HddCount;

-  UINT16                    BbsCount;

-  HDD_INFO                  *LocalHddInfo;

-  BBS_TABLE                 *LocalBbsTable;

-  UINT16                    BbsIndex;

-  EFI_LEGACY_BIOS_PROTOCOL  *LegacyBios;

-  UINTN                     Index;

-  UINT32                    Attribute;

-  UINTN                     OptionNumber;

-  BOOLEAN                   Ret;

-

-  BootOrder     = NULL;

-  HddCount      = 0;

-  BbsCount      = 0;

-  LocalHddInfo  = NULL;

-  LocalBbsTable = NULL;

-

-  Status        = EfiLibLocateProtocol (&gEfiLegacyBiosProtocolGuid, &LegacyBios);

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  LegacyBios->GetBbsInfo (

-                LegacyBios,

-                &HddCount,

-                &LocalHddInfo,

-                &BbsCount,

-                &LocalBbsTable

-                );

-

-  BootOrder = BdsLibGetVariableAndSize (

-                L"BootOrder",

-                &gEfiGlobalVariableGuid,

-                &BootOrderSize

-                );

-  if (NULL == BootOrder) {

-    BootOrderSize = 0;

-  }

-

-  for (Index = 0; Index < BbsCount; Index++) {

-    if ((LocalBbsTable[Index].BootPriority == BBS_IGNORE_ENTRY) ||

-        (LocalBbsTable[Index].BootPriority == BBS_DO_NOT_BOOT_FROM)

-        ) {

-      continue;

-    }

-

-    Ret = BdsFindLegacyBootOptionByDevType (

-            BootOrder,

-            BootOrderSize / sizeof (UINT16),

-            LocalBbsTable[Index].DeviceType,

-            &Attribute,

-            &BbsIndex,

-            &OptionNumber

-            );

-    if (Ret && (Attribute & LOAD_OPTION_ACTIVE) != 0) {

-      continue;

-    }

-

-    if (Ret) {

-      if (Index != BbsIndex) {

-        BdsDeleteBootOption (

-          OptionNumber,

-          BootOrder,

-          &BootOrderSize

-          );

-      } else {

-        continue;

-      }

-    }

-    //

-    // Not found such type of legacy device in boot options or we found but it's disabled

-    // so we have to create one and put it to the tail of boot order list

-    //

-    Status = BdsCreateOneLegacyBootOption (

-              &LocalBbsTable[Index],

-              Index,

-              &BootOrder,

-              &BootOrderSize

-              );

-    if (EFI_ERROR (Status)) {

-      break;

-    }

-  }

-

-  if (BootOrderSize > 0) {

-    Status = gRT->SetVariable (

-                    L"BootOrder",

-                    &gEfiGlobalVariableGuid,

-                    VAR_FLAG,

-                    BootOrderSize,

-                    BootOrder

-                    );

-  } else {

-    EfiLibDeleteVariable (L"BootOrder", &gEfiGlobalVariableGuid);

-  }

-

-  if (BootOrder != NULL) {

-    SafeFreePool (BootOrder);

-  }

-

-  return Status;

-}

-

-UINT16 *

-BdsFillDevOrderBuf (

-  IN BBS_TABLE                    *BbsTable,

-  IN BBS_TYPE                     BbsType,

-  IN UINTN                        BbsCount,

-  IN UINT16                       *Buf

-  )

-{

-  UINTN Index;

-

-  for (Index = 0; Index < BbsCount; Index++) {

-    if (BbsTable[Index].BootPriority == BBS_IGNORE_ENTRY) {

-      continue;

-    }

-

-    if (BbsTable[Index].DeviceType != BbsType) {

-      continue;

-    }

-

-    *Buf = (UINT16) (Index & 0xFF);

-    Buf++;

-  }

-

-  return Buf;

-}

-

-EFI_STATUS

-BdsCreateDevOrder (

-  IN BBS_TABLE                  *BbsTable,

-  IN UINT16                     BbsCount

-  )

-{

-  UINTN       Index;

-  UINTN       FDCount;

-  UINTN       HDCount;

-  UINTN       CDCount;

-  UINTN       NETCount;

-  UINTN       BEVCount;

-  UINTN       TotalSize;

-  UINTN       HeaderSize;

-  UINT8       *DevOrder;

-  UINT8       *Ptr;

-  EFI_STATUS  Status;

-

-  FDCount     = 0;

-  HDCount     = 0;

-  CDCount     = 0;

-  NETCount    = 0;

-  BEVCount    = 0;

-  TotalSize   = 0;

-  HeaderSize  = sizeof (BBS_TYPE) + sizeof (UINT16);

-  DevOrder    = NULL;

-  Ptr         = NULL;

-  Status      = EFI_SUCCESS;

-

-  for (Index = 0; Index < BbsCount; Index++) {

-    if (BbsTable[Index].BootPriority == BBS_IGNORE_ENTRY) {

-      continue;

-    }

-

-    switch (BbsTable[Index].DeviceType) {

-    case BBS_FLOPPY:

-      FDCount++;

-      break;

-

-    case BBS_HARDDISK:

-      HDCount++;

-      break;

-

-    case BBS_CDROM:

-      CDCount++;

-      break;

-

-    case BBS_EMBED_NETWORK:

-      NETCount++;

-      break;

-

-    case BBS_BEV_DEVICE:

-      BEVCount++;

-      break;

-

-    default:

-      break;

-    }

-  }

-

-  TotalSize += (HeaderSize + sizeof (UINT16) * FDCount);

-  TotalSize += (HeaderSize + sizeof (UINT16) * HDCount);

-  TotalSize += (HeaderSize + sizeof (UINT16) * CDCount);

-  TotalSize += (HeaderSize + sizeof (UINT16) * NETCount);

-  TotalSize += (HeaderSize + sizeof (UINT16) * BEVCount);

-

-  DevOrder = AllocateZeroPool (TotalSize);

-  if (NULL == DevOrder) {

-    return EFI_OUT_OF_RESOURCES;

-  }

-

-  Ptr                 = DevOrder;

-

-  *((BBS_TYPE *) Ptr) = BBS_FLOPPY;

-  Ptr += sizeof (BBS_TYPE);

-  *((UINT16 *) Ptr) = (UINT16) (sizeof (UINT16) + FDCount * sizeof (UINT16));

-  Ptr += sizeof (UINT16);

-  if (FDCount) {

-    Ptr = (UINT8 *) BdsFillDevOrderBuf (BbsTable, BBS_FLOPPY, BbsCount, (UINT16 *) Ptr);

-  }

-

-  *((BBS_TYPE *) Ptr) = BBS_HARDDISK;

-  Ptr += sizeof (BBS_TYPE);

-  *((UINT16 *) Ptr) = (UINT16) (sizeof (UINT16) + HDCount * sizeof (UINT16));

-  Ptr += sizeof (UINT16);

-  if (HDCount) {

-    Ptr = (UINT8 *) BdsFillDevOrderBuf (BbsTable, BBS_HARDDISK, BbsCount, (UINT16 *) Ptr);

-  }

-

-  *((BBS_TYPE *) Ptr) = BBS_CDROM;

-  Ptr += sizeof (BBS_TYPE);

-  *((UINT16 *) Ptr) = (UINT16) (sizeof (UINT16) + CDCount * sizeof (UINT16));

-  Ptr += sizeof (UINT16);

-  if (CDCount) {

-    Ptr = (UINT8 *) BdsFillDevOrderBuf (BbsTable, BBS_CDROM, BbsCount, (UINT16 *) Ptr);

-  }

-

-  *((BBS_TYPE *) Ptr) = BBS_EMBED_NETWORK;

-  Ptr += sizeof (BBS_TYPE);

-  *((UINT16 *) Ptr) = (UINT16) (sizeof (UINT16) + NETCount * sizeof (UINT16));

-  Ptr += sizeof (UINT16);

-  if (NETCount) {

-    Ptr = (UINT8 *) BdsFillDevOrderBuf (BbsTable, BBS_EMBED_NETWORK, BbsCount, (UINT16 *) Ptr);

-  }

-

-  *((BBS_TYPE *) Ptr) = BBS_BEV_DEVICE;

-  Ptr += sizeof (BBS_TYPE);

-  *((UINT16 *) Ptr) = (UINT16) (sizeof (UINT16) + BEVCount * sizeof (UINT16));

-  Ptr += sizeof (UINT16);

-  if (BEVCount) {

-    Ptr = (UINT8 *) BdsFillDevOrderBuf (BbsTable, BBS_BEV_DEVICE, BbsCount, (UINT16 *) Ptr);

-  }

-

-  Status = gRT->SetVariable (

-                  VarLegacyDevOrder,

-                  &EfiLegacyDevOrderGuid,

-                  VAR_FLAG,

-                  TotalSize,

-                  DevOrder

-                  );

-  SafeFreePool (DevOrder);

-

-  return Status;

-}

-

-EFI_STATUS

-BdsUpdateLegacyDevOrder (

-  VOID

-  )

-/*++

-Format of LegacyDevOrder variable:

-|-----------------------------------------------------------------------------------------------------------------

-| BBS_FLOPPY | Length | Index0 | Index1 | ... | BBS_HARDDISK | Length | Index0 | Index1 | ... | BBS_CDROM | Length | Index0 | ...

-|-----------------------------------------------------------------------------------------------------------------

-

-Length is a 16 bit integer, it indicates how many Indexes follows, including the size of itself.

-Index# is a 16 bit integer, the low byte of it stands for the index in BBS table

-           the high byte of it only have two value 0 and 0xFF, 0xFF means this device has been

-           disabled by user.

---*/

-{

-  UINT8                     *DevOrder;

-  UINT8                     *NewDevOrder;

-  UINTN                     DevOrderSize;

-  EFI_LEGACY_BIOS_PROTOCOL  *LegacyBios;

-  EFI_STATUS                Status;

-  UINT16                    HddCount;

-  UINT16                    BbsCount;

-  HDD_INFO                  *LocalHddInfo;

-  BBS_TABLE                 *LocalBbsTable;

-  UINTN                     Index;

-  UINTN                     Index2;

-  UINTN                     *Idx;

-  UINTN                     FDCount;

-  UINTN                     HDCount;

-  UINTN                     CDCount;

-  UINTN                     NETCount;

-  UINTN                     BEVCount;

-  UINTN                     TotalSize;

-  UINTN                     HeaderSize;

-  UINT8                     *Ptr;

-  UINT8                     *NewPtr;

-  UINT16                    *NewFDPtr;

-  UINT16                    *NewHDPtr;

-  UINT16                    *NewCDPtr;

-  UINT16                    *NewNETPtr;

-  UINT16                    *NewBEVPtr;

-  UINT16                    *NewDevPtr;

-  UINT16                    Length;

-  UINT16                    tmp;

-  UINTN                     FDIndex;

-  UINTN                     HDIndex;

-  UINTN                     CDIndex;

-  UINTN                     NETIndex;

-  UINTN                     BEVIndex;

-

-  LocalHddInfo  = NULL;

-  LocalBbsTable = NULL;

-  Idx           = NULL;

-  FDCount       = 0;

-  HDCount       = 0;

-  CDCount       = 0;

-  NETCount      = 0;

-  BEVCount      = 0;

-  TotalSize     = 0;

-  HeaderSize    = sizeof (BBS_TYPE) + sizeof (UINT16);

-  FDIndex       = 0;

-  HDIndex       = 0;

-  CDIndex       = 0;

-  NETIndex      = 0;

-  BEVIndex      = 0;

-  NewDevPtr     = NULL;

-

-  Status        = EfiLibLocateProtocol (&gEfiLegacyBiosProtocolGuid, &LegacyBios);

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  LegacyBios->GetBbsInfo (

-                LegacyBios,

-                &HddCount,

-                &LocalHddInfo,

-                &BbsCount,

-                &LocalBbsTable

-                );

-

-  DevOrder = (UINT8 *) BdsLibGetVariableAndSize (

-                        VarLegacyDevOrder,

-                        &EfiLegacyDevOrderGuid,

-                        &DevOrderSize

-                        );

-  if (NULL == DevOrder) {

-    return BdsCreateDevOrder (LocalBbsTable, BbsCount);

-  }

-  //

-  // First we figure out how many boot devices with same device type respectively

-  //

-  for (Index = 0; Index < BbsCount; Index++) {

-    if ((LocalBbsTable[Index].BootPriority == BBS_IGNORE_ENTRY) ||

-        (LocalBbsTable[Index].BootPriority == BBS_DO_NOT_BOOT_FROM) ||

-        (LocalBbsTable[Index].BootPriority == BBS_LOWEST_PRIORITY)

-        ) {

-      continue;

-    }

-

-    switch (LocalBbsTable[Index].DeviceType) {

-    case BBS_FLOPPY:

-      FDCount++;

-      break;

-

-    case BBS_HARDDISK:

-      HDCount++;

-      break;

-

-    case BBS_CDROM:

-      CDCount++;

-      break;

-

-    case BBS_EMBED_NETWORK:

-      NETCount++;

-      break;

-

-    case BBS_BEV_DEVICE:

-      BEVCount++;

-      break;

-

-    default:

-      break;

-    }

-  }

-

-  TotalSize += (HeaderSize + FDCount * sizeof (UINT16));

-  TotalSize += (HeaderSize + HDCount * sizeof (UINT16));

-  TotalSize += (HeaderSize + CDCount * sizeof (UINT16));

-  TotalSize += (HeaderSize + NETCount * sizeof (UINT16));

-  TotalSize += (HeaderSize + BEVCount * sizeof (UINT16));

-

-  NewDevOrder = AllocateZeroPool (TotalSize);

-  if (NULL == NewDevOrder) {

-    return EFI_OUT_OF_RESOURCES;

-  }

-

-  NewFDPtr  = (UINT16 *) (NewDevOrder + HeaderSize);

-  NewHDPtr  = (UINT16 *) ((UINT8 *) NewFDPtr + FDCount * sizeof (UINT16) + HeaderSize);

-  NewCDPtr  = (UINT16 *) ((UINT8 *) NewHDPtr + HDCount * sizeof (UINT16) + HeaderSize);

-  NewNETPtr = (UINT16 *) ((UINT8 *) NewCDPtr + CDCount * sizeof (UINT16) + HeaderSize);

-  NewBEVPtr = (UINT16 *) ((UINT8 *) NewNETPtr + NETCount * sizeof (UINT16) + HeaderSize);

-

-  //

-  // copy FD

-  //

-  Ptr                     = DevOrder;

-  NewPtr                  = NewDevOrder;

-  *((BBS_TYPE *) NewPtr)  = *((BBS_TYPE *) Ptr);

-  Ptr += sizeof (BBS_TYPE);

-  NewPtr += sizeof (BBS_TYPE);

-  Length                = *((UINT16 *) Ptr);

-  *((UINT16 *) NewPtr)  = (UINT16) (sizeof (UINT16) + FDCount * sizeof (UINT16));

-  Ptr += sizeof (UINT16);

-

-  for (Index = 0; Index < Length / sizeof (UINT16) - 1; Index++) {

-    if (LocalBbsTable[*Ptr].BootPriority == BBS_IGNORE_ENTRY ||

-        LocalBbsTable[*Ptr].BootPriority == BBS_DO_NOT_BOOT_FROM ||

-        LocalBbsTable[*Ptr].BootPriority == BBS_LOWEST_PRIORITY ||

-        LocalBbsTable[*Ptr].DeviceType != BBS_FLOPPY

-        ) {

-      Ptr += sizeof (UINT16);

-      continue;

-    }

-

-    NewFDPtr[FDIndex] = *(UINT16 *) Ptr;

-    FDIndex++;

-    Ptr += sizeof (UINT16);

-  }

-  //

-  // copy HD

-  //

-  NewPtr                  = (UINT8 *) NewHDPtr - HeaderSize;

-  *((BBS_TYPE *) NewPtr)  = *((BBS_TYPE *) Ptr);

-  Ptr += sizeof (BBS_TYPE);

-  NewPtr += sizeof (BBS_TYPE);

-  Length                = *((UINT16 *) Ptr);

-  *((UINT16 *) NewPtr)  = (UINT16) (sizeof (UINT16) + HDCount * sizeof (UINT16));

-  Ptr += sizeof (UINT16);

-

-  for (Index = 0; Index < Length / sizeof (UINT16) - 1; Index++) {

-    if (LocalBbsTable[*Ptr].BootPriority == BBS_IGNORE_ENTRY ||

-        LocalBbsTable[*Ptr].BootPriority == BBS_DO_NOT_BOOT_FROM ||

-        LocalBbsTable[*Ptr].BootPriority == BBS_LOWEST_PRIORITY ||

-        LocalBbsTable[*Ptr].DeviceType != BBS_HARDDISK

-        ) {

-      Ptr += sizeof (UINT16);

-      continue;

-    }

-

-    NewHDPtr[HDIndex] = *(UINT16 *) Ptr;

-    HDIndex++;

-    Ptr += sizeof (UINT16);

-  }

-  //

-  // copy CD

-  //

-  NewPtr                  = (UINT8 *) NewCDPtr - HeaderSize;

-  *((BBS_TYPE *) NewPtr)  = *((BBS_TYPE *) Ptr);

-  Ptr += sizeof (BBS_TYPE);

-  NewPtr += sizeof (BBS_TYPE);

-  Length                = *((UINT16 *) Ptr);

-  *((UINT16 *) NewPtr)  = (UINT16) (sizeof (UINT16) + CDCount * sizeof (UINT16));

-  Ptr += sizeof (UINT16);

-

-  for (Index = 0; Index < Length / sizeof (UINT16) - 1; Index++) {

-    if (LocalBbsTable[*Ptr].BootPriority == BBS_IGNORE_ENTRY ||

-        LocalBbsTable[*Ptr].BootPriority == BBS_DO_NOT_BOOT_FROM ||

-        LocalBbsTable[*Ptr].BootPriority == BBS_LOWEST_PRIORITY ||

-        LocalBbsTable[*Ptr].DeviceType != BBS_CDROM

-        ) {

-      Ptr += sizeof (UINT16);

-      continue;

-    }

-

-    NewCDPtr[CDIndex] = *(UINT16 *) Ptr;

-    CDIndex++;

-    Ptr += sizeof (UINT16);

-  }

-  //

-  // copy NET

-  //

-  NewPtr                  = (UINT8 *) NewNETPtr - HeaderSize;

-  *((BBS_TYPE *) NewPtr)  = *((BBS_TYPE *) Ptr);

-  Ptr += sizeof (BBS_TYPE);

-  NewPtr += sizeof (BBS_TYPE);

-  Length                = *((UINT16 *) Ptr);

-  *((UINT16 *) NewPtr)  = (UINT16) (sizeof (UINT16) + NETCount * sizeof (UINT16));

-  Ptr += sizeof (UINT16);

-

-  for (Index = 0; Index < Length / sizeof (UINT16) - 1; Index++) {

-    if (LocalBbsTable[*Ptr].BootPriority == BBS_IGNORE_ENTRY ||

-        LocalBbsTable[*Ptr].BootPriority == BBS_DO_NOT_BOOT_FROM ||

-        LocalBbsTable[*Ptr].BootPriority == BBS_LOWEST_PRIORITY ||

-        LocalBbsTable[*Ptr].DeviceType != BBS_EMBED_NETWORK

-        ) {

-      Ptr += sizeof (UINT16);

-      continue;

-    }

-

-    NewNETPtr[NETIndex] = *(UINT16 *) Ptr;

-    NETIndex++;

-    Ptr += sizeof (UINT16);

-  }

-  //

-  // copy BEV

-  //

-  NewPtr                  = (UINT8 *) NewBEVPtr - HeaderSize;

-  *((BBS_TYPE *) NewPtr)  = *((BBS_TYPE *) Ptr);

-  Ptr += sizeof (BBS_TYPE);

-  NewPtr += sizeof (BBS_TYPE);

-  Length                = *((UINT16 *) Ptr);

-  *((UINT16 *) NewPtr)  = (UINT16) (sizeof (UINT16) + BEVCount * sizeof (UINT16));

-  Ptr += sizeof (UINT16);

-

-  for (Index = 0; Index < Length / sizeof (UINT16) - 1; Index++) {

-    if (LocalBbsTable[*Ptr].BootPriority == BBS_IGNORE_ENTRY ||

-        LocalBbsTable[*Ptr].BootPriority == BBS_DO_NOT_BOOT_FROM ||

-        LocalBbsTable[*Ptr].BootPriority == BBS_LOWEST_PRIORITY ||

-        LocalBbsTable[*Ptr].DeviceType != BBS_BEV_DEVICE

-        ) {

-      Ptr += sizeof (UINT16);

-      continue;

-    }

-

-    NewBEVPtr[BEVIndex] = *(UINT16 *) Ptr;

-    BEVIndex++;

-    Ptr += sizeof (UINT16);

-  }

-

-  for (Index = 0; Index < BbsCount; Index++) {

-    if ((LocalBbsTable[Index].BootPriority == BBS_IGNORE_ENTRY) ||

-        (LocalBbsTable[Index].BootPriority == BBS_DO_NOT_BOOT_FROM) ||

-        (LocalBbsTable[Index].BootPriority == BBS_LOWEST_PRIORITY)

-        ) {

-      continue;

-    }

-

-    switch (LocalBbsTable[Index].DeviceType) {

-    case BBS_FLOPPY:

-      Idx       = &FDIndex;

-      NewDevPtr = NewFDPtr;

-      break;

-

-    case BBS_HARDDISK:

-      Idx       = &HDIndex;

-      NewDevPtr = NewHDPtr;

-      break;

-

-    case BBS_CDROM:

-      Idx       = &CDIndex;

-      NewDevPtr = NewCDPtr;

-      break;

-

-    case BBS_EMBED_NETWORK:

-      Idx       = &NETIndex;

-      NewDevPtr = NewNETPtr;

-      break;

-

-    case BBS_BEV_DEVICE:

-      Idx       = &BEVIndex;

-      NewDevPtr = NewBEVPtr;

-      break;

-

-    default:

-      Idx = NULL;

-      break;

-    }

-    //

-    // at this point we have copied those valid indexes to new buffer

-    // and we should check if there is any new appeared boot device

-    //

-    if (Idx) {

-      for (Index2 = 0; Index2 < *Idx; Index2++) {

-        if ((NewDevPtr[Index2] & 0xFF) == (UINT16) Index) {

-          break;

-        }

-      }

-

-      if (Index2 == *Idx) {

-        //

-        // Index2 == *Idx means we didn't find Index

-        // so Index is a new appeared device's index in BBS table

-        // save it.

-        //

-        NewDevPtr[*Idx] = (UINT16) (Index & 0xFF);

-        (*Idx)++;

-      }

-    }

-  }

-

-  if (FDCount) {

-    //

-    // Just to make sure that disabled indexes are all at the end of the array

-    //

-    for (Index = 0; Index < FDIndex - 1; Index++) {

-      if (0xFF00 != (NewFDPtr[Index] & 0xFF00)) {

-        continue;

-      }

-

-      for (Index2 = Index + 1; Index2 < FDIndex; Index2++) {

-        if (0 == (NewFDPtr[Index2] & 0xFF00)) {

-          tmp               = NewFDPtr[Index];

-          NewFDPtr[Index]   = NewFDPtr[Index2];

-          NewFDPtr[Index2]  = tmp;

-          break;

-        }

-      }

-    }

-  }

-

-  if (HDCount) {

-    //

-    // Just to make sure that disabled indexes are all at the end of the array

-    //

-    for (Index = 0; Index < HDIndex - 1; Index++) {

-      if (0xFF00 != (NewHDPtr[Index] & 0xFF00)) {

-        continue;

-      }

-

-      for (Index2 = Index + 1; Index2 < HDIndex; Index2++) {

-        if (0 == (NewHDPtr[Index2] & 0xFF00)) {

-          tmp               = NewHDPtr[Index];

-          NewHDPtr[Index]   = NewHDPtr[Index2];

-          NewHDPtr[Index2]  = tmp;

-          break;

-        }

-      }

-    }

-  }

-

-  if (CDCount) {

-    //

-    // Just to make sure that disabled indexes are all at the end of the array

-    //

-    for (Index = 0; Index < CDIndex - 1; Index++) {

-      if (0xFF00 != (NewCDPtr[Index] & 0xFF00)) {

-        continue;

-      }

-

-      for (Index2 = Index + 1; Index2 < CDIndex; Index2++) {

-        if (0 == (NewCDPtr[Index2] & 0xFF00)) {

-          tmp               = NewCDPtr[Index];

-          NewCDPtr[Index]   = NewCDPtr[Index2];

-          NewCDPtr[Index2]  = tmp;

-          break;

-        }

-      }

-    }

-  }

-

-  if (NETCount) {

-    //

-    // Just to make sure that disabled indexes are all at the end of the array

-    //

-    for (Index = 0; Index < NETIndex - 1; Index++) {

-      if (0xFF00 != (NewNETPtr[Index] & 0xFF00)) {

-        continue;

-      }

-

-      for (Index2 = Index + 1; Index2 < NETIndex; Index2++) {

-        if (0 == (NewNETPtr[Index2] & 0xFF00)) {

-          tmp               = NewNETPtr[Index];

-          NewNETPtr[Index]  = NewNETPtr[Index2];

-          NewNETPtr[Index2] = tmp;

-          break;

-        }

-      }

-    }

-  }

-

-  if (BEVCount) {

-    //

-    // Just to make sure that disabled indexes are all at the end of the array

-    //

-    for (Index = 0; Index < BEVIndex - 1; Index++) {

-      if (0xFF00 != (NewBEVPtr[Index] & 0xFF00)) {

-        continue;

-      }

-

-      for (Index2 = Index + 1; Index2 < BEVIndex; Index2++) {

-        if (0 == (NewBEVPtr[Index2] & 0xFF00)) {

-          tmp               = NewBEVPtr[Index];

-          NewBEVPtr[Index]  = NewBEVPtr[Index2];

-          NewBEVPtr[Index2] = tmp;

-          break;

-        }

-      }

-    }

-  }

-

-  SafeFreePool (DevOrder);

-

-  Status = gRT->SetVariable (

-                  VarLegacyDevOrder,

-                  &EfiLegacyDevOrderGuid,

-                  VAR_FLAG,

-                  TotalSize,

-                  NewDevOrder

-                  );

-  SafeFreePool (NewDevOrder);

-

-  return Status;

-}

-

-EFI_STATUS

-BdsSetBootPriority4SameTypeDev (

-  IN UINT16                                              DeviceType,

-  IN OUT BBS_TABLE                                       *LocalBbsTable,

-  IN OUT UINT16                                          *Priority

-  )

-/*++

-DeviceType           - BBS_FLOPPY, BBS_HARDDISK, BBS_CDROM and so on

-LocalBbsTable       - BBS table instance

-Priority                 - As input arg, it is the start point of boot priority, as output arg, it is the start point of boot

-                              priority can be used next time.

---*/

-{

-  UINT8   *DevOrder;

-

-  UINT8   *OrigBuffer;

-  UINT16  *DevIndex;

-  UINTN   DevOrderSize;

-  UINTN   DevCount;

-  UINTN   Index;

-

-  DevOrder = BdsLibGetVariableAndSize (

-              VarLegacyDevOrder,

-              &EfiLegacyDevOrderGuid,

-              &DevOrderSize

-              );

-  if (NULL == DevOrder) {

-    return EFI_OUT_OF_RESOURCES;

-  }

-

-  OrigBuffer = DevOrder;

-  while (DevOrder < OrigBuffer + DevOrderSize) {

-    if (DeviceType == * (BBS_TYPE *) DevOrder) {

-      break;

-    }

-

-    DevOrder += sizeof (BBS_TYPE);

-    DevOrder += *(UINT16 *) DevOrder;

-  }

-

-  if (DevOrder >= OrigBuffer + DevOrderSize) {

-    SafeFreePool (OrigBuffer);

-    return EFI_NOT_FOUND;

-  }

-

-  DevOrder += sizeof (BBS_TYPE);

-  DevCount  = (*((UINT16 *) DevOrder) - sizeof (UINT16)) / sizeof (UINT16);

-  DevIndex  = (UINT16 *) (DevOrder + sizeof (UINT16));

-  //

-  // If the high byte of the DevIndex is 0xFF, it indicates that this device has been disabled.

-  //

-  for (Index = 0; Index < DevCount; Index++) {

-    if ((DevIndex[Index] & 0xFF00) == 0xFF00) {

-      //

-      // LocalBbsTable[DevIndex[Index] & 0xFF].BootPriority = BBS_DISABLED_ENTRY;

-      //

-    } else {

-      LocalBbsTable[DevIndex[Index] & 0xFF].BootPriority = *Priority;

-      (*Priority)++;

-    }

-  }

-

-  SafeFreePool (OrigBuffer);

-  return EFI_SUCCESS;

-}

-

-VOID

-PrintBbsTable (

-  IN BBS_TABLE                      *LocalBbsTable

-  )

-{

-  UINT16  Idx;

-

-  DEBUG ((EFI_D_ERROR, "\n"));

-  DEBUG ((EFI_D_ERROR, " NO  Prio bb/dd/ff cl/sc Type Stat segm:offs\n"));

-  DEBUG ((EFI_D_ERROR, "=============================================\n"));

-  for (Idx = 0; Idx < MAX_BBS_ENTRIES; Idx++) {

-    if ((LocalBbsTable[Idx].BootPriority == BBS_IGNORE_ENTRY) ||

-        (LocalBbsTable[Idx].BootPriority == BBS_DO_NOT_BOOT_FROM) ||

-        (LocalBbsTable[Idx].BootPriority == BBS_LOWEST_PRIORITY)

-        ) {

-      continue;

-    }

-

-    DEBUG (

-      (EFI_D_ERROR,

-      " %02x: %04x %02x/%02x/%02x %02x/02%x %04x %04x %04x:%04x\n",

-      (UINTN) Idx,

-      (UINTN) LocalBbsTable[Idx].BootPriority,

-      (UINTN) LocalBbsTable[Idx].Bus,

-      (UINTN) LocalBbsTable[Idx].Device,

-      (UINTN) LocalBbsTable[Idx].Function,

-      (UINTN) LocalBbsTable[Idx].Class,

-      (UINTN) LocalBbsTable[Idx].SubClass,

-      (UINTN) LocalBbsTable[Idx].DeviceType,

-      (UINTN) * (UINT16 *) &LocalBbsTable[Idx].StatusFlags,

-      (UINTN) LocalBbsTable[Idx].BootHandlerSegment,

-      (UINTN) LocalBbsTable[Idx].BootHandlerOffset,

-      (UINTN) ((LocalBbsTable[Idx].MfgStringSegment << 4) + LocalBbsTable[Idx].MfgStringOffset),

-      (UINTN) ((LocalBbsTable[Idx].DescStringSegment << 4) + LocalBbsTable[Idx].DescStringOffset))

-      );

-  }

-

-  DEBUG ((EFI_D_ERROR, "\n"));

-}

-

-EFI_STATUS

-BdsRefreshBbsTableForBoot (

-  IN BDS_COMMON_OPTION        *Entry

-  )

-{

-  EFI_STATUS                Status;

-  UINT16                    HddCount;

-  UINT16                    BbsCount;

-  HDD_INFO                  *LocalHddInfo;

-  BBS_TABLE                 *LocalBbsTable;

-  UINT16                    DevType;

-  EFI_LEGACY_BIOS_PROTOCOL  *LegacyBios;

-  UINTN                     Index;

-  UINT16                    Priority;

-  UINT16                    *BootOrder;

-  UINTN                     BootOrderSize;

-  UINT8                     *BootOptionVar;

-  UINTN                     BootOptionSize;

-  UINT16                    BootOption[100];

-  UINT8                     *Ptr;

-  UINT16                    DevPathLen;

-  EFI_DEVICE_PATH_PROTOCOL  *DevPath;

-

-  HddCount      = 0;

-  BbsCount      = 0;

-  LocalHddInfo  = NULL;

-  LocalBbsTable = NULL;

-  DevType       = BBS_UNKNOWN;

-

-  Status        = EfiLibLocateProtocol (&gEfiLegacyBiosProtocolGuid, &LegacyBios);

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  LegacyBios->GetBbsInfo (

-                LegacyBios,

-                &HddCount,

-                &LocalHddInfo,

-                &BbsCount,

-                &LocalBbsTable

-                );

-  //

-  // First, set all the present devices' boot priority to BBS_UNPRIORITIZED_ENTRY

-  // We will set them according to the settings setup by user

-  //

-  for (Index = 0; Index < BbsCount; Index++) {

-    if (!((BBS_IGNORE_ENTRY == LocalBbsTable[Index].BootPriority) ||

-        (BBS_DO_NOT_BOOT_FROM == LocalBbsTable[Index].BootPriority) ||

-         (BBS_LOWEST_PRIORITY == LocalBbsTable[Index].BootPriority))) {

-      LocalBbsTable[Index].BootPriority = BBS_UNPRIORITIZED_ENTRY;

-    }

-  }

-  //

-  // boot priority always starts at 0

-  //

-  Priority = 0;

-  if (Entry->LoadOptionsSize == sizeof (BBS_TABLE) + sizeof (UINT16)) {

-    //

-    // If Entry stands for a legacy boot option, we prioritize the devices with the same type first.

-    //

-    DevType = ((BBS_TABLE *) Entry->LoadOptions)->DeviceType;

-    Status = BdsSetBootPriority4SameTypeDev (

-              DevType,

-              LocalBbsTable,

-              &Priority

-              );

-    if (EFI_ERROR (Status)) {

-      return Status;

-    }

-  }

-  //

-  // we have to set the boot priority for other BBS entries with different device types

-  //

-  BootOrder = (UINT16 *) BdsLibGetVariableAndSize (

-                          L"BootOrder",

-                          &gEfiGlobalVariableGuid,

-                          &BootOrderSize

-                          );

-  for (Index = 0; BootOrder && Index < BootOrderSize / sizeof (UINT16); Index++) {

-    UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", BootOrder[Index]);

-    BootOptionVar = BdsLibGetVariableAndSize (

-                      BootOption,

-                      &gEfiGlobalVariableGuid,

-                      &BootOptionSize

-                      );

-    if (NULL == BootOptionVar) {

-      continue;

-    }

-

-    Ptr = BootOptionVar;

-

-    Ptr += sizeof (UINT32);

-    DevPathLen = *(UINT16 *) Ptr;

-    Ptr += sizeof (UINT16);

-    Ptr += StrSize ((UINT16 *) Ptr);

-    DevPath = (EFI_DEVICE_PATH_PROTOCOL *) Ptr;

-    if (BBS_DEVICE_PATH != DevPath->Type || BBS_BBS_DP != DevPath->SubType) {

-      SafeFreePool (BootOptionVar);

-      continue;

-    }

-

-    Ptr += DevPathLen;

-    if (DevType == ((BBS_TABLE *) Ptr)->DeviceType) {

-      //

-      // We don't want to process twice for a device type

-      //

-      SafeFreePool (BootOptionVar);

-      continue;

-    }

-

-    Status = BdsSetBootPriority4SameTypeDev (

-              ((BBS_TABLE *) Ptr)->DeviceType,

-              LocalBbsTable,

-              &Priority

-              );

-    SafeFreePool (BootOptionVar);

-    if (EFI_ERROR (Status)) {

-      break;

-    }

-  }

-

-  if (BootOrder) {

-    SafeFreePool (BootOrder);

-  }

-  //

-  // For debug

-  //

-  PrintBbsTable (LocalBbsTable);

-

-  return Status;

-}

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BBSsupport.h b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BBSsupport.h
deleted file mode 100644
index 663fd0a..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BBSsupport.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  BBSsupport.h

-

-Abstract:

-

-  declares interface functions

-

-Revision History

-

---*/

-

-#ifndef _EFI_BDS_BBS_SUPPORT_H

-#define _EFI_BDS_BBS_SUPPORT_H

-

-#include "Generic/BootMaint/BootMaint.h"

-

-#if   defined (MDE_CPU_IA32)

-#define REFRESH_LEGACY_BOOT_OPTIONS \

-        BdsDeleteAllInvalidLegacyBootOptions ();\

-        BdsAddNonExistingLegacyBootOptions (); \

-        BdsUpdateLegacyDevOrder ()

-#else

-#define REFRESH_LEGACY_BOOT_OPTIONS

-#endif

-

-VOID

-BdsBuildLegacyDevNameString (

-  IN BBS_TABLE                     *CurBBSEntry,

-  IN UINTN                         Index,

-  IN UINTN                         BufSize,

-  OUT CHAR16                       *BootString

-  );

-

-EFI_STATUS

-BdsDeleteAllInvalidLegacyBootOptions (

-  VOID

-  );

-

-EFI_STATUS

-BdsAddNonExistingLegacyBootOptions (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  Add the legacy boot options from BBS table if they do not exist.

-

-Arguments:

-

-  None.

-

-Returns:

-

-  EFI_SUCCESS       - The boot options are added successfully or they are already in boot options.

-  others            - An error occurred when creating legacy boot options.

-

---*/

-;

-

-EFI_STATUS

-BdsUpdateLegacyDevOrder (

-  VOID

-  );

-

-EFI_STATUS

-BdsRefreshBbsTableForBoot (

-  IN BDS_COMMON_OPTION        *Entry

-  );

-

-#endif

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BmLib.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BmLib.c
deleted file mode 100644
index 8804b14..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BmLib.c
+++ /dev/null
@@ -1,627 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  BmLib.c

-

-AgBStract:

-

-  Boot Maintainence Helper functions

-

---*/

-

-#include "BootMaint.h"

-

-EFI_STATUS

-EfiLibLocateProtocol (

-  IN  EFI_GUID    *ProtocolGuid,

-  OUT VOID        **Interface

-  )

-/*++

-

-Routine Description:

-

-  Find the first instance of this Protocol

-  in the system and return it's interface

-

-Arguments:

-

-  ProtocolGuid    - Provides the protocol to search for

-  Interface       - On return, a pointer to the first interface

-                    that matches ProtocolGuid

-

-Returns:

-

-  EFI_SUCCESS     - A protocol instance matching ProtocolGuid was found

-

-  EFI_NOT_FOUND   - No protocol instances were found that match ProtocolGuid

-

---*/

-{

-  EFI_STATUS  Status;

-

-  Status = gBS->LocateProtocol (

-                  ProtocolGuid,

-                  NULL,

-                  Interface

-                  );

-  return Status;

-}

-

-EFI_FILE_HANDLE

-EfiLibOpenRoot (

-  IN EFI_HANDLE                   DeviceHandle

-  )

-/*++

-

-Routine Description:

-

-  Function opens and returns a file handle to the root directory of a volume.

-

-Arguments:

-

-  DeviceHandle         - A handle for a device

-

-Returns:

-

-  A valid file handle or NULL is returned

-

---*/

-{

-  EFI_STATUS                      Status;

-  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Volume;

-  EFI_FILE_HANDLE                 File;

-

-  File = NULL;

-

-  //

-  // File the file system interface to the device

-  //

-  Status = gBS->HandleProtocol (

-                  DeviceHandle,

-                  &gEfiSimpleFileSystemProtocolGuid,

-                  (VOID *) &Volume

-                  );

-

-  //

-  // Open the root directory of the volume

-  //

-  if (!EFI_ERROR (Status)) {

-    Status = Volume->OpenVolume (

-                      Volume,

-                      &File

-                      );

-  }

-  //

-  // Done

-  //

-  return EFI_ERROR (Status) ? NULL : File;

-}

-

-BOOLEAN

-EfiGrowBuffer (

-  IN OUT EFI_STATUS   *Status,

-  IN OUT VOID         **Buffer,

-  IN UINTN            BufferSize

-  )

-/*++

-

-Routine Description:

-

-    Helper function called as part of the code needed

-    to allocate the proper sized buffer for various

-    EFI interfaces.

-

-Arguments:

-

-    Status      - Current status

-

-    Buffer      - Current allocated buffer, or NULL

-

-    BufferSize  - Current buffer size needed

-

-Returns:

-

-    TRUE - if the buffer was reallocated and the caller

-    should try the API again.

-

---*/

-{

-  BOOLEAN TryAgain;

-

-  //

-  // If this is an initial request, buffer will be null with a new buffer size

-  //

-  if (!*Buffer && BufferSize) {

-    *Status = EFI_BUFFER_TOO_SMALL;

-  }

-  //

-  // If the status code is "buffer too small", resize the buffer

-  //

-  TryAgain = FALSE;

-  if (*Status == EFI_BUFFER_TOO_SMALL) {

-

-    SafeFreePool (*Buffer);

-

-    *Buffer = AllocateZeroPool (BufferSize);

-

-    if (*Buffer) {

-      TryAgain = TRUE;

-    } else {

-      *Status = EFI_OUT_OF_RESOURCES;

-    }

-  }

-  //

-  // If there's an error, free the buffer

-  //

-  if (!TryAgain && EFI_ERROR (*Status) && *Buffer) {

-    SafeFreePool (*Buffer);

-    *Buffer = NULL;

-  }

-

-  return TryAgain;

-}

-

-VOID *

-EfiLibGetVariable (

-  IN CHAR16               *Name,

-  IN EFI_GUID             *VendorGuid

-  )

-/*++

-

-Routine Description:

-  Function returns the value of the specified variable.

-

-Arguments:

-  Name                - A Null-terminated Unicode string that is

-                        the name of the vendor's variable.

-

-  VendorGuid          - A unique identifier for the vendor.

-

-Returns:

-

-  None

-

---*/

-{

-  UINTN VarSize;

-

-  return BdsLibGetVariableAndSize (Name, VendorGuid, &VarSize);

-}

-

-EFI_STATUS

-EfiLibDeleteVariable (

-  IN CHAR16   *VarName,

-  IN EFI_GUID *VarGuid

-  )

-/*++

-

-Routine Description:

-  Function deletes the variable specified by VarName and VarGuid.

-

-Arguments:

-  VarName              - A Null-terminated Unicode string that is

-                         the name of the vendor's variable.

-

-  VendorGuid           - A unique identifier for the vendor.

-

-Returns:

-

-  EFI_SUCCESS          - The variable was found and removed

-

-  EFI_UNSUPPORTED      - The variable store was inaccessible

-

-  EFI_OUT_OF_RESOURCES - The temporary buffer was not available

-

-  EFI_NOT_FOUND        - The variable was not found

-

---*/

-{

-  VOID        *VarBuf;

-  EFI_STATUS  Status;

-

-  VarBuf  = EfiLibGetVariable (VarName, VarGuid);

-  Status  = EFI_NOT_FOUND;

-

-  if (VarBuf) {

-    //

-    // Delete variable from Storage

-    //

-    Status = gRT->SetVariable (VarName, VarGuid, VAR_FLAG, 0, NULL);

-    ASSERT (!EFI_ERROR (Status));

-    SafeFreePool (VarBuf);

-  }

-

-  return Status;

-}

-

-EFI_FILE_SYSTEM_VOLUME_LABEL_INFO *

-EfiLibFileSystemVolumeLabelInfo (

-  IN EFI_FILE_HANDLE      FHand

-  )

-/*++

-

-Routine Description:

-

-  Function gets the file system information from an open file descriptor,

-  and stores it in a buffer allocated from pool.

-

-Arguments:

-

-  Fhand         - A file handle

-

-Returns:

-

-  A pointer to a buffer with file information or NULL is returned

-

---*/

-{

-  EFI_STATUS                        Status;

-  EFI_FILE_SYSTEM_VOLUME_LABEL_INFO *Buffer;

-  UINTN                             BufferSize;

-  //

-  // Initialize for GrowBuffer loop

-  //

-  Buffer      = NULL;

-  BufferSize  = SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL_INFO + 200;

-

-  //

-  // Call the real function

-  //

-  while (EfiGrowBuffer (&Status, (VOID **) &Buffer, BufferSize)) {

-    Status = FHand->GetInfo (

-                      FHand,

-                      &gEfiFileSystemVolumeLabelInfoIdGuid,

-                      &BufferSize,

-                      Buffer

-                      );

-  }

-

-  return Buffer;

-}

-

-CHAR16 *

-EfiStrDuplicate (

-  IN CHAR16   *Src

-  )

-{

-  CHAR16  *Dest;

-  UINTN   Size;

-

-  Size  = StrSize (Src);

-  Dest  = AllocateZeroPool (Size);

-  ASSERT (Dest != NULL);

-  if (Dest) {

-    CopyMem (Dest, Src, Size);

-  }

-

-  return Dest;

-}

-

-EFI_FILE_INFO *

-EfiLibFileInfo (

-  IN EFI_FILE_HANDLE      FHand

-  )

-/*++

-

-Routine Description:

-

-  Function gets the file information from an open file descriptor, and stores it

-  in a buffer allocated from pool.

-

-Arguments:

-

-  Fhand         - A file handle

-

-Returns:

-

-  A pointer to a buffer with file information or NULL is returned

-

---*/

-{

-  EFI_STATUS    Status;

-  EFI_FILE_INFO *Buffer;

-  UINTN         BufferSize;

-

-  //

-  // Initialize for GrowBuffer loop

-  //

-  Buffer      = NULL;

-  BufferSize  = SIZE_OF_EFI_FILE_INFO + 200;

-

-  //

-  // Call the real function

-  //

-  while (EfiGrowBuffer (&Status, (VOID **) &Buffer, BufferSize)) {

-    Status = FHand->GetInfo (

-                      FHand,

-                      &gEfiFileInfoGuid,

-                      &BufferSize,

-                      Buffer

-                      );

-  }

-

-  return Buffer;

-}

-

-UINTN

-EfiDevicePathInstanceCount (

-  IN EFI_DEVICE_PATH_PROTOCOL      *DevicePath

-  )

-/*++

-

-Routine Description:

-  Function is used to determine the number of device path instances

-  that exist in a device path.

-

-Arguments:

-  DevicePath           - A pointer to a device path data structure.

-

-Returns:

-

-  This function counts and returns the number of device path instances

-  in DevicePath.

-

---*/

-{

-  UINTN Count;

-  UINTN Size;

-

-  Count = 0;

-  while (GetNextDevicePathInstance (&DevicePath, &Size)) {

-    Count += 1;

-  }

-

-  return Count;

-}

-

-VOID *

-EfiReallocatePool (

-  IN VOID                 *OldPool,

-  IN UINTN                OldSize,

-  IN UINTN                NewSize

-  )

-/*++

-

-Routine Description:

-  Adjusts the size of a previously allocated buffer.

-

-Arguments:

-  OldPool               - A pointer to the buffer whose size is being adjusted.

-  OldSize               - The size of the current buffer.

-  NewSize               - The size of the new buffer.

-

-Returns:

-

-  EFI_SUCEESS           - The requested number of bytes were allocated.

-

-  EFI_OUT_OF_RESOURCES  - The pool requested could not be allocated.

-

-  EFI_INVALID_PARAMETER - The buffer was invalid.

-

---*/

-{

-  VOID  *NewPool;

-

-  NewPool = NULL;

-  if (NewSize) {

-    NewPool = AllocateZeroPool (NewSize);

-  }

-

-  if (OldPool) {

-    if (NewPool) {

-      CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize);

-    }

-

-    SafeFreePool (OldPool);

-  }

-

-  return NewPool;

-}

-

-EFI_STATUS

-EfiLibGetStringFromToken (

-  IN      EFI_GUID                  *ProducerGuid,

-  IN      STRING_REF                Token,

-  OUT     CHAR16                    **String

-  )

-/*++

-

-Routine Description:

-

-  Acquire the string associated with the ProducerGuid and return it.

-

-Arguments:

-

-  ProducerGuid - The Guid to search the HII database for

-  Token        - The token value of the string to extract

-  String       - The string that is extracted

-

-Returns:

-

-  EFI_SUCCESS           -  Buffer filled with the requested forms. BufferLength

-                           was updated.

-  EFI_BUFFER_TOO_SMALL  -  The buffer provided was not large enough to allow the form to be stored.

-

---*/

-{

-  EFI_STATUS        Status;

-  UINT16            HandleBufferLength;

-  EFI_HII_HANDLE    *HiiHandleBuffer;

-  UINTN             StringBufferLength;

-  UINTN             NumberOfHiiHandles;

-  UINTN             Index;

-  UINT16            Length;

-  EFI_GUID          HiiGuid;

-  EFI_HII_PROTOCOL  *Hii;

-

-  //

-  // Initialize params.

-  //

-  HandleBufferLength  = 0;

-  HiiHandleBuffer     = NULL;

-

-  Status = gBS->LocateProtocol (

-                  &gEfiHiiProtocolGuid,

-                  NULL,

-                  &Hii

-                  );

-  if (EFI_ERROR (Status)) {

-    *String = NULL;

-    return Status;

-  }

-  //

-  // Get all the Hii handles

-  //

-  Status = BdsLibGetHiiHandles (Hii, &HandleBufferLength, &HiiHandleBuffer);

-  ASSERT_EFI_ERROR (Status);

-

-  //

-  // Get the Hii Handle that matches the StructureNode->ProducerName

-  //

-  NumberOfHiiHandles = HandleBufferLength / sizeof (EFI_HII_HANDLE);

-  for (Index = 0; Index < NumberOfHiiHandles; Index++) {

-    Length = 0;

-    Status = ExtractDataFromHiiHandle (

-              HiiHandleBuffer[Index],

-              &Length,

-              NULL,

-              &HiiGuid

-              );

-    if (CompareGuid (ProducerGuid, &HiiGuid)) {

-      break;

-    }

-  }

-  //

-  // Find the string based on the current language

-  //

-  StringBufferLength  = 0x100;

-  *String             = AllocateZeroPool (0x100);

-  ASSERT (*String != NULL);

-

-  Status = Hii->GetString (

-                  Hii,

-                  HiiHandleBuffer[Index],

-                  Token,

-                  FALSE,

-                  NULL,

-                  &StringBufferLength,

-                  *String

-                  );

-

-  FreePool (HiiHandleBuffer);

-

-  return Status;

-}

-

-BOOLEAN

-TimeCompare (

-  IN EFI_TIME               *FirstTime,

-  IN EFI_TIME               *SecondTime

-  )

-/*++

-

-Routine Description:

-  Compare two EFI_TIME data.

-

-Arguments:

-

-  FirstTime         - A pointer to the first EFI_TIME data.

-  SecondTime        - A pointer to the second EFI_TIME data.

-

-Returns:

-  TRUE              The FirstTime is not later than the SecondTime.

-  FALSE             The FirstTime is later than the SecondTime.

-

---*/

-{

-  if (FirstTime->Year != SecondTime->Year) {

-    return (BOOLEAN) (FirstTime->Year < SecondTime->Year);

-  } else if (FirstTime->Month != SecondTime->Month) {

-    return (BOOLEAN) (FirstTime->Month < SecondTime->Month);

-  } else if (FirstTime->Day != SecondTime->Day) {

-    return (BOOLEAN) (FirstTime->Day < SecondTime->Day);

-  } else if (FirstTime->Hour != SecondTime->Hour) {

-    return (BOOLEAN) (FirstTime->Hour < SecondTime->Hour);

-  } else if (FirstTime->Minute != SecondTime->Minute) {

-    return (BOOLEAN) (FirstTime->Minute < FirstTime->Minute);

-  } else if (FirstTime->Second != SecondTime->Second) {

-    return (BOOLEAN) (FirstTime->Second < SecondTime->Second);

-  }

-

-  return (BOOLEAN) (FirstTime->Nanosecond <= SecondTime->Nanosecond);

-}

-

-UINT16 *

-EfiLibStrFromDatahub (

-  IN EFI_DEVICE_PATH_PROTOCOL                 *DevPath

-  )

-{

-  EFI_STATUS                                  Status;

-  UINT16                                      *Desc;

-  EFI_DATA_HUB_PROTOCOL                       *Datahub;

-  UINT64                                      Count;

-  EFI_DATA_RECORD_HEADER                      *Record;

-  EFI_SUBCLASS_TYPE1_HEADER                   *DataHdr;

-  EFI_GUID                                    MiscGuid = EFI_MISC_SUBCLASS_GUID;

-  EFI_MISC_ONBOARD_DEVICE_DATA                *ob;

-  EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *Port;

-  EFI_TIME                                    CurTime;

-

-  Status = gBS->LocateProtocol (

-                  &gEfiDataHubProtocolGuid,

-                  NULL,

-                  &Datahub

-                  );

-  if (EFI_ERROR (Status)) {

-    return NULL;

-  }

-

-  Status = gRT->GetTime (&CurTime, NULL);

-  if (EFI_ERROR (Status)) {

-    return NULL;

-  }

-

-  Count = 0;

-  do {

-    Status = Datahub->GetNextRecord (Datahub, &Count, NULL, &Record);

-

-    if (EFI_ERROR (Status)) {

-      break;

-    }

-

-    if (Record->DataRecordClass == EFI_DATA_RECORD_CLASS_DATA && CompareGuid (&Record->DataRecordGuid, &MiscGuid)) {

-      //

-      // This record is what we need

-      //

-      DataHdr = (EFI_SUBCLASS_TYPE1_HEADER *) (Record + 1);

-      if (EFI_MISC_ONBOARD_DEVICE_RECORD_NUMBER == DataHdr->RecordType) {

-        ob = (EFI_MISC_ONBOARD_DEVICE_DATA *) (DataHdr + 1);

-        if (BdsLibMatchDevicePaths ((EFI_DEVICE_PATH_PROTOCOL *) &ob->OnBoardDevicePath, DevPath)) {

-          EfiLibGetStringFromToken (&Record->ProducerName, ob->OnBoardDeviceDescription, &Desc);

-          return Desc;

-        }

-      }

-

-      if (EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_RECORD_NUMBER == DataHdr->RecordType) {

-        Port = (EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) (DataHdr + 1);

-        if (BdsLibMatchDevicePaths ((EFI_DEVICE_PATH_PROTOCOL *) &Port->PortPath, DevPath)) {

-          EfiLibGetStringFromToken (&Record->ProducerName, Port->PortExternalConnectorDesignator, &Desc);

-          return Desc;

-        }

-      }

-    }

-

-  } while (TimeCompare (&Record->LogTime, &CurTime) && Count != 0);

-

-  return NULL;

-}

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootMaint.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootMaint.c
deleted file mode 100644
index 77b530d..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootMaint.c
+++ /dev/null
@@ -1,1319 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  BootMaint.c

-

-Abstract:

-

-  Boot Maintainence Main File

-

---*/

-

-#include "Generic/Bds.h"

-#include "BootMaint.h"

-#include "BdsStrDefs.h"

-#include "formguid.h"

-

-//

-// Form binary for Boot Maintenance

-//

-extern UINT8    bmBin[];

-extern UINT8    FEBin[];

-extern EFI_GUID gBdsStringPackGuid;

-extern BOOLEAN  gConnectAllHappened;

-

-EFI_GUID        EfiLegacyDevOrderGuid = EFI_LEGACY_DEV_ORDER_VARIABLE_GUID;

-

-VOID

-InitAllMenu (

-  IN  BMM_CALLBACK_DATA    *CallbackData

-  );

-

-VOID

-FreeAllMenu (

-  VOID

-  );

-

-EFI_STATUS

-CreateMenuStringToken (

-  IN BMM_CALLBACK_DATA                *CallbackData,

-  IN EFI_HII_HANDLE                   HiiHandle,

-  IN BM_MENU_OPTION                   *MenuOption

-  )

-/*++

-Routine Description:

-

-  Create string tokens for a menu from its help strings and display strings

-

-Arguments:

-

-  HiiHandle       - Hii Handle of the package to be updated.

-

-  MenuOption      - The Menu whose string tokens need to be created

-

-Returns:

-

-  EFI_SUCCESS     - string tokens created successfully

-

-  others          - contain some errors

-

---*/

-{

-  BM_MENU_ENTRY *NewMenuEntry;

-  UINTN         Index;

-

-  for (Index = 0; Index < MenuOption->MenuNumber; Index++) {

-    NewMenuEntry = BOpt_GetMenuEntry (MenuOption, Index);

-    CallbackData->Hii->NewString (

-                        CallbackData->Hii,

-                        NULL,

-                        HiiHandle,

-                        &NewMenuEntry->DisplayStringToken,

-                        NewMenuEntry->DisplayString

-                        );

-

-    if (NULL == NewMenuEntry->HelpString) {

-      NewMenuEntry->HelpStringToken = NewMenuEntry->DisplayStringToken;

-    } else {

-      CallbackData->Hii->NewString (

-                          CallbackData->Hii,

-                          NULL,

-                          HiiHandle,

-                          &NewMenuEntry->HelpStringToken,

-                          NewMenuEntry->HelpString

-                          );

-    }

-  }

-

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-EFIAPI

-DriverCallback (

-  IN EFI_FORM_CALLBACK_PROTOCOL       *This,

-  IN UINT16                           KeyValue,

-  IN EFI_IFR_DATA_ARRAY               *Data,

-  OUT EFI_HII_CALLBACK_PACKET         **Packet

-  )

-/*++

-Routine Description:

-

-  Callback Function for boot maintenance utility user interface interaction.

-

-Arguments:

-

-  This            - File explorer callback protocol pointer.

-  KeyValue        - Key value to identify the type of data to expect.

-  Data            - A pointer to the data being sent to the original exporting driver.

-  Packet          - A pointer to a packet of information which a driver passes back to the browser.

-

-Returns:

-

-  EFI_SUCCESS     - Callback ended successfully.

-  Others          - Contain some errors.

-

---*/

-{

-  BMM_CALLBACK_DATA *Private;

-  BM_MENU_ENTRY     *NewMenuEntry;

-  BMM_FAKE_NV_DATA  *CurrentFakeNVMap;

-  EFI_STATUS        Status;

-  UINTN             OldValue;

-  UINTN             NewValue;

-  UINTN             Number;

-  UINTN             Pos;

-  UINTN             Bit;

-  UINT16            NewValuePos;

-  UINT16            Index2;

-  UINT16            Index;

-  UINT8             *OldLegacyDev;

-  UINT8             *NewLegacyDev;

-  UINT8             *Location;

-  UINT8             *DisMap;

-  FORM_ID           FormId;

-

-  OldValue                        = 0;

-  NewValue                        = 0;

-  Number                          = 0;

-  OldLegacyDev                    = NULL;

-  NewLegacyDev                    = NULL;

-  NewValuePos                     = 0;

-  DisMap                          = NULL;

-

-  Private                         = BMM_CALLBACK_DATA_FROM_THIS (This);

-  UpdateData->FormCallbackHandle  = (EFI_PHYSICAL_ADDRESS) (UINTN) Private->BmmCallbackHandle;

-  CurrentFakeNVMap                = (BMM_FAKE_NV_DATA *) Data->NvRamMap;

-  Private->BmmFakeNvData          = CurrentFakeNVMap;

-  Location                        = (UINT8 *) &UpdateData->Data;

-

-  UpdatePageId (Private, KeyValue);

-

-  //

-  // need to be subtituded.

-  //

-  // Update Select FD/HD/CD/NET/BEV Order Form

-  //

-  if (FORM_SET_FD_ORDER_ID == Private->BmmPreviousPageId ||

-      FORM_SET_HD_ORDER_ID == Private->BmmPreviousPageId ||

-      FORM_SET_CD_ORDER_ID == Private->BmmPreviousPageId ||

-      FORM_SET_NET_ORDER_ID == Private->BmmPreviousPageId ||

-      FORM_SET_BEV_ORDER_ID == Private->BmmPreviousPageId ||

-      ((FORM_BOOT_SETUP_ID == Private->BmmPreviousPageId) &&

-      (KeyValue >= LEGACY_FD_QUESTION_ID) &&

-       (KeyValue < (LEGACY_BEV_QUESTION_ID + 100)) )

-      ) {

-

-    DisMap  = Private->BmmOldFakeNVData.DisableMap;

-

-    FormId  = Private->BmmPreviousPageId;

-    if (FormId == FORM_BOOT_SETUP_ID) {

-      FormId = Private->BmmCurrentPageId;

-    }

-

-    switch (FormId) {

-    case FORM_SET_FD_ORDER_ID:

-      Number        = (UINT16) LegacyFDMenu.MenuNumber;

-      OldLegacyDev  = Private->BmmOldFakeNVData.LegacyFD;

-      NewLegacyDev  = CurrentFakeNVMap->LegacyFD;

-      break;

-

-    case FORM_SET_HD_ORDER_ID:

-      Number        = (UINT16) LegacyHDMenu.MenuNumber;

-      OldLegacyDev  = Private->BmmOldFakeNVData.LegacyHD;

-      NewLegacyDev  = CurrentFakeNVMap->LegacyHD;

-      break;

-

-    case FORM_SET_CD_ORDER_ID:

-      Number        = (UINT16) LegacyCDMenu.MenuNumber;

-      OldLegacyDev  = Private->BmmOldFakeNVData.LegacyCD;

-      NewLegacyDev  = CurrentFakeNVMap->LegacyCD;

-      break;

-

-    case FORM_SET_NET_ORDER_ID:

-      Number        = (UINT16) LegacyNETMenu.MenuNumber;

-      OldLegacyDev  = Private->BmmOldFakeNVData.LegacyNET;

-      NewLegacyDev  = CurrentFakeNVMap->LegacyNET;

-      break;

-

-    case FORM_SET_BEV_ORDER_ID:

-      Number        = (UINT16) LegacyBEVMenu.MenuNumber;

-      OldLegacyDev  = Private->BmmOldFakeNVData.LegacyBEV;

-      NewLegacyDev  = CurrentFakeNVMap->LegacyBEV;

-      break;

-

-    default:

-      break;

-    }

-    //

-    //  First, find the different position

-    //  if there is change, it should be only one

-    //

-    for (Index = 0; Index < Number; Index++) {

-      if (OldLegacyDev[Index] != NewLegacyDev[Index]) {

-        OldValue  = OldLegacyDev[Index];

-        NewValue  = NewLegacyDev[Index];

-        break;

-      }

-    }

-

-    if (Index != Number) {

-      //

-      // there is change, now process

-      //

-      if (0xFF == NewValue) {

-        //

-        // This item will be disable

-        // Just move the items behind this forward to overlap it

-        //

-        Pos = OldValue / 8;

-        Bit = 7 - (OldValue % 8);

-        DisMap[Pos] |= (UINT8) (1 << Bit);

-        for (Index2 = Index; Index2 < Number - 1; Index2++) {

-          NewLegacyDev[Index2] = NewLegacyDev[Index2 + 1];

-        }

-

-        NewLegacyDev[Index2] = 0xFF;

-      } else {

-        for (Index2 = 0; Index2 < Number; Index2++) {

-          if (Index2 == Index) {

-            continue;

-          }

-

-          if (OldLegacyDev[Index2] == NewValue) {

-            //

-            // If NewValue is in OldLegacyDev array

-            // remember its old position

-            //

-            NewValuePos = Index2;

-            break;

-          }

-        }

-

-        if (Index2 != Number) {

-          //

-          // We will change current item to an existing item

-          // (It's hard to describe here, please read code, it's like a cycle-moving)

-          //

-          for (Index2 = NewValuePos; Index2 != Index;) {

-            if (NewValuePos < Index) {

-              NewLegacyDev[Index2] = OldLegacyDev[Index2 + 1];

-              Index2++;

-            } else {

-              NewLegacyDev[Index2] = OldLegacyDev[Index2 - 1];

-              Index2--;

-            }

-          }

-        } else {

-          //

-          // If NewValue is not in OldlegacyDev array, we are changing to a disabled item

-          // so we should modify DisMap to reflect the change

-          //

-          Pos = NewValue / 8;

-          Bit = 7 - (NewValue % 8);

-          DisMap[Pos] &= ~ (UINT8) (1 << Bit);

-          if (0xFF != OldValue) {

-            //

-            // Because NewValue is a item that was disabled before

-            // so after changing the OldValue should be disabled

-            // actually we are doing a swap of enable-disable states of two items

-            //

-            Pos = OldValue / 8;

-            Bit = 7 - (OldValue % 8);

-            DisMap[Pos] |= (UINT8) (1 << Bit);

-          }

-        }

-      }

-      //

-      // To prevent DISABLE appears in the middle of the list

-      // we should perform a re-ordering

-      //

-      Index = 0;

-      while (Index < Number) {

-        if (0xFF != NewLegacyDev[Index]) {

-          Index++;

-          continue;

-        }

-

-        Index2 = Index;

-        Index2++;

-        while (Index2 < Number) {

-          if (0xFF != NewLegacyDev[Index2]) {

-            break;

-          }

-

-          Index2++;

-        }

-

-        if (Index2 < Number) {

-          NewLegacyDev[Index]   = NewLegacyDev[Index2];

-          NewLegacyDev[Index2]  = 0xFF;

-        }

-

-        Index++;

-      }

-

-      CopyMem (

-        OldLegacyDev,

-        NewLegacyDev,

-        Number

-        );

-    }

-  }

-

-  if (KeyValue < FILE_OPTION_OFFSET) {

-    if (KeyValue < NORMAL_GOTO_OFFSET) {

-      switch (KeyValue) {

-      case KEY_VALUE_BOOT_FROM_FILE:

-        Private->FeCurrentState = BOOT_FROM_FILE_STATE;

-

-        //

-        // Exit Bmm main formset to send File Explorer formset.

-        //

-        CreateCallbackPacket (Packet, EXIT_REQUIRED);

-

-        break;

-

-      case FORM_BOOT_ADD_ID:

-        Private->FeCurrentState = ADD_BOOT_OPTION_STATE;

-

-        //

-        // Exit Bmm main formset to send File Explorer formset.

-        //

-        CreateCallbackPacket (Packet, EXIT_REQUIRED);

-        break;

-

-      case FORM_DRV_ADD_FILE_ID:

-        Private->FeCurrentState = ADD_DRIVER_OPTION_STATE;

-

-        //

-        // Exit Bmm main formset to send File Explorer formset.

-        //

-        CreateCallbackPacket (Packet, EXIT_REQUIRED);

-

-        break;

-

-      case FORM_DRV_ADD_HANDLE_ID:

-        CleanUpPage (FORM_DRV_ADD_HANDLE_ID, Private);

-        UpdateDrvAddHandlePage (Private);

-        break;

-

-      case FORM_BOOT_DEL_ID:

-        CleanUpPage (FORM_BOOT_DEL_ID, Private);

-        UpdateBootDelPage (Private);

-        break;

-

-      case FORM_BOOT_CHG_ID:

-      case FORM_DRV_CHG_ID:

-        UpdatePageBody (KeyValue, Private);

-        break;

-

-      case FORM_DRV_DEL_ID:

-        CleanUpPage (FORM_DRV_DEL_ID, Private);

-        UpdateDrvDelPage (Private);

-        break;

-

-      case FORM_BOOT_NEXT_ID:

-        CleanUpPage (FORM_BOOT_NEXT_ID, Private);

-        UpdateBootNextPage (Private);

-        break;

-

-      case FORM_TIME_OUT_ID:

-        CleanUpPage (FORM_TIME_OUT_ID, Private);

-        UpdateTimeOutPage (Private);

-        break;

-

-      case FORM_RESET:

-        gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);

-        return EFI_UNSUPPORTED;

-

-      case FORM_CON_IN_ID:

-      case FORM_CON_OUT_ID:

-      case FORM_CON_ERR_ID:

-        UpdatePageBody (KeyValue, Private);

-        break;

-

-      case FORM_CON_COM_ID:

-        CleanUpPage (FORM_CON_COM_ID, Private);

-        UpdateConCOMPage (Private);

-        break;

-

-      case FORM_SET_FD_ORDER_ID:

-      case FORM_SET_HD_ORDER_ID:

-      case FORM_SET_CD_ORDER_ID:

-      case FORM_SET_NET_ORDER_ID:

-      case FORM_SET_BEV_ORDER_ID:

-        CleanUpPage (KeyValue, Private);

-        UpdateSetLegacyDeviceOrderPage (KeyValue, Private);

-        break;

-

-      case KEY_VALUE_SAVE_AND_EXIT:

-      case KEY_VALUE_NO_SAVE_AND_EXIT:

-

-        if (KeyValue == KEY_VALUE_SAVE_AND_EXIT) {

-          Status = ApplyChangeHandler (Private, CurrentFakeNVMap, Private->BmmPreviousPageId);

-          if (EFI_ERROR (Status)) {

-            return Status;

-          }

-        } else if (KeyValue == KEY_VALUE_NO_SAVE_AND_EXIT) {

-          DiscardChangeHandler (Private, CurrentFakeNVMap);

-        }

-        //

-        // Tell browser not to ask for confirmation of changes,

-        // since we have already applied or discarded.

-        //

-        CreateCallbackPacket (Packet, NV_NOT_CHANGED);

-        break;

-

-      default:

-        break;

-      }

-    } else if ((KeyValue >= TERMINAL_OPTION_OFFSET) && (KeyValue < CONSOLE_OPTION_OFFSET)) {

-      Index2                    = (UINT16) (KeyValue - TERMINAL_OPTION_OFFSET);

-      Private->CurrentTerminal  = Index2;

-

-      CleanUpPage (FORM_CON_COM_SETUP_ID, Private);

-      UpdateTerminalPage (Private);

-

-    } else if (KeyValue >= HANDLE_OPTION_OFFSET) {

-      Index2                  = (UINT16) (KeyValue - HANDLE_OPTION_OFFSET);

-

-      NewMenuEntry            = BOpt_GetMenuEntry (&DriverMenu, Index2);

-      ASSERT (NewMenuEntry != NULL);

-      Private->HandleContext  = (BM_HANDLE_CONTEXT *) NewMenuEntry->VariableContext;

-

-      CleanUpPage (FORM_DRV_ADD_HANDLE_DESC_ID, Private);

-

-      Private->MenuEntry                  = NewMenuEntry;

-      Private->LoadContext->FilePathList  = Private->HandleContext->DevicePath;

-

-      UpdateDriverAddHandleDescPage (Private);

-    }

-  }

-

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-ApplyChangeHandler (

-  IN  BMM_CALLBACK_DATA               *Private,

-  IN  BMM_FAKE_NV_DATA                *CurrentFakeNVMap,

-  IN  FORM_ID                         FormId

-  )

-/*++

-

-Routine Description:

-

-  Function handling request to apply changes for BMM pages.

-

-Arguments:

-

-  Private          - Pointer to callback data buffer.

-  CurrentFakeNVMap - Pointer to buffer holding data of various values used by BMM

-  FormId           - ID of the form which has sent the request to apply change.

-

-Returns:

-

-  EFI_SUCCESS      - Change successfully applied.

-  Other            - Error occurs while trying to apply changes.

-

---*/

-{

-  BM_CONSOLE_CONTEXT  *NewConsoleContext;

-  BM_TERMINAL_CONTEXT *NewTerminalContext;

-  BM_LOAD_CONTEXT     *NewLoadContext;

-  BM_MENU_ENTRY       *NewMenuEntry;

-  EFI_STATUS          Status;

-  UINT16              Index;

-

-  Status = EFI_SUCCESS;

-

-  switch (FormId) {

-  case FORM_SET_FD_ORDER_ID:

-  case FORM_SET_HD_ORDER_ID:

-  case FORM_SET_CD_ORDER_ID:

-  case FORM_SET_NET_ORDER_ID:

-  case FORM_SET_BEV_ORDER_ID:

-    Var_UpdateBBSOption (Private);

-    break;

-

-  case FORM_BOOT_DEL_ID:

-    for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {

-      NewMenuEntry            = BOpt_GetMenuEntry (&BootOptionMenu, Index);

-      NewLoadContext          = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;

-      NewLoadContext->Deleted = CurrentFakeNVMap->BootOptionDel[Index];

-    }

-

-    Var_DelBootOption ();

-    break;

-

-  case FORM_DRV_DEL_ID:

-    for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {

-      NewMenuEntry            = BOpt_GetMenuEntry (&DriverOptionMenu, Index);

-      NewLoadContext          = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;

-      NewLoadContext->Deleted = CurrentFakeNVMap->DriverOptionDel[Index];

-    }

-

-    Var_DelDriverOption ();

-    break;

-

-  case FORM_BOOT_CHG_ID:

-    Status = Var_UpdateBootOrder (Private);

-    break;

-

-  case FORM_DRV_CHG_ID:

-    Status = Var_UpdateDriverOrder (Private);

-    break;

-

-  case FORM_TIME_OUT_ID:

-    Status = gRT->SetVariable (

-                    L"Timeout",

-                    &gEfiGlobalVariableGuid,

-                    VAR_FLAG,

-                    sizeof (UINT16),

-                    &(CurrentFakeNVMap->BootTimeOut)

-                    );

-    if (EFI_ERROR (Status)) {

-      goto Error;

-    }

-

-    Private->BmmOldFakeNVData.BootTimeOut = CurrentFakeNVMap->BootTimeOut;

-    break;

-

-  case FORM_BOOT_NEXT_ID:

-    Status = Var_UpdateBootNext (Private);

-    break;

-

-  case FORM_CON_COM_ID:

-    NewMenuEntry                      = BOpt_GetMenuEntry (&TerminalMenu, Private->CurrentTerminal);

-

-    ASSERT (NewMenuEntry != NULL);

-

-    NewTerminalContext                = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;

-

-    NewTerminalContext->BaudRateIndex = CurrentFakeNVMap->COMBaudRate;

-    NewTerminalContext->BaudRate      = BaudRateList[CurrentFakeNVMap->COMBaudRate].Value;

-    NewTerminalContext->DataBitsIndex = CurrentFakeNVMap->COMDataRate;

-    NewTerminalContext->DataBits      = (UINT8) DataBitsList[CurrentFakeNVMap->COMDataRate].Value;

-    NewTerminalContext->StopBitsIndex = CurrentFakeNVMap->COMStopBits;

-    NewTerminalContext->StopBits      = (UINT8) StopBitsList[CurrentFakeNVMap->COMStopBits].Value;

-    NewTerminalContext->ParityIndex   = CurrentFakeNVMap->COMParity;

-    NewTerminalContext->Parity        = (UINT8) ParityList[CurrentFakeNVMap->COMParity].Value;

-    NewTerminalContext->TerminalType  = CurrentFakeNVMap->COMTerminalType;

-

-    ChangeTerminalDevicePath (

-      NewTerminalContext->DevicePath,

-      FALSE

-      );

-

-    Var_UpdateConsoleInpOption ();

-    Var_UpdateConsoleOutOption ();

-    Var_UpdateErrorOutOption ();

-    break;

-

-  case FORM_CON_IN_ID:

-    for (Index = 0; Index < ConsoleInpMenu.MenuNumber; Index++) {

-      NewMenuEntry                = BOpt_GetMenuEntry (&ConsoleInpMenu, Index);

-      NewConsoleContext           = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;

-      NewConsoleContext->IsActive = CurrentFakeNVMap->ConsoleCheck[Index];

-    }

-

-    for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {

-      NewMenuEntry                = BOpt_GetMenuEntry (&TerminalMenu, Index);

-      NewTerminalContext          = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;

-      NewTerminalContext->IsConIn = CurrentFakeNVMap->ConsoleCheck[Index + ConsoleInpMenu.MenuNumber];

-    }

-

-    Var_UpdateConsoleInpOption ();

-    break;

-

-  case FORM_CON_OUT_ID:

-    for (Index = 0; Index < ConsoleOutMenu.MenuNumber; Index++) {

-      NewMenuEntry                = BOpt_GetMenuEntry (&ConsoleOutMenu, Index);

-      NewConsoleContext           = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;

-      NewConsoleContext->IsActive = CurrentFakeNVMap->ConsoleCheck[Index];

-    }

-

-    for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {

-      NewMenuEntry                  = BOpt_GetMenuEntry (&TerminalMenu, Index);

-      NewTerminalContext            = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;

-      NewTerminalContext->IsConOut  = CurrentFakeNVMap->ConsoleCheck[Index + ConsoleOutMenu.MenuNumber];

-    }

-

-    Var_UpdateConsoleOutOption ();

-    break;

-

-  case FORM_CON_ERR_ID:

-    for (Index = 0; Index < ConsoleErrMenu.MenuNumber; Index++) {

-      NewMenuEntry                = BOpt_GetMenuEntry (&ConsoleErrMenu, Index);

-      NewConsoleContext           = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;

-      NewConsoleContext->IsActive = CurrentFakeNVMap->ConsoleCheck[Index];

-    }

-

-    for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {

-      NewMenuEntry                  = BOpt_GetMenuEntry (&TerminalMenu, Index);

-      NewTerminalContext            = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;

-      NewTerminalContext->IsStdErr  = CurrentFakeNVMap->ConsoleCheck[Index + ConsoleErrMenu.MenuNumber];

-    }

-

-    Var_UpdateErrorOutOption ();

-    break;

-

-  case FORM_DRV_ADD_HANDLE_DESC_ID:

-    Status = Var_UpdateDriverOption (

-               Private,

-               Private->BmmHiiHandle,

-               CurrentFakeNVMap->DriverAddHandleDesc,

-               CurrentFakeNVMap->DriverAddHandleOptionalData,

-               CurrentFakeNVMap->DriverAddForceReconnect

-               );

-    if (EFI_ERROR (Status)) {

-      goto Error;

-    }

-

-    BOpt_GetDriverOptions (Private);

-    CreateMenuStringToken (Private, Private->BmmHiiHandle, &DriverOptionMenu);

-    break;

-

-  default:

-    break;

-  }

-

-Error:

-  return Status;

-}

-

-VOID

-DiscardChangeHandler (

-  IN  BMM_CALLBACK_DATA               *Private,

-  IN  BMM_FAKE_NV_DATA                *CurrentFakeNVMap

-  )

-{

-  UINT16  Index;

-

-  switch (Private->BmmPreviousPageId) {

-  case FORM_BOOT_CHG_ID:

-  case FORM_DRV_CHG_ID:

-    CopyMem (CurrentFakeNVMap->OptionOrder, Private->BmmOldFakeNVData.OptionOrder, 100);

-    break;

-

-  case FORM_BOOT_DEL_ID:

-    for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {

-      CurrentFakeNVMap->BootOptionDel[Index] = 0x00;

-    }

-    break;

-

-  case FORM_DRV_DEL_ID:

-    for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {

-      CurrentFakeNVMap->DriverOptionDel[Index] = 0x00;

-    }

-    break;

-

-  case FORM_BOOT_NEXT_ID:

-    CurrentFakeNVMap->BootNext = Private->BmmOldFakeNVData.BootNext;

-    break;

-

-  case FORM_TIME_OUT_ID:

-    CurrentFakeNVMap->BootTimeOut = Private->BmmOldFakeNVData.BootTimeOut;

-    break;

-

-  case FORM_DRV_ADD_HANDLE_DESC_ID:

-  case FORM_DRV_ADD_FILE_ID:

-  case FORM_DRV_ADD_HANDLE_ID:

-    CurrentFakeNVMap->DriverAddHandleDesc[0]          = 0x0000;

-    CurrentFakeNVMap->DriverAddHandleOptionalData[0]  = 0x0000;

-    break;

-

-  default:

-    break;

-  }

-}

-

-EFI_STATUS

-EFIAPI

-NvWrite (

-  IN     EFI_FORM_CALLBACK_PROTOCOL              *This,

-  IN     CHAR16                                  *VariableName,

-  IN     EFI_GUID                                *VendorGuid,

-  OUT    UINT32                                  Attributes OPTIONAL,

-  IN OUT UINTN                                   DataSize,

-  OUT    VOID                                    *Buffer,

-  OUT    BOOLEAN                                 *ResetRequired

-  )

-{

-  //

-  // Do nothing here. Just to catch the F10, we use "Apply Changes" tag to save.

-  //

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-InitializeBM (

-  VOID

-  )

-/*++

-Routine Description:

-

-  Initialize the Boot Maintenance Utitliy

-

-Arguments:

-

-  ImageHandle     - caller provided handle

-

-  SystemTable     - caller provided system tables

-

-Returns:

-

-  EFI_SUCCESS     - utility ended successfully

-

-  others          - contain some errors

-

---*/

-{

-  EFI_LEGACY_BIOS_PROTOCOL  *LegacyBios;

-  EFI_HII_PACKAGES          *PackageList;

-  BMM_CALLBACK_DATA         *BmmCallbackInfo;

-  EFI_HII_PROTOCOL          *Hii;

-  EFI_HII_HANDLE            HiiHandle;

-  EFI_STATUS                Status;

-  EFI_HANDLE                Handle;

-  UINT8                     *Ptr;

-  UINT8                     *Location;

-

-  Status      = EFI_SUCCESS;

-  UpdateData  = NULL;

-  //

-  // Initialize EfiUtilityLib and EfiDriverLib

-  // Since many functions in UtilityLib must be used and

-  // SetupBrowser use DriverLib

-  //

-  //

-  // There should be only one EFI_HII_PROTOCOL Image

-  //

-  Status = EfiLibLocateProtocol (&gEfiHiiProtocolGuid, &Hii);

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-  //

-  // Create CallbackData structures for Driver Callback

-  //

-  BmmCallbackInfo = AllocateZeroPool (sizeof (BMM_CALLBACK_DATA));

-  if (!BmmCallbackInfo) {

-    return EFI_OUT_OF_RESOURCES;

-  }

-  //

-  // Create LoadOption in BmmCallbackInfo for Driver Callback

-  //

-  Ptr = AllocateZeroPool (sizeof (BM_LOAD_CONTEXT) + sizeof (BM_FILE_CONTEXT) + sizeof (BM_HANDLE_CONTEXT) + sizeof (BM_MENU_ENTRY));

-  if (!Ptr) {

-    SafeFreePool (BmmCallbackInfo);

-    return EFI_OUT_OF_RESOURCES;

-  }

-  //

-  // Initialize Bmm callback data.

-  //

-  BmmCallbackInfo->LoadContext = (BM_LOAD_CONTEXT *) Ptr;

-  Ptr += sizeof (BM_LOAD_CONTEXT);

-

-  BmmCallbackInfo->FileContext = (BM_FILE_CONTEXT *) Ptr;

-  Ptr += sizeof (BM_FILE_CONTEXT);

-

-  BmmCallbackInfo->HandleContext = (BM_HANDLE_CONTEXT *) Ptr;

-  Ptr += sizeof (BM_HANDLE_CONTEXT);

-

-  BmmCallbackInfo->MenuEntry      = (BM_MENU_ENTRY *) Ptr;

-

-  BmmCallbackInfo->BmmFakeNvData  = &BmmCallbackInfo->BmmOldFakeNVData;

-

-  ZeroMem (BmmCallbackInfo->BmmFakeNvData, sizeof (BMM_FAKE_NV_DATA));

-

-  BmmCallbackInfo->Signature                  = BMM_CALLBACK_DATA_SIGNATURE;

-  BmmCallbackInfo->Hii                        = Hii;

-  BmmCallbackInfo->BmmDriverCallback.NvRead   = NULL;

-  BmmCallbackInfo->BmmDriverCallback.NvWrite  = NvWrite;

-  BmmCallbackInfo->BmmDriverCallback.Callback = DriverCallback;

-  BmmCallbackInfo->BmmPreviousPageId          = FORM_MAIN_ID;

-  BmmCallbackInfo->BmmCurrentPageId           = FORM_MAIN_ID;

-  BmmCallbackInfo->FeDriverCallback.NvRead    = NULL;

-  BmmCallbackInfo->FeDriverCallback.NvWrite   = NvWrite;

-  BmmCallbackInfo->FeDriverCallback.Callback  = FileExplorerCallback;

-  BmmCallbackInfo->FeCurrentState             = INACTIVE_STATE;

-  BmmCallbackInfo->FeDisplayContext           = UNKNOWN_CONTEXT;

-

-  //

-  // Install bmm callback protocol interface

-  //

-  Handle = NULL;

-  Status = gBS->InstallProtocolInterface (

-                  &Handle,

-                  &gEfiFormCallbackProtocolGuid,

-                  EFI_NATIVE_INTERFACE,

-                  &BmmCallbackInfo->BmmDriverCallback

-                  );

-

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  BmmCallbackInfo->BmmCallbackHandle = Handle;

-

-  //

-  // Install file explorer callback protocol interface

-  //

-  Handle = NULL;

-  Status = gBS->InstallProtocolInterface (

-                  &Handle,

-                  &gEfiFormCallbackProtocolGuid,

-                  EFI_NATIVE_INTERFACE,

-                  &BmmCallbackInfo->FeDriverCallback

-                  );

-

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  BmmCallbackInfo->FeCallbackHandle = Handle;

-

-  //

-  // Post our VFR to the HII database.

-  //

-  PackageList = PreparePackages (1, &gBdsStringPackGuid, bmBin);

-  Status      = Hii->NewPack (Hii, PackageList, &HiiHandle);

-  FreePool (PackageList);

-

-  BmmCallbackInfo->BmmHiiHandle = HiiHandle;

-

-  PackageList                   = PreparePackages (1, &gBdsStringPackGuid, FEBin);

-  Status                        = Hii->NewPack (Hii, PackageList, &HiiHandle);

-  FreePool (PackageList);

-

-  BmmCallbackInfo->FeHiiHandle = HiiHandle;

-

-  //

-  // Allocate space for creation of Buffer

-  //

-  UpdateData = AllocateZeroPool (UPDATE_DATA_SIZE);

-  if (!UpdateData) {

-    SafeFreePool (BmmCallbackInfo->LoadContext);

-    SafeFreePool (BmmCallbackInfo);

-    return EFI_OUT_OF_RESOURCES;

-  }

-  //

-  // Initialize UpdateData structure

-  //

-  RefreshUpdateData (TRUE, (EFI_PHYSICAL_ADDRESS) (UINTN) BmmCallbackInfo->BmmCallbackHandle, FALSE, 0, 0);

-

-  Location = (UINT8 *) &UpdateData->Data;

-

-  InitializeStringDepository ();

-

-  InitAllMenu (BmmCallbackInfo);

-

-  CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &ConsoleInpMenu);

-  CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &ConsoleOutMenu);

-  CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &ConsoleErrMenu);

-  CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &BootOptionMenu);

-  CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &DriverOptionMenu);

-  CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &TerminalMenu);

-  CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &DriverMenu);

-

-  UpdateBootDelPage (BmmCallbackInfo);

-  UpdateDrvDelPage (BmmCallbackInfo);

-

-  if (TerminalMenu.MenuNumber > 0) {

-    BmmCallbackInfo->CurrentTerminal = 0;

-    UpdateTerminalPage (BmmCallbackInfo);

-  }

-

-  Location  = (UINT8 *) &UpdateData->Data;

-  Status    = EfiLibLocateProtocol (&gEfiLegacyBiosProtocolGuid, &LegacyBios);

-  if (!EFI_ERROR (Status)) {

-    //

-    // If LegacyBios Protocol is installed, add 3 tags about legacy boot option

-    // in BootOption form: legacy FD/HD/CD/NET/BEV

-    //

-    UpdateData->DataCount = 5;

-    CreateGotoOpCode (

-      FORM_SET_FD_ORDER_ID,

-      STRING_TOKEN (STR_FORM_SET_FD_ORDER_TITLE),

-      STRING_TOKEN (STR_FORM_SET_FD_ORDER_TITLE),

-      EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,

-      FORM_SET_FD_ORDER_ID,

-      Location

-      );

-

-    Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-

-    CreateGotoOpCode (

-      FORM_SET_HD_ORDER_ID,

-      STRING_TOKEN (STR_FORM_SET_HD_ORDER_TITLE),

-      STRING_TOKEN (STR_FORM_SET_HD_ORDER_TITLE),

-      EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,

-      FORM_SET_HD_ORDER_ID,

-      Location

-      );

-

-    Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-

-    CreateGotoOpCode (

-      FORM_SET_CD_ORDER_ID,

-      STRING_TOKEN (STR_FORM_SET_CD_ORDER_TITLE),

-      STRING_TOKEN (STR_FORM_SET_CD_ORDER_TITLE),

-      EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,

-      FORM_SET_CD_ORDER_ID,

-      Location

-      );

-

-    Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-

-    CreateGotoOpCode (

-      FORM_SET_NET_ORDER_ID,

-      STRING_TOKEN (STR_FORM_SET_NET_ORDER_TITLE),

-      STRING_TOKEN (STR_FORM_SET_NET_ORDER_TITLE),

-      EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,

-      FORM_SET_NET_ORDER_ID,

-      Location

-      );

-

-    Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-

-    CreateGotoOpCode (

-      FORM_SET_BEV_ORDER_ID,

-      STRING_TOKEN (STR_FORM_SET_BEV_ORDER_TITLE),

-      STRING_TOKEN (STR_FORM_SET_BEV_ORDER_TITLE),

-      EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,

-      FORM_SET_BEV_ORDER_ID,

-      Location

-      );

-

-    Hii->UpdateForm (

-          Hii,

-          BmmCallbackInfo->BmmHiiHandle,

-          (EFI_FORM_LABEL) FORM_BOOT_LEGACY_DEVICE_ID,

-          TRUE,

-          UpdateData

-          );

-  }

-  //

-  // Dispatch BMM main formset and File Explorer formset.

-  //

-  FormSetDispatcher (BmmCallbackInfo);

-

-  Hii->ResetStrings (Hii, HiiHandle);

-

-  CleanUpStringDepository ();

-

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  FreeAllMenu ();

-

-  SafeFreePool (BmmCallbackInfo->LoadContext);

-  BmmCallbackInfo->LoadContext = NULL;

-  SafeFreePool (BmmCallbackInfo);

-  BmmCallbackInfo = NULL;

-  SafeFreePool (UpdateData);

-  UpdateData = NULL;

-

-  return Status;

-}

-

-VOID

-InitAllMenu (

-  IN  BMM_CALLBACK_DATA    *CallbackData

-  )

-{

-  InitializeListHead (&BootOptionMenu.Head);

-  InitializeListHead (&DriverOptionMenu.Head);

-  BOpt_GetBootOptions (CallbackData);

-  BOpt_GetDriverOptions (CallbackData);

-  BOpt_GetLegacyOptions ();

-  InitializeListHead (&FsOptionMenu.Head);

-  BOpt_FindDrivers ();

-  InitializeListHead (&DirectoryMenu.Head);

-  InitializeListHead (&ConsoleInpMenu.Head);

-  InitializeListHead (&ConsoleOutMenu.Head);

-  InitializeListHead (&ConsoleErrMenu.Head);

-  InitializeListHead (&TerminalMenu.Head);

-  LocateSerialIo ();

-  GetAllConsoles ();

-}

-

-VOID

-FreeAllMenu (

-  VOID

-  )

-{

-  BOpt_FreeMenu (&DirectoryMenu);

-  BOpt_FreeMenu (&FsOptionMenu);

-  BOpt_FreeMenu (&BootOptionMenu);

-  BOpt_FreeMenu (&DriverOptionMenu);

-  BOpt_FreeMenu (&DriverMenu);

-  BOpt_FreeLegacyOptions ();

-  FreeAllConsoles ();

-}

-

-VOID

-InitializeStringDepository (

-  VOID

-  )

-/*++

-Routine Description:

-  Intialize all the string depositories.

-

-Arguments:

-  None.

-

-Returns:

-  None.

---*/

-{

-  STRING_DEPOSITORY *StringDepository;

-  StringDepository              = AllocateZeroPool (sizeof (STRING_DEPOSITORY) * STRING_DEPOSITORY_NUMBER);

-  FileOptionStrDepository       = StringDepository++;

-  ConsoleOptionStrDepository    = StringDepository++;

-  BootOptionStrDepository       = StringDepository++;

-  BootOptionHelpStrDepository   = StringDepository++;

-  DriverOptionStrDepository     = StringDepository++;

-  DriverOptionHelpStrDepository = StringDepository++;

-  TerminalStrDepository         = StringDepository;

-}

-

-STRING_REF

-GetStringTokenFromDepository (

-  IN   BMM_CALLBACK_DATA     *CallbackData,

-  IN   STRING_DEPOSITORY     *StringDepository

-  )

-/*++

-Routine Description:

-  Fetch a usable string node from the string depository and return the string token.

-

-Arguments:

-  StringDepository       - Pointer of the string depository.

-

-Returns:

-  STRING_REF             - String token.

---*/

-{

-  STRING_LIST_NODE  *CurrentListNode;

-  STRING_LIST_NODE  *NextListNode;

-

-  CurrentListNode = StringDepository->CurrentNode;

-

-  if ((NULL != CurrentListNode) && (NULL != CurrentListNode->Next)) {

-    //

-    // Fetch one reclaimed node from the list.

-    //

-    NextListNode = StringDepository->CurrentNode->Next;

-  } else {

-    //

-    // If there is no usable node in the list, update the list.

-    //

-    NextListNode = AllocateZeroPool (sizeof (STRING_LIST_NODE));

-

-    CallbackData->Hii->NewString (

-                        CallbackData->Hii,

-                        NULL,

-                        CallbackData->BmmHiiHandle,

-                        &(NextListNode->StringToken),

-                        L" "

-                        );

-

-    ASSERT (NextListNode->StringToken != 0);

-

-    StringDepository->TotalNodeNumber++;

-

-    if (NULL == CurrentListNode) {

-      StringDepository->ListHead = NextListNode;

-    } else {

-      CurrentListNode->Next = NextListNode;

-    }

-  }

-

-  StringDepository->CurrentNode = NextListNode;

-

-  return StringDepository->CurrentNode->StringToken;

-}

-

-VOID

-ReclaimStringDepository (

-  VOID

-  )

-/*++

-Routine Description:

-  Reclaim string depositories by moving the current node pointer to list head..

-

-Arguments:

-  None.

-

-Returns:

-  None.

---*/

-{

-  UINTN             DepositoryIndex;

-  STRING_DEPOSITORY *StringDepository;

-

-  StringDepository = FileOptionStrDepository;

-  for (DepositoryIndex = 0; DepositoryIndex < STRING_DEPOSITORY_NUMBER; DepositoryIndex++) {

-    StringDepository->CurrentNode = StringDepository->ListHead;

-    StringDepository++;

-  }

-}

-

-VOID

-CleanUpStringDepository (

-  VOID

-  )

-/*++

-Routine Description:

-  Release resource for all the string depositories.

-

-Arguments:

-  None.

-

-Returns:

-  None.

---*/

-{

-  UINTN             NodeIndex;

-  UINTN             DepositoryIndex;

-  STRING_LIST_NODE  *CurrentListNode;

-  STRING_LIST_NODE  *NextListNode;

-  STRING_DEPOSITORY *StringDepository;

-

-  //

-  // Release string list nodes.

-  //

-  StringDepository = FileOptionStrDepository;

-  for (DepositoryIndex = 0; DepositoryIndex < STRING_DEPOSITORY_NUMBER; DepositoryIndex++) {

-    CurrentListNode = StringDepository->ListHead;

-    for (NodeIndex = 0; NodeIndex < StringDepository->TotalNodeNumber; NodeIndex++) {

-      NextListNode = CurrentListNode->Next;

-      SafeFreePool (CurrentListNode);

-      CurrentListNode = NextListNode;

-    }

-

-    StringDepository++;

-  }

-  //

-  // Release string depository.

-  //

-  SafeFreePool (FileOptionStrDepository);

-}

-

-EFI_STATUS

-BdsStartBootMaint (

-  VOID

-  )

-/*++

-

-Routine Description:

-  Start boot maintenance manager

-

-Arguments:

-

-Returns:

-

---*/

-{

-  EFI_STATUS  Status;

-  LIST_ENTRY  BdsBootOptionList;

-

-  InitializeListHead (&BdsBootOptionList);

-

-  //

-  // Connect all prior to entering the platform setup menu.

-  //

-  if (!gConnectAllHappened) {

-    BdsLibConnectAllDriversToAllControllers ();

-    gConnectAllHappened = TRUE;

-  }

-  //

-  // Have chance to enumerate boot device

-  //

-  BdsLibEnumerateAllBootOption (&BdsBootOptionList);

-

-  //

-  // Init the BMM

-  //

-  Status = InitializeBM ();

-

-  return Status;

-}

-

-EFI_STATUS

-FormSetDispatcher (

-  IN  BMM_CALLBACK_DATA    *CallbackData

-  )

-/*++

-

-Routine Description:

-  Dispatch BMM formset and FileExplorer formset.

-

-Arguments:

-

-Returns:

-

---*/

-{

-  EFI_FORM_BROWSER_PROTOCOL *FormConfig;

-  UINT8                     *Location;

-  EFI_STATUS                Status;

-  UINTN                     Index;

-  BM_MENU_ENTRY             *NewMenuEntry;

-  BM_FILE_CONTEXT           *NewFileContext;

-  BOOLEAN	                 BootMaintMenuResetRequired;

-

-  Location        = NULL;

-  Index           = 0;

-  NewMenuEntry    = NULL;

-  NewFileContext  = NULL;

-

-  //

-  // There should only be one Form Configuration protocol

-  //

-  Status = EfiLibLocateProtocol (&gEfiFormBrowserProtocolGuid, &FormConfig);

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  while (1) {

-    UpdatePageId (CallbackData, FORM_MAIN_ID);

-

-    BootMaintMenuResetRequired = FALSE;

-    Status = FormConfig->SendForm (

-                          FormConfig,

-                          TRUE,

-                          &(CallbackData->BmmHiiHandle),

-                          1,

-                          NULL,

-                          NULL,

-                          (UINT8 *) CallbackData->BmmFakeNvData,

-                          NULL,

-                          &BootMaintMenuResetRequired

-                          );

-

-    if (BootMaintMenuResetRequired) {

-      EnableResetRequired ();

-    }

-

-    ReclaimStringDepository ();

-

-    //

-    // When this Formset returns, check if we are going to explore files.

-    //

-    if (INACTIVE_STATE != CallbackData->FeCurrentState) {

-      UpdateFileExplorer (CallbackData, 0);

-

-      BootMaintMenuResetRequired = FALSE;

-      Status = FormConfig->SendForm (

-                            FormConfig,

-                            TRUE,

-                            &(CallbackData->FeHiiHandle),

-                            1,

-                            NULL,

-                            NULL,

-                            NULL,

-                            NULL,

-                            &BootMaintMenuResetRequired

-                            );

-

-      if (BootMaintMenuResetRequired) {

-        EnableResetRequired ();

-      }

-

-      CallbackData->FeCurrentState    = INACTIVE_STATE;

-      CallbackData->FeDisplayContext  = UNKNOWN_CONTEXT;

-      ReclaimStringDepository ();

-    } else {

-      break;

-    }

-  }

-

-  return Status;

-}

-

-VOID

-CreateCallbackPacket (

-  OUT EFI_HII_CALLBACK_PACKET         **Packet,

-  IN  UINT16                          Flags

-  )

-{

-  *Packet = (EFI_HII_CALLBACK_PACKET *) AllocateZeroPool (sizeof (EFI_HII_CALLBACK_PACKET) + 2);

-  ASSERT (*Packet != NULL);

-

-  (*Packet)->DataArray.EntryCount   = 1;

-  (*Packet)->DataArray.NvRamMap     = NULL;

-  ((EFI_IFR_DATA_ENTRY *) (&((*Packet)->DataArray) + 1))->Flags  = Flags;

-}

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootMaint.h b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootMaint.h
deleted file mode 100644
index 13fd281..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootMaint.h
+++ /dev/null
@@ -1,1159 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  BootMaint.h

-

-Abstract:

-

-Revision History

-

---*/

-

-#ifndef _BOOT_MAINT_H

-#define _BOOT_MAINT_H

-

-#include "BdsStrDefs.h"

-#include "Generic/BootMaint/BBSsupport.h"

-

-//

-// Constants which are variable names used to access variables

-//

-#define VarLegacyDevOrder L"LegacyDevOrder"

-

-//

-// Guid of a NV Variable which store the information about the

-// FD/HD/CD/NET/BEV order

-//

-#define EFI_LEGACY_DEV_ORDER_VARIABLE_GUID \

-  { \

-    0xa56074db, 0x65fe, 0x45f7, {0xbd, 0x21, 0x2d, 0x2b, 0xdd, 0x8e, 0x96, 0x52 } \

-  }

-

-//

-// String Contant

-//

-#define StrFloppy       L"Floppy Drive #%02x"

-#define StrHardDisk     L"HardDisk Drive #%02x"

-#define StrCDROM        L"ATAPI CDROM Drive #%02x"

-#define StrNET          L"NET Drive #%02x"

-#define StrBEV          L"BEV Drive #%02x"

-#define StrFloppyHelp   L"Select Floppy Drive #%02x"

-#define StrHardDiskHelp L"Select HardDisk Drive #%02x"

-#define StrCDROMHelp    L"Select ATAPI CDROM Drive #%02x"

-#define StrNETHelp      L"NET Drive #%02x"

-#define StrBEVHelp      L"BEV Drive #%02x"

-

-//

-// Constant will be used in display and file system navigation

-//

-#define UPDATE_DATA_SIZE        0x100000

-#define MAX_BBS_OFFSET          0xE000

-#define NET_OPTION_OFFSET       0xD800

-#define BEV_OPTION_OFFSET       0xD000

-#define FD_OPTION_OFFSET        0xC000

-#define HD_OPTION_OFFSET        0xB000

-#define CD_OPTION_OFFSET        0xA000

-#define FILE_OPTION_OFFSET      0x8000

-#define FILE_OPTION_MASK        0x7FFF

-#define HANDLE_OPTION_OFFSET    0x7000

-#define CONSOLE_OPTION_OFFSET   0x0A00

-#define TERMINAL_OPTION_OFFSET  0x0700

-#define NORMAL_GOTO_OFFSET      0x0100

-#define MAX_STRING_TOKEN_COUNT  0x00FF

-//

-// Variable created with this flag will be "Efi:...."

-//

-#define VAR_FLAG  EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE

-

-//

-// Define Maxmim characters that will be accepted

-//

-#define MAX_CHAR      480

-#define MAX_CHAR_SIZE (MAX_CHAR * 2)

-

-//

-// Check to see if current build support option active feature of

-// some driver option

-//

-#define LOAD_OPTION_ACTIVE  0x00000001

-

-//

-// Check to see if current build support force reconnect feature of

-// some driver option

-//

-#define LOAD_OPTION_FORCE_RECONNECT 0x00000002

-

-//

-// Below are the form ids for display, form id is used as callback key value,

-// some key value definitions are also defined here. By defining this enum type,

-// We can easy know where we are. The int to UINT16 convertion should be ok because

-// there is a MAXIMUM_FORM_ID which in within the range of UINT16.

-//

-typedef enum {

-  IplRelative,

-  BcvRelative

-} BBS_TYPE;

-

-typedef enum {

-  FORM_RESERVED_ID                    = 0,

-  FORM_MAIN_ID,                         // 0x0001

-  FORM_BOOT_ADD_ID,                     // 0x0002

-  FORM_BOOT_DEL_ID,                     // 0x0003

-  FORM_BOOT_CHG_ID,                     // 0x0004

-  FORM_DRV_ADD_ID,                      // 0x0005

-  FORM_DRV_DEL_ID,                      // 0x0006

-  FORM_DRV_CHG_ID,                      // 0x0007

-  FORM_CON_MAIN_ID,                     // 0x0008

-  FORM_CON_IN_ID,                       // 0x0009

-  FORM_CON_OUT_ID,                      // 0x000A

-  FORM_CON_ERR_ID,                      // 0x000B

-  FORM_FILE_SEEK_ID,                    // 0x000C

-  FORM_FILE_NEW_SEEK_ID,                // 0x000D

-  FORM_DRV_ADD_FILE_ID,                 // 0x000E

-  FORM_DRV_ADD_HANDLE_ID,               // 0x000F

-  FORM_DRV_ADD_HANDLE_DESC_ID,          // 0x0010

-  FORM_BOOT_NEXT_ID,                    // 0x0011

-  FORM_TIME_OUT_ID,                     // 0x0012

-  FORM_RESET,                           // 0x0013

-  FORM_BOOT_SETUP_ID,                   // 0x0014

-  FORM_DRIVER_SETUP_ID,                 // 0x0015

-  FORM_BOOT_LEGACY_DEVICE_ID,           // 0x0016

-  FORM_CON_COM_ID,                      // 0x0017

-  FORM_CON_COM_SETUP_ID,                // 0x0018

-  FORM_SET_FD_ORDER_ID,                 // 0x0019

-  FORM_SET_HD_ORDER_ID,                 // 0x001A

-  FORM_SET_CD_ORDER_ID,                 // 0x001B

-  FORM_SET_NET_ORDER_ID,                // 0x001C

-  FORM_SET_BEV_ORDER_ID,                // 0x001D

-  FORM_FILE_EXPLORER_ID,                // 0x001E

-  FORM_BOOT_ADD_DESCRIPTION_ID,         // 0x001F

-  FORM_DRIVER_ADD_FILE_DESCRIPTION_ID,  // 0x0020

-} FORM_ID;

-

-#define MAXIMUM_FORM_ID                 0x007F

-

-#define KEY_VALUE_COM_SET_BAUD_RATE     0x0080

-#define KEY_VALUE_COM_SET_DATA_BITS     0x0081

-#define KEY_VALUE_COM_SET_STOP_BITS     0x0082

-#define KEY_VALUE_COM_SET_PARITY        0x0083

-#define KEY_VALUE_COM_SET_TERMI_TYPE    0x0084

-#define KEY_VALUE_MAIN_BOOT_NEXT        0x0085

-#define KEY_VALUE_BOOT_ADD_DESC_DATA    0x0086

-#define KEY_VALUE_BOOT_ADD_OPT_DATA     0x0087

-#define KEY_VALUE_DRIVER_ADD_DESC_DATA  0x0088

-#define KEY_VALUE_DRIVER_ADD_OPT_DATA   0x0089

-#define KEY_VALUE_SAVE_AND_EXIT         0x0090

-#define KEY_VALUE_NO_SAVE_AND_EXIT      0x0091

-#define KEY_VALUE_BOOT_FROM_FILE        0x0092

-

-#define MAXIMUM_NORMAL_KEY_VALUE        NORMAL_GOTO_OFFSET

-//

-// Below are the number of options in Baudrate, Databits,

-// Parity and Stopbits selection for serial ports.

-//

-#define BM_COM_ATTR_BUADRATE  19

-#define BM_COM_ATTR_DATABITS  4

-#define BM_COM_ATTR_PARITY    5

-#define BM_COM_ATTR_STOPBITS  3

-

-//

-// Callback function helper

-//

-#define BMM_CALLBACK_DATA_SIGNATURE     EFI_SIGNATURE_32 ('C', 'b', 'c', 'k')

-#define BMM_CALLBACK_DATA_FROM_THIS(a)  CR (a, BMM_CALLBACK_DATA, BmmDriverCallback, BMM_CALLBACK_DATA_SIGNATURE)

-

-#define FE_CALLBACK_DATA_FROM_THIS(a)   CR (a, BMM_CALLBACK_DATA, FeDriverCallback, BMM_CALLBACK_DATA_SIGNATURE)

-

-//

-// Enumeration type definition

-//

-typedef enum {

-  PC_ANSI                             = 0,

-  VT_100,

-  VT_100_PLUS,

-  VT_UTF8

-} TYPE_OF_TERMINAL;

-

-typedef enum {

-  COM1                                = 0,

-  COM2,

-  UNKNOW_COM

-} TYPE_OF_COM;

-

-typedef enum {

-  CONIN                               = 0,

-  CONOUT,

-  CONERR,

-  UNKNOWN_CON

-} TYPE_OF_CON;

-

-typedef enum {

-  BAUDRATE                            = 0,

-  DATABITS,

-  PARITY,

-  STOPBITS,

-  UNKNOW_ATTR

-} TYPE_OF_ATTRIBUTE;

-

-typedef enum {

-  MANNER_GOTO                         = 0,

-  MANNER_CHECK,

-  MANNER_ONEOF,

-  MANNER_USER_DEFINE

-} TYPE_OF_UPATE_MANNER;

-

-typedef enum {

-  INACTIVE_STATE                      = 0,

-  BOOT_FROM_FILE_STATE,

-  ADD_BOOT_OPTION_STATE,

-  ADD_DRIVER_OPTION_STATE,

-  UNKNOWN_STATE

-} FILE_EXPLORER_STATE;

-

-typedef enum {

-  FILE_SYSTEM,

-  DIRECTORY,

-  UNKNOWN_CONTEXT

-} FILE_EXPLORER_DISPLAY_CONTEXT;

-

-//

-// All of the signatures that will be used in list structure

-//

-#define BM_MENU_OPTION_SIGNATURE      'menu'

-#define BM_LOAD_OPTION_SIGNATURE      'load'

-#define BM_CONSOLE_OPTION_SIGNATURE   'cnsl'

-#define BM_FILE_OPTION_SIGNATURE      'file'

-#define BM_HANDLE_OPTION_SIGNATURE    'hndl'

-#define BM_TERMINAL_OPTION_SIGNATURE  'trml'

-#define BM_MENU_ENTRY_SIGNATURE       'entr'

-

-#define BM_LOAD_CONTEXT_SELECT        0x0

-#define BM_CONSOLE_CONTEXT_SELECT     0x1

-#define BM_FILE_CONTEXT_SELECT        0x2

-#define BM_HANDLE_CONTEXT_SELECT      0x3

-#define BM_TERMINAL_CONTEXT_SELECT    0x5

-

-#define BM_CONSOLE_IN_CONTEXT_SELECT  0x6

-#define BM_CONSOLE_OUT_CONTEXT_SELECT 0x7

-#define BM_CONSOLE_ERR_CONTEXT_SELECT 0x8

-#define BM_LEGACY_DEV_CONTEXT_SELECT  0x9

-

-//

-// Question Id that will be used to create question

-// all these values are computed from the structure

-// defined below

-//

-#define QUESTION_ID(Field)              ((UINTN) &(((BMM_FAKE_NV_DATA *) 0)->Field))

-

-#define BOOT_TIME_OUT_QUESTION_ID       QUESTION_ID (BootTimeOut)

-#define BOOT_NEXT_QUESTION_ID           QUESTION_ID (BootNext)

-#define COM1_BAUD_RATE_QUESTION_ID      QUESTION_ID (COM1BaudRate)

-#define COM1_DATA_RATE_QUESTION_ID      QUESTION_ID (COM1DataRate)

-#define COM1_STOP_BITS_QUESTION_ID      QUESTION_ID (COM1StopBits)

-#define COM1_PARITY_QUESTION_ID         QUESTION_ID (COM1Parity)

-#define COM1_TERMINAL_QUESTION_ID       QUESTION_ID (COM2TerminalType)

-#define COM2_BAUD_RATE_QUESTION_ID      QUESTION_ID (COM2BaudRate)

-#define COM2_DATA_RATE_QUESTION_ID      QUESTION_ID (COM2DataRate)

-#define COM2_STOP_BITS_QUESTION_ID      QUESTION_ID (COM2StopBits)

-#define COM2_PARITY_QUESTION_ID         QUESTION_ID (COM2Parity)

-#define COM2_TERMINAL_QUESTION_ID       QUESTION_ID (COM2TerminalType)

-#define DRV_ADD_HANDLE_DESC_QUESTION_ID QUESTION_ID (DriverAddHandleDesc)

-#define DRV_ADD_ACTIVE_QUESTION_ID      QUESTION_ID (DriverAddActive)

-#define DRV_ADD_RECON_QUESTION_ID       QUESTION_ID (DriverAddForceReconnect)

-#define CON_IN_COM1_QUESTION_ID         QUESTION_ID (ConsoleInputCOM1)

-#define CON_IN_COM2_QUESTION_ID         QUESTION_ID (ConsoleInputCOM2)

-#define CON_OUT_COM1_QUESTION_ID        QUESTION_ID (ConsoleOutputCOM1)

-#define CON_OUT_COM2_QUESTION_ID        QUESTION_ID (ConsoleOutputCOM2)

-#define CON_ERR_COM1_QUESTION_ID        QUESTION_ID (ConsoleErrorCOM1)

-#define CON_ERR_COM2_QUESTION_ID        QUESTION_ID (ConsoleErrorCOM2)

-#define CON_DEVICE_QUESTION_ID          QUESTION_ID (ConsoleCheck)

-#define OPTION_ORDER_QUESTION_ID        QUESTION_ID (OptionOrder)

-#define DRIVER_OPTION_ORDER_QUESTION_ID QUESTION_ID (DriverOptionToBeDeleted)

-#define BOOT_OPTION_DEL_QUESTION_ID     QUESTION_ID (BootOptionDel)

-#define DRIVER_OPTION_DEL_QUESTION_ID   QUESTION_ID (DriverOptionDel)

-#define DRIVER_ADD_OPTION_QUESTION_ID   QUESTION_ID (DriverAddHandleOptionalData)

-#define COM_BAUD_RATE_QUESTION_ID       QUESTION_ID (COMBaudRate)

-#define COM_DATA_RATE_QUESTION_ID       QUESTION_ID (COMDataRate)

-#define COM_STOP_BITS_QUESTION_ID       QUESTION_ID (COMStopBits)

-#define COM_PARITY_QUESTION_ID          QUESTION_ID (COMParity)

-#define COM_TERMINAL_QUESTION_ID        QUESTION_ID (COMTerminalType)

-#define LEGACY_FD_QUESTION_ID           QUESTION_ID (LegacyFD)

-#define LEGACY_HD_QUESTION_ID           QUESTION_ID (LegacyHD)

-#define LEGACY_CD_QUESTION_ID           QUESTION_ID (LegacyCD)

-#define LEGACY_NET_QUESTION_ID          QUESTION_ID (LegacyNET)

-#define LEGACY_BEV_QUESTION_ID          QUESTION_ID (LegacyBEV)

-

-#define STRING_DEPOSITORY_NUMBER        8

-

-//

-// #pragma pack(1)

-//

-// Serial Ports attributes, first one is the value for

-// return from callback function, stringtoken is used to

-// display the value properly

-//

-typedef struct {

-  UINTN   Value;

-  UINT16  StringToken;

-} COM_ATTR;

-

-//

-// This is the structure that will be used to store the

-// question's current value. Use it at initialize time to

-// set default value for each question. When using at run

-// time, this map is returned by the callback function,

-// so dynamically changing the question's value will be

-// possible through this mechanism

-//

-typedef struct {

-  //

-  // Three questions displayed at the main page

-  // for Timeout, BootNext Variables respectively

-  //

-  UINT16  BootTimeOut;

-  UINT16  BootNext;

-

-  //

-  // This is the COM1 Attributes value storage

-  //

-  UINT8   COM1BaudRate;

-  UINT8   COM1DataRate;

-  UINT8   COM1StopBits;

-  UINT8   COM1Parity;

-  UINT8   COM1TerminalType;

-

-  //

-  // This is the COM2 Attributes value storage

-  //

-  UINT8   COM2BaudRate;

-  UINT8   COM2DataRate;

-  UINT8   COM2StopBits;

-  UINT8   COM2Parity;

-  UINT8   COM2TerminalType;

-

-  //

-  // Driver Option Add Handle page storage

-  //

-  UINT16  DriverAddHandleDesc[100];

-  UINT16  DriverAddHandleOptionalData[100];

-  UINT8   DriverAddActive;

-  UINT8   DriverAddForceReconnect;

-

-  //

-  // Console Input/Output/Errorout using COM port check storage

-  //

-  UINT8   ConsoleInputCOM1;

-  UINT8   ConsoleInputCOM2;

-  UINT8   ConsoleOutputCOM1;

-  UINT8   ConsoleOutputCOM2;

-  UINT8   ConsoleErrorCOM1;

-  UINT8   ConsoleErrorCOM2;

-

-  //

-  // At most 100 input/output/errorout device for console storage

-  //

-  UINT8   ConsoleCheck[100];

-

-  //

-  // Boot or Driver Option Order storage

-  //

-  UINT8   OptionOrder[100];

-  UINT8   DriverOptionToBeDeleted[100];

-

-  //

-  // Boot Option Delete storage

-  //

-  UINT8   BootOptionDel[100];

-  UINT8   DriverOptionDel[100];

-

-  //

-  // This is the Terminal Attributes value storage

-  //

-  UINT8   COMBaudRate;

-  UINT8   COMDataRate;

-  UINT8   COMStopBits;

-  UINT8   COMParity;

-  UINT8   COMTerminalType;

-

-  //

-  // Legacy Device Order Selection Storage

-  //

-  UINT8   LegacyFD[100];

-  UINT8   LegacyHD[100];

-  UINT8   LegacyCD[100];

-  UINT8   LegacyNET[100];

-  UINT8   LegacyBEV[100];

-

-  //

-  // We use DisableMap array to record the enable/disable state of each boot device

-  // It should be taken as a bit array, from left to right there are totally 256 bits

-  // the most left one stands for BBS table item 0, and the most right one stands for item 256

-  // If the bit is 1, it means the boot device has been disabled.

-  //

-  UINT8   DisableMap[32];

-

-  //

-  //  UINT16                    PadArea[10];

-  //

-} BMM_FAKE_NV_DATA;

-

-typedef struct {

-  UINT16  DescriptionData[75];

-  UINT16                    OptionalData[127];

-  UINT8   Active;

-  UINT8   ForceReconnect;

-} FILE_EXPLORER_NV_DATA;

-

-typedef struct {

-  BBS_TYPE  BbsType;

-  //

-  // Length = sizeof (UINT16) + SIZEOF (Data)

-  //

-  UINT16    Length;

-  UINT16    *Data;

-} BM_LEGACY_DEV_ORDER_CONTEXT;

-

-typedef struct {

-  UINT64                    BaudRate;

-  UINT8                     DataBits;

-  UINT8                     Parity;

-  UINT8                     StopBits;

-

-  UINT8                     BaudRateIndex;

-  UINT8                     DataBitsIndex;

-  UINT8                     ParityIndex;

-  UINT8                     StopBitsIndex;

-

-  UINT8                     IsConIn;

-  UINT8                     IsConOut;

-  UINT8                     IsStdErr;

-  UINT8                     TerminalType;

-

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;

-} BM_TERMINAL_CONTEXT;

-

-typedef struct {

-  BOOLEAN                   IsBootNext;

-  BOOLEAN                   LoadOptionModified;

-  BOOLEAN                   Deleted;

-

-  BOOLEAN                   IsLegacy;

-  BOOLEAN                   IsActive;

-  BOOLEAN                   ForceReconnect;

-  UINTN                     OptionalDataSize;

-

-  UINTN                     LoadOptionSize;

-  UINT8                     *LoadOption;

-

-  UINT32                    Attributes;

-  UINT16                    FilePathListLength;

-  UINT16                    *Description;

-  EFI_DEVICE_PATH_PROTOCOL  *FilePathList;

-  UINT8                     *OptionalData;

-

-  UINT16                    BbsIndex;

-} BM_LOAD_CONTEXT;

-

-typedef struct {

-  BBS_TABLE *BbsTable;

-  UINTN     Index;

-  UINTN     BbsCount;

-  UINT16    *Description;

-} BM_LEGACY_DEVICE_CONTEXT;

-

-typedef struct {

-

-  BOOLEAN                   IsActive;

-

-  BOOLEAN                   IsTerminal;

-

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;

-} BM_CONSOLE_CONTEXT;

-

-typedef struct {

-  EFI_HANDLE                        Handle;

-  EFI_DEVICE_PATH_PROTOCOL          *DevicePath;

-  EFI_FILE_HANDLE                   FHandle;

-  UINT16                            *FileName;

-  EFI_FILE_SYSTEM_VOLUME_LABEL_INFO *Info;

-

-  BOOLEAN                           IsRoot;

-  BOOLEAN                           IsDir;

-  BOOLEAN                           IsRemovableMedia;

-  BOOLEAN                           IsLoadFile;

-  BOOLEAN                           IsBootLegacy;

-} BM_FILE_CONTEXT;

-

-typedef struct {

-  EFI_HANDLE                Handle;

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;

-} BM_HANDLE_CONTEXT;

-

-typedef struct {

-  UINTN           Signature;

-  LIST_ENTRY      Head;

-  UINTN           MenuNumber;

-} BM_MENU_OPTION;

-

-typedef struct {

-  UINTN           Signature;

-  LIST_ENTRY      Link;

-  UINTN           OptionNumber;

-  UINT16          *DisplayString;

-  UINT16          *HelpString;

-  STRING_REF      DisplayStringToken;

-  STRING_REF      HelpStringToken;

-  UINTN           ContextSelection;

-  VOID            *VariableContext;

-} BM_MENU_ENTRY;

-

-typedef struct {

-  //

-  // Shared callback data.

-  //

-  UINTN                         Signature;

-  EFI_HII_PROTOCOL              *Hii;

-  BM_MENU_ENTRY                 *MenuEntry;

-  BM_HANDLE_CONTEXT             *HandleContext;

-  BM_FILE_CONTEXT               *FileContext;

-  BM_LOAD_CONTEXT               *LoadContext;

-  BM_TERMINAL_CONTEXT           *TerminalContext;

-  UINTN                         CurrentTerminal;

-  BBS_TYPE                      BbsType;

-

-  //

-  // BMM main formset callback data.

-  //

-  EFI_HII_HANDLE                BmmHiiHandle;

-  EFI_HANDLE                    BmmCallbackHandle;

-  EFI_FORM_CALLBACK_PROTOCOL    BmmDriverCallback;

-  FORM_ID                       BmmCurrentPageId;

-  FORM_ID                       BmmPreviousPageId;

-  BOOLEAN                       BmmAskSaveOrNot;

-  BMM_FAKE_NV_DATA              *BmmFakeNvData;

-  BMM_FAKE_NV_DATA              BmmOldFakeNVData;

-

-  //

-  // File explorer formset callback data.

-  //

-  EFI_HII_HANDLE                FeHiiHandle;

-  EFI_HANDLE                    FeCallbackHandle;

-  EFI_FORM_CALLBACK_PROTOCOL    FeDriverCallback;

-  FILE_EXPLORER_STATE           FeCurrentState;

-  FILE_EXPLORER_DISPLAY_CONTEXT FeDisplayContext;

-} BMM_CALLBACK_DATA;

-

-typedef struct _STRING_LIST_NODE {

-  STRING_REF                StringToken;

-  struct _STRING_LIST_NODE  *Next;

-} STRING_LIST_NODE;

-

-typedef struct _STRING_DEPOSITORY {

-  UINTN             TotalNodeNumber;

-  STRING_LIST_NODE  *CurrentNode;

-  STRING_LIST_NODE  *ListHead;

-} STRING_DEPOSITORY;

-

-//

-// #pragma pack()

-//

-// For initializing File System menu

-//

-EFI_STATUS

-BOpt_FindFileSystem (

-  IN BMM_CALLBACK_DATA          *CallbackData

-  )

-;

-

-//

-// For cleaning up File System menu

-//

-VOID

-BOpt_FreeFileSystem (

-  VOID

-  )

-;

-

-//

-// For initializing File Navigation menu

-//

-EFI_STATUS

-BOpt_FindFiles (

-  IN BMM_CALLBACK_DATA          *CallbackData,

-  IN BM_MENU_ENTRY              *MenuEntry

-  )

-;

-

-//

-// For cleaning up File Navigation menu

-//

-VOID

-BOpt_FreeFiles (

-  VOID

-  )

-;

-

-//

-// For Initializing handle navigation menu

-//

-EFI_STATUS

-BOpt_FindDrivers (

-  VOID

-  )

-;

-

-//

-// For Cleaning up handle navigation menu

-//

-VOID

-BOpt_FreeDrivers();

-

-//

-// For initializing Boot Option menu

-//

-EFI_STATUS

-BOpt_GetBootOptions (

-  IN  BMM_CALLBACK_DATA         *CallbackData

-  );

-

-//

-// For Initializing Driver option menu

-//

-EFI_STATUS

-BOpt_GetDriverOptions (

-  IN  BMM_CALLBACK_DATA         *CallbackData

-  );

-

-//

-// For Cleaning up boot option menu

-//

-VOID

-BOpt_FreeBootOptions ();

-

-//

-// For cleaning up driver option menu

-//

-VOID

-BOpt_FreeDriverOptions();

-

-//

-// For Initializing HD/FD/CD/NET/BEV option menu

-//

-EFI_STATUS

-BOpt_GetLegacyOptions();

-

-//

-// For cleaning up driver option menu

-//

-VOID

-BOpt_FreeLegacyOptions();

-

-//

-// this function is used to take place of all other free menu actions

-//

-VOID

-BOpt_FreeMenu (

-  BM_MENU_OPTION        *FreeMenu

-  );

-

-

-//

-// Following are the helper functions used

-//

-CHAR16                            *

-BOpt_AppendFileName (

-  IN  CHAR16  *Str1,

-  IN  CHAR16  *Str2

-  );

-

-BOOLEAN

-BOpt_IsEfiImageName (

-  IN UINT16  *FileName

-  );

-

-BOOLEAN

-BOpt_IsEfiApp (

-  IN EFI_FILE_HANDLE Dir,

-  IN UINT16          *FileName

-  );

-

-//

-// Get current unused boot option number

-//

-UINT16

-BOpt_GetBootOptionNumber ();

-

-//

-// Get current unused driver option number

-//

-UINT16

-BOpt_GetDriverOptionNumber ();

-

-BM_MENU_ENTRY                     *

-BOpt_CreateMenuEntry (

-  UINTN           MenuType

-  );

-

-VOID

-BOpt_DestroyMenuEntry (

-  BM_MENU_ENTRY         *MenuEntry

-  );

-

-BM_MENU_ENTRY                     *

-BOpt_GetMenuEntry (

-  BM_MENU_OPTION      *MenuOption,

-  UINTN               MenuNumber

-  );

-

-//

-// a helper function used to free pool type memory

-//

-VOID

-SafeFreePool (

-  IN VOID *Buffer

-  );

-

-//

-// Locate all serial io devices for console

-//

-EFI_STATUS

-LocateSerialIo ();

-

-//

-// Initializing Console menu

-//

-EFI_STATUS

-GetAllConsoles();

-

-//

-// Cleaning up console menu

-//

-EFI_STATUS

-FreeAllConsoles();

-

-VOID

-ChangeVariableDevicePath (

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath

-); 

-

-EFI_STATUS

-ChangeTerminalDevicePath (

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath,

-  BOOLEAN                   ChangeTerminal

-);

-//

-// Variable operation by menu selection

-//

-EFI_STATUS

-Var_UpdateBootOption (

-  IN  BMM_CALLBACK_DATA                   *CallbackData,

-  IN  FILE_EXPLORER_NV_DATA               *NvRamMap

-  );

-

-EFI_STATUS

-Var_DelBootOption ();

-

-EFI_STATUS

-Var_ChangeBootOrder ();

-

-EFI_STATUS

-Var_UpdateDriverOption (

-  IN  BMM_CALLBACK_DATA         *CallbackData,

-  IN  EFI_HII_HANDLE            HiiHandle,

-  IN  UINT16                    *DescriptionData,

-  IN  UINT16                    *OptionalData,

-  IN  UINT8                     ForceReconnect

-  );

-

-EFI_STATUS

-Var_DelDriverOption ();

-

-EFI_STATUS

-Var_ChangeDriverOrder ();

-

-EFI_STATUS

-Var_UpdateConsoleInpOption ();

-

-EFI_STATUS

-Var_UpdateConsoleOutOption ();

-

-EFI_STATUS

-Var_UpdateErrorOutOption ();

-

-VOID

-Var_UpdateAllConsoleOption ();

-

-EFI_STATUS

-Var_UpdateBootNext (

-  IN BMM_CALLBACK_DATA            *CallbackData

-  );

-

-EFI_STATUS

-Var_UpdateBootOrder (

-  IN BMM_CALLBACK_DATA            *CallbackData

-  );

-

-EFI_STATUS

-Var_UpdateDriverOrder (

-  IN BMM_CALLBACK_DATA            *CallbackData

-  );

-

-EFI_STATUS

-Var_UpdateBBSOption (

-  IN BMM_CALLBACK_DATA            *CallbackData

-  );

-

-//

-// Following are page create and refresh functions

-//

-VOID

-RefreshUpdateData (

-  IN BOOLEAN                          FormSetUpdate,

-  IN EFI_PHYSICAL_ADDRESS             FormCallbackHandle,

-  IN BOOLEAN                          FormUpdate,

-  IN STRING_REF                       FormTitle,

-  IN UINT16                           DataCount

-  );

-

-VOID

-CleanUpPage (

-  IN EFI_FORM_LABEL                   LabelId,

-  IN BMM_CALLBACK_DATA                *CallbackData

-  );

-

-EFI_STATUS

-UpdatePage (

-  IN BMM_CALLBACK_DATA                *CallbackData,

-  IN BM_MENU_OPTION                   *UpdatingMenu,

-  IN UINT16                           UpdatingPage,

-  IN UINT16                           UpdatingManner,

-  IN UINT16                           QuestionIdStart,

-  IN UINT16                           GotoForm,

-  IN UINT16                           GotoAlternateForm,

-  IN STRING_REF                       DisplayTokenStart,

-  IN STRING_REF                       HelpTokenStart,

-  IN UINT16                           KeyValueStart

-  );

-

-VOID

-UpdateBootAddPage (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  );

-

-VOID

-UpdateBootDelPage (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  );

-

-VOID

-UpdateDrvAddFilePage (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  );

-

-VOID

-UpdateDrvAddHandlePage (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  );

-

-VOID

-UpdateDrvDelPage (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  );

-

-VOID

-UpdateDriverAddHandleDescPage (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  );

-

-VOID

-UpdateBootTimeOut (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  );

-

-VOID

-UpdateConInPage (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  );

-

-VOID

-UpdateConOutPage (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  );

-

-VOID

-UpdateStdErrPage (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  );

-

-VOID

-UpdatePageBody (

-  IN UINT16                           UpdatePageId,

-  IN BMM_CALLBACK_DATA                *CallbackData

-  );

-

-VOID

-UpdateCOM1Page (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  );

-

-VOID

-UpdateCOM2Page (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  );

-

-VOID

-UpdateBootOrderPage (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  );

-

-VOID

-UpdateDriverOrderPage (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  );

-

-VOID

-UpdateBootNextPage (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  );

-

-VOID

-UpdateTimeOutPage (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  );

-

-VOID

-UpdateTerminalPage (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  );

-

-VOID

-UpdateConCOMPage (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  );

-

-VOID

-UpdateSetLegacyDeviceOrderPage (

-  IN UINT16                           UpdatePageId,

-  IN BMM_CALLBACK_DATA                *CallbackData

-);

-

-EFI_STATUS

-BootLegacy (

-  IN  UINT16  BbsType,

-  IN  UINT16  BbsFlag

-);

-

-BM_MENU_ENTRY                     *

-GetCurrentTerminal (

-  UINTN       TerminalNumber

-);

-

-EFI_FILE_HANDLE

-EfiLibOpenRoot (

-  IN EFI_HANDLE       DeviceHandle

-  );

-

-EFI_FILE_SYSTEM_VOLUME_LABEL_INFO *

-EfiLibFileSystemVolumeLabelInfo (

-  IN EFI_FILE_HANDLE      FHand

-  );

-

-EFI_FILE_INFO                     *

-EfiLibFileInfo (

-  IN EFI_FILE_HANDLE      FHand

-  );

-

-CHAR16                            *

-DevicePathToStr (

-  EFI_DEVICE_PATH_PROTOCOL     *DevPath

-  );

-

-EFI_STATUS

-EfiLibLocateProtocol (

-  IN  EFI_GUID        *ProtocolGuid,

-  OUT VOID            **Interface

-  );

-

-VOID                              *

-EfiReallocatePool (

-  IN VOID                 *OldPool,

-  IN UINTN                OldSize,

-  IN UINTN                NewSize

-  );

-

-CHAR16                            *

-DevicePathToStr (

-  EFI_DEVICE_PATH_PROTOCOL     *DevPath

-  );

-

-VOID                              *

-BdsLibGetVariableAndSize (

-  IN CHAR16               *Name,

-  IN EFI_GUID             *VendorGuid,

-  OUT UINTN               *VarSize

-  );

-

-EFI_STATUS

-EfiLibDeleteVariable (

-  IN CHAR16   *VarName,

-  IN EFI_GUID *VarGuid

-  );

-

-CHAR16                            *

-EfiStrDuplicate (

-  IN CHAR16   *Src

-  );

-

-BOOLEAN

-EfiLibMatchDevicePaths (

-  IN  EFI_DEVICE_PATH_PROTOCOL *Multi,

-  IN  EFI_DEVICE_PATH_PROTOCOL *Single

-  );

-

-UINTN

-EfiDevicePathInstanceCount (

-  IN EFI_DEVICE_PATH_PROTOCOL      *DevicePath

-  );

-

-EFI_STATUS

-CreateMenuStringToken (

-  IN BMM_CALLBACK_DATA                *CallbackData,

-  IN EFI_HII_HANDLE                   HiiHandle,

-  IN BM_MENU_OPTION                   *MenuOption

-  );

-

-UINT16                            *

-EfiLibStrFromDatahub (

-  IN EFI_DEVICE_PATH_PROTOCOL                 *DevPath

-  );

-

-VOID                              *

-GetLegacyBootOptionVar (

-  IN  UINTN                            DeviceType,

-  OUT UINTN                            *OptionIndex,

-  OUT UINTN                            *OptionSize

- );

-

-EFI_STATUS

-InitializeBM (

-  VOID

-  );

-

-EFI_STATUS

-BdsStartBootMaint (

-  VOID

-  );

-

-VOID

-InitializeStringDepository ();

-

-STRING_REF

-GetStringTokenFromDepository (

-  IN   BMM_CALLBACK_DATA     *CallbackData,

-  IN   STRING_DEPOSITORY     *StringDepository

-  ) ;

-

-VOID

-ReclaimStringDepository (

-  VOID

-  );

-

-VOID

-CleanUpStringDepository (

-  VOID

-  );

-

-EFI_STATUS

-ApplyChangeHandler (

-  IN  BMM_CALLBACK_DATA               *Private,

-  IN  BMM_FAKE_NV_DATA                *CurrentFakeNVMap,

-  IN  FORM_ID                         FormId

-  );

-

-VOID

-DiscardChangeHandler (

-  IN  BMM_CALLBACK_DATA               *Private,

-  IN  BMM_FAKE_NV_DATA                *CurrentFakeNVMap

-  );

-

-VOID

-UpdatePageId (

-  BMM_CALLBACK_DATA              *Private,

-  UINT16                         NewPageId

-  );

-

-EFI_STATUS

-BootThisFile (

-  IN BM_FILE_CONTEXT                   *FileContext

-  );

-

-BOOLEAN

-UpdateFileExplorer (

-  IN BMM_CALLBACK_DATA            *CallbackData,

-  IN UINT16                       KeyValue

-  );

-

-EFI_STATUS

-EFIAPI

-FileExplorerCallback (

-  IN EFI_FORM_CALLBACK_PROTOCOL       *This,

-  IN UINT16                           KeyValue,

-  IN EFI_IFR_DATA_ARRAY               *Data,

-  OUT EFI_HII_CALLBACK_PACKET         **Packet

-  );

-

-EFI_STATUS

-FormSetDispatcher (

-  IN  BMM_CALLBACK_DATA    *CallbackData

-  );

-

-VOID CreateCallbackPacket (

-  OUT EFI_HII_CALLBACK_PACKET         **Packet,

-  IN  UINT16                          Flags

-  );

-

-//

-// Global variable in this program (defined in data.c)

-//

-extern BM_MENU_OPTION             BootOptionMenu;

-extern BM_MENU_OPTION             DriverOptionMenu;

-extern BM_MENU_OPTION             FsOptionMenu;

-extern BM_MENU_OPTION             ConsoleInpMenu;

-extern BM_MENU_OPTION             ConsoleOutMenu;

-extern BM_MENU_OPTION             ConsoleErrMenu;

-extern BM_MENU_OPTION             DirectoryMenu;

-extern BM_MENU_OPTION             DriverMenu;

-extern BM_MENU_OPTION             TerminalMenu;

-extern BM_MENU_OPTION             LegacyFDMenu;

-extern BM_MENU_OPTION             LegacyHDMenu;

-extern BM_MENU_OPTION             LegacyCDMenu;

-extern BM_MENU_OPTION             LegacyNETMenu;

-extern BM_MENU_OPTION             LegacyBEVMenu;

-extern UINT16                     TerminalType[];

-extern COM_ATTR                   BaudRateList[19];

-extern COM_ATTR                   DataBitsList[4];

-extern COM_ATTR                   ParityList[5];

-extern COM_ATTR                   StopBitsList[3];

-extern EFI_GUID                   Guid[4];

-extern EFI_HII_UPDATE_DATA        *UpdateData;

-extern STRING_DEPOSITORY          *FileOptionStrDepository;

-extern STRING_DEPOSITORY          *ConsoleOptionStrDepository;

-extern STRING_DEPOSITORY          *BootOptionStrDepository;

-extern STRING_DEPOSITORY          *BootOptionHelpStrDepository;

-extern STRING_DEPOSITORY          *DriverOptionStrDepository;

-extern STRING_DEPOSITORY          *DriverOptionHelpStrDepository;

-extern STRING_DEPOSITORY          *TerminalStrDepository;

-extern EFI_DEVICE_PATH_PROTOCOL   EndDevicePath[];

-extern EFI_GUID                   EfiLegacyDevOrderGuid;

-

-#endif

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootOption.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootOption.c
deleted file mode 100644
index b5afc7c..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootOption.c
+++ /dev/null
@@ -1,1685 +0,0 @@
-/*++

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  BootOption.c

-

-Abstract:

-

-  Provide boot option support for Application "BootMaint"

-

-  Include file system navigation, system handle selection

-

-  Boot option manipulation

-

-Revision History

-

---*/

-

-#include "BootMaint.h"

-#include "BBSsupport.h"

-

-BM_MENU_ENTRY *

-BOpt_CreateMenuEntry (

-  UINTN           MenuType

-  )

-/*++

-

-Routine Description

-  Create Menu Entry for future use, make all types together

-  in order to reduce code size

-

-Arguments:

-  MenuType            Use this parameter to identify current

-                      Menu type

-

-Returns:

-  NULL                Cannot allocate memory for current menu

-                      entry

-  Others              A valid pointer pointing to the allocated

-                      memory pool for current menu entry

-

---*/

-{

-  BM_MENU_ENTRY *MenuEntry;

-  UINTN         ContextSize;

-

-  switch (MenuType) {

-  case BM_LOAD_CONTEXT_SELECT:

-    ContextSize = sizeof (BM_LOAD_CONTEXT);

-    break;

-

-  case BM_FILE_CONTEXT_SELECT:

-    ContextSize = sizeof (BM_FILE_CONTEXT);

-    break;

-

-  case BM_CONSOLE_CONTEXT_SELECT:

-    ContextSize = sizeof (BM_CONSOLE_CONTEXT);

-    break;

-

-  case BM_TERMINAL_CONTEXT_SELECT:

-    ContextSize = sizeof (BM_TERMINAL_CONTEXT);

-    break;

-

-  case BM_HANDLE_CONTEXT_SELECT:

-    ContextSize = sizeof (BM_HANDLE_CONTEXT);

-    break;

-

-  case BM_LEGACY_DEV_CONTEXT_SELECT:

-    ContextSize = sizeof (BM_LEGACY_DEVICE_CONTEXT);

-    break;

-

-  default:

-    ContextSize = 0;

-    break;

-

-  }

-

-  if (0 == ContextSize) {

-    return NULL;

-  }

-

-  MenuEntry = AllocateZeroPool (sizeof (BM_MENU_ENTRY));

-  if (NULL == MenuEntry) {

-    return MenuEntry;

-  }

-

-  MenuEntry->VariableContext = AllocateZeroPool (ContextSize);

-  if (NULL == MenuEntry->VariableContext) {

-    SafeFreePool (MenuEntry);

-    MenuEntry = NULL;

-    return MenuEntry;

-  }

-

-  MenuEntry->Signature        = BM_MENU_ENTRY_SIGNATURE;

-  MenuEntry->ContextSelection = MenuType;

-  return MenuEntry;

-}

-

-VOID

-BOpt_DestroyMenuEntry (

-  BM_MENU_ENTRY         *MenuEntry

-  )

-/*++

-  Routine Description :

-    Destroy the menu entry passed in

-

-  Arguments :

-    The menu entry need to be destroyed

-

-  Returns :

-    None

-

---*/

-{

-  BM_LOAD_CONTEXT           *LoadContext;

-  BM_FILE_CONTEXT           *FileContext;

-  BM_CONSOLE_CONTEXT        *ConsoleContext;

-  BM_TERMINAL_CONTEXT       *TerminalContext;

-  BM_HANDLE_CONTEXT         *HandleContext;

-  BM_LEGACY_DEVICE_CONTEXT  *LegacyDevContext;

-

-  //

-  //  Select by the type in Menu entry for current context type

-  //

-  switch (MenuEntry->ContextSelection) {

-  case BM_LOAD_CONTEXT_SELECT:

-    LoadContext = (BM_LOAD_CONTEXT *) MenuEntry->VariableContext;

-    SafeFreePool (LoadContext->FilePathList);

-    SafeFreePool (LoadContext->LoadOption);

-    SafeFreePool (LoadContext->OptionalData);

-    SafeFreePool (LoadContext);

-    break;

-

-  case BM_FILE_CONTEXT_SELECT:

-    FileContext = (BM_FILE_CONTEXT *) MenuEntry->VariableContext;

-

-    if (!FileContext->IsRoot) {

-      SafeFreePool (FileContext->DevicePath);

-    } else {

-      if (FileContext->FHandle != NULL) {

-        FileContext->FHandle->Close (FileContext->FHandle);

-      }

-    }

-

-    SafeFreePool (FileContext->FileName);

-    SafeFreePool (FileContext->Info);

-    SafeFreePool (FileContext);

-    break;

-

-  case BM_CONSOLE_CONTEXT_SELECT:

-    ConsoleContext = (BM_CONSOLE_CONTEXT *) MenuEntry->VariableContext;

-    SafeFreePool (ConsoleContext->DevicePath);

-    SafeFreePool (ConsoleContext);

-    break;

-

-  case BM_TERMINAL_CONTEXT_SELECT:

-    TerminalContext = (BM_TERMINAL_CONTEXT *) MenuEntry->VariableContext;

-    SafeFreePool (TerminalContext->DevicePath);

-    SafeFreePool (TerminalContext);

-    break;

-

-  case BM_HANDLE_CONTEXT_SELECT:

-    HandleContext = (BM_HANDLE_CONTEXT *) MenuEntry->VariableContext;

-    SafeFreePool (HandleContext);

-    break;

-

-  case BM_LEGACY_DEV_CONTEXT_SELECT:

-    LegacyDevContext = (BM_LEGACY_DEVICE_CONTEXT *) MenuEntry->VariableContext;

-    SafeFreePool (LegacyDevContext);

-

-  default:

-    break;

-  }

-

-  SafeFreePool (MenuEntry->DisplayString);

-  if (NULL != MenuEntry->HelpString) {

-    SafeFreePool (MenuEntry->HelpString);

-  }

-

-  SafeFreePool (MenuEntry);

-}

-

-BM_MENU_ENTRY *

-BOpt_GetMenuEntry (

-  BM_MENU_OPTION      *MenuOption,

-  UINTN               MenuNumber

-  )

-/*++

-  Rountine Description :

-    Use this routine to get one particular menu entry in specified

-    menu

-

-  Arguments :

-    MenuOption        The menu that we will search

-

-    MenuNumber        The menunubmer that we want

-

-  Returns :

-    The desired menu entry

-

---*/

-{

-  BM_MENU_ENTRY   *NewMenuEntry;

-  UINTN           Index;

-  LIST_ENTRY      *List;

-

-  if (MenuNumber >= MenuOption->MenuNumber) {

-    return NULL;

-  }

-

-  List = MenuOption->Head.ForwardLink;

-  for (Index = 0; Index < MenuNumber; Index++) {

-    List = List->ForwardLink;

-  }

-

-  NewMenuEntry = CR (List, BM_MENU_ENTRY, Link, BM_MENU_ENTRY_SIGNATURE);

-

-  return NewMenuEntry;

-}

-

-EFI_STATUS

-BOpt_FindFileSystem (

-  IN BMM_CALLBACK_DATA          *CallbackData

-  )

-/*++

-

-Routine Description

-  Find file systems for current Extensible Firmware

-  Including Handles that support Simple File System

-  protocol, Load File protocol.

-

-  Building up the FileSystem Menu for user selection

-  All file system will be stored in FsOptionMenu

-  for future use.

-

-Arguments:

-  CallbackData           -   BMM context data

-

-Returns:

-  EFI_SUCCESS            -   Success find the file system

-  EFI_OUT_OF_RESOURCES   -   Can not create menu entry

-

---*/

-{

-  UINTN                     NoSimpleFsHandles;

-  UINTN                     NoLoadFileHandles;

-  EFI_HANDLE                *SimpleFsHandle;

-  EFI_HANDLE                *LoadFileHandle;

-  UINT16                    *VolumeLabel;

-  EFI_BLOCK_IO_PROTOCOL     *BlkIo;

-  UINTN                     Index;

-  EFI_STATUS                Status;

-  BM_MENU_ENTRY             *MenuEntry;

-  BM_FILE_CONTEXT           *FileContext;

-  UINT16                    *TempStr;

-  UINTN                     OptionNumber;

-  EFI_LEGACY_BIOS_PROTOCOL  *LegacyBios;

-  UINT16                    DeviceType;

-  BBS_BBS_DEVICE_PATH       BbsDevicePathNode;

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;

-  BOOLEAN                   RemovableMedia;

-

-

-  NoSimpleFsHandles = 0;

-  NoLoadFileHandles = 0;

-  OptionNumber      = 0;

-  InitializeListHead (&FsOptionMenu.Head);

-

-  //

-  // Locate Handles that support Simple File System protocol

-  //

-  Status = gBS->LocateHandleBuffer (

-                  ByProtocol,

-                  &gEfiSimpleFileSystemProtocolGuid,

-                  NULL,

-                  &NoSimpleFsHandles,

-                  &SimpleFsHandle

-                  );

-  if (!EFI_ERROR (Status)) {

-    //

-    // Find all the instances of the File System prototocol

-    //

-    for (Index = 0; Index < NoSimpleFsHandles; Index++) {

-      Status = gBS->HandleProtocol (

-                      SimpleFsHandle[Index],

-                      &gEfiBlockIoProtocolGuid,

-                      &BlkIo

-                      );

-      if (EFI_ERROR (Status)) {

-        //

-        // If no block IO exists assume it's NOT a removable media

-        //

-        RemovableMedia = FALSE;

-      } else {

-        //

-        // If block IO exists check to see if it's remobable media

-        //

-        RemovableMedia = BlkIo->Media->RemovableMedia;

-      }

-

-      //

-      // Allocate pool for this load option

-      //

-      MenuEntry = BOpt_CreateMenuEntry (BM_FILE_CONTEXT_SELECT);

-      if (NULL == MenuEntry) {

-        SafeFreePool (SimpleFsHandle);

-        return EFI_OUT_OF_RESOURCES;

-      }

-

-      FileContext = (BM_FILE_CONTEXT *) MenuEntry->VariableContext;

-

-      FileContext->Handle     = SimpleFsHandle[Index];

-      MenuEntry->OptionNumber = Index;

-      FileContext->FHandle    = EfiLibOpenRoot (FileContext->Handle);

-      if (!FileContext->FHandle) {

-        BOpt_DestroyMenuEntry (MenuEntry);

-        continue;

-      }

-

-      MenuEntry->HelpString = DevicePathToStr (DevicePathFromHandle (FileContext->Handle));

-      FileContext->Info = EfiLibFileSystemVolumeLabelInfo (FileContext->FHandle);

-      FileContext->FileName = EfiStrDuplicate (L"\\");

-      FileContext->DevicePath = FileDevicePath (

-                                  FileContext->Handle,

-                                  FileContext->FileName

-                                  );

-      FileContext->IsDir            = TRUE;

-      FileContext->IsRoot           = TRUE;

-      FileContext->IsRemovableMedia = FALSE;

-      FileContext->IsLoadFile       = FALSE;

-

-      //

-      // Get current file system's Volume Label

-      //

-      if (FileContext->Info == NULL) {

-        VolumeLabel = L"NO FILE SYSTEM INFO";

-      } else {

-        if (FileContext->Info->VolumeLabel == NULL) {

-          VolumeLabel = L"NULL VOLUME LABEL";

-        } else {

-          VolumeLabel = FileContext->Info->VolumeLabel;

-          if (*VolumeLabel == 0x0000) {

-            VolumeLabel = L"NO VOLUME LABEL";

-          }

-        }

-      }

-

-      TempStr                   = MenuEntry->HelpString;

-      MenuEntry->DisplayString  = AllocateZeroPool (MAX_CHAR);

-      ASSERT (MenuEntry->DisplayString != NULL);

-      UnicodeSPrint (

-        MenuEntry->DisplayString,

-        MAX_CHAR,

-        L"%s, [%s]",

-        VolumeLabel,

-        TempStr

-        );

-      OptionNumber++;

-      InsertTailList (&FsOptionMenu.Head, &MenuEntry->Link);

-    }

-  }

-

-  if (NoSimpleFsHandles != 0) {

-    SafeFreePool (SimpleFsHandle);

-  }

-  //

-  // Searching for handles that support Load File protocol

-  //

-  Status = gBS->LocateHandleBuffer (

-                  ByProtocol,

-                  &gEfiLoadFileProtocolGuid,

-                  NULL,

-                  &NoLoadFileHandles,

-                  &LoadFileHandle

-                  );

-

-  if (!EFI_ERROR (Status)) {

-    for (Index = 0; Index < NoLoadFileHandles; Index++) {

-      MenuEntry = BOpt_CreateMenuEntry (BM_FILE_CONTEXT_SELECT);

-      if (NULL == MenuEntry) {

-        SafeFreePool (LoadFileHandle);

-        return EFI_OUT_OF_RESOURCES;

-      }

-

-      FileContext                   = (BM_FILE_CONTEXT *) MenuEntry->VariableContext;

-      FileContext->IsRemovableMedia = FALSE;

-      FileContext->IsLoadFile       = TRUE;

-      FileContext->Handle           = LoadFileHandle[Index];

-      FileContext->IsRoot           = TRUE;

-

-      FileContext->DevicePath = DevicePathFromHandle (FileContext->Handle);

-

-      MenuEntry->HelpString     = DevicePathToStr (FileContext->DevicePath);

-

-      TempStr                   = MenuEntry->HelpString;

-      MenuEntry->DisplayString  = AllocateZeroPool (MAX_CHAR);

-      ASSERT (MenuEntry->DisplayString != NULL);

-      UnicodeSPrint (

-        MenuEntry->DisplayString,

-        MAX_CHAR,

-        L"Load File [%s]",

-        TempStr

-        );

-

-      MenuEntry->OptionNumber = OptionNumber;

-      OptionNumber++;

-      InsertTailList (&FsOptionMenu.Head, &MenuEntry->Link);

-    }

-  }

-

-  if (NoLoadFileHandles != 0) {

-    SafeFreePool (LoadFileHandle);

-  }

-

-  //

-  // Add Legacy Boot Option Support Here

-  //

-  Status = gBS->LocateProtocol (

-                  &gEfiLegacyBiosProtocolGuid,

-                  NULL,

-                  &LegacyBios

-                  );

-  if (!EFI_ERROR (Status)) {

-

-    for (Index = BBS_TYPE_FLOPPY; Index <= BBS_TYPE_EMBEDDED_NETWORK; Index++) {

-      MenuEntry = BOpt_CreateMenuEntry (BM_FILE_CONTEXT_SELECT);

-      if (NULL == MenuEntry) {

-        return EFI_OUT_OF_RESOURCES;

-      }

-

-      FileContext                       = (BM_FILE_CONTEXT *) MenuEntry->VariableContext;

-

-      FileContext->IsRemovableMedia     = FALSE;

-      FileContext->IsLoadFile           = TRUE;

-      FileContext->IsBootLegacy         = TRUE;

-      DeviceType                        = (UINT16) Index;

-      BbsDevicePathNode.Header.Type     = BBS_DEVICE_PATH;

-      BbsDevicePathNode.Header.SubType  = BBS_BBS_DP;

-      SetDevicePathNodeLength (

-        &BbsDevicePathNode.Header,

-        sizeof (BBS_BBS_DEVICE_PATH)

-        );

-      BbsDevicePathNode.DeviceType  = DeviceType;

-      BbsDevicePathNode.StatusFlag  = 0;

-      BbsDevicePathNode.String[0]   = 0;

-      DevicePath = AppendDevicePathNode (

-                    EndDevicePath,

-                    (EFI_DEVICE_PATH_PROTOCOL *) &BbsDevicePathNode

-                    );

-

-      FileContext->DevicePath   = DevicePath;

-      MenuEntry->HelpString     = DevicePathToStr (FileContext->DevicePath);

-

-      TempStr                   = MenuEntry->HelpString;

-      MenuEntry->DisplayString  = AllocateZeroPool (MAX_CHAR);

-      ASSERT (MenuEntry->DisplayString != NULL);

-      UnicodeSPrint (

-        MenuEntry->DisplayString,

-        MAX_CHAR,

-        L"Boot Legacy [%s]",

-        TempStr

-        );

-      MenuEntry->OptionNumber = OptionNumber;

-      OptionNumber++;

-      InsertTailList (&FsOptionMenu.Head, &MenuEntry->Link);

-    }

-  }

-  //

-  // Remember how many file system options are here

-  //

-  FsOptionMenu.MenuNumber = OptionNumber;

-  return EFI_SUCCESS;

-}

-

-VOID

-BOpt_FreeMenu (

-  BM_MENU_OPTION        *FreeMenu

-  )

-/*++

-

-Routine Description

-  Free resources allocated in Allocate Rountine

-

-Arguments:

-  FreeMenu        Menu to be freed

-

-Returns:

-  VOID

-

---*/

-{

-  BM_MENU_ENTRY *MenuEntry;

-  while (!IsListEmpty (&FreeMenu->Head)) {

-    MenuEntry = CR (

-                  FreeMenu->Head.ForwardLink,

-                  BM_MENU_ENTRY,

-                  Link,

-                  BM_MENU_ENTRY_SIGNATURE

-                  );

-    RemoveEntryList (&MenuEntry->Link);

-    BOpt_DestroyMenuEntry (MenuEntry);

-  }

-}

-

-EFI_STATUS

-BOpt_FindFiles (

-  IN BMM_CALLBACK_DATA          *CallbackData,

-  IN BM_MENU_ENTRY              *MenuEntry

-  )

-/*++

-

-Routine Description

-  Find files under current directory

-  All files and sub-directories in current directory

-  will be stored in DirectoryMenu for future use.

-

-Arguments:

-  FileOption   -- Pointer for Dir to explore

-

-Returns:

-  TRUE         -- Get files from current dir successfully

-  FALSE        -- Can't get files from current dir

-

---*/

-{

-  EFI_FILE_HANDLE NewDir;

-  EFI_FILE_HANDLE Dir;

-  EFI_FILE_INFO   *DirInfo;

-  UINTN           BufferSize;

-  UINTN           DirBufferSize;

-  BM_MENU_ENTRY   *NewMenuEntry;

-  BM_FILE_CONTEXT *FileContext;

-  BM_FILE_CONTEXT *NewFileContext;

-  UINTN           Pass;

-  EFI_STATUS      Status;

-  UINTN           OptionNumber;

-

-  FileContext   = (BM_FILE_CONTEXT *) MenuEntry->VariableContext;

-  Dir           = FileContext->FHandle;

-  OptionNumber  = 0;

-  //

-  // Open current directory to get files from it

-  //

-  Status = Dir->Open (

-                  Dir,

-                  &NewDir,

-                  FileContext->FileName,

-                  EFI_FILE_READ_ONLY,

-                  0

-                  );

-  if (!FileContext->IsRoot) {

-    Dir->Close (Dir);

-  }

-

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  DirInfo = EfiLibFileInfo (NewDir);

-  if (!DirInfo) {

-    return EFI_NOT_FOUND;

-  }

-

-  if (!(DirInfo->Attribute & EFI_FILE_DIRECTORY)) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  FileContext->DevicePath = FileDevicePath (

-                              FileContext->Handle,

-                              FileContext->FileName

-                              );

-

-  DirBufferSize = sizeof (EFI_FILE_INFO) + 1024;

-  DirInfo       = AllocateZeroPool (DirBufferSize);

-  if (!DirInfo) {

-    return EFI_OUT_OF_RESOURCES;

-  }

-  //

-  // Get all files in current directory

-  // Pass 1 to get Directories

-  // Pass 2 to get files that are EFI images

-  //

-  for (Pass = 1; Pass <= 2; Pass++) {

-    NewDir->SetPosition (NewDir, 0);

-    for (;;) {

-      BufferSize  = DirBufferSize;

-      Status      = NewDir->Read (NewDir, &BufferSize, DirInfo);

-      if (EFI_ERROR (Status) || BufferSize == 0) {

-        break;

-      }

-

-      if ((DirInfo->Attribute & EFI_FILE_DIRECTORY && Pass == 2) ||

-          (!(DirInfo->Attribute & EFI_FILE_DIRECTORY) && Pass == 1)

-          ) {

-        //

-        // Pass 1 is for Directories

-        // Pass 2 is for file names

-        //

-        continue;

-      }

-

-      if (!(BOpt_IsEfiImageName (DirInfo->FileName) || DirInfo->Attribute & EFI_FILE_DIRECTORY)) {

-        //

-        // Slip file unless it is a directory entry or a .EFI file

-        //

-        continue;

-      }

-

-      NewMenuEntry = BOpt_CreateMenuEntry (BM_FILE_CONTEXT_SELECT);

-      if (NULL == NewMenuEntry) {

-        return EFI_OUT_OF_RESOURCES;

-      }

-

-      NewFileContext          = (BM_FILE_CONTEXT *) NewMenuEntry->VariableContext;

-      NewFileContext->Handle  = FileContext->Handle;

-      NewFileContext->FileName = BOpt_AppendFileName (

-                                  FileContext->FileName,

-                                  DirInfo->FileName

-                                  );

-      NewFileContext->FHandle = NewDir;

-      NewFileContext->DevicePath = FileDevicePath (

-                                    NewFileContext->Handle,

-                                    NewFileContext->FileName

-                                    );

-      NewMenuEntry->HelpString = NULL;

-

-      MenuEntry->DisplayStringToken = GetStringTokenFromDepository (

-                                        CallbackData,

-                                        FileOptionStrDepository

-                                        );

-

-      NewFileContext->IsDir = (BOOLEAN) ((DirInfo->Attribute & EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY);

-

-      if (NewFileContext->IsDir) {

-        BufferSize                  = StrLen (DirInfo->FileName) * 2 + 6;

-        NewMenuEntry->DisplayString = AllocateZeroPool (BufferSize);

-

-        UnicodeSPrint (

-          NewMenuEntry->DisplayString,

-          BufferSize,

-          L"<%s>",

-          DirInfo->FileName

-          );

-

-      } else {

-        NewMenuEntry->DisplayString = EfiStrDuplicate (DirInfo->FileName);

-      }

-

-      NewFileContext->IsRoot            = FALSE;

-      NewFileContext->IsLoadFile        = FALSE;

-      NewFileContext->IsRemovableMedia  = FALSE;

-

-      NewMenuEntry->OptionNumber        = OptionNumber;

-      OptionNumber++;

-      InsertTailList (&DirectoryMenu.Head, &NewMenuEntry->Link);

-    }

-  }

-

-  DirectoryMenu.MenuNumber = OptionNumber;

-  SafeFreePool (DirInfo);

-  return TRUE;

-}

-

-EFI_STATUS

-BOpt_GetLegacyOptions (

-  VOID

-  )

-/*++

-Routine Description:

-

-  Build the LegacyFDMenu LegacyHDMenu LegacyCDMenu according to LegacyBios.GetBbsInfo().

-

-Arguments:

-  None

-

-Returns:

-  The device info of legacy device.

-

---*/

-{

-  BM_MENU_ENTRY             *NewMenuEntry;

-  BM_LEGACY_DEVICE_CONTEXT  *NewLegacyDevContext;

-  EFI_STATUS                Status;

-  EFI_LEGACY_BIOS_PROTOCOL  *LegacyBios;

-  UINT16                    HddCount;

-  HDD_INFO                  *HddInfo;

-  UINT16                    BbsCount;

-  BBS_TABLE                 *BbsTable;

-  UINTN                     Index;

-  CHAR16                    DescString[100];

-  UINTN                     FDNum;

-  UINTN                     HDNum;

-  UINTN                     CDNum;

-  UINTN                     NETNum;

-  UINTN                     BEVNum;

-

-  NewMenuEntry  = NULL;

-  HddInfo       = NULL;

-  BbsTable      = NULL;

-  BbsCount      = 0;

-

-  //

-  // Initialize Bbs Table Context from BBS info data

-  //

-  InitializeListHead (&LegacyFDMenu.Head);

-  InitializeListHead (&LegacyHDMenu.Head);

-  InitializeListHead (&LegacyCDMenu.Head);

-  InitializeListHead (&LegacyNETMenu.Head);

-  InitializeListHead (&LegacyBEVMenu.Head);

-

-  Status = gBS->LocateProtocol (

-                  &gEfiLegacyBiosProtocolGuid,

-                  NULL,

-                  &LegacyBios

-                  );

-  if (!EFI_ERROR (Status)) {

-    Status = LegacyBios->GetBbsInfo (

-                          LegacyBios,

-                          &HddCount,

-                          &HddInfo,

-                          &BbsCount,

-                          &BbsTable

-                          );

-    if (EFI_ERROR (Status)) {

-      return Status;

-    }

-  }

-

-  FDNum   = 0;

-  HDNum   = 0;

-  CDNum   = 0;

-  NETNum  = 0;

-  BEVNum  = 0;

-

-  for (Index = 0; Index < BbsCount; Index++) {

-    if ((BBS_IGNORE_ENTRY == BbsTable[Index].BootPriority) ||

-        (BBS_DO_NOT_BOOT_FROM == BbsTable[Index].BootPriority) ||

-        (BBS_LOWEST_PRIORITY == BbsTable[Index].BootPriority)

-        ) {

-      continue;

-    }

-

-    NewMenuEntry = BOpt_CreateMenuEntry (BM_LEGACY_DEV_CONTEXT_SELECT);

-    if (NULL == NewMenuEntry) {

-      break;

-    }

-

-    NewLegacyDevContext           = (BM_LEGACY_DEVICE_CONTEXT *) NewMenuEntry->VariableContext;

-    NewLegacyDevContext->BbsTable = &BbsTable[Index];

-    NewLegacyDevContext->Index    = Index;

-    NewLegacyDevContext->BbsCount = BbsCount;

-    BdsBuildLegacyDevNameString (

-      &BbsTable[Index],

-      Index,

-      sizeof (DescString),

-      DescString

-      );

-    NewLegacyDevContext->Description = AllocateZeroPool (StrSize (DescString));

-    if (NULL == NewLegacyDevContext->Description) {

-      break;

-    }

-

-    CopyMem (NewLegacyDevContext->Description, DescString, StrSize (DescString));

-    NewMenuEntry->DisplayString = NewLegacyDevContext->Description;

-    NewMenuEntry->HelpString    = NULL;

-

-    switch (BbsTable[Index].DeviceType) {

-    case BBS_FLOPPY:

-      InsertTailList (&LegacyFDMenu.Head, &NewMenuEntry->Link);

-      FDNum++;

-      break;

-

-    case BBS_HARDDISK:

-      InsertTailList (&LegacyHDMenu.Head, &NewMenuEntry->Link);

-      HDNum++;

-      break;

-

-    case BBS_CDROM:

-      InsertTailList (&LegacyCDMenu.Head, &NewMenuEntry->Link);

-      CDNum++;

-      break;

-

-    case BBS_EMBED_NETWORK:

-      InsertTailList (&LegacyNETMenu.Head, &NewMenuEntry->Link);

-      NETNum++;

-      break;

-

-    case BBS_BEV_DEVICE:

-      InsertTailList (&LegacyBEVMenu.Head, &NewMenuEntry->Link);

-      BEVNum++;

-      break;

-    }

-  }

-

-  if (Index != BbsCount) {

-    BOpt_FreeLegacyOptions ();

-    return EFI_OUT_OF_RESOURCES;

-  }

-

-  LegacyFDMenu.MenuNumber   = FDNum;

-  LegacyHDMenu.MenuNumber   = HDNum;

-  LegacyCDMenu.MenuNumber   = CDNum;

-  LegacyNETMenu.MenuNumber  = NETNum;

-  LegacyBEVMenu.MenuNumber  = BEVNum;

-  return EFI_SUCCESS;

-}

-

-VOID

-BOpt_FreeLegacyOptions (

-  VOID

-  )

-{

-  BOpt_FreeMenu (&LegacyFDMenu);

-  BOpt_FreeMenu (&LegacyHDMenu);

-  BOpt_FreeMenu (&LegacyCDMenu);

-  BOpt_FreeMenu (&LegacyNETMenu);

-  BOpt_FreeMenu (&LegacyBEVMenu);

-}

-

-EFI_STATUS

-BOpt_GetBootOptions (

-  IN  BMM_CALLBACK_DATA         *CallbackData

-  )

-/*++

-

-Routine Description:

-

-  Build the BootOptionMenu according to BootOrder Variable.

-  This Routine will access the Boot#### to get EFI_LOAD_OPTION

-

-Arguments:

-  None

-

-Returns:

-  The number of the Var Boot####

-

---*/

-{

-  UINTN                     Index;

-  UINT16                    BootString[10];

-  UINT8                     *LoadOptionFromVar;

-  UINT8                     *LoadOption;

-  UINTN                     BootOptionSize;

-  BOOLEAN                   BootNextFlag;

-  UINT16                    *BootOrderList;

-  UINTN                     BootOrderListSize;

-  UINT16                    *BootNext;

-  UINTN                     BootNextSize;

-  BM_MENU_ENTRY             *NewMenuEntry;

-  BM_LOAD_CONTEXT           *NewLoadContext;

-  UINT8                     *LoadOptionPtr;

-  UINTN                     StringSize;

-  UINTN                     OptionalDataSize;

-  UINT8                     *LoadOptionEnd;

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;

-  UINTN                     MenuCount;

-  UINT8                     *Ptr;

-

-  MenuCount         = 0;

-  BootOrderListSize = 0;

-  BootNextSize      = 0;

-  BootOrderList     = NULL;

-  BootNext          = NULL;

-  LoadOptionFromVar = NULL;

-  BOpt_FreeMenu (&BootOptionMenu);

-  InitializeListHead (&BootOptionMenu.Head);

-

-  //

-  // Get the BootOrder from the Var

-  //

-  BootOrderList = BdsLibGetVariableAndSize (

-                    L"BootOrder",

-                    &gEfiGlobalVariableGuid,

-                    &BootOrderListSize

-                    );

-

-  //

-  // Get the BootNext from the Var

-  //

-  BootNext = BdsLibGetVariableAndSize (

-              L"BootNext",

-              &gEfiGlobalVariableGuid,

-              &BootNextSize

-              );

-

-  if (BootNext) {

-    if (BootNextSize != sizeof (UINT16)) {

-      SafeFreePool (BootNext);

-      BootNext = NULL;

-    }

-  }

-

-  for (Index = 0; Index < BootOrderListSize / sizeof (UINT16); Index++) {

-    UnicodeSPrint (BootString, sizeof (BootString), L"Boot%04x", BootOrderList[Index]);

-    //

-    //  Get all loadoptions from the VAR

-    //

-    LoadOptionFromVar = BdsLibGetVariableAndSize (

-                          BootString,

-                          &gEfiGlobalVariableGuid,

-                          &BootOptionSize

-                          );

-    if (!LoadOptionFromVar) {

-      continue;

-    }

-

-    LoadOption = AllocateZeroPool (BootOptionSize);

-    if (!LoadOption) {

-      continue;

-    }

-

-    CopyMem (LoadOption, LoadOptionFromVar, BootOptionSize);

-    SafeFreePool (LoadOptionFromVar);

-

-    if (BootNext) {

-      BootNextFlag = (BOOLEAN) (*BootNext == BootOrderList[Index]);

-    } else {

-      BootNextFlag = FALSE;

-    }

-

-    if (0 == (*((UINT32 *) LoadOption) & LOAD_OPTION_ACTIVE)) {

-      SafeFreePool (LoadOption);

-      continue;

-    }

-    //

-    // BUGBUG: could not return EFI_OUT_OF_RESOURCES here directly.

-    // the buffer allocated already should be freed before returning.

-    //

-    NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT);

-    if (NULL == NewMenuEntry) {

-      return EFI_OUT_OF_RESOURCES;

-    }

-

-    NewLoadContext                      = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;

-

-    LoadOptionPtr                       = LoadOption;

-    LoadOptionEnd                       = LoadOption + BootOptionSize;

-

-    NewMenuEntry->OptionNumber          = BootOrderList[Index];

-    NewLoadContext->LoadOptionModified  = FALSE;

-    NewLoadContext->Deleted             = FALSE;

-    NewLoadContext->IsBootNext          = BootNextFlag;

-

-    //

-    // Is a Legacy Device?

-    //

-    Ptr = (UINT8 *) LoadOption;

-

-    //

-    // Attribute = *(UINT32 *)Ptr;

-    //

-    Ptr += sizeof (UINT32);

-

-    //

-    // FilePathSize = *(UINT16 *)Ptr;

-    //

-    Ptr += sizeof (UINT16);

-

-    //

-    // Description = (CHAR16 *)Ptr;

-    //

-    Ptr += StrSize ((CHAR16 *) Ptr);

-

-    //

-    // Now Ptr point to Device Path

-    //

-    DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) Ptr;

-    if ((BBS_DEVICE_PATH == DevicePath->Type) && (BBS_BBS_DP == DevicePath->SubType)) {

-      NewLoadContext->IsLegacy = TRUE;

-    } else {

-      NewLoadContext->IsLegacy = FALSE;

-    }

-    //

-    // LoadOption is a pointer type of UINT8

-    // for easy use with following LOAD_OPTION

-    // embedded in this struct

-    //

-    NewLoadContext->LoadOption      = LoadOption;

-    NewLoadContext->LoadOptionSize  = BootOptionSize;

-

-    NewLoadContext->Attributes      = *(UINT32 *) LoadOptionPtr;

-    NewLoadContext->IsActive        = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_ACTIVE);

-

-    NewLoadContext->ForceReconnect  = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_FORCE_RECONNECT);

-

-    LoadOptionPtr += sizeof (UINT32);

-

-    NewLoadContext->FilePathListLength = *(UINT16 *) LoadOptionPtr;

-    LoadOptionPtr += sizeof (UINT16);

-

-    StringSize                  = StrSize ((UINT16 *) LoadOptionPtr);

-    NewLoadContext->Description = AllocateZeroPool (StringSize);

-    ASSERT (NewLoadContext->Description != NULL);

-    CopyMem (

-      NewLoadContext->Description,

-      (UINT16 *) LoadOptionPtr,

-      StringSize

-      );

-    NewMenuEntry->DisplayString = NewLoadContext->Description;

-

-    LoadOptionPtr += StringSize;

-

-    NewLoadContext->FilePathList = AllocateZeroPool (NewLoadContext->FilePathListLength);

-    ASSERT (NewLoadContext->FilePathList != NULL);

-    CopyMem (

-      NewLoadContext->FilePathList,

-      (EFI_DEVICE_PATH_PROTOCOL *) LoadOptionPtr,

-      NewLoadContext->FilePathListLength

-      );

-

-    NewMenuEntry->HelpString = DevicePathToStr (NewLoadContext->FilePathList);

-    NewMenuEntry->DisplayStringToken = GetStringTokenFromDepository (

-                                        CallbackData,

-                                        BootOptionStrDepository

-                                        );

-    NewMenuEntry->HelpStringToken = GetStringTokenFromDepository (

-                                      CallbackData,

-                                      BootOptionHelpStrDepository

-                                      );

-    LoadOptionPtr += NewLoadContext->FilePathListLength;

-

-    if (LoadOptionPtr < LoadOptionEnd) {

-      OptionalDataSize = BootOptionSize -

-        sizeof (UINT32) -

-        sizeof (UINT16) -

-        StringSize -

-        NewLoadContext->FilePathListLength;

-

-      NewLoadContext->OptionalData = AllocateZeroPool (OptionalDataSize);

-      ASSERT (NewLoadContext->OptionalData != NULL);

-      CopyMem (

-        NewLoadContext->OptionalData,

-        LoadOptionPtr,

-        OptionalDataSize

-        );

-

-      NewLoadContext->OptionalDataSize = OptionalDataSize;

-    }

-

-    InsertTailList (&BootOptionMenu.Head, &NewMenuEntry->Link);

-    MenuCount++;

-  }

-

-  SafeFreePool (BootNext);

-  SafeFreePool (BootOrderList);

-  BootOptionMenu.MenuNumber = MenuCount;

-  return MenuCount;

-}

-

-CHAR16 *

-BdsStrCpy (

-  OUT     CHAR16                    *Destination,

-  IN      CONST CHAR16              *Source

-  )

-{

-  CHAR16                            *ReturnValue;

-

-  //

-  // Destination cannot be NULL

-  //

-  ASSERT (Destination != NULL);

-

-  ReturnValue = Destination;

-  while (*Source) {

-    *(Destination++) = *(Source++);

-  }

-  *Destination = 0;

-  return ReturnValue;

-}

-

-CHAR16 *

-BOpt_AppendFileName (

-  IN  CHAR16  *Str1,

-  IN  CHAR16  *Str2

-  )

-/*++

-

-Routine Description

-  Append file name to existing file name.

-

-Arguments:

-  Str1  -   existing file name

-  Str2  -   file name to be appended

-

-Returns:

-  Allocate a new string to hold the appended result.

-  Caller is responsible to free the returned string.

-

---*/

-{

-  UINTN   Size1;

-  UINTN   Size2;

-  CHAR16  *Str;

-  CHAR16  *Ptr;

-  CHAR16  *LastSlash;

-

-  Size1 = StrSize (Str1);

-  Size2 = StrSize (Str2);

-  Str   = AllocateZeroPool (Size1 + Size2 + sizeof (CHAR16));

-  ASSERT (Str != NULL);

-

-  StrCat (Str, Str1);

-  if (!((*Str == '\\') && (*(Str + 1) == 0))) {

-    StrCat (Str, L"\\");

-  }

-

-  StrCat (Str, Str2);

-

-  Ptr       = Str;

-  LastSlash = Str;

-  while (*Ptr != 0) {

-    if (*Ptr == '\\' && *(Ptr + 1) == '.' && *(Ptr + 2) == '.' && *(Ptr + 3) != 0) {

-      //

-      // Convert \Name\..\ to \

-      // DO NOT convert the .. if it is at the end of the string. This will

-      // break the .. behavior in changing directories.

-      //

-      BdsStrCpy (LastSlash, Ptr + 3);

-      Ptr = LastSlash;

-    } else if (*Ptr == '\\' && *(Ptr + 1) == '.' && *(Ptr + 2) == '\\') {

-      //

-      // Convert a \.\ to a \

-      //

-      BdsStrCpy (Ptr, Ptr + 2);

-      Ptr = LastSlash;

-    } else if (*Ptr == '\\') {

-      LastSlash = Ptr;

-    }

-

-    Ptr++;

-  }

-

-  return Str;

-}

-

-BOOLEAN

-BOpt_IsEfiImageName (

-  IN UINT16  *FileName

-  )

-/*++

-

-Routine Description

-  Check whether current FileName point to a valid

-  Efi Image File.

-

-Arguments:

-  FileName  -   File need to be checked.

-

-Returns:

-  TRUE  -   Is Efi Image

-  FALSE -   Not a valid Efi Image

-

---*/

-{

-  //

-  // Search for ".efi" extension

-  //

-  while (*FileName) {

-    if (FileName[0] == '.') {

-      if (FileName[1] == 'e' || FileName[1] == 'E') {

-        if (FileName[2] == 'f' || FileName[2] == 'F') {

-          if (FileName[3] == 'i' || FileName[3] == 'I') {

-            return TRUE;

-          } else if (FileName[3] == 0x0000) {

-            return FALSE;

-          }

-        } else if (FileName[2] == 0x0000) {

-          return FALSE;

-        }

-      } else if (FileName[1] == 0x0000) {

-        return FALSE;

-      }

-    }

-

-    FileName += 1;

-  }

-

-  return FALSE;

-}

-

-

-RETURN_STATUS

-EFIAPI

-IsEfiAppReadFromFile (

-  IN     VOID    *FileHandle,

-  IN     UINTN   FileOffset,

-  IN OUT UINTN   *ReadSize,

-  OUT    VOID    *Buffer

-  )

-{

-  EFI_STATUS        Status;

-  EFI_FILE_HANDLE   File;

-

-  File = (EFI_FILE_HANDLE)FileHandle;

-  Status = File->SetPosition (File, FileOffset);

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  return File->Read (File, ReadSize, Buffer);

-}

-

-

-

-BOOLEAN

-BOpt_IsEfiApp (

-  IN EFI_FILE_HANDLE Dir,

-  IN UINT16          *FileName

-  )

-/*++

-

-Routine Description:

-  Check whether current FileName point to a valid Efi Application

-

-Arguments:

-  Dir       -   Pointer to current Directory

-  FileName  -   Pointer to current File name.

-

-Returns:

-  TRUE      -   Is a valid Efi Application

-  FALSE     -   not a valid Efi Application

-

---*/

-{

-  EFI_STATUS                            Status;

-  PE_COFF_LOADER_IMAGE_CONTEXT          ImageContext;

-  EFI_FILE_HANDLE                       File;

-

-  Status = Dir->Open (Dir, &File, FileName, EFI_FILE_MODE_READ, 0);

-  if (EFI_ERROR (Status)) {

-    return FALSE;

-  }

-

-  ZeroMem (&ImageContext, sizeof (ImageContext));

-  ImageContext.Handle    = (VOID *)File;

-  ImageContext.ImageRead = IsEfiAppReadFromFile;

-

-  Status = PeCoffLoaderGetImageInfo (&ImageContext);

-  File->Close (File);

-  if (EFI_ERROR (Status)) {

-    return FALSE;

-  }

-

-  if (ImageContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION) {

-    return TRUE;

-  } else {

-    return FALSE;

-  }

- }

-

-

-EFI_STATUS

-BOpt_FindDrivers (

-  VOID

-  )

-/*++

-

-Routine Description

-  Find drivers that will be added as Driver#### variables from handles

-  in current system environment

-  All valid handles in the system except those consume SimpleFs, LoadFile

-  are stored in DriverMenu for future use.

-

-Arguments:

-  None

-

-Returns:

-  EFI_SUCCESS

-  Others

-

---*/

-{

-  UINTN                           NoDevicePathHandles;

-  EFI_HANDLE                      *DevicePathHandle;

-  UINTN                           Index;

-  EFI_STATUS                      Status;

-  BM_MENU_ENTRY                   *NewMenuEntry;

-  BM_HANDLE_CONTEXT               *NewHandleContext;

-  EFI_HANDLE                      CurHandle;

-  UINTN                           OptionNumber;

-  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFs;

-  EFI_LOAD_FILE_PROTOCOL          *LoadFile;

-

-  SimpleFs  = NULL;

-  LoadFile  = NULL;

-

-  InitializeListHead (&DriverMenu.Head);

-

-  //

-  // At first, get all handles that support Device Path

-  // protocol which is the basic requirement for

-  // Driver####

-  //

-  Status = gBS->LocateHandleBuffer (

-                  ByProtocol,

-                  &gEfiDevicePathProtocolGuid,

-                  NULL,

-                  &NoDevicePathHandles,

-                  &DevicePathHandle

-                  );

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  OptionNumber = 0;

-  for (Index = 0; Index < NoDevicePathHandles; Index++) {

-    CurHandle = DevicePathHandle[Index];

-

-    //

-    //  Check whether this handle support

-    //  driver binding

-    //

-    Status = gBS->HandleProtocol (

-                    CurHandle,

-                    &gEfiSimpleFileSystemProtocolGuid,

-                    &SimpleFs

-                    );

-    if (Status == EFI_SUCCESS) {

-      continue;

-    }

-

-    Status = gBS->HandleProtocol (

-                    CurHandle,

-                    &gEfiLoadFileProtocolGuid,

-                    &LoadFile

-                    );

-    if (Status == EFI_SUCCESS) {

-      continue;

-    }

-

-    NewMenuEntry = BOpt_CreateMenuEntry (BM_HANDLE_CONTEXT_SELECT);

-    if (NULL == NewMenuEntry) {

-      return EFI_OUT_OF_RESOURCES;

-    }

-

-    NewHandleContext              = (BM_HANDLE_CONTEXT *) NewMenuEntry->VariableContext;

-    NewHandleContext->Handle      = CurHandle;

-    NewHandleContext->DevicePath  = DevicePathFromHandle (CurHandle);

-    NewMenuEntry->DisplayString = DevicePathToStr (NewHandleContext->DevicePath);

-    NewMenuEntry->HelpString    = NULL;

-    NewMenuEntry->OptionNumber  = OptionNumber;

-    OptionNumber++;

-    InsertTailList (&DriverMenu.Head, &NewMenuEntry->Link);

-

-  }

-

-  DriverMenu.MenuNumber = OptionNumber;

-  return EFI_SUCCESS;

-}

-

-UINT16

-BOpt_GetBootOptionNumber (

-  VOID

-  )

-/*++

-

-Routine Description:

-  Get the Option Number that does not used

-

-Arguments:

-

-Returns:

-  The Option Number

-

---*/

-{

-  BM_MENU_ENTRY *NewMenuEntry;

-  UINT16        *BootOrderList;

-  UINTN         BootOrderListSize;

-  UINT16        Number;

-  UINTN         Index;

-  UINTN         Index2;

-  BOOLEAN       Found;

-  CHAR16        StrTemp[100];

-  UINT16        *OptionBuffer;

-  UINTN         OptionSize;

-

-  BootOrderListSize = 0;

-  BootOrderList     = NULL;

-

-  BootOrderList = BdsLibGetVariableAndSize (

-                    L"BootOrder",

-                    &gEfiGlobalVariableGuid,

-                    &BootOrderListSize

-                    );

-  if (BootOrderList) {

-    //

-    // already have Boot####

-    //

-    // AlreadyBootNumbers = BootOrderListSize / sizeof(UINT16);

-    //

-    for (Index = 0; Index < BootOrderListSize / sizeof (UINT16); Index++) {

-      Found = TRUE;

-      for (Index2 = 0; Index2 < BootOptionMenu.MenuNumber; Index2++) {

-        NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index2);

-        if (Index == NewMenuEntry->OptionNumber) {

-          Found = FALSE;

-          break;

-        }

-      }

-

-      if (Found) {

-  	   UnicodeSPrint (StrTemp, 100, L"Boot%04x", Index);

-  	   DEBUG((EFI_D_ERROR,"INdex= %s\n", StrTemp));

-       OptionBuffer = BdsLibGetVariableAndSize (

-                StrTemp,

-                &gEfiGlobalVariableGuid,

-                &OptionSize

-                );

-      if (NULL == OptionBuffer)

-        break;

-      }

-    }

-    //

-    // end for Index

-    //

-    Number = (UINT16) Index;

-  } else {

-    //

-    // No Boot####

-    //

-    Number = 0;

-  }

-

-  return Number;

-}

-

-UINT16

-BOpt_GetDriverOptionNumber (

-  VOID

-  )

-/*++

-

-Routine Description:

-  Get the Option Number that does not used

-

-Arguments:

-

-Returns:

-  The Option Number

-

---*/

-{

-  BM_MENU_ENTRY *NewMenuEntry;

-  UINT16        *DriverOrderList;

-  UINTN         DriverOrderListSize;

-  UINT16        Number;

-  UINTN         Index;

-  UINTN         Index2;

-  BOOLEAN       Found;

-

-  DriverOrderListSize = 0;

-  DriverOrderList     = NULL;

-

-  DriverOrderList = BdsLibGetVariableAndSize (

-                      L"DriverOrder",

-                      &gEfiGlobalVariableGuid,

-                      &DriverOrderListSize

-                      );

-  if (DriverOrderList) {

-    //

-    // already have Driver####

-    //

-    // AlreadyDriverNumbers = DriverOrderListSize / sizeof(UINT16);

-    //

-    for (Index = 0; Index < DriverOrderListSize / sizeof (UINT16); Index++) {

-      Found = TRUE;

-      for (Index2 = 0; Index2 < DriverOptionMenu.MenuNumber; Index2++) {

-        NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index2);

-        if (Index == NewMenuEntry->OptionNumber) {

-          Found = FALSE;

-          break;

-        }

-      }

-

-      if (Found) {

-        break;

-      }

-    }

-    //

-    // end for Index

-    //

-    Number = (UINT16) Index;

-  } else {

-    //

-    // No Driver####

-    //

-    Number = 0;

-  }

-

-  return Number;

-}

-

-EFI_STATUS

-BOpt_GetDriverOptions (

-  IN  BMM_CALLBACK_DATA         *CallbackData

-  )

-/*++

-

-Routine Description:

-  Build up all DriverOptionMenu

-

-Arguments:

-

-Returns:

-  The Option Number

-

---*/

-{

-  UINTN           Index;

-  UINT16          DriverString[12];

-  UINT8           *LoadOptionFromVar;

-  UINT8           *LoadOption;

-  UINTN           DriverOptionSize;

-

-  UINT16          *DriverOrderList;

-  UINTN           DriverOrderListSize;

-  BM_MENU_ENTRY   *NewMenuEntry;

-  BM_LOAD_CONTEXT *NewLoadContext;

-  UINT8           *LoadOptionPtr;

-  UINTN           StringSize;

-  UINTN           OptionalDataSize;

-  UINT8           *LoadOptionEnd;

-

-  DriverOrderListSize = 0;

-  DriverOrderList     = NULL;

-  DriverOptionSize    = 0;

-  LoadOptionFromVar   = NULL;

-  BOpt_FreeMenu (&DriverOptionMenu);

-  InitializeListHead (&DriverOptionMenu.Head);

-  //

-  // Get the DriverOrder from the Var

-  //

-  DriverOrderList = BdsLibGetVariableAndSize (

-                      L"DriverOrder",

-                      &gEfiGlobalVariableGuid,

-                      &DriverOrderListSize

-                      );

-

-  for (Index = 0; Index < DriverOrderListSize / sizeof (UINT16); Index++) {

-    UnicodeSPrint (

-      DriverString,

-      sizeof (DriverString),

-      L"Driver%04x",

-      DriverOrderList[Index]

-      );

-    //

-    //  Get all loadoptions from the VAR

-    //

-    LoadOptionFromVar = BdsLibGetVariableAndSize (

-                          DriverString,

-                          &gEfiGlobalVariableGuid,

-                          &DriverOptionSize

-                          );

-    if (!LoadOptionFromVar) {

-      continue;

-    }

-

-    LoadOption = AllocateZeroPool (DriverOptionSize);

-    if (!LoadOption) {

-      continue;

-    }

-

-    CopyMem (LoadOption, LoadOptionFromVar, DriverOptionSize);

-    SafeFreePool (LoadOptionFromVar);

-

-    NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT);

-    if (NULL == NewMenuEntry) {

-      return EFI_OUT_OF_RESOURCES;

-    }

-

-    NewLoadContext                      = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;

-    LoadOptionPtr                       = LoadOption;

-    LoadOptionEnd                       = LoadOption + DriverOptionSize;

-    NewMenuEntry->OptionNumber          = DriverOrderList[Index];

-    NewLoadContext->LoadOptionModified  = FALSE;

-    NewLoadContext->Deleted             = FALSE;

-    NewLoadContext->IsLegacy            = FALSE;

-

-    //

-    // LoadOption is a pointer type of UINT8

-    // for easy use with following LOAD_OPTION

-    // embedded in this struct

-    //

-    NewLoadContext->LoadOption      = LoadOption;

-    NewLoadContext->LoadOptionSize  = DriverOptionSize;

-

-    NewLoadContext->Attributes      = *(UINT32 *) LoadOptionPtr;

-    NewLoadContext->IsActive        = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_ACTIVE);

-

-    NewLoadContext->ForceReconnect  = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_FORCE_RECONNECT);

-

-    LoadOptionPtr += sizeof (UINT32);

-

-    NewLoadContext->FilePathListLength = *(UINT16 *) LoadOptionPtr;

-    LoadOptionPtr += sizeof (UINT16);

-

-    StringSize                  = StrSize ((UINT16 *) LoadOptionPtr);

-    NewLoadContext->Description = AllocateZeroPool (StringSize);

-    ASSERT (NewLoadContext->Description != NULL);

-    CopyMem (

-      NewLoadContext->Description,

-      (UINT16 *) LoadOptionPtr,

-      StringSize

-      );

-    NewMenuEntry->DisplayString = NewLoadContext->Description;

-

-    LoadOptionPtr += StringSize;

-

-    NewLoadContext->FilePathList = AllocateZeroPool (NewLoadContext->FilePathListLength);

-    ASSERT (NewLoadContext->FilePathList != NULL);

-    CopyMem (

-      NewLoadContext->FilePathList,

-      (EFI_DEVICE_PATH_PROTOCOL *) LoadOptionPtr,

-      NewLoadContext->FilePathListLength

-      );

-

-    NewMenuEntry->HelpString = DevicePathToStr (NewLoadContext->FilePathList);

-    NewMenuEntry->DisplayStringToken = GetStringTokenFromDepository (

-                                        CallbackData,

-                                        DriverOptionStrDepository

-                                        );

-    NewMenuEntry->HelpStringToken = GetStringTokenFromDepository (

-                                      CallbackData,

-                                      DriverOptionHelpStrDepository

-                                      );

-    LoadOptionPtr += NewLoadContext->FilePathListLength;

-

-    if (LoadOptionPtr < LoadOptionEnd) {

-      OptionalDataSize = DriverOptionSize -

-        sizeof (UINT32) -

-        sizeof (UINT16) -

-        StringSize -

-        NewLoadContext->FilePathListLength;

-

-      NewLoadContext->OptionalData = AllocateZeroPool (OptionalDataSize);

-      ASSERT (NewLoadContext->OptionalData != NULL);

-      CopyMem (

-        NewLoadContext->OptionalData,

-        LoadOptionPtr,

-        OptionalDataSize

-        );

-

-      NewLoadContext->OptionalDataSize = OptionalDataSize;

-    }

-

-    InsertTailList (&DriverOptionMenu.Head, &NewMenuEntry->Link);

-

-  }

-

-  SafeFreePool (DriverOrderList);

-  DriverOptionMenu.MenuNumber = Index;

-  return EFI_SUCCESS;

-

-}

-

-VOID

-SafeFreePool (

-  IN VOID    *Buffer

-  )

-/*++

-

-Routine Description:

-  Wrap original FreePool gBS call

-  in order to decrease code length

-

-Arguments:

-

-Returns:

-

---*/

-{

-  if (Buffer != NULL) {

-    FreePool (Buffer);

-    Buffer = NULL;

-  }

-}

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/ConsoleOption.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/ConsoleOption.c
deleted file mode 100644
index 7a62765..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/ConsoleOption.c
+++ /dev/null
@@ -1,841 +0,0 @@
-/*++

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-    ConsoleOption.c

-    

-Abstract:

-

-    handles console redirection from boot manager

-

-

-Revision History

-

---*/

-

-#include "BootMaint.h"

-

-EFI_DEVICE_PATH_PROTOCOL  *

-DevicePathInstanceDup (

-  IN EFI_DEVICE_PATH_PROTOCOL  *DevPath

-  );

-

-EFI_STATUS

-UpdateComAttributeFromVariable (

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath

-  );

-

-EFI_STATUS

-ChangeTerminalDevicePath (

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath,

-  BOOLEAN                   ChangeTerminal

-  )

-{

-  EFI_DEVICE_PATH_PROTOCOL  *Node;

-  EFI_DEVICE_PATH_PROTOCOL  *Node1;

-  ACPI_HID_DEVICE_PATH      *Acpi;

-  UART_DEVICE_PATH          *Uart;

-  UART_DEVICE_PATH          *Uart1;

-  UINTN                     Com;

-  UINT32                    Match;

-  BM_TERMINAL_CONTEXT       *NewTerminalContext;

-  BM_MENU_ENTRY             *NewMenuEntry;

-

-  Match = EISA_PNP_ID (0x0501);

-  Node  = DevicePath;

-  Node  = NextDevicePathNode (Node);

-  Com   = 0;

-  while (!IsDevicePathEnd (Node)) {

-    if ((DevicePathType (Node) == ACPI_DEVICE_PATH) && (DevicePathSubType (Node) == ACPI_DP)) {

-      Acpi = (ACPI_HID_DEVICE_PATH *) Node;

-      if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {

-        CopyMem (&Com, &Acpi->UID, sizeof (UINT32));

-      }

-    }

-

-    NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Com);

-    if (NULL == NewMenuEntry) {

-      return EFI_NOT_FOUND;

-    }

-

-    NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;

-    if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {

-      Uart = (UART_DEVICE_PATH *) Node;

-      CopyMem (

-        &Uart->BaudRate,

-        &NewTerminalContext->BaudRate,

-        sizeof (UINT64)

-        );

-

-      CopyMem (

-        &Uart->DataBits,

-        &NewTerminalContext->DataBits,

-        sizeof (UINT8)

-        );

-

-      CopyMem (

-        &Uart->Parity,

-        &NewTerminalContext->Parity,

-        sizeof (UINT8)

-        );

-

-      CopyMem (

-        &Uart->StopBits,

-        &NewTerminalContext->StopBits,

-        sizeof (UINT8)

-        );

-      //

-      // Change the device path in the ComPort

-      //

-      if (ChangeTerminal) {

-        Node1 = NewTerminalContext->DevicePath;

-        Node1 = NextDevicePathNode (Node1);

-        while (!IsDevicePathEnd (Node1)) {

-          if ((DevicePathType (Node1) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node1) == MSG_UART_DP)) {

-            Uart1 = (UART_DEVICE_PATH *) Node1;

-            CopyMem (

-              &Uart1->BaudRate,

-              &NewTerminalContext->BaudRate,

-              sizeof (UINT64)

-              );

-

-            CopyMem (

-              &Uart1->DataBits,

-              &NewTerminalContext->DataBits,

-              sizeof (UINT8)

-              );

-

-            CopyMem (

-              &Uart1->Parity,

-              &NewTerminalContext->Parity,

-              sizeof (UINT8)

-              );

-

-            CopyMem (

-              &Uart1->StopBits,

-              &NewTerminalContext->StopBits,

-              sizeof (UINT8)

-              );

-            break;

-          }

-          //

-          // end if

-          //

-          Node1 = NextDevicePathNode (Node1);

-        }

-        //

-        // end while

-        //

-        break;

-      }

-    }

-

-    Node = NextDevicePathNode (Node);

-  }

-

-  return EFI_SUCCESS;

-

-}

-

-VOID

-ChangeVariableDevicePath (

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath

-  )

-{

-  EFI_DEVICE_PATH_PROTOCOL  *Node;

-  ACPI_HID_DEVICE_PATH      *Acpi;

-  UART_DEVICE_PATH          *Uart;

-  UINTN                     Com;

-  UINT32                    Match;

-  BM_TERMINAL_CONTEXT       *NewTerminalContext;

-  BM_MENU_ENTRY             *NewMenuEntry;

-

-  Match = EISA_PNP_ID (0x0501);

-  Node  = DevicePath;

-  Node  = NextDevicePathNode (Node);

-  Com   = 0;

-  while (!IsDevicePathEnd (Node)) {

-    if ((DevicePathType (Node) == ACPI_DEVICE_PATH) && (DevicePathSubType (Node) == ACPI_DP)) {

-      Acpi = (ACPI_HID_DEVICE_PATH *) Node;

-      if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {

-        CopyMem (&Com, &Acpi->UID, sizeof (UINT32));

-      }

-    }

-

-    if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {

-      NewMenuEntry = BOpt_GetMenuEntry (

-                      &TerminalMenu,

-                      Com

-                      );

-      ASSERT (NewMenuEntry != NULL);

-      NewTerminalContext  = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;

-      Uart                = (UART_DEVICE_PATH *) Node;

-      CopyMem (

-        &Uart->BaudRate,

-        &NewTerminalContext->BaudRate,

-        sizeof (UINT64)

-        );

-

-      CopyMem (

-        &Uart->DataBits,

-        &NewTerminalContext->DataBits,

-        sizeof (UINT8)

-        );

-

-      CopyMem (

-        &Uart->Parity,

-        &NewTerminalContext->Parity,

-        sizeof (UINT8)

-        );

-

-      CopyMem (

-        &Uart->StopBits,

-        &NewTerminalContext->StopBits,

-        sizeof (UINT8)

-        );

-    }

-

-    Node = NextDevicePathNode (Node);

-  }

-

-  return ;

-}

-

-BOOLEAN

-IsTerminalDevicePath (

-  IN  EFI_DEVICE_PATH_PROTOCOL *DevicePath,

-  OUT TYPE_OF_TERMINAL         *Termi,

-  OUT UINTN                    *Com

-  );

-

-EFI_STATUS

-LocateSerialIo (

-  VOID

-  )

-/*++

-

-Routine Description:

-  Build a list containing all serial devices 

-  

-Arguments:

-  

-Returns:

-  

---*/

-{

-  UINT8                     *Ptr;

-  UINTN                     Index;

-  UINTN                     Index2;

-  UINTN                     NoHandles;

-  EFI_HANDLE                *Handles;

-  EFI_STATUS                Status;

-  ACPI_HID_DEVICE_PATH      *Acpi;

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;

-  UINT32                    Match;

-  EFI_SERIAL_IO_PROTOCOL    *SerialIo;

-  EFI_DEVICE_PATH_PROTOCOL  *OutDevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  *InpDevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  *ErrDevicePath;

-  BM_MENU_ENTRY             *NewMenuEntry;

-  BM_TERMINAL_CONTEXT       *NewTerminalContext;

-  EFI_DEVICE_PATH_PROTOCOL  *NewDevicePath;

-  VENDOR_DEVICE_PATH        Vendor;

-  //

-  // Get all handles that have SerialIo protocol installed

-  //

-  InitializeListHead (&TerminalMenu.Head);

-  TerminalMenu.MenuNumber = 0;

-  Status = gBS->LocateHandleBuffer (

-                  ByProtocol,

-                  &gEfiSerialIoProtocolGuid,

-                  NULL,

-                  &NoHandles,

-                  &Handles

-                  );

-  if (EFI_ERROR (Status)) {

-    //

-    // No serial ports present

-    //

-    return EFI_UNSUPPORTED;

-  }

-

-  for (Index = 0; Index < NoHandles; Index++) {

-    //

-    // Check to see whether the handle has DevicePath Protocol installed

-    //

-    gBS->HandleProtocol (

-          Handles[Index],

-          &gEfiDevicePathProtocolGuid,

-          &DevicePath

-          );

-    Ptr = (UINT8 *) DevicePath;

-    while (*Ptr != END_DEVICE_PATH_TYPE) {

-      Ptr++;

-    }

-

-    Ptr   = Ptr - sizeof (UART_DEVICE_PATH) - sizeof (ACPI_HID_DEVICE_PATH);

-    Acpi  = (ACPI_HID_DEVICE_PATH *) Ptr;

-    Match = EISA_PNP_ID (0x0501);

-

-    if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {

-      NewMenuEntry = BOpt_CreateMenuEntry (BM_TERMINAL_CONTEXT_SELECT);

-      if (!NewMenuEntry) {

-        return EFI_OUT_OF_RESOURCES;

-      }

-

-      NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;

-      CopyMem (&NewMenuEntry->OptionNumber, &Acpi->UID, sizeof (UINT32));

-      NewTerminalContext->DevicePath = DevicePathInstanceDup (DevicePath);

-      //

-      // BugBug: I have no choice, calling EfiLibStrFromDatahub will hang the system!

-      // coz' the misc data for each platform is not correct, actually it's the device path stored in

-      // datahub which is not completed, so a searching for end of device path will enter a

-      // dead-loop.

-      //

-      NewMenuEntry->DisplayString = EfiLibStrFromDatahub (DevicePath);

-      if (NULL == NewMenuEntry->DisplayString) {

-        NewMenuEntry->DisplayString = DevicePathToStr (DevicePath);

-      }

-

-      NewMenuEntry->HelpString = NULL;

-

-      gBS->HandleProtocol (

-            Handles[Index],

-            &gEfiSerialIoProtocolGuid,

-            &SerialIo

-            );

-

-      CopyMem (

-        &NewTerminalContext->BaudRate,

-        &SerialIo->Mode->BaudRate,

-        sizeof (UINT64)

-        );

-

-      CopyMem (

-        &NewTerminalContext->DataBits,

-        &SerialIo->Mode->DataBits,

-        sizeof (UINT8)

-        );

-

-      CopyMem (

-        &NewTerminalContext->Parity,

-        &SerialIo->Mode->Parity,

-        sizeof (UINT8)

-        );

-

-      CopyMem (

-        &NewTerminalContext->StopBits,

-        &SerialIo->Mode->StopBits,

-        sizeof (UINT8)

-        );

-      InsertTailList (&TerminalMenu.Head, &NewMenuEntry->Link);

-      TerminalMenu.MenuNumber++;

-    }

-  }

-  //

-  // Get L"ConOut", L"ConIn" and L"ErrOut" from the Var

-  //

-  OutDevicePath = EfiLibGetVariable (L"ConOut", &gEfiGlobalVariableGuid);

-  InpDevicePath = EfiLibGetVariable (L"ConIn", &gEfiGlobalVariableGuid);

-  ErrDevicePath = EfiLibGetVariable (L"ErrOut", &gEfiGlobalVariableGuid);

-  if (OutDevicePath) {

-    UpdateComAttributeFromVariable (OutDevicePath);

-  }

-

-  if (InpDevicePath) {

-    UpdateComAttributeFromVariable (InpDevicePath);

-  }

-

-  if (ErrDevicePath) {

-    UpdateComAttributeFromVariable (ErrDevicePath);

-  }

-

-  for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {

-    NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);

-    if (NULL == NewMenuEntry) {

-      return EFI_NOT_FOUND;

-    }

-

-    NewTerminalContext                = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;

-

-    NewTerminalContext->TerminalType  = 0;

-    NewTerminalContext->IsConIn       = FALSE;

-    NewTerminalContext->IsConOut      = FALSE;

-    NewTerminalContext->IsStdErr      = FALSE;

-

-    Vendor.Header.Type                = MESSAGING_DEVICE_PATH;

-    Vendor.Header.SubType             = MSG_VENDOR_DP;

-

-    for (Index2 = 0; Index2 < 4; Index2++) {

-      CopyMem (&Vendor.Guid, &Guid[Index2], sizeof (EFI_GUID));

-      SetDevicePathNodeLength (&Vendor.Header, sizeof (VENDOR_DEVICE_PATH));

-      NewDevicePath = AppendDevicePathNode (

-                        NewTerminalContext->DevicePath,

-                        (EFI_DEVICE_PATH_PROTOCOL *) &Vendor

-                        );

-      SafeFreePool (NewMenuEntry->HelpString);

-      //

-      // NewMenuEntry->HelpString = DevicePathToStr (NewDevicePath);

-      // NewMenuEntry->DisplayString = NewMenuEntry->HelpString;

-      //

-      NewMenuEntry->HelpString = NULL;

-

-      if (BdsLibMatchDevicePaths (OutDevicePath, NewDevicePath)) {

-        NewTerminalContext->IsConOut      = TRUE;

-        NewTerminalContext->TerminalType  = (UINT8) Index2;

-      }

-

-      if (BdsLibMatchDevicePaths (InpDevicePath, NewDevicePath)) {

-        NewTerminalContext->IsConIn       = TRUE;

-        NewTerminalContext->TerminalType  = (UINT8) Index2;

-      }

-

-      if (BdsLibMatchDevicePaths (ErrDevicePath, NewDevicePath)) {

-        NewTerminalContext->IsStdErr      = TRUE;

-        NewTerminalContext->TerminalType  = (UINT8) Index2;

-      }

-    }

-  }

-

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-UpdateComAttributeFromVariable (

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath

-  )

-/*++

-

-Routine Description:

-  Update Com Ports attributes from DevicePath

-  

-Arguments:

-  DevicePath  -   DevicePath that contains Com ports

-  

-Returns:

-  

---*/

-{

-  EFI_DEVICE_PATH_PROTOCOL  *Node;

-  EFI_DEVICE_PATH_PROTOCOL  *SerialNode;

-  ACPI_HID_DEVICE_PATH      *Acpi;

-  UART_DEVICE_PATH          *Uart;

-  UART_DEVICE_PATH          *Uart1;

-  UINT32                    Match;

-  UINTN                     TerminalNumber;

-  BM_MENU_ENTRY             *NewMenuEntry;

-  BM_TERMINAL_CONTEXT       *NewTerminalContext;

-  UINTN                     Index;

-

-  Match           = EISA_PNP_ID (0x0501);

-  Node            = DevicePath;

-  Node            = NextDevicePathNode (Node);

-  TerminalNumber  = 0;

-  for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {

-    while (!IsDevicePathEnd (Node)) {

-      if ((DevicePathType (Node) == ACPI_DEVICE_PATH) && (DevicePathSubType (Node) == ACPI_DP)) {

-        Acpi = (ACPI_HID_DEVICE_PATH *) Node;

-        if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {

-          CopyMem (&TerminalNumber, &Acpi->UID, sizeof (UINT32));

-        }

-      }

-

-      if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {

-        Uart          = (UART_DEVICE_PATH *) Node;

-        NewMenuEntry  = BOpt_GetMenuEntry (&TerminalMenu, TerminalNumber);

-        if (NULL == NewMenuEntry) {

-          return EFI_NOT_FOUND;

-        }

-

-        NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;

-        CopyMem (

-          &NewTerminalContext->BaudRate,

-          &Uart->BaudRate,

-          sizeof (UINT64)

-          );

-

-        CopyMem (

-          &NewTerminalContext->DataBits,

-          &Uart->DataBits,

-          sizeof (UINT8)

-          );

-

-        CopyMem (

-          &NewTerminalContext->Parity,

-          &Uart->Parity,

-          sizeof (UINT8)

-          );

-

-        CopyMem (

-          &NewTerminalContext->StopBits,

-          &Uart->StopBits,

-          sizeof (UINT8)

-          );

-

-        SerialNode  = NewTerminalContext->DevicePath;

-        SerialNode  = NextDevicePathNode (SerialNode);

-        while (!IsDevicePathEnd (SerialNode)) {

-          if ((DevicePathType (SerialNode) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (SerialNode) == MSG_UART_DP)) {

-            //

-            // Update following device paths according to

-            // previous acquired uart attributes

-            //

-            Uart1 = (UART_DEVICE_PATH *) SerialNode;

-            CopyMem (

-              &Uart1->BaudRate,

-              &NewTerminalContext->BaudRate,

-              sizeof (UINT64)

-              );

-

-            CopyMem (

-              &Uart1->DataBits,

-              &NewTerminalContext->DataBits,

-              sizeof (UINT8)

-              );

-            CopyMem (

-              &Uart1->Parity,

-              &NewTerminalContext->Parity,

-              sizeof (UINT8)

-              );

-            CopyMem (

-              &Uart1->StopBits,

-              &NewTerminalContext->StopBits,

-              sizeof (UINT8)

-              );

-

-            break;

-          }

-

-          SerialNode = NextDevicePathNode (SerialNode);

-        }

-        //

-        // end while

-        //

-      }

-

-      Node = NextDevicePathNode (Node);

-    }

-    //

-    // end while

-    //

-  }

-

-  return EFI_SUCCESS;

-}

-

-EFI_DEVICE_PATH_PROTOCOL *

-DevicePathInstanceDup (

-  IN EFI_DEVICE_PATH_PROTOCOL  *DevPath

-  )

-/*++

-

-Routine Description:

-  Function creates a device path data structure that identically matches the 

-  device path passed in.

-

-Arguments:

-  DevPath      - A pointer to a device path data structure.

-

-Returns:

-

-  The new copy of DevPath is created to identically match the input.  

-  Otherwise, NULL is returned.

-

---*/

-{

-  EFI_DEVICE_PATH_PROTOCOL  *NewDevPath;

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePathInst;

-  EFI_DEVICE_PATH_PROTOCOL  *Temp;

-  UINT8                     *Ptr;

-  UINTN                     Size;

-

-  //

-  // get the size of an instance from the input

-  //

-  Temp            = DevPath;

-  DevicePathInst  = GetNextDevicePathInstance (&Temp, &Size);

-

-  //

-  // Make a copy and set proper end type

-  //

-  NewDevPath = NULL;

-  if (Size) {

-    NewDevPath = AllocateZeroPool (Size);

-    ASSERT (NewDevPath != NULL);

-  }

-

-  if (NewDevPath) {

-    CopyMem (NewDevPath, DevicePathInst, Size);

-    Ptr = (UINT8 *) NewDevPath;

-    Ptr += Size - sizeof (EFI_DEVICE_PATH_PROTOCOL);

-    Temp = (EFI_DEVICE_PATH_PROTOCOL *) Ptr;

-    SetDevicePathEndNode (Temp);

-  }

-

-  return NewDevPath;

-}

-

-EFI_STATUS

-GetConsoleMenu (

-  IN UINTN              ConsoleMenuType

-  )

-{

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  *AllDevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  *MultiDevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePathInst;

-  UINTN                     Size;

-  UINTN                     AllCount;

-  UINTN                     Index;

-  UINTN                     Index2;

-  BM_MENU_ENTRY             *NewMenuEntry;

-  BM_CONSOLE_CONTEXT        *NewConsoleContext;

-  BM_TERMINAL_CONTEXT       *NewTerminalContext;

-  TYPE_OF_TERMINAL          Terminal;

-  BM_MENU_ENTRY             *NewTerminalMenuEntry;

-  UINTN                     Com;

-  BM_MENU_OPTION            *ConsoleMenu;

-

-  DevicePath    = NULL;

-  AllDevicePath = NULL;

-  AllCount      = 0;

-  switch (ConsoleMenuType) {

-  case BM_CONSOLE_IN_CONTEXT_SELECT:

-    ConsoleMenu = &ConsoleInpMenu;

-    DevicePath = EfiLibGetVariable (

-                  L"ConIn",

-                  &gEfiGlobalVariableGuid

-                  );

-

-    AllDevicePath = EfiLibGetVariable (

-                      L"ConInDev",

-                      &gEfiGlobalVariableGuid

-                      );

-    break;

-

-  case BM_CONSOLE_OUT_CONTEXT_SELECT:

-    ConsoleMenu = &ConsoleOutMenu;

-    DevicePath = EfiLibGetVariable (

-                  L"ConOut",

-                  &gEfiGlobalVariableGuid

-                  );

-

-    AllDevicePath = EfiLibGetVariable (

-                      L"ConOutDev",

-                      &gEfiGlobalVariableGuid

-                      );

-    break;

-

-  case BM_CONSOLE_ERR_CONTEXT_SELECT:

-    ConsoleMenu = &ConsoleErrMenu;

-    DevicePath = EfiLibGetVariable (

-                  L"ErrOut",

-                  &gEfiGlobalVariableGuid

-                  );

-

-    AllDevicePath = EfiLibGetVariable (

-                      L"ErrOutDev",

-                      &gEfiGlobalVariableGuid

-                      );

-    break;

-

-  default:

-    return EFI_UNSUPPORTED;

-  }

-

-  if (NULL == AllDevicePath) {

-    return EFI_NOT_FOUND;

-  }

-

-  InitializeListHead (&ConsoleMenu->Head);

-

-  AllCount                = EfiDevicePathInstanceCount (AllDevicePath);

-  ConsoleMenu->MenuNumber = 0;

-  //

-  // Following is menu building up for Console Out Devices

-  //

-  MultiDevicePath = AllDevicePath;

-  Index2          = 0;

-  for (Index = 0; Index < AllCount; Index++) {

-    DevicePathInst  = GetNextDevicePathInstance (&MultiDevicePath, &Size);

-

-    NewMenuEntry    = BOpt_CreateMenuEntry (BM_CONSOLE_CONTEXT_SELECT);

-    if (NULL == NewMenuEntry) {

-      return EFI_OUT_OF_RESOURCES;

-    }

-

-    NewConsoleContext             = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;

-    NewMenuEntry->OptionNumber    = Index2;

-

-    NewConsoleContext->DevicePath = DevicePathInstanceDup (DevicePathInst);

-    NewMenuEntry->DisplayString   = EfiLibStrFromDatahub (NewConsoleContext->DevicePath);

-    if (NULL == NewMenuEntry->DisplayString) {

-      NewMenuEntry->DisplayString = DevicePathToStr (NewConsoleContext->DevicePath);

-    }

-

-    NewConsoleContext->IsTerminal = IsTerminalDevicePath (

-                                      NewConsoleContext->DevicePath,

-                                      &Terminal,

-                                      &Com

-                                      );

-

-    NewConsoleContext->IsActive = BdsLibMatchDevicePaths (

-                                    DevicePath,

-                                    NewConsoleContext->DevicePath

-                                    );

-    NewTerminalMenuEntry  = NULL;

-    NewTerminalContext    = NULL;

-

-    if (NewConsoleContext->IsTerminal) {

-      BOpt_DestroyMenuEntry (NewMenuEntry);

-    } else {

-      Index2++;

-      ConsoleMenu->MenuNumber++;

-      InsertTailList (&ConsoleMenu->Head, &NewMenuEntry->Link);

-    }

-  }

-

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-GetAllConsoles (

-  VOID

-  )

-/*++

-

-Routine Description:

-  Build up ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu

-

-Arguments:

-  

-Returns:

-  EFI_SUCCESS 

-  Others

-  

---*/

-{

-  GetConsoleMenu (BM_CONSOLE_IN_CONTEXT_SELECT);

-  GetConsoleMenu (BM_CONSOLE_OUT_CONTEXT_SELECT);

-  GetConsoleMenu (BM_CONSOLE_ERR_CONTEXT_SELECT);

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-FreeAllConsoles (

-  VOID

-  )

-/*++

-

-Routine Description:

-  Free ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu

-

-Arguments:

-  

-Returns:

-  EFI_SUCCESS 

-  Others

-  

---*/

-{

-  BOpt_FreeMenu (&ConsoleOutMenu);

-  BOpt_FreeMenu (&ConsoleInpMenu);

-  BOpt_FreeMenu (&ConsoleErrMenu);

-  BOpt_FreeMenu (&TerminalMenu);

-  return EFI_SUCCESS;

-}

-

-BOOLEAN

-IsTerminalDevicePath (

-  IN  EFI_DEVICE_PATH_PROTOCOL *DevicePath,

-  OUT TYPE_OF_TERMINAL         *Termi,

-  OUT UINTN                    *Com

-  )

-/*++

-

-Routine Description:

-  Test whether DevicePath is a valid Terminal

-

-Arguments:

-  DevicePath  -   DevicePath to be checked

-  Termi       -   If is terminal, give its type

-  Com         -   If is Com Port, give its type

-  

-Returns:

-  TRUE        -   If DevicePath point to a Terminal

-  FALSE

-  

---*/

-{

-  UINT8                 *Ptr;

-  BOOLEAN               IsTerminal;

-  VENDOR_DEVICE_PATH    *Vendor;

-  ACPI_HID_DEVICE_PATH  *Acpi;

-  UINT32                Match;

-  EFI_GUID              TempGuid;

-

-  IsTerminal = FALSE;

-

-  //

-  // Parse the Device Path, should be change later!!!

-  //

-  Ptr = (UINT8 *) DevicePath;

-  while (*Ptr != END_DEVICE_PATH_TYPE) {

-    Ptr++;

-  }

-

-  Ptr     = Ptr - sizeof (VENDOR_DEVICE_PATH);

-  Vendor  = (VENDOR_DEVICE_PATH *) Ptr;

-

-  //

-  // There are four kinds of Terminal types

-  // check to see whether this devicepath

-  // is one of that type

-  //

-  CopyMem (&TempGuid, &Vendor->Guid, sizeof (EFI_GUID));

-

-  if (CompareGuid (&TempGuid, &Guid[0])) {

-    *Termi      = PC_ANSI;

-    IsTerminal  = TRUE;

-  } else {

-    if (CompareGuid (&TempGuid, &Guid[1])) {

-      *Termi      = VT_100;

-      IsTerminal  = TRUE;

-    } else {

-      if (CompareGuid (&TempGuid, &Guid[2])) {

-        *Termi      = VT_100_PLUS;

-        IsTerminal  = TRUE;

-      } else {

-        if (CompareGuid (&TempGuid, &Guid[3])) {

-          *Termi      = VT_UTF8;

-          IsTerminal  = TRUE;

-        } else {

-          IsTerminal = FALSE;

-        }

-      }

-    }

-  }

-

-  if (!IsTerminal) {

-    return FALSE;

-  }

-

-  Ptr   = Ptr - sizeof (UART_DEVICE_PATH) - sizeof (ACPI_HID_DEVICE_PATH);

-  Acpi  = (ACPI_HID_DEVICE_PATH *) Ptr;

-  Match = EISA_PNP_ID (0x0501);

-  if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {

-    CopyMem (Com, &Acpi->UID, sizeof (UINT32));

-  } else {

-    return FALSE;

-  }

-

-  return TRUE;

-}

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/Data.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/Data.c
deleted file mode 100644
index 4b169c9..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/Data.c
+++ /dev/null
@@ -1,324 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  Data.c

-    

-Abstract:

-

-  Define some data used for Boot Maint

-

-Revision History

-

---*/

-

-#include "BootMaint.h"

-

-EFI_HII_UPDATE_DATA *UpdateData;

-STRING_DEPOSITORY   *FileOptionStrDepository;

-STRING_DEPOSITORY   *ConsoleOptionStrDepository;

-STRING_DEPOSITORY   *BootOptionStrDepository;

-STRING_DEPOSITORY   *BootOptionHelpStrDepository;

-STRING_DEPOSITORY   *DriverOptionStrDepository;

-STRING_DEPOSITORY   *DriverOptionHelpStrDepository;

-STRING_DEPOSITORY   *TerminalStrDepository;

-

-//

-// Terminal type string token storage

-//

-UINT16              TerminalType[] = {

-  STRING_TOKEN(STR_COM_TYPE_0),

-  STRING_TOKEN(STR_COM_TYPE_1),

-  STRING_TOKEN(STR_COM_TYPE_2),

-  STRING_TOKEN(STR_COM_TYPE_3),

-};

-

-//

-// File system selection menu

-//

-BM_MENU_OPTION      FsOptionMenu = {

-  BM_MENU_OPTION_SIGNATURE,

-  NULL,

-  0

-};

-

-//

-// Console Input Device Selection Menu

-//

-BM_MENU_OPTION      ConsoleInpMenu = {

-  BM_MENU_OPTION_SIGNATURE,

-  NULL,

-  0

-};

-

-//

-// Console Output Device Selection Menu

-//

-BM_MENU_OPTION      ConsoleOutMenu = {

-  BM_MENU_OPTION_SIGNATURE,

-  NULL,

-  0

-};

-

-//

-// Error Output Device Selection Menu

-//

-BM_MENU_OPTION      ConsoleErrMenu = {

-  BM_MENU_OPTION_SIGNATURE,

-  NULL,

-  0

-};

-

-//

-// Boot Option from variable Menu

-//

-BM_MENU_OPTION      BootOptionMenu = {

-  BM_MENU_OPTION_SIGNATURE,

-  NULL,

-  0

-};

-

-//

-// Driver Option from variable menu

-//

-BM_MENU_OPTION      DriverOptionMenu = {

-  BM_MENU_OPTION_SIGNATURE,

-  NULL,

-  0

-};

-

-//

-// Legacy FD Info from LegacyBios.GetBbsInfo()

-//

-BM_MENU_OPTION      LegacyFDMenu = {

-  BM_MENU_OPTION_SIGNATURE,

-  NULL,

-  0

-};

-

-//

-// Legacy HD Info from LegacyBios.GetBbsInfo()

-//

-BM_MENU_OPTION      LegacyHDMenu = {

-  BM_MENU_OPTION_SIGNATURE,

-  NULL,

-  0

-};

-

-//

-// Legacy CD Info from LegacyBios.GetBbsInfo()

-//

-BM_MENU_OPTION      LegacyCDMenu = {

-  BM_MENU_OPTION_SIGNATURE,

-  NULL,

-  0

-};

-

-//

-// Legacy NET Info from LegacyBios.GetBbsInfo()

-//

-BM_MENU_OPTION      LegacyNETMenu = {

-  BM_MENU_OPTION_SIGNATURE,

-  NULL,

-  0

-};

-

-//

-// Legacy NET Info from LegacyBios.GetBbsInfo()

-//

-BM_MENU_OPTION      LegacyBEVMenu = {

-  BM_MENU_OPTION_SIGNATURE,

-  NULL,

-  0

-};

-

-//

-// Files and sub-directories in current directory menu

-//

-BM_MENU_OPTION      DirectoryMenu = {

-  BM_MENU_OPTION_SIGNATURE,

-  NULL,

-  0

-};

-

-//

-// Handles in current system selection menu

-//

-BM_MENU_OPTION      DriverMenu = {

-  BM_MENU_OPTION_SIGNATURE,

-  NULL,

-  0

-};

-

-BM_MENU_OPTION      TerminalMenu = {

-  BM_MENU_OPTION_SIGNATURE,

-  NULL,

-  0

-};

-

-//

-// Value and string token correspondency for BaudRate

-//

-COM_ATTR            BaudRateList[19] = {

-  {

-    115200,

-    STRING_TOKEN(STR_COM_BAUD_RATE_0)

-  },

-  {

-    57600,

-    STRING_TOKEN(STR_COM_BAUD_RATE_1)

-  },

-  {

-    38400,

-    STRING_TOKEN(STR_COM_BAUD_RATE_2)

-  },

-  {

-    19200,

-    STRING_TOKEN(STR_COM_BAUD_RATE_3)

-  },

-  {

-    9600,

-    STRING_TOKEN(STR_COM_BAUD_RATE_4)

-  },

-  {

-    7200,

-    STRING_TOKEN(STR_COM_BAUD_RATE_5)

-  },

-  {

-    4800,

-    STRING_TOKEN(STR_COM_BAUD_RATE_6)

-  },

-  {

-    3600,

-    STRING_TOKEN(STR_COM_BAUD_RATE_7)

-  },

-  {

-    2400,

-    STRING_TOKEN(STR_COM_BAUD_RATE_8)

-  },

-  {

-    2000,

-    STRING_TOKEN(STR_COM_BAUD_RATE_9)

-  },

-  {

-    1800,

-    STRING_TOKEN(STR_COM_BAUD_RATE_10)

-  },

-  {

-    1200,

-    STRING_TOKEN(STR_COM_BAUD_RATE_11)

-  },

-  {

-    600,

-    STRING_TOKEN(STR_COM_BAUD_RATE_12)

-  },

-  {

-    300,

-    STRING_TOKEN(STR_COM_BAUD_RATE_13)

-  },

-  {

-    150,

-    STRING_TOKEN(STR_COM_BAUD_RATE_14)

-  },

-  {

-    134,

-    STRING_TOKEN(STR_COM_BAUD_RATE_15)

-  },

-  {

-    110,

-    STRING_TOKEN(STR_COM_BAUD_RATE_16)

-  },

-  {

-    75,

-    STRING_TOKEN(STR_COM_BAUD_RATE_17)

-  },

-  {

-    50,

-    STRING_TOKEN(STR_COM_BAUD_RATE_18)

-  }

-};

-

-//

-// Value and string token correspondency for DataBits

-//

-COM_ATTR            DataBitsList[4] = {

-  {

-    5,

-    STRING_TOKEN(STR_COM_DATA_BITS_0)

-  },

-  {

-    6,

-    STRING_TOKEN(STR_COM_DATA_BITS_1)

-  },

-  {

-    7,

-    STRING_TOKEN(STR_COM_DATA_BITS_2)

-  },

-  {

-    8,

-    STRING_TOKEN(STR_COM_DATA_BITS_3)

-  }

-};

-

-//

-// Value and string token correspondency for Parity

-//

-COM_ATTR            ParityList[5] = {

-  {

-    NoParity,

-    STRING_TOKEN(STR_COM_PAR_0)

-  },

-  {

-    EvenParity,

-    STRING_TOKEN(STR_COM_PAR_1)

-  },

-  {

-    OddParity,

-    STRING_TOKEN(STR_COM_PAR_2)

-  },

-  {

-    MarkParity,

-    STRING_TOKEN(STR_COM_PAR_3)

-  },

-  {

-    SpaceParity,

-    STRING_TOKEN(STR_COM_PAR_4)

-  }

-};

-

-//

-// Value and string token correspondency for Baudreate

-//

-COM_ATTR            StopBitsList[3] = {

-  {

-    OneStopBit,

-    STRING_TOKEN(STR_COM_STOP_BITS_0)

-  },

-  {

-    OneFiveStopBits,

-    STRING_TOKEN(STR_COM_STOP_BITS_1)

-  },

-  {

-    TwoStopBits,

-    STRING_TOKEN(STR_COM_STOP_BITS_2)

-  }

-};

-

-//

-// Guid for messaging path, used in Serial port setting.

-//

-EFI_GUID            Guid[4] = {

-  DEVICE_PATH_MESSAGING_PC_ANSI,

-  DEVICE_PATH_MESSAGING_VT_100,

-  DEVICE_PATH_MESSAGING_VT_100_PLUS,

-  DEVICE_PATH_MESSAGING_VT_UTF8

-};

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/FE.vfr b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/FE.vfr
deleted file mode 100644
index 998a4a6..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/FE.vfr
+++ /dev/null
@@ -1,138 +0,0 @@
-// *++

-//

-// Copyright (c) 2006, Intel Corporation                                                         

-// All rights reserved. This program and the accompanying materials                          

-// are licensed and made available under the terms and conditions of the BSD License         

-// which accompanies this distribution.  The full text of the license may be found at        

-// http://opensource.org/licenses/bsd-license.php                                            

-//                                                                                           

-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-// 

-// Module Name:

-//

-//   FE.vfr 

-// 

-// Abstract:

-// 

-//   File Explorer Formset

-// 

-// Revision History: 

-// 

-// --*/

-

-#include "BdsStrDefs.h" 

-#include "formguid.h"

-

-#pragma pack(1)

-typedef struct {

-  UINT16                    DescriptionData[75];

-  UINT16                    OptionalData[127];

-  UINT8                     Active;

-  UINT8                     ForceReconnect;  

-} FILE_EXPLORER_NV_DATA;

-#pragma pack()

-

-#define FORM_FILE_EXPLORER_ID                 0x001E

-#define FORM_BOOT_ADD_DESCRIPTION_ID          0x001F

-#define FORM_DRIVER_ADD_FILE_DESCRIPTION_ID   0x0020

-#define KEY_VALUE_SAVE_AND_EXIT               0x0090

-#define KEY_VALUE_NO_SAVE_AND_EXIT            0x0091

-

-

-

-formset 

-  guid = FILE_EXPLORE_FORMSET_GUID,

-  title = STRING_TOKEN(STR_FILE_EXPLORER_TITLE),

-  help = STRING_TOKEN(STR_NULL_STRING),

-  class = 0,

-  subclass = 0,

-

-  form formid = FORM_FILE_EXPLORER_ID,

-       title = STRING_TOKEN(STR_FILE_EXPLORER_TITLE);

-

-       label FORM_FILE_EXPLORER_ID;

-  endform;

-  

-  form formid = FORM_BOOT_ADD_DESCRIPTION_ID,

-       title = STRING_TOKEN(STR_FORM_BOOT_ADD_DESC_TITLE);

-       

-       label FORM_BOOT_ADD_DESCRIPTION_ID;

-

-       subtitle  text = STRING_TOKEN(STR_NULL_STRING);

-       

-       string    varid    = FILE_EXPLORER_NV_DATA.DescriptionData,

-                 prompt   = STRING_TOKEN(STR_LOAD_OPTION_DESC),

-                 help     = STRING_TOKEN(STR_NULL_STRING),

-                 minsize  = 6,

-                 maxsize  = 75,

-       endstring;

-

-       string    varid    = FILE_EXPLORER_NV_DATA.OptionalData,

-       		prompt   = STRING_TOKEN(STR_OPTIONAL_DATA),

-       		help     = STRING_TOKEN(STR_NULL_STRING),

-       		minsize  = 0,

-       		maxsize  = 120,

-       endstring;

-

-       text 

-         help   = STRING_TOKEN(STR_SAVE_AND_EXIT),  

-         text   = STRING_TOKEN(STR_SAVE_AND_EXIT), 

-         text   = STRING_TOKEN(STR_NULL_STRING),

-         flags  = INTERACTIVE | NV_ACCESS,

-         key    = KEY_VALUE_SAVE_AND_EXIT;

-             

-       text 

-         help   = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),  

-         text   = STRING_TOKEN(STR_NO_SAVE_AND_EXIT), 

-         text   = STRING_TOKEN(STR_NULL_STRING),

-         flags  = INTERACTIVE | NV_ACCESS,

-         key    = KEY_VALUE_NO_SAVE_AND_EXIT;

-    

-  endform;

-

-  form formid = FORM_DRIVER_ADD_FILE_DESCRIPTION_ID,

-       title = STRING_TOKEN(STR_FORM_DRV_ADD_DESC_TITLE);

-       

-       label FORM_DRIVER_ADD_FILE_DESCRIPTION_ID;

-       

-       subtitle  text = STRING_TOKEN(STR_NULL_STRING);

-

-       string    varid    = FILE_EXPLORER_NV_DATA.DescriptionData,

-                 prompt   = STRING_TOKEN(STR_LOAD_OPTION_DESC),

-                 help     = STRING_TOKEN(STR_NULL_STRING),

-                 minsize  = 6,

-                 maxsize  = 75,

-       endstring;

-

-       string    varid    = FILE_EXPLORER_NV_DATA.OptionalData,

-                 prompt   = STRING_TOKEN(STR_OPTIONAL_DATA),

-                 help     = STRING_TOKEN(STR_NULL_STRING),

-                 minsize  = 0,

-                 maxsize  = 120,

-       endstring; 

-       

-       checkbox varid    = FILE_EXPLORER_NV_DATA.ForceReconnect,

-               prompt   = STRING_TOKEN(STR_LOAD_OPTION_FORCE_RECON),

-               help     = STRING_TOKEN(STR_LOAD_OPTION_FORCE_RECON),  

-               flags    = 1,

-               key      = 0,

-       endcheckbox;

-

-       text 

-         help   = STRING_TOKEN(STR_SAVE_AND_EXIT),  

-         text   = STRING_TOKEN(STR_SAVE_AND_EXIT), 

-         text   = STRING_TOKEN(STR_NULL_STRING),

-         flags  = INTERACTIVE | NV_ACCESS,

-         key    = KEY_VALUE_SAVE_AND_EXIT;

-      

-       text 

-         help   = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),  

-         text   = STRING_TOKEN(STR_NO_SAVE_AND_EXIT), 

-         text   = STRING_TOKEN(STR_NULL_STRING),

-         flags  = INTERACTIVE | NV_ACCESS,

-         key    = KEY_VALUE_NO_SAVE_AND_EXIT;

-               

-  endform;

-  

-endformset;
\ No newline at end of file
diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/FileExplorer.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/FileExplorer.c
deleted file mode 100644
index db835cf..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/FileExplorer.c
+++ /dev/null
@@ -1,340 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  FileExplorer.c

-    

-AgBStract:

-

-  File explorer related functions.

-

---*/

-

-#include "Generic/Bds.h"

-#include "BootMaint.h"

-#include "BdsPlatform.h"

-

-VOID

-UpdateFileExplorePage (

-  IN BMM_CALLBACK_DATA            *CallbackData,

-  BM_MENU_OPTION                  *MenuOption

-  )

-/*++

-Routine Description:

-  Update the File Explore page.

-

-Arguments:

-  MenuOption      - Pointer to menu options to display.

-

-Returns:

-  None.

-

---*/

-{

-  UINT8           *Location;

-  UINTN           Index;

-  BM_MENU_ENTRY   *NewMenuEntry;

-  BM_FILE_CONTEXT *NewFileContext;

-  FORM_ID         FormId;

-

-  NewMenuEntry    = NULL;

-  NewFileContext  = NULL;

-  FormId          = 0;

-

-  //

-  // Clean up file explore page.

-  //

-  RefreshUpdateData (FALSE, 0, FALSE, 0, 0xff);

-

-  //

-  // Remove all op-codes from dynamic page

-  //

-  CallbackData->Hii->UpdateForm (

-                      CallbackData->Hii,

-                      CallbackData->FeHiiHandle,

-                      FORM_FILE_EXPLORER_ID,

-                      FALSE,

-                      UpdateData

-                      );

-

-  RefreshUpdateData (TRUE, (EFI_PHYSICAL_ADDRESS) (UINTN) CallbackData->FeCallbackHandle, FALSE, 0, 0);

-

-  Location = (UINT8 *) &UpdateData->Data;

-

-  for (Index = 0; Index < MenuOption->MenuNumber; Index++) {

-    NewMenuEntry    = BOpt_GetMenuEntry (MenuOption, Index);

-    NewFileContext  = (BM_FILE_CONTEXT *) NewMenuEntry->VariableContext;

-

-    if (NewFileContext->IsBootLegacy) {

-      continue;

-    }

-

-    if ((NewFileContext->IsDir) || (BOOT_FROM_FILE_STATE == CallbackData->FeCurrentState)) {

-      //

-      // Create Text opcode for directory, also create Text opcode for file in BOOT_FROM_FILE_STATE.

-      //

-      CreateTextOpCode (

-        NewMenuEntry->DisplayStringToken,

-        STR_NULL_STRING,

-        STR_NULL_STRING,

-        EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,

-        (UINT16) (FILE_OPTION_OFFSET + Index),

-        Location

-        );

-    } else {

-      //

-      // Create Goto opcode for file in ADD_BOOT_OPTION_STATE or ADD_DRIVER_OPTION_STATE.

-      //

-      if (ADD_BOOT_OPTION_STATE == CallbackData->FeCurrentState) {

-        FormId = FORM_BOOT_ADD_DESCRIPTION_ID;

-      } else if (ADD_DRIVER_OPTION_STATE == CallbackData->FeCurrentState) {

-        FormId = FORM_DRIVER_ADD_FILE_DESCRIPTION_ID;

-      }

-

-      CreateGotoOpCode (

-        FormId,

-        NewMenuEntry->DisplayStringToken,

-        STRING_TOKEN (STR_NULL_STRING),

-        EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,

-        (UINT16) (FILE_OPTION_OFFSET + Index),

-        Location

-        );

-    }

-

-    UpdateData->DataCount++;

-    Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-  }

-

-  CallbackData->Hii->UpdateForm (

-                      CallbackData->Hii,

-                      CallbackData->FeHiiHandle,

-                      FORM_FILE_EXPLORER_ID,

-                      TRUE,

-                      UpdateData

-                      );

-}

-

-BOOLEAN

-UpdateFileExplorer (

-  IN BMM_CALLBACK_DATA            *CallbackData,

-  IN UINT16                       KeyValue

-  )

-/*++

-

-Routine Description:

-  Update the file explower page with the refershed file system.

-

-Arguments:

-  CallbackData  -   BMM context data

-  KeyValue        - Key value to identify the type of data to expect.

-

-Returns:

-  TRUE          - Inform the caller to create a callback packet to exit file explorer.

-  FALSE         - Indicate that there is no need to exit file explorer.

-

---*/

-{

-  UINT16          FileOptionMask;

-  BM_MENU_ENTRY   *NewMenuEntry;

-  BM_FILE_CONTEXT *NewFileContext;

-  FORM_ID         FormId;

-  BOOLEAN         ExitFileExplorer;

-  EFI_STATUS      Status;

-  

-  NewMenuEntry      = NULL;

-  NewFileContext    = NULL;

-  ExitFileExplorer  = FALSE;

-

-  FileOptionMask    = (UINT16) (FILE_OPTION_MASK & KeyValue);

-

-  if (UNKNOWN_CONTEXT == CallbackData->FeDisplayContext) {

-    //

-    // First in, display file system.

-    //

-    BOpt_FreeMenu (&FsOptionMenu);

-    BOpt_FindFileSystem (CallbackData);

-    CreateMenuStringToken (CallbackData, CallbackData->FeHiiHandle, &FsOptionMenu);

-

-    UpdateFileExplorePage (CallbackData, &FsOptionMenu);

-

-    CallbackData->FeDisplayContext = FILE_SYSTEM;

-  } else {

-    if (FILE_SYSTEM == CallbackData->FeDisplayContext) {

-      NewMenuEntry = BOpt_GetMenuEntry (&FsOptionMenu, FileOptionMask);

-    } else if (DIRECTORY == CallbackData->FeDisplayContext) {

-      NewMenuEntry = BOpt_GetMenuEntry (&DirectoryMenu, FileOptionMask);

-    }

-

-    CallbackData->FeDisplayContext  = DIRECTORY;

-

-    NewFileContext                  = (BM_FILE_CONTEXT *) NewMenuEntry->VariableContext;

-

-    if (NewFileContext->IsDir ) {

-      RemoveEntryList (&NewMenuEntry->Link);

-      BOpt_FreeMenu (&DirectoryMenu);

-      Status = BOpt_FindFiles (CallbackData, NewMenuEntry);

-       if (EFI_ERROR (Status)) {

-         ExitFileExplorer = TRUE;

-         goto exit;

-       }

-      CreateMenuStringToken (CallbackData, CallbackData->FeHiiHandle, &DirectoryMenu);

-      BOpt_DestroyMenuEntry (NewMenuEntry);

-

-      UpdateFileExplorePage (CallbackData, &DirectoryMenu);

-

-    } else {

-      switch (CallbackData->FeCurrentState) {

-      case BOOT_FROM_FILE_STATE:

-        //

-        // Here boot from file

-        //

-        BootThisFile (NewFileContext);

-        ExitFileExplorer = TRUE;

-        break;

-

-      case ADD_BOOT_OPTION_STATE:

-      case ADD_DRIVER_OPTION_STATE:

-        if (ADD_BOOT_OPTION_STATE == CallbackData->FeCurrentState) {

-          FormId = FORM_BOOT_ADD_DESCRIPTION_ID;

-        } else {

-          FormId = FORM_DRIVER_ADD_FILE_DESCRIPTION_ID;

-        }

-

-        CallbackData->MenuEntry = NewMenuEntry;

-        CallbackData->LoadContext->FilePathList = ((BM_FILE_CONTEXT *) (CallbackData->MenuEntry->VariableContext))->DevicePath;

-

-        //

-        // Clean up file explore page.

-        //

-        RefreshUpdateData (FALSE, 0, FALSE, 0, 1);

-

-        //

-        // Remove the Subtitle op-code.

-        //

-        CallbackData->Hii->UpdateForm (

-                            CallbackData->Hii,

-                            CallbackData->FeHiiHandle,

-                            FormId,

-                            FALSE,

-                            UpdateData

-                            );

-

-        //

-        // Create Subtitle op-code for the display string of the option.

-        //

-        RefreshUpdateData (TRUE, (EFI_PHYSICAL_ADDRESS) (UINTN) CallbackData->FeCallbackHandle, FALSE, 0, 1);

-

-        CreateSubTitleOpCode (

-          NewMenuEntry->DisplayStringToken,

-          &UpdateData->Data

-          );

-

-        CallbackData->Hii->UpdateForm (

-                            CallbackData->Hii,

-                            CallbackData->FeHiiHandle,

-                            FormId,

-                            TRUE,

-                            UpdateData

-                            );

-        break;

-

-      default:

-        break;

-      }

-    }

-  }

-exit:

-  return ExitFileExplorer;

-}

-

-EFI_STATUS

-EFIAPI

-FileExplorerCallback (

-  IN EFI_FORM_CALLBACK_PROTOCOL       *This,

-  IN UINT16                           KeyValue,

-  IN EFI_IFR_DATA_ARRAY               *Data,

-  OUT EFI_HII_CALLBACK_PACKET         **Packet

-  )

-/*++

-Routine Description:

-  Callback Function for file exploration and file interaction.

-

-Arguments:

-  This            - File explorer callback protocol pointer.     

-  KeyValue        - Key value to identify the type of data to expect.

-  Data            - A pointer to the data being sent to the original exporting driver.

-  Packet          - A pointer to a packet of information which a driver passes back to the browser.

-

-Returns:

-  EFI_SUCCESS     - Callback ended successfully.

-  Others          - Contain some errors.

-  

---*/

-{

-  BMM_CALLBACK_DATA     *Private;

-  FILE_EXPLORER_NV_DATA *NvRamMap;

-  EFI_STATUS            Status;

-

-  Status                          = EFI_SUCCESS;

-  Private                         = FE_CALLBACK_DATA_FROM_THIS (This);

-  UpdateData->FormCallbackHandle  = (EFI_PHYSICAL_ADDRESS) (UINTN) Private->FeCallbackHandle;

-  NvRamMap                        = (FILE_EXPLORER_NV_DATA *) Data->NvRamMap;

-

-  if (KEY_VALUE_SAVE_AND_EXIT == KeyValue) {

-    //

-    // Apply changes and exit formset.

-    //

-    if (ADD_BOOT_OPTION_STATE == Private->FeCurrentState) {

-      Status = Var_UpdateBootOption (Private, NvRamMap);

-      if (EFI_ERROR (Status)) {

-        return Status;

-      }

-

-      BOpt_GetBootOptions (Private);

-      CreateMenuStringToken (Private, Private->FeHiiHandle, &BootOptionMenu);

-    } else if (ADD_DRIVER_OPTION_STATE == Private->FeCurrentState) {

-      Status = Var_UpdateDriverOption (

-                Private,

-                Private->FeHiiHandle,

-                NvRamMap->DescriptionData,

-                NvRamMap->OptionalData,

-                NvRamMap->ForceReconnect

-                );

-      if (EFI_ERROR (Status)) {

-        return Status;

-      }

-

-      BOpt_GetDriverOptions (Private);

-      CreateMenuStringToken (Private, Private->FeHiiHandle, &DriverOptionMenu);

-    }

-

-    CreateCallbackPacket (Packet, EXIT_REQUIRED | NV_NOT_CHANGED);

-  } else if (KEY_VALUE_NO_SAVE_AND_EXIT == KeyValue) {

-    //

-    // Discard changes and exit formset.

-    //

-    NvRamMap->OptionalData[0]     = 0x0000;

-    NvRamMap->DescriptionData[0]  = 0x0000;

-    CreateCallbackPacket (Packet, EXIT_REQUIRED | NV_NOT_CHANGED);

-  } else if (KeyValue < FILE_OPTION_OFFSET) {

-    //

-    // Exit File Explorer formset.

-    //

-    CreateCallbackPacket (Packet, EXIT_REQUIRED);

-  } else {

-    if (UpdateFileExplorer (Private, KeyValue)) {

-      CreateCallbackPacket (Packet, EXIT_REQUIRED);

-    }

-  }

-

-  return Status;

-}

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/FormGuid.h b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/FormGuid.h
deleted file mode 100644
index 8b55159..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/FormGuid.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// *++

-//

-// Copyright (c) 2006, Intel Corporation

-// All rights reserved. This program and the accompanying materials

-// are licensed and made available under the terms and conditions of the BSD License

-// which accompanies this distribution.  The full text of the license may be found at

-// http://opensource.org/licenses/bsd-license.php

-//

-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-//

-// Module Name:

-//

-//   FormGuid.h

-//

-// Abstract:

-//

-//   Formset guids for Boot Maintenance Manager

-//

-// Revision History:

-//

-// --*/

-//

-#define MAIN_FORMSET_GUID \

-  { \

-    0x642237c7, 0x35d4, 0x472d, { 0x83, 0x65, 0x12, 0xe0, 0xcc, 0xf2, 0x7a, 0x22 } \

-  }

-

-#define FILE_EXPLORE_FORMSET_GUID \

-  { \

-    0x1f2d63e1, 0xfebd, 0x4dc7, { 0x9c, 0xc5, 0xba, 0x2b, 0x1c, 0xef, 0x9c, 0x5b } \

-  }

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/UpdatePage.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/UpdatePage.c
deleted file mode 100644
index 435b075..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/UpdatePage.c
+++ /dev/null
@@ -1,1269 +0,0 @@
-/**@file

-  Dynamically Update the pages.

-  

-Copyright (c) 2006 - 2007 Intel Corporation.

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-**/

-

-#include "Generic/Bds.h"

-#include "BootMaint.h"

-#include "BdsPlatform.h"

-

-EFI_GUID gTerminalDriverGuid = {

-  0x9E863906, 0xA40F, 0x4875, {0x97, 0x7F, 0x5B, 0x93, 0xFF, 0x23, 0x7F, 0xC6}

-};

-

-VOID

-RefreshUpdateData (

-  IN BOOLEAN                      FormSetUpdate,

-  IN EFI_PHYSICAL_ADDRESS         FormCallbackHandle,

-  IN BOOLEAN                      FormUpdate,

-  IN STRING_REF                   FormTitle,

-  IN UINT16                       DataCount

-  )

-/*++

-Routine Description:

-  Refresh the global UpdateData structure.

-

-Arguments:

-  FormSetUpdate      - If TRUE, next variable is significant

-  FormCallbackHandle - If not 0, will update FormSet with this info

-  FormUpdate         - If TRUE, next variable is significant

-  FormTitle          - If not 0, will update Form with this info

-  DataCount          - The number of Data entries in this structure

-

-Returns:

-  None.

---*/

-{

-  UpdateData->FormSetUpdate = FormSetUpdate;

-  if (FormSetUpdate) {

-    ASSERT (0 != FormCallbackHandle);

-    UpdateData->FormCallbackHandle = FormCallbackHandle;

-  }

-

-  UpdateData->FormUpdate  = FALSE;

-  UpdateData->FormTitle   = FormTitle;

-  UpdateData->DataCount   = DataCount;

-}

-

-VOID

-UpdatePageStart (

-  IN BMM_CALLBACK_DATA                *CallbackData,

-  IN OUT UINT8                        **CurrentLocation

-  )

-{

-  RefreshUpdateData (TRUE, (EFI_PHYSICAL_ADDRESS) (UINTN) CallbackData->BmmCallbackHandle, FALSE, 0, 0);

-

-  if (!(CallbackData->BmmAskSaveOrNot)) {

-    //

-    // Add a "Go back to main page" tag in front of the form when there are no

-    // "Apply changes" and "Discard changes" tags in the end of the form.

-    //

-    CreateGotoOpCode (

-      FORM_MAIN_ID,

-      STRING_TOKEN (STR_FORM_GOTO_MAIN),

-      STRING_TOKEN (STR_FORM_GOTO_MAIN),

-      EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,

-      FORM_MAIN_ID,

-      *CurrentLocation

-      );

-

-    UpdateData->DataCount++;

-

-    *CurrentLocation = *CurrentLocation + ((EFI_IFR_OP_HEADER *) (*CurrentLocation))->Length;

-  }

-

-}

-

-VOID

-UpdatePageEnd (

-  IN BMM_CALLBACK_DATA                *CallbackData,

-  IN UINT8                            *CurrentLocation

-  )

-{

-  //

-  // Create the "Apply changes" and "Discard changes" tags.

-  //

-  if (CallbackData->BmmAskSaveOrNot) {

-    CreateGotoOpCode (

-      FORM_MAIN_ID,

-      STRING_TOKEN (STR_SAVE_AND_EXIT),

-      STRING_TOKEN (STR_NULL_STRING),

-      EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,

-      KEY_VALUE_SAVE_AND_EXIT,

-      CurrentLocation

-      );

-

-    UpdateData->DataCount++;

-

-    CurrentLocation = CurrentLocation + ((EFI_IFR_OP_HEADER *) CurrentLocation)->Length;

-

-    CreateGotoOpCode (

-      FORM_MAIN_ID,

-      STRING_TOKEN (STR_NO_SAVE_AND_EXIT),

-      STRING_TOKEN (STR_NULL_STRING),

-      EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,

-      KEY_VALUE_NO_SAVE_AND_EXIT,

-      CurrentLocation

-      );

-

-    UpdateData->DataCount++;

-  }

-  //

-  // Ensure user can return to the main page.

-  //

-  if (0 == UpdateData->DataCount) {

-    CreateGotoOpCode (

-      FORM_MAIN_ID,

-      STRING_TOKEN (STR_NO_SAVE_AND_EXIT),

-      STRING_TOKEN (STR_NULL_STRING),

-      EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,

-      KEY_VALUE_NO_SAVE_AND_EXIT,

-      CurrentLocation

-      );

-

-    UpdateData->DataCount++;

-  }

-

-  CallbackData->Hii->UpdateForm (

-                      CallbackData->Hii,

-                      CallbackData->BmmHiiHandle,

-                      CallbackData->BmmCurrentPageId,

-                      TRUE,

-                      UpdateData

-                      );

-}

-

-VOID

-CleanUpPage (

-  IN EFI_FORM_LABEL                   LabelId,

-  IN BMM_CALLBACK_DATA                *CallbackData

-  )

-{

-  RefreshUpdateData (FALSE, 0, FALSE, 0, 0xff);

-

-  //

-  // Remove all op-codes from dynamic page

-  //

-  CallbackData->Hii->UpdateForm (

-                      CallbackData->Hii,

-                      CallbackData->BmmHiiHandle,

-                      LabelId,

-                      FALSE,

-                      UpdateData

-                      );

-}

-

-EFI_STATUS

-BootThisFile (

-  IN BM_FILE_CONTEXT                   *FileContext

-  )

-{

-  EFI_STATUS        Status;

-  UINTN             ExitDataSize;

-  CHAR16            *ExitData;

-  BDS_COMMON_OPTION *Option;

-

-  Option                  = AllocatePool (sizeof (BDS_COMMON_OPTION));

-

-  Option->Description     = FileContext->FileName;

-  Option->DevicePath      = FileContext->DevicePath;

-  Option->LoadOptionsSize = 0;

-  Option->LoadOptions     = NULL;

-

-  //

-  // Since current no boot from removable media directly is allowed */

-  //

-  gST->ConOut->ClearScreen (gST->ConOut);

-

-  ExitDataSize  = 0;

-

-  Status        = BdsLibBootViaBootOption (Option, Option->DevicePath, &ExitDataSize, &ExitData);

-

-  return Status;

-

-}

-

-VOID

-UpdateConCOMPage (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  )

-{

-  BM_MENU_ENTRY *NewMenuEntry;

-  UINT16        Index;

-  UINT8         *Location;

-  EFI_STATUS    Status;

-  VOID        	*Interface;

-

-  Location                      = (UINT8 *) &UpdateData->Data;

-  CallbackData->BmmAskSaveOrNot = FALSE;

-

-  UpdatePageStart (CallbackData, &Location);

-

-  Status = EfiLibLocateProtocol (&gTerminalDriverGuid, &Interface);

-  if (!EFI_ERROR (Status)) {

-    for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {

-      NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);

-

-      CreateGotoOpCode (

-        FORM_CON_COM_SETUP_ID,

-        NewMenuEntry->DisplayStringToken,

-        STRING_TOKEN (STR_NULL_STRING),

-        EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,

-        (UINT16) (TERMINAL_OPTION_OFFSET + Index),

-        Location

-        );

-      Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-      UpdateData->DataCount++;

-    }

-  }

-

-  UpdatePageEnd (CallbackData, Location);

-}

-

-VOID

-UpdateBootDelPage (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  )

-{

-  BM_MENU_ENTRY   *NewMenuEntry;

-  BM_LOAD_CONTEXT *NewLoadContext;

-  UINT16          Index;

-  UINT8           *Location;

-

-  Location                      = (UINT8 *) &UpdateData->Data;

-  CallbackData->BmmAskSaveOrNot = TRUE;

-

-  UpdatePageStart (CallbackData, &Location);

-  CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, &BootOptionMenu);

-

-  for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {

-    NewMenuEntry    = BOpt_GetMenuEntry (&BootOptionMenu, Index);

-    NewLoadContext  = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;

-    if (NewLoadContext->IsLegacy) {

-      continue;

-    }

-

-    NewLoadContext->Deleted = FALSE;

-    CallbackData->BmmFakeNvData->BootOptionDel[Index] = 0x00;

-

-    CreateCheckBoxOpCode (

-      (UINT16) (BOOT_OPTION_DEL_QUESTION_ID + Index),

-      (UINT8) 1,

-      NewMenuEntry->DisplayStringToken,

-      NewMenuEntry->HelpStringToken,

-      EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,

-      (UINT16) BOOT_OPTION_DEL_QUESTION_ID,

-      Location

-      );

-

-    Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-    UpdateData->DataCount++;

-  }

-

-  UpdatePageEnd (CallbackData, Location);

-}

-

-VOID

-UpdateDrvAddHandlePage (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  )

-{

-  BM_MENU_ENTRY *NewMenuEntry;

-  UINT16        Index;

-  UINT8         *Location;

-

-  Location                      = (UINT8 *) &UpdateData->Data;

-  CallbackData->BmmAskSaveOrNot = FALSE;

-

-  UpdatePageStart (CallbackData, &Location);

-

-  for (Index = 0; Index < DriverMenu.MenuNumber; Index++) {

-    NewMenuEntry = BOpt_GetMenuEntry (&DriverMenu, Index);

-

-    CreateGotoOpCode (

-      FORM_DRV_ADD_HANDLE_DESC_ID,

-      NewMenuEntry->DisplayStringToken,

-      STRING_TOKEN (STR_NULL_STRING),

-      EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,

-      (UINT16) (HANDLE_OPTION_OFFSET + Index),

-      Location

-      );

-

-    Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-    UpdateData->DataCount++;

-  }

-

-  UpdatePageEnd (CallbackData, Location);

-}

-

-VOID

-UpdateDrvDelPage (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  )

-{

-  BM_MENU_ENTRY   *NewMenuEntry;

-  BM_LOAD_CONTEXT *NewLoadContext;

-  UINT16          Index;

-  UINT8           *Location;

-

-  Location                      = (UINT8 *) &UpdateData->Data;

-  CallbackData->BmmAskSaveOrNot = TRUE;

-

-  UpdatePageStart (CallbackData, &Location);

-

-  CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, &DriverOptionMenu);

-

-  for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {

-    NewMenuEntry            = BOpt_GetMenuEntry (&DriverOptionMenu, Index);

-

-    NewLoadContext          = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;

-    NewLoadContext->Deleted = FALSE;

-    CallbackData->BmmFakeNvData->DriverOptionDel[Index] = 0x00;

-

-    CreateCheckBoxOpCode (

-      (UINT16) (DRIVER_OPTION_DEL_QUESTION_ID + Index),

-      (UINT8) 1,

-      NewMenuEntry->DisplayStringToken,

-      NewMenuEntry->HelpStringToken,

-      EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,

-      (UINT16) DRIVER_OPTION_DEL_QUESTION_ID,

-      Location

-      );

-

-    Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-    UpdateData->DataCount++;

-  }

-

-  UpdatePageEnd (CallbackData, Location);

-}

-

-VOID

-UpdateDriverAddHandleDescPage (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  )

-{

-  BM_MENU_ENTRY *NewMenuEntry;

-  UINT8         *Location;

-

-  Location  = (UINT8 *) &UpdateData->Data;

-  CallbackData->BmmFakeNvData->DriverAddActive          = 0x01;

-  CallbackData->BmmFakeNvData->DriverAddForceReconnect  = 0x00;

-  CallbackData->BmmAskSaveOrNot                         = TRUE;

-  NewMenuEntry = CallbackData->MenuEntry;

-

-  UpdatePageStart (CallbackData, &Location);

-

-  UpdateData->DataCount += (UINT16) 4;

-

-  CreateSubTitleOpCode (

-    NewMenuEntry->DisplayStringToken,

-    Location

-    );

-

-  Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-

-  CreateStringOpCode (

-    DRV_ADD_HANDLE_DESC_QUESTION_ID,

-    (UINT8) 150,

-    STRING_TOKEN (STR_LOAD_OPTION_DESC),

-    STRING_TOKEN (STR_NULL_STRING),

-    6,

-    75,

-    EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,

-    KEY_VALUE_DRIVER_ADD_DESC_DATA,

-    Location

-    );

-

-  Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-

-  CreateCheckBoxOpCode (

-    DRV_ADD_RECON_QUESTION_ID,

-    (UINT8) 1,

-    STRING_TOKEN (STR_LOAD_OPTION_FORCE_RECON),

-    STRING_TOKEN (STR_LOAD_OPTION_FORCE_RECON),

-    EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,

-    DRV_ADD_RECON_QUESTION_ID,

-    Location

-    );

-  Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-

-  CreateStringOpCode (

-    DRIVER_ADD_OPTION_QUESTION_ID,

-    (UINT8) 150,

-    STRING_TOKEN (STR_OPTIONAL_DATA),

-    STRING_TOKEN (STR_NULL_STRING),

-    6,

-    75,

-    EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,

-    KEY_VALUE_DRIVER_ADD_OPT_DATA,

-    Location

-    );

-

-  Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-  UpdatePageEnd (CallbackData, Location);

-}

-

-VOID

-UpdateConsolePage (

-  IN UINT16                           UpdatePageId,

-  IN BM_MENU_OPTION                   *ConsoleMenu,

-  IN BMM_CALLBACK_DATA                *CallbackData

-  )

-{

-  BM_MENU_ENTRY       *NewMenuEntry;

-  BM_CONSOLE_CONTEXT  *NewConsoleContext;

-  BM_TERMINAL_CONTEXT *NewTerminalContext;

-  UINT16              Index;

-  UINT16              Index2;

-  UINT8               *Location;

-  UINT8               CheckFlags;

-  EFI_STATUS          Status;

-  VOID        	      *Interface;

-

-  Location                      = (UINT8 *) &UpdateData->Data;

-  CallbackData->BmmAskSaveOrNot = TRUE;

-

-  UpdatePageStart (CallbackData, &Location);

-

-  for (Index = 0; Index < ConsoleMenu->MenuNumber; Index++) {

-    NewMenuEntry      = BOpt_GetMenuEntry (ConsoleMenu, Index);

-    NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;

-    CheckFlags        = EFI_IFR_FLAG_INTERACTIVE;

-    if (NewConsoleContext->IsActive) {

-      CheckFlags |= EFI_IFR_FLAG_DEFAULT;

-      CallbackData->BmmFakeNvData->ConsoleCheck[Index] = TRUE;

-    } else {

-      CallbackData->BmmFakeNvData->ConsoleCheck[Index] = FALSE;

-    }

-

-    CreateCheckBoxOpCode (

-      (UINT16) (CON_DEVICE_QUESTION_ID + Index),

-      (UINT8) 1,

-      NewMenuEntry->DisplayStringToken,

-      NewMenuEntry->HelpStringToken,

-      CheckFlags,

-      (UINT16) (CONSOLE_OPTION_OFFSET + Index),

-      Location

-      );

-    Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-    UpdateData->DataCount++;

-  }

-

-  Status = EfiLibLocateProtocol (&gTerminalDriverGuid, &Interface);

-  if (!EFI_ERROR (Status)) {

-    for (Index2 = 0; Index2 < TerminalMenu.MenuNumber; Index2++) {

-      CheckFlags          = EFI_IFR_FLAG_INTERACTIVE;

-      NewMenuEntry        = BOpt_GetMenuEntry (&TerminalMenu, Index2);

-      NewTerminalContext  = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;

-

-      if ((NewTerminalContext->IsConIn && (UpdatePageId == FORM_CON_IN_ID)) ||

-          (NewTerminalContext->IsConOut && (UpdatePageId == FORM_CON_OUT_ID)) ||

-          (NewTerminalContext->IsStdErr && (UpdatePageId == FORM_CON_ERR_ID))

-          ) {

-        CheckFlags |= EFI_IFR_FLAG_DEFAULT;

-        CallbackData->BmmFakeNvData->ConsoleCheck[Index] = TRUE;

-      } else {

-        CallbackData->BmmFakeNvData->ConsoleCheck[Index] = FALSE;

-      }

-

-      CreateCheckBoxOpCode (

-        (UINT16) (CON_DEVICE_QUESTION_ID + Index),

-        (UINT8) 1,

-        NewMenuEntry->DisplayStringToken,

-        NewMenuEntry->HelpStringToken,

-        CheckFlags,

-        (UINT16) (CONSOLE_OPTION_OFFSET + Index),

-        Location

-        );

-      Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-      UpdateData->DataCount++;

-      Index++;

-    }

-  }

-

-  UpdatePageEnd (CallbackData, Location);

-}

-

-VOID

-UpdateOrderPage (

-  IN UINT16                           UpdatePageId,

-  IN BM_MENU_OPTION                   *OptionMenu,

-  IN BMM_CALLBACK_DATA                *CallbackData

-  )

-{

-  BM_MENU_ENTRY *NewMenuEntry;

-  UINT16        Index;

-  UINT8         *Location;

-  IFR_OPTION    *IfrOptionList;

-

-  Location                      = (UINT8 *) &UpdateData->Data;

-  CallbackData->BmmAskSaveOrNot = TRUE;

-

-  UpdatePageStart (CallbackData, &Location);

-

-  CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, OptionMenu);

-

-  ZeroMem (CallbackData->BmmFakeNvData->OptionOrder, 100);

-

-  IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * OptionMenu->MenuNumber);

-  if (NULL == IfrOptionList) {

-    return ;

-  }

-

-  for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {

-    NewMenuEntry = BOpt_GetMenuEntry (OptionMenu, Index);

-    IfrOptionList[Index].StringToken = NewMenuEntry->DisplayStringToken;

-    IfrOptionList[Index].Value = (UINT16) (NewMenuEntry->OptionNumber + 1);

-    IfrOptionList[Index].OptionString = NULL;

-    CallbackData->BmmFakeNvData->OptionOrder[Index] = (UINT8) (IfrOptionList[Index].Value);

-  }

-

-  if (OptionMenu->MenuNumber > 0) {

-    CreateOrderedListOpCode (

-      (UINT16) OPTION_ORDER_QUESTION_ID,

-      (UINT8) 100,

-      STRING_TOKEN (STR_CHANGE_ORDER),

-      STRING_TOKEN (STR_CHANGE_ORDER),

-      IfrOptionList,

-      OptionMenu->MenuNumber,

-      Location

-      );

-

-    for (Index = 0; Index < OptionMenu->MenuNumber + 2; Index++) {

-      Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-    }

-

-    UpdateData->DataCount = (UINT16) (UpdateData->DataCount + OptionMenu->MenuNumber + 2);

-  }

-

-  SafeFreePool (IfrOptionList);

-

-  UpdatePageEnd (CallbackData, Location);

-

-  CopyMem (

-    CallbackData->BmmOldFakeNVData.OptionOrder,

-    CallbackData->BmmFakeNvData->OptionOrder,

-    100

-    );

-}

-

-VOID

-UpdateBootNextPage (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  )

-{

-  UINT8           *Location;

-  BM_MENU_ENTRY   *NewMenuEntry;

-  BM_LOAD_CONTEXT *NewLoadContext;

-  IFR_OPTION      *IfrOptionList;

-  UINTN           NumberOfOptions;

-  UINT16          Index;

-

-  Location                      = (UINT8 *) &UpdateData->Data;

-  IfrOptionList                 = NULL;

-  NumberOfOptions               = BootOptionMenu.MenuNumber;

-  CallbackData->BmmAskSaveOrNot = TRUE;

-

-  UpdatePageStart (CallbackData, &Location);

-  CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, &BootOptionMenu);

-

-  if (NumberOfOptions > 0) {

-    UpdateData->DataCount = (UINT8) (UpdateData->DataCount + NumberOfOptions);

-    IfrOptionList = AllocateZeroPool ((NumberOfOptions + 1) * sizeof (IFR_OPTION));

-

-    ASSERT (IfrOptionList);

-

-    CallbackData->BmmFakeNvData->BootNext = (UINT16) (BootOptionMenu.MenuNumber);

-

-    for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {

-      NewMenuEntry    = BOpt_GetMenuEntry (&BootOptionMenu, Index);

-      NewLoadContext  = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;

-      if (NewLoadContext->IsBootNext) {

-        IfrOptionList[Index].Flags            = EFI_IFR_FLAG_DEFAULT | EFI_IFR_FLAG_INTERACTIVE;

-        CallbackData->BmmFakeNvData->BootNext = Index;

-      } else {

-        IfrOptionList[Index].Flags = EFI_IFR_FLAG_INTERACTIVE;

-      }

-

-      IfrOptionList[Index].Key          = (UINT16) KEY_VALUE_MAIN_BOOT_NEXT;

-      IfrOptionList[Index].Value        = Index;

-      IfrOptionList[Index].StringToken  = NewMenuEntry->DisplayStringToken;

-      IfrOptionList[Index].OptionString = NULL;

-    }

-

-    IfrOptionList[Index].Key          = (UINT16) KEY_VALUE_MAIN_BOOT_NEXT;

-    IfrOptionList[Index].Value        = Index;

-    IfrOptionList[Index].StringToken  = STRING_TOKEN (STR_NONE);

-    IfrOptionList[Index].Flags        = EFI_IFR_FLAG_INTERACTIVE;

-    if (CallbackData->BmmFakeNvData->BootNext == Index) {

-      IfrOptionList[Index].Flags |= EFI_IFR_FLAG_DEFAULT;

-    }

-

-    IfrOptionList[Index].OptionString = NULL;

-

-    CreateOneOfOpCode (

-      (UINT16) BOOT_NEXT_QUESTION_ID,

-      (UINT8) 2,

-      STRING_TOKEN (STR_BOOT_NEXT),

-      STRING_TOKEN (STR_BOOT_NEXT_HELP),

-      IfrOptionList,

-      (UINTN) (NumberOfOptions + 1),

-      Location

-      );

-    Location  = Location + (NumberOfOptions + 2) * ((EFI_IFR_OP_HEADER *) Location)->Length;

-    Location  = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-

-    UpdateData->DataCount += 3;

-    SafeFreePool (IfrOptionList);

-    IfrOptionList = NULL;

-  }

-

-  UpdatePageEnd (CallbackData, Location);

-}

-

-VOID

-UpdateTimeOutPage (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  )

-{

-  UINT8   *Location;

-  UINT16  BootTimeOut;

-

-  Location                      = (UINT8 *) &UpdateData->Data;

-  CallbackData->BmmAskSaveOrNot = TRUE;

-

-  UpdatePageStart (CallbackData, &Location);

-

-  BootTimeOut = BdsLibGetTimeout ();

-

-  CreateNumericOpCode (

-    (UINT16) BOOT_TIME_OUT_QUESTION_ID,

-    (UINT8) 2,

-    STRING_TOKEN (STR_NUM_AUTO_BOOT),

-    STRING_TOKEN (STR_HLP_AUTO_BOOT),

-    0,

-    65535,

-    0,

-    10,

-    0,

-    0,

-    Location

-    );

-

-  CallbackData->BmmFakeNvData->BootTimeOut = (UINT16) BootTimeOut;

-  UpdateData->DataCount++;

-  Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-

-  UpdatePageEnd (CallbackData, Location);

-}

-

-VOID

-UpdateTerminalPage (

-  IN BMM_CALLBACK_DATA                *CallbackData

-  )

-{

-  UINT16              Index;

-  UINT8               *Location;

-  UINT8               CheckFlags;

-  IFR_OPTION          *IfrOptionList;

-  BM_MENU_ENTRY       *NewMenuEntry;

-  BM_TERMINAL_CONTEXT *NewTerminalContext;

-

-  ZeroMem (UpdateData, UPDATE_DATA_SIZE);

-  Location = (UINT8 *) &UpdateData->Data;

-  UpdatePageStart (CallbackData, &Location);

-

-  NewMenuEntry = BOpt_GetMenuEntry (

-                  &TerminalMenu,

-                  CallbackData->CurrentTerminal

-                  );

-

-  if (!NewMenuEntry) {

-    return ;

-  }

-

-  NewTerminalContext  = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;

-

-  IfrOptionList       = AllocateZeroPool (sizeof (IFR_OPTION) * 19);

-  if (!IfrOptionList) {

-    return ;

-  }

-

-  for (Index = 0; Index < 19; Index++) {

-    CheckFlags = EFI_IFR_FLAG_INTERACTIVE;

-    if (NewTerminalContext->BaudRate == (UINT64) (BaudRateList[Index].Value)) {

-      CheckFlags |= EFI_IFR_FLAG_DEFAULT;

-      NewTerminalContext->BaudRateIndex         = (UINT8) Index;

-      CallbackData->BmmFakeNvData->COMBaudRate  = NewTerminalContext->BaudRateIndex;

-    }

-

-    IfrOptionList[Index].Flags        = CheckFlags;

-    IfrOptionList[Index].Key          = KEY_VALUE_COM_SET_BAUD_RATE;

-    IfrOptionList[Index].StringToken  = BaudRateList[Index].StringToken;

-    IfrOptionList[Index].Value        = Index;

-  }

-

-  CreateOneOfOpCode (

-    (UINT16) COM_BAUD_RATE_QUESTION_ID,

-    (UINT8) 1,

-    STRING_TOKEN (STR_COM_BAUD_RATE),

-    STRING_TOKEN (STR_COM_BAUD_RATE),

-    IfrOptionList,

-    19,

-    Location

-    );

-

-  Location              = Location + (Index + 1) * ((EFI_IFR_OP_HEADER *) Location)->Length;

-  Location              = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-  UpdateData->DataCount = (UINT8) (UpdateData->DataCount + Index);

-  UpdateData->DataCount += 2;

-

-  SafeFreePool (IfrOptionList);

-

-  IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * 4);

-  if (!IfrOptionList) {

-    return ;

-  }

-

-  for (Index = 0; Index < 4; Index++) {

-    CheckFlags = EFI_IFR_FLAG_INTERACTIVE;

-

-    if (NewTerminalContext->DataBits == DataBitsList[Index].Value) {

-      NewTerminalContext->DataBitsIndex         = (UINT8) Index;

-      CallbackData->BmmFakeNvData->COMDataRate  = NewTerminalContext->DataBitsIndex;

-      CheckFlags |= EFI_IFR_FLAG_DEFAULT;

-    }

-

-    IfrOptionList[Index].Flags        = CheckFlags;

-    IfrOptionList[Index].Key          = KEY_VALUE_COM_SET_DATA_BITS;

-    IfrOptionList[Index].StringToken  = DataBitsList[Index].StringToken;

-    IfrOptionList[Index].Value        = Index;

-  }

-

-  CreateOneOfOpCode (

-    (UINT16) COM_DATA_RATE_QUESTION_ID,

-    (UINT8) 1,

-    STRING_TOKEN (STR_COM_DATA_BITS),

-    STRING_TOKEN (STR_COM_DATA_BITS),

-    IfrOptionList,

-    4,

-    Location

-    );

-

-  Location              = Location + (Index + 1) * ((EFI_IFR_OP_HEADER *) Location)->Length;

-  Location              = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-  UpdateData->DataCount = (UINT8) (UpdateData->DataCount + Index);

-  UpdateData->DataCount += 2;

-

-  SafeFreePool (IfrOptionList);

-

-  IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * 5);

-  if (!IfrOptionList) {

-    return ;

-  }

-

-  for (Index = 0; Index < 5; Index++) {

-    CheckFlags = EFI_IFR_FLAG_INTERACTIVE;

-    if (NewTerminalContext->Parity == ParityList[Index].Value) {

-      CheckFlags |= EFI_IFR_FLAG_DEFAULT;

-      NewTerminalContext->ParityIndex         = (UINT8) Index;

-      CallbackData->BmmFakeNvData->COMParity  = NewTerminalContext->ParityIndex;

-    }

-

-    IfrOptionList[Index].Flags        = CheckFlags;

-    IfrOptionList[Index].Key          = KEY_VALUE_COM_SET_PARITY;

-    IfrOptionList[Index].StringToken  = ParityList[Index].StringToken;

-    IfrOptionList[Index].Value        = Index;

-  }

-

-  CreateOneOfOpCode (

-    (UINT16) COM_PARITY_QUESTION_ID,

-    (UINT8) 1,

-    STRING_TOKEN (STR_COM_PARITY),

-    STRING_TOKEN (STR_COM_PARITY),

-    IfrOptionList,

-    5,

-    Location

-    );

-

-  Location              = Location + (Index + 1) * ((EFI_IFR_OP_HEADER *) Location)->Length;

-  Location              = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-  UpdateData->DataCount = (UINT8) (UpdateData->DataCount + Index);

-  UpdateData->DataCount += 2;

-

-  SafeFreePool (IfrOptionList);

-

-  IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * 3);

-  if (!IfrOptionList) {

-    return ;

-  }

-

-  for (Index = 0; Index < 3; Index++) {

-    CheckFlags = EFI_IFR_FLAG_INTERACTIVE;

-    if (NewTerminalContext->StopBits == StopBitsList[Index].Value) {

-      CheckFlags |= EFI_IFR_FLAG_DEFAULT;

-      NewTerminalContext->StopBitsIndex         = (UINT8) Index;

-      CallbackData->BmmFakeNvData->COMStopBits  = NewTerminalContext->StopBitsIndex;

-    }

-

-    IfrOptionList[Index].Flags        = CheckFlags;

-    IfrOptionList[Index].Key          = KEY_VALUE_COM_SET_STOP_BITS;

-    IfrOptionList[Index].StringToken  = StopBitsList[Index].StringToken;

-    IfrOptionList[Index].Value        = Index;

-  }

-

-  CreateOneOfOpCode (

-    (UINT16) COM_STOP_BITS_QUESTION_ID,

-    (UINT8) 1,

-    STRING_TOKEN (STR_COM_STOP_BITS),

-    STRING_TOKEN (STR_COM_STOP_BITS),

-    IfrOptionList,

-    3,

-    Location

-    );

-

-  Location              = Location + (Index + 1) * ((EFI_IFR_OP_HEADER *) Location)->Length;

-  Location              = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-  UpdateData->DataCount = (UINT8) (UpdateData->DataCount + Index);

-  UpdateData->DataCount += 2;

-

-  SafeFreePool (IfrOptionList);

-

-  IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * 4);

-  if (!IfrOptionList) {

-    return ;

-  }

-

-  for (Index = 0; Index < 4; Index++) {

-    CheckFlags = EFI_IFR_FLAG_INTERACTIVE;

-    if (NewTerminalContext->TerminalType == Index) {

-      CheckFlags |= EFI_IFR_FLAG_DEFAULT;

-      CallbackData->BmmFakeNvData->COMTerminalType = NewTerminalContext->TerminalType;

-    }

-

-    IfrOptionList[Index].Flags        = CheckFlags;

-    IfrOptionList[Index].Key          = KEY_VALUE_COM_SET_TERMI_TYPE;

-    IfrOptionList[Index].StringToken  = (STRING_REF) TerminalType[Index];

-    IfrOptionList[Index].Value        = Index;

-  }

-

-  CreateOneOfOpCode (

-    (UINT16) COM_TERMINAL_QUESTION_ID,

-    (UINT8) 1,

-    STRING_TOKEN (STR_COM_TERMI_TYPE),

-    STRING_TOKEN (STR_COM_TERMI_TYPE),

-    IfrOptionList,

-    4,

-    Location

-    );

-

-  Location              = Location + (Index + 1) * ((EFI_IFR_OP_HEADER *) Location)->Length;

-  Location              = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-  UpdateData->DataCount = (UINT8) (UpdateData->DataCount + Index);

-  UpdateData->DataCount += 2;

-

-  SafeFreePool (IfrOptionList);

-

-  CreateGotoOpCode (

-    FORM_MAIN_ID,

-    STRING_TOKEN (STR_SAVE_AND_EXIT),

-    STRING_TOKEN (STR_NULL_STRING),

-    EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,

-    KEY_VALUE_SAVE_AND_EXIT,

-    Location

-    );

-

-  Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-  UpdateData->DataCount++;

-

-  CreateGotoOpCode (

-    FORM_MAIN_ID,

-    STRING_TOKEN (STR_NO_SAVE_AND_EXIT),

-    STRING_TOKEN (STR_NULL_STRING),

-    EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,

-    KEY_VALUE_NO_SAVE_AND_EXIT,

-    Location

-    );

-

-  UpdateData->DataCount++;

-

-  CallbackData->Hii->UpdateForm (

-                      CallbackData->Hii,

-                      CallbackData->BmmHiiHandle,

-                      (EFI_FORM_LABEL) FORM_CON_COM_SETUP_ID,

-                      TRUE,

-                      UpdateData

-                      );

-

-}

-

-VOID

-UpdatePageBody (

-  IN UINT16                           UpdatePageId,

-  IN BMM_CALLBACK_DATA                *CallbackData

-  )

-{

-  CleanUpPage (UpdatePageId, CallbackData);

-  switch (UpdatePageId) {

-  case FORM_CON_IN_ID:

-    UpdateConsolePage (UpdatePageId, &ConsoleInpMenu, CallbackData);

-    break;

-

-  case FORM_CON_OUT_ID:

-    UpdateConsolePage (UpdatePageId, &ConsoleOutMenu, CallbackData);

-    break;

-

-  case FORM_CON_ERR_ID:

-    UpdateConsolePage (UpdatePageId, &ConsoleErrMenu, CallbackData);

-    break;

-

-  case FORM_BOOT_CHG_ID:

-    UpdateOrderPage (UpdatePageId, &BootOptionMenu, CallbackData);

-    break;

-

-  case FORM_DRV_CHG_ID:

-    UpdateOrderPage (UpdatePageId, &DriverOptionMenu, CallbackData);

-    break;

-

-  default:

-    break;

-  }

-}

-

-VOID *

-GetLegacyBootOptionVar (

-  IN  UINTN                            DeviceType,

-  OUT UINTN                            *OptionIndex,

-  OUT UINTN                            *OptionSize

-  )

-{

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;

-  VOID                      *OptionBuffer;

-  UINTN                     OrderSize;

-  UINTN                     Index;

-  UINT32                    Attribute;

-  UINT16                    *OrderBuffer;

-  CHAR16                    StrTemp[100];

-  UINT16                    FilePathSize;

-  CHAR16                    *Description;

-  UINT8                     *Ptr;

-  UINT8                     *OptionalData;

-

-  //

-  // Get Boot Option number from the size of BootOrder

-  //

-  OrderBuffer = BdsLibGetVariableAndSize (

-                  L"BootOrder",

-                  &gEfiGlobalVariableGuid,

-                  &OrderSize

-                  );

-

-  for (Index = 0; Index < OrderSize / sizeof (UINT16); Index++) {

-    UnicodeSPrint (StrTemp, 100, L"Boot%04x", OrderBuffer[Index]);

-    OptionBuffer = BdsLibGetVariableAndSize (

-                    StrTemp,

-                    &gEfiGlobalVariableGuid,

-                    OptionSize

-                    );

-    if (NULL == OptionBuffer) {

-      continue;

-    }

-

-    Ptr       = (UINT8 *) OptionBuffer;

-    Attribute = *(UINT32 *) Ptr;

-    Ptr += sizeof (UINT32);

-

-    FilePathSize = *(UINT16 *) Ptr;

-    Ptr += sizeof (UINT16);

-

-    Description = (CHAR16 *) Ptr;

-    Ptr += StrSize ((CHAR16 *) Ptr);

-

-    //

-    // Now Ptr point to Device Path

-    //

-    DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) Ptr;

-    Ptr += FilePathSize;

-

-    //

-    // Now Ptr point to Optional Data

-    //

-    OptionalData = Ptr;

-

-    if ((DeviceType == ((BBS_TABLE *) OptionalData)->DeviceType) &&

-        (BBS_DEVICE_PATH == DevicePath->Type) &&

-        (BBS_BBS_DP == DevicePath->SubType)

-        ) {

-      *OptionIndex = OrderBuffer[Index];

-      SafeFreePool (OrderBuffer);

-      return OptionBuffer;

-    } else {

-      SafeFreePool (OptionBuffer);

-    }

-  }

-

-  SafeFreePool (OrderBuffer);

-  return NULL;

-}

-

-VOID

-UpdateSetLegacyDeviceOrderPage (

-  IN UINT16                           UpdatePageId,

-  IN BMM_CALLBACK_DATA                *CallbackData

-  )

-{

-  BM_LEGACY_DEV_ORDER_CONTEXT *DevOrder;

-  BM_MENU_OPTION              *OptionMenu;

-  BM_MENU_ENTRY               *NewMenuEntry;

-  IFR_OPTION                  *IfrOptionList;

-  STRING_REF                  StrRef;

-  STRING_REF                  StrRefHelp;

-  BBS_TYPE                    BbsType;

-  UINTN                       VarSize;

-  UINTN                       Pos;

-  UINTN                       Bit;

-  UINT16                      Index;

-  UINT16                      Index2;

-  UINT16                      Key;

-  CHAR16                      String[100];

-  CHAR16                      *TypeStr;

-  CHAR16                      *TypeStrHelp;

-  UINT16                      VarDevOrder;

-  UINT8                       *Location;

-  UINT8                       *VarData;

-  UINT8                       *OriginalPtr;

-  UINT8                       *LegacyOrder;

-  UINT8                       *OldData;

-  UINT8                       *DisMap;

-

-  OptionMenu                    = NULL;

-  Key = 0;

-  StrRef = 0;

-  StrRefHelp = 0;

-  TypeStr = NULL;

-  TypeStrHelp = NULL;

-  BbsType = BBS_FLOPPY;

-  LegacyOrder = NULL;

-  OldData = NULL;

-  DisMap = NULL;

-

-  Location = (UINT8 *) &UpdateData->Data;

-  CallbackData->BmmAskSaveOrNot = TRUE;

-

-  UpdatePageStart (CallbackData, &Location);

-

-  DisMap = CallbackData->BmmOldFakeNVData.DisableMap;

-

-  SetMem (DisMap, 32, 0);

-  //

-  // Create oneof option list

-  //

-  switch (UpdatePageId) {

-  case FORM_SET_FD_ORDER_ID:

-    OptionMenu  = (BM_MENU_OPTION *) &LegacyFDMenu;

-    Key         = LEGACY_FD_QUESTION_ID;

-    TypeStr     = StrFloppy;

-    TypeStrHelp = StrFloppyHelp;

-    BbsType     = BBS_FLOPPY;

-    LegacyOrder = CallbackData->BmmFakeNvData->LegacyFD;

-    OldData     = CallbackData->BmmOldFakeNVData.LegacyFD;

-    break;

-

-  case FORM_SET_HD_ORDER_ID:

-    OptionMenu  = (BM_MENU_OPTION *) &LegacyHDMenu;

-    Key         = LEGACY_HD_QUESTION_ID;

-    TypeStr     = StrHardDisk;

-    TypeStrHelp = StrHardDiskHelp;

-    BbsType     = BBS_HARDDISK;

-    LegacyOrder = CallbackData->BmmFakeNvData->LegacyHD;

-    OldData     = CallbackData->BmmOldFakeNVData.LegacyHD;

-    break;

-

-  case FORM_SET_CD_ORDER_ID:

-    OptionMenu  = (BM_MENU_OPTION *) &LegacyCDMenu;

-    Key         = LEGACY_CD_QUESTION_ID;

-    TypeStr     = StrCDROM;

-    TypeStrHelp = StrCDROMHelp;

-    BbsType     = BBS_CDROM;

-    LegacyOrder = CallbackData->BmmFakeNvData->LegacyCD;

-    OldData     = CallbackData->BmmOldFakeNVData.LegacyCD;

-    break;

-

-  case FORM_SET_NET_ORDER_ID:

-    OptionMenu  = (BM_MENU_OPTION *) &LegacyNETMenu;

-    Key         = LEGACY_NET_QUESTION_ID;

-    TypeStr     = StrNET;

-    TypeStrHelp = StrNETHelp;

-    BbsType     = BBS_EMBED_NETWORK;

-    LegacyOrder = CallbackData->BmmFakeNvData->LegacyNET;

-    OldData     = CallbackData->BmmOldFakeNVData.LegacyNET;

-    break;

-

-  case FORM_SET_BEV_ORDER_ID:

-    OptionMenu  = (BM_MENU_OPTION *) &LegacyBEVMenu;

-    Key         = LEGACY_BEV_QUESTION_ID;

-    TypeStr     = StrBEV;

-    TypeStrHelp = StrBEVHelp;

-    BbsType     = BBS_BEV_DEVICE;

-    LegacyOrder = CallbackData->BmmFakeNvData->LegacyBEV;

-    OldData     = CallbackData->BmmOldFakeNVData.LegacyBEV;

-    break;

-

-  }

-

-  CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, OptionMenu);

-

-  IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * (OptionMenu->MenuNumber + 1));

-  if (NULL == IfrOptionList) {

-    return ;

-  }

-

-  for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {

-    NewMenuEntry                = BOpt_GetMenuEntry (OptionMenu, Index);

-    IfrOptionList[Index].Flags  = EFI_IFR_FLAG_INTERACTIVE;

-    if (0 == Index) {

-      IfrOptionList[Index].Flags |= EFI_IFR_FLAG_DEFAULT;

-    }

-

-    IfrOptionList[Index].Key          = Key;

-    IfrOptionList[Index].StringToken  = NewMenuEntry->DisplayStringToken;

-    IfrOptionList[Index].Value        = (UINT16) ((BM_LEGACY_DEVICE_CONTEXT *) NewMenuEntry->VariableContext)->Index;

-    IfrOptionList[Index].OptionString = NULL;

-  }

-  //

-  // for item "Disabled"

-  //

-  IfrOptionList[Index].Flags        = EFI_IFR_FLAG_INTERACTIVE;

-  IfrOptionList[Index].Key          = Key;

-  IfrOptionList[Index].StringToken  = STRING_TOKEN (STR_DISABLE_LEGACY_DEVICE);

-  IfrOptionList[Index].Value        = 0xFF;

-  IfrOptionList[Index].OptionString = NULL;

-

-  //

-  // Get Device Order from variable

-  //

-  VarData = BdsLibGetVariableAndSize (

-              VarLegacyDevOrder,

-              &EfiLegacyDevOrderGuid,

-              &VarSize

-              );

-

-  if (NULL != VarData) {

-    OriginalPtr = VarData;

-    DevOrder    = (BM_LEGACY_DEV_ORDER_CONTEXT *) VarData;

-    while (VarData < VarData + VarSize) {

-      if (DevOrder->BbsType == BbsType) {

-        break;

-      }

-

-      VarData += sizeof (BBS_TYPE);

-      VarData += *(UINT16 *) VarData;

-      DevOrder = (BM_LEGACY_DEV_ORDER_CONTEXT *) VarData;

-    }

-    //

-    // Create oneof tag here for FD/HD/CD #1 #2

-    //

-    for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {

-      for (Index2 = 0; Index2 <= OptionMenu->MenuNumber; Index2++) {

-        IfrOptionList[Index2].Key = (UINT16) (Key + Index);

-      }

-      //

-      // Create the string for oneof tag

-      //

-      UnicodeSPrint (String, sizeof (String), TypeStr, Index);

-      StrRef = 0;

-      CallbackData->Hii->NewString (

-                          CallbackData->Hii,

-                          NULL,

-                          CallbackData->BmmHiiHandle,

-                          &StrRef,

-                          String

-                          );

-

-      UnicodeSPrint (String, sizeof (String), TypeStrHelp, Index);

-      StrRefHelp = 0;

-      CallbackData->Hii->NewString (

-                          CallbackData->Hii,

-                          NULL,

-                          CallbackData->BmmHiiHandle,

-                          &StrRefHelp,

-                          String

-                          );

-

-      CreateOneOfOpCode (

-        (UINT16) (Key + Index),

-        (UINT8) 1,

-        StrRef,

-        StrRefHelp,

-        IfrOptionList,

-        OptionMenu->MenuNumber + 1,

-        Location

-        );

-

-      VarDevOrder = *(UINT16 *) ((UINT8 *) DevOrder + sizeof (BBS_TYPE) + sizeof (UINT16) + Index * sizeof (UINT16));

-

-      if (0xFF00 == (VarDevOrder & 0xFF00)) {

-        LegacyOrder[Index]  = 0xFF;

-        Pos                 = (VarDevOrder & 0xFF) / 8;

-        Bit                 = 7 - ((VarDevOrder & 0xFF) % 8);

-        DisMap[Pos] |= (UINT8) (1 << Bit);

-      } else {

-        LegacyOrder[Index] = (UINT8) (VarDevOrder & 0xFF);

-      }

-

-      Location              = Location + (OptionMenu->MenuNumber + 2) * ((EFI_IFR_OP_HEADER *) Location)->Length;

-      Location              = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-      UpdateData->DataCount = (UINT16) (UpdateData->DataCount + (OptionMenu->MenuNumber + 3));

-    }

-  }

-

-  CopyMem (

-    OldData,

-    LegacyOrder,

-    100

-    );

-

-  if (IfrOptionList != NULL) {

-    SafeFreePool (IfrOptionList);

-    IfrOptionList = NULL;

-  }

-

-  UpdatePageEnd (CallbackData, Location);

-}

-

-VOID

-UpdatePageId (

-  BMM_CALLBACK_DATA              *Private,

-  UINT16                         NewPageId

-  )

-{

-  UINT16  FileOptionMask;

-

-  FileOptionMask = (UINT16) (FILE_OPTION_MASK & NewPageId);

-

-  if ((NewPageId < FILE_OPTION_OFFSET) && (NewPageId >= HANDLE_OPTION_OFFSET)) {

-    //

-    // If we select a handle to add driver option, advance to the add handle description page.

-    //

-    NewPageId = FORM_DRV_ADD_HANDLE_DESC_ID;

-  } else if ((NewPageId == KEY_VALUE_SAVE_AND_EXIT) || (NewPageId == KEY_VALUE_NO_SAVE_AND_EXIT)) {

-    //

-    // Return to main page after "Save Changes" or "Discard Changes".

-    //

-    NewPageId = FORM_MAIN_ID;

-  }

-

-  if ((NewPageId > 0) && (NewPageId < MAXIMUM_FORM_ID)) {

-    Private->BmmPreviousPageId  = Private->BmmCurrentPageId;

-    Private->BmmCurrentPageId   = NewPageId;

-  }

-}

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/Variable.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/Variable.c
deleted file mode 100644
index cac68a1..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/Variable.c
+++ /dev/null
@@ -1,1280 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  Variable.c

-

-Abstract:

-

-  Variable operation that will be used by BootMaint

-

---*/

-

-#include "Generic/Bds.h"

-#include "BootMaint.h"

-#include "bdsplatform.h"

-

-EFI_STATUS

-Var_DelBootOption (

-  VOID

-  )

-/*++

-

-Routine Description:

-  Delete Boot Option that represent a Deleted state in BootOptionMenu.

-  After deleting this boot option, call Var_ChangeBootOrder to

-  make sure BootOrder is in valid state.

-  

-Arguments:

-  LoadOption -- Pointer to the boot option that to be deleted

-

-Returns:

-  EFI_SUCCESS

-  Others

-  

---*/

-{

-  BM_MENU_ENTRY   *NewMenuEntry;

-  BM_LOAD_CONTEXT *NewLoadContext;

-

-  UINT16          BootString[10];

-  EFI_STATUS      Status;

-  UINTN           Index;

-  UINTN           Index2;

-

-  Status  = EFI_SUCCESS;

-  Index2  = 0;

-  for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {

-    NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, (Index - Index2));

-    if (NULL == NewMenuEntry) {

-      return EFI_NOT_FOUND;

-    }

-

-    NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;

-    if (!NewLoadContext->Deleted) {

-      continue;

-    }

-

-    UnicodeSPrint (

-      BootString,

-      sizeof (BootString),

-      L"Boot%04x",

-      NewMenuEntry->OptionNumber

-      );

-

-    EfiLibDeleteVariable (BootString, &gEfiGlobalVariableGuid);

-    Index2++;

-    //

-    // If current Load Option is the same as BootNext,

-    // must delete BootNext in order to make sure

-    // there will be no panic on next boot

-    //

-    if (NewLoadContext->IsBootNext) {

-      EfiLibDeleteVariable (L"BootNext", &gEfiGlobalVariableGuid);

-    }

-

-    RemoveEntryList (&NewMenuEntry->Link);

-    BOpt_DestroyMenuEntry (NewMenuEntry);

-    NewMenuEntry = NULL;

-  }

-

-  BootOptionMenu.MenuNumber -= Index2;

-

-  Status = Var_ChangeBootOrder ();

-  return Status;

-}

-

-EFI_STATUS

-Var_ChangeBootOrder (

-  VOID

-  )

-/*++

-

-Routine Description:

-  After any operation on Boot####, there will be a discrepancy in BootOrder.

-  Since some are missing but in BootOrder, while some are present but are 

-  not reflected by BootOrder. Then a function rebuild BootOrder from 

-  scratch by content from BootOptionMenu is needed.

-  

-Arguments:

-

-Returns:

-  EFI_SUCCESS

-  Others

-  

---*/

-{

-

-  EFI_STATUS    Status;

-  BM_MENU_ENTRY *NewMenuEntry;

-  UINT16        *BootOrderList;

-  UINT16        *BootOrderListPtr;

-  UINTN         BootOrderListSize;

-  UINTN         Index;

-

-  BootOrderList     = NULL;

-  BootOrderListSize = 0;

-

-  //

-  // First check whether BootOrder is present in current configuration

-  //

-  BootOrderList = BdsLibGetVariableAndSize (

-                    L"BootOrder",

-                    &gEfiGlobalVariableGuid,

-                    &BootOrderListSize

-                    );

-

-  //

-  // If exists, delete it to hold new BootOrder

-  //

-  if (BootOrderList) {

-    EfiLibDeleteVariable (L"BootOrder", &gEfiGlobalVariableGuid);

-    SafeFreePool (BootOrderList);

-    BootOrderList = NULL;

-  }

-  //

-  // Maybe here should be some check method to ensure that

-  // no new added boot options will be added

-  // but the setup engine now will give only one callback

-  // that is to say, user are granted only one chance to

-  // decide whether the boot option will be added or not

-  // there should be no indictor to show whether this

-  // is a "new" boot option

-  //

-  BootOrderListSize = BootOptionMenu.MenuNumber;

-

-  if (BootOrderListSize > 0) {

-    BootOrderList = AllocateZeroPool (BootOrderListSize * sizeof (UINT16));

-    ASSERT (BootOrderList != NULL);

-    BootOrderListPtr = BootOrderList;

-

-    //

-    // Get all current used Boot#### from BootOptionMenu.

-    // OptionNumber in each BM_LOAD_OPTION is really its

-    // #### value.

-    //

-    for (Index = 0; Index < BootOrderListSize; Index++) {

-      NewMenuEntry    = BOpt_GetMenuEntry (&BootOptionMenu, Index);

-      *BootOrderList  = (UINT16) NewMenuEntry->OptionNumber;

-      BootOrderList++;

-    }

-

-    BootOrderList = BootOrderListPtr;

-

-    //

-    // After building the BootOrderList, write it back

-    //

-    Status = gRT->SetVariable (

-                    L"BootOrder",

-                    &gEfiGlobalVariableGuid,

-                    VAR_FLAG,

-                    BootOrderListSize * sizeof (UINT16),

-                    BootOrderList

-                    );

-    if (EFI_ERROR (Status)) {

-      return Status;

-    }

-  }

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-Var_DelDriverOption (

-  VOID

-  )

-/*++

-

-Routine Description:

-  Delete Load Option that represent a Deleted state in BootOptionMenu.

-  After deleting this Driver option, call Var_ChangeDriverOrder to

-  make sure DriverOrder is in valid state.

-  

-Arguments:

-  LoadOption -- Pointer to the Driver option that to be deleted

-

-Returns:

-  EFI_SUCCESS

-  Others

-  

---*/

-{

-  BM_MENU_ENTRY   *NewMenuEntry;

-  BM_LOAD_CONTEXT *NewLoadContext;

-

-  UINT16          DriverString[12];

-  EFI_STATUS      Status;

-  UINTN           Index;

-  UINTN           Index2;

-

-  Status  = EFI_SUCCESS;

-  Index2  = 0;

-  for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {

-    NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, (Index - Index2));

-    if (NULL == NewMenuEntry) {

-      return EFI_NOT_FOUND;

-    }

-

-    NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;

-    if (!NewLoadContext->Deleted) {

-      continue;

-    }

-

-    UnicodeSPrint (

-      DriverString,

-      sizeof (DriverString),

-      L"Driver%04x",

-      NewMenuEntry->OptionNumber

-      );

-

-    EfiLibDeleteVariable (DriverString, &gEfiGlobalVariableGuid);

-    Index2++;

-

-    RemoveEntryList (&NewMenuEntry->Link);

-    BOpt_DestroyMenuEntry (NewMenuEntry);

-    NewMenuEntry = NULL;

-  }

-

-  DriverOptionMenu.MenuNumber -= Index2;

-

-  Status = Var_ChangeDriverOrder ();

-  return Status;

-}

-

-EFI_STATUS

-Var_ChangeDriverOrder (

-  VOID

-  )

-/*++

-

-Routine Description:

-  After any operation on Driver####, there will be a discrepancy in 

-  DriverOrder. Since some are missing but in DriverOrder, while some 

-  are present but are not reflected by DriverOrder. Then a function 

-  rebuild DriverOrder from scratch by content from DriverOptionMenu is 

-  needed.

-  

-Arguments:

-

-Returns:

-  EFI_SUCCESS

-  Others

-  

---*/

-{

-  EFI_STATUS    Status;

-  BM_MENU_ENTRY *NewMenuEntry;

-  UINT16        *DriverOrderList;

-  UINT16        *DriverOrderListPtr;

-  UINTN         DriverOrderListSize;

-  UINTN         Index;

-

-  DriverOrderList     = NULL;

-  DriverOrderListSize = 0;

-

-  //

-  // First check whether DriverOrder is present in current configuration

-  //

-  DriverOrderList = BdsLibGetVariableAndSize (

-                      L"DriverOrder",

-                      &gEfiGlobalVariableGuid,

-                      &DriverOrderListSize

-                      );

-

-  //

-  // If exists, delete it to hold new DriverOrder

-  //

-  if (DriverOrderList) {

-    EfiLibDeleteVariable (L"DriverOrder", &gEfiGlobalVariableGuid);

-    SafeFreePool (DriverOrderList);

-    DriverOrderList = NULL;

-  }

-

-  DriverOrderListSize = DriverOptionMenu.MenuNumber;

-

-  if (DriverOrderListSize > 0) {

-    DriverOrderList = AllocateZeroPool (DriverOrderListSize * sizeof (UINT16));

-    ASSERT (DriverOrderList != NULL);

-    DriverOrderListPtr = DriverOrderList;

-

-    //

-    // Get all current used Driver#### from DriverOptionMenu.

-    // OptionNumber in each BM_LOAD_OPTION is really its

-    // #### value.

-    //

-    for (Index = 0; Index < DriverOrderListSize; Index++) {

-      NewMenuEntry      = BOpt_GetMenuEntry (&DriverOptionMenu, Index);

-      *DriverOrderList  = (UINT16) NewMenuEntry->OptionNumber;

-      DriverOrderList++;

-    }

-

-    DriverOrderList = DriverOrderListPtr;

-

-    //

-    // After building the DriverOrderList, write it back

-    //

-    Status = gRT->SetVariable (

-                    L"DriverOrder",

-                    &gEfiGlobalVariableGuid,

-                    VAR_FLAG,

-                    DriverOrderListSize * sizeof (UINT16),

-                    DriverOrderList

-                    );

-    if (EFI_ERROR (Status)) {

-      return Status;

-    }

-  }

-  return EFI_SUCCESS;

-}

-

-VOID

-Var_UpdateAllConsoleOption (

-  VOID

-  )

-{

-  EFI_DEVICE_PATH_PROTOCOL  *OutDevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  *InpDevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  *ErrDevicePath;

-  EFI_STATUS                Status;

-

-  OutDevicePath = EfiLibGetVariable (L"ConOut", &gEfiGlobalVariableGuid);

-  InpDevicePath = EfiLibGetVariable (L"ConIn", &gEfiGlobalVariableGuid);

-  ErrDevicePath = EfiLibGetVariable (L"ErrOut", &gEfiGlobalVariableGuid);

-  if (OutDevicePath) {

-    ChangeVariableDevicePath (OutDevicePath);

-    Status = gRT->SetVariable (

-                    L"ConOut",

-                    &gEfiGlobalVariableGuid,

-                    VAR_FLAG,

-                    GetDevicePathSize (OutDevicePath),

-                    OutDevicePath

-                    );

-    ASSERT (!EFI_ERROR (Status));

-  }

-

-  if (InpDevicePath) {

-    ChangeVariableDevicePath (InpDevicePath);

-    Status = gRT->SetVariable (

-                    L"ConIn",

-                    &gEfiGlobalVariableGuid,

-                    VAR_FLAG,

-                    GetDevicePathSize (InpDevicePath),

-                    InpDevicePath

-                    );

-    ASSERT (!EFI_ERROR (Status));

-  }

-

-  if (ErrDevicePath) {

-    ChangeVariableDevicePath (ErrDevicePath);

-    Status = gRT->SetVariable (

-                    L"ErrOut",

-                    &gEfiGlobalVariableGuid,

-                    VAR_FLAG,

-                    GetDevicePathSize (ErrDevicePath),

-                    ErrDevicePath

-                    );

-    ASSERT (!EFI_ERROR (Status));

-  }

-}

-

-EFI_STATUS

-Var_UpdateConsoleOption (

-  IN UINT16                     *ConsoleName,

-  IN BM_MENU_OPTION             *ConsoleMenu,

-  IN UINT16                     UpdatePageId

-  )

-{

-  EFI_DEVICE_PATH_PROTOCOL  *ConDevicePath;

-  BM_MENU_ENTRY             *NewMenuEntry;

-  BM_CONSOLE_CONTEXT        *NewConsoleContext;

-  BM_TERMINAL_CONTEXT       *NewTerminalContext;

-  EFI_STATUS                Status;

-  VENDOR_DEVICE_PATH        Vendor;

-  EFI_DEVICE_PATH_PROTOCOL  *TerminalDevicePath;

-  UINTN                     Index;

-  UINT16                    *Temp;

-

-  ConDevicePath = EfiLibGetVariable (ConsoleName, &gEfiGlobalVariableGuid);

-  if (ConDevicePath != NULL) {

-    EfiLibDeleteVariable (ConsoleName, &gEfiGlobalVariableGuid);

-    SafeFreePool (ConDevicePath);

-    ConDevicePath = NULL;

-  };

-

-  //

-  // First add all console input device to it from console input menu

-  //

-  for (Index = 0; Index < ConsoleMenu->MenuNumber; Index++) {

-    NewMenuEntry = BOpt_GetMenuEntry (ConsoleMenu, Index);

-    if (NULL == NewMenuEntry) {

-      return EFI_NOT_FOUND;

-    }

-

-    NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;

-    if (NewConsoleContext->IsActive) {

-      ConDevicePath = AppendDevicePathInstance (

-                        ConDevicePath,

-                        NewConsoleContext->DevicePath

-                        );

-    }

-  }

-

-  for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {

-    NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);

-    if (NULL == NewMenuEntry) {

-      return EFI_NOT_FOUND;

-    }

-

-    NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;

-    if ((NewTerminalContext->IsConIn && (UpdatePageId == FORM_CON_IN_ID)) ||

-        (NewTerminalContext->IsConOut && (UpdatePageId == FORM_CON_OUT_ID)) ||

-        (NewTerminalContext->IsStdErr && (UpdatePageId == FORM_CON_ERR_ID))

-        ) {

-      Vendor.Header.Type    = MESSAGING_DEVICE_PATH;

-      Vendor.Header.SubType = MSG_VENDOR_DP;

-      CopyMem (

-        &Vendor.Guid,

-        &Guid[NewTerminalContext->TerminalType],

-        sizeof (EFI_GUID)

-        );

-      SetDevicePathNodeLength (&Vendor.Header, sizeof (VENDOR_DEVICE_PATH));

-      TerminalDevicePath = AppendDevicePathNode (

-                            NewTerminalContext->DevicePath,

-                            (EFI_DEVICE_PATH_PROTOCOL *) &Vendor

-                            );

-      ASSERT (TerminalDevicePath != NULL);

-      ChangeTerminalDevicePath (TerminalDevicePath, TRUE);

-      Temp = DevicePathToStr (TerminalDevicePath);

-      ConDevicePath = AppendDevicePathInstance (

-                        ConDevicePath,

-                        TerminalDevicePath

-                        );

-    }

-  }

-

-  if (ConDevicePath) {

-    Status = gRT->SetVariable (

-                    ConsoleName,

-                    &gEfiGlobalVariableGuid,

-                    VAR_FLAG,

-                    GetDevicePathSize (ConDevicePath),

-                    ConDevicePath

-                    );

-    if (EFI_ERROR (Status)) {

-      return Status;

-    }

-  }

-

-  return EFI_SUCCESS;

-

-}

-

-EFI_STATUS

-Var_UpdateConsoleInpOption (

-  VOID

-  )

-{

-  return Var_UpdateConsoleOption (L"ConIn", &ConsoleInpMenu, FORM_CON_IN_ID);

-}

-

-EFI_STATUS

-Var_UpdateConsoleOutOption (

-  VOID

-  )

-{

-  return Var_UpdateConsoleOption (L"ConOut", &ConsoleOutMenu, FORM_CON_OUT_ID);

-}

-

-EFI_STATUS

-Var_UpdateErrorOutOption (

-  VOID

-  )

-{

-  return Var_UpdateConsoleOption (L"ErrOut", &ConsoleErrMenu, FORM_CON_ERR_ID);

-}

-

-EFI_STATUS

-Var_UpdateDriverOption (

-  IN  BMM_CALLBACK_DATA         *CallbackData,

-  IN  EFI_HII_HANDLE            HiiHandle,

-  IN  UINT16                    *DescriptionData,

-  IN  UINT16                    *OptionalData,

-  IN  UINT8                     ForceReconnect

-  )

-{

-  UINT16          Index;

-  UINT16          *DriverOrderList;

-  UINT16          *NewDriverOrderList;

-  UINT16          DriverString[12];

-  UINTN           DriverOrderListSize;

-  VOID            *Buffer;

-  UINTN           BufferSize;

-  UINT8           *Ptr;

-  BM_MENU_ENTRY   *NewMenuEntry;

-  BM_LOAD_CONTEXT *NewLoadContext;

-  BOOLEAN         OptionalDataExist;

-  EFI_STATUS      Status;

-

-  OptionalDataExist = FALSE;

-

-  Index             = BOpt_GetDriverOptionNumber ();

-  UnicodeSPrint (

-    DriverString,

-    sizeof (DriverString),

-    L"Driver%04x",

-    Index

-    );

-

-  if (*DescriptionData == 0x0000) {

-    StrCpy (DescriptionData, DriverString);

-  }

-

-  BufferSize = sizeof (UINT32) + sizeof (UINT16) + StrSize (DescriptionData) + GetDevicePathSize (CallbackData->LoadContext->FilePathList);

-

-  if (*OptionalData != 0x0000) {

-    OptionalDataExist = TRUE;

-    BufferSize += StrSize (OptionalData);

-  }

-

-  Buffer = AllocateZeroPool (BufferSize);

-  if (NULL == Buffer) {

-    return EFI_OUT_OF_RESOURCES;

-  }

-

-  NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT);

-  if (NULL == NewMenuEntry) {

-    return EFI_OUT_OF_RESOURCES;

-  }

-

-  NewLoadContext                  = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;

-  NewLoadContext->Deleted         = FALSE;

-  NewLoadContext->LoadOptionSize  = BufferSize;

-  Ptr = (UINT8 *) Buffer;

-  NewLoadContext->LoadOption = Ptr;

-  *((UINT32 *) Ptr) = LOAD_OPTION_ACTIVE | (ForceReconnect << 1);

-  NewLoadContext->Attributes = *((UINT32 *) Ptr);

-  NewLoadContext->IsActive = TRUE;

-  NewLoadContext->ForceReconnect = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_FORCE_RECONNECT);

-

-  Ptr += sizeof (UINT32);

-  *((UINT16 *) Ptr) = (UINT16) GetDevicePathSize (CallbackData->LoadContext->FilePathList);

-  NewLoadContext->FilePathListLength = *((UINT16 *) Ptr);

-

-  Ptr += sizeof (UINT16);

-  CopyMem (

-    Ptr,

-    DescriptionData,

-    StrSize (DescriptionData)

-    );

-

-  NewLoadContext->Description = AllocateZeroPool (StrSize (DescriptionData));

-  ASSERT (NewLoadContext->Description != NULL);

-  NewMenuEntry->DisplayString = NewLoadContext->Description;

-  CopyMem (

-    NewLoadContext->Description,

-    (VOID *) Ptr,

-    StrSize (DescriptionData)

-    );

-

-  Ptr += StrSize (DescriptionData);

-  CopyMem (

-    Ptr,

-    CallbackData->LoadContext->FilePathList,

-    GetDevicePathSize (CallbackData->LoadContext->FilePathList)

-    );

-

-  NewLoadContext->FilePathList = AllocateZeroPool (GetDevicePathSize (CallbackData->LoadContext->FilePathList));

-  ASSERT (NewLoadContext->FilePathList != NULL);

-

-  CopyMem (

-    NewLoadContext->FilePathList,

-    (VOID *) Ptr,

-    GetDevicePathSize (CallbackData->LoadContext->FilePathList)

-    );

-

-  NewMenuEntry->HelpString    = DevicePathToStr (NewLoadContext->FilePathList);

-  NewMenuEntry->OptionNumber  = Index;

-  NewMenuEntry->DisplayStringToken = GetStringTokenFromDepository (

-                                      CallbackData,

-                                      DriverOptionStrDepository

-                                      );

-  CallbackData->Hii->NewString (

-                      CallbackData->Hii,

-                      NULL,

-                      HiiHandle,

-                      &NewMenuEntry->DisplayStringToken,

-                      NewMenuEntry->DisplayString

-                      );

-

-  NewMenuEntry->HelpStringToken = GetStringTokenFromDepository (

-                                    CallbackData,

-                                    DriverOptionHelpStrDepository

-                                    );

-  CallbackData->Hii->NewString (

-                      CallbackData->Hii,

-                      NULL,

-                      HiiHandle,

-                      &NewMenuEntry->HelpStringToken,

-                      NewMenuEntry->HelpString

-                      );

-

-  if (OptionalDataExist) {

-    Ptr += (UINT8) GetDevicePathSize (CallbackData->LoadContext->FilePathList);

-

-    CopyMem (

-      Ptr,

-      OptionalData,

-      StrSize (OptionalData)

-      );

-  }

-

-  Status = gRT->SetVariable (

-                  DriverString,

-                  &gEfiGlobalVariableGuid,

-                  VAR_FLAG,

-                  BufferSize,

-                  Buffer

-                  );

-  DriverOrderList = BdsLibGetVariableAndSize (

-                      L"DriverOrder",

-                      &gEfiGlobalVariableGuid,

-                      &DriverOrderListSize

-                      );

-  NewDriverOrderList = AllocateZeroPool (DriverOrderListSize + sizeof (UINT16));

-  ASSERT (NewDriverOrderList != NULL);

-  CopyMem (NewDriverOrderList, DriverOrderList, DriverOrderListSize);

-  NewDriverOrderList[DriverOrderListSize / sizeof (UINT16)] = Index;

-  if (DriverOrderList != NULL) {

-    EfiLibDeleteVariable (L"DriverOrder", &gEfiGlobalVariableGuid);

-  }

-

-  Status = gRT->SetVariable (

-                  L"DriverOrder",

-                  &gEfiGlobalVariableGuid,

-                  VAR_FLAG,

-                  DriverOrderListSize + sizeof (UINT16),

-                  NewDriverOrderList

-                  );

-  SafeFreePool (DriverOrderList);

-  DriverOrderList = NULL;

-  SafeFreePool (NewDriverOrderList);

-  NewDriverOrderList = NULL;

-  InsertTailList (&DriverOptionMenu.Head, &NewMenuEntry->Link);

-  DriverOptionMenu.MenuNumber++;

-

-  *DescriptionData  = 0x0000;

-  *OptionalData     = 0x0000;

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-Var_UpdateBootOption (

-  IN  BMM_CALLBACK_DATA                   *CallbackData,

-  IN  FILE_EXPLORER_NV_DATA               *NvRamMap

-  )

-{

-  UINT16          *BootOrderList;

-  UINT16          *NewBootOrderList;

-  UINTN           BootOrderListSize;

-  UINT16          BootString[10];

-  VOID            *Buffer;

-  UINTN           BufferSize;

-  UINT8           *Ptr;

-  UINT16          Index;

-  BM_MENU_ENTRY   *NewMenuEntry;

-  BM_LOAD_CONTEXT *NewLoadContext;

-  BOOLEAN         OptionalDataExist;

-  EFI_STATUS      Status;

-

-  OptionalDataExist = FALSE;

-

-  Index             = BOpt_GetBootOptionNumber ();

-  UnicodeSPrint (BootString, sizeof (BootString), L"Boot%04x", Index);

-

-  if (NvRamMap->DescriptionData[0] == 0x0000) {

-    StrCpy (NvRamMap->DescriptionData, BootString);

-  }

-

-  BufferSize = sizeof (UINT32) + sizeof (UINT16) + StrSize (NvRamMap->DescriptionData) + GetDevicePathSize (CallbackData->LoadContext->FilePathList);

-

-  if (NvRamMap->OptionalData[0] != 0x0000) {

-    OptionalDataExist = TRUE;

-    BufferSize += StrSize (NvRamMap->OptionalData);

-  }

-

-  Buffer = AllocateZeroPool (BufferSize);

-  if (NULL == Buffer) {

-    return EFI_OUT_OF_RESOURCES;

-  }

-

-  NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT);

-  if (NULL == NewMenuEntry) {

-    return EFI_OUT_OF_RESOURCES;

-  }

-

-  NewLoadContext                  = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;

-  NewLoadContext->Deleted         = FALSE;

-  NewLoadContext->LoadOptionSize  = BufferSize;

-  Ptr = (UINT8 *) Buffer;

-  NewLoadContext->LoadOption = Ptr;

-  *((UINT32 *) Ptr) = LOAD_OPTION_ACTIVE;

-  NewLoadContext->Attributes = *((UINT32 *) Ptr);

-  NewLoadContext->IsActive = TRUE;

-  NewLoadContext->ForceReconnect = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_FORCE_RECONNECT);

-

-  Ptr += sizeof (UINT32);

-  *((UINT16 *) Ptr) = (UINT16) GetDevicePathSize (CallbackData->LoadContext->FilePathList);

-  NewLoadContext->FilePathListLength = *((UINT16 *) Ptr);

-  Ptr += sizeof (UINT16);

-

-  CopyMem (

-    Ptr,

-    NvRamMap->DescriptionData,

-    StrSize (NvRamMap->DescriptionData)

-    );

-

-  NewLoadContext->Description = AllocateZeroPool (StrSize (NvRamMap->DescriptionData));

-  ASSERT (NewLoadContext->Description != NULL);

-

-  NewMenuEntry->DisplayString = NewLoadContext->Description;

-  CopyMem (

-    NewLoadContext->Description,

-    (VOID *) Ptr,

-    StrSize (NvRamMap->DescriptionData)

-    );

-

-  Ptr += StrSize (NvRamMap->DescriptionData);

-  CopyMem (

-    Ptr,

-    CallbackData->LoadContext->FilePathList,

-    GetDevicePathSize (CallbackData->LoadContext->FilePathList)

-    );

-

-  NewLoadContext->FilePathList = AllocateZeroPool (GetDevicePathSize (CallbackData->LoadContext->FilePathList));

-  ASSERT (NewLoadContext->FilePathList != NULL);

-

-  CopyMem (

-    NewLoadContext->FilePathList,

-    (VOID *) Ptr,

-    GetDevicePathSize (CallbackData->LoadContext->FilePathList)

-    );

-

-  NewMenuEntry->HelpString    = DevicePathToStr (NewLoadContext->FilePathList);

-  NewMenuEntry->OptionNumber  = Index;

-  NewMenuEntry->DisplayStringToken = GetStringTokenFromDepository (

-                                      CallbackData,

-                                      BootOptionStrDepository

-                                      );

-  CallbackData->Hii->NewString (

-                      CallbackData->Hii,

-                      NULL,

-                      CallbackData->FeHiiHandle,

-                      &NewMenuEntry->DisplayStringToken,

-                      NewMenuEntry->DisplayString

-                      );

-

-  NewMenuEntry->HelpStringToken = GetStringTokenFromDepository (

-                                    CallbackData,

-                                    BootOptionHelpStrDepository

-                                    );

-

-  CallbackData->Hii->NewString (

-                      CallbackData->Hii,

-                      NULL,

-                      CallbackData->FeHiiHandle,

-                      &NewMenuEntry->HelpStringToken,

-                      NewMenuEntry->HelpString

-                      );

-

-  if (OptionalDataExist) {

-    Ptr += (UINT8) GetDevicePathSize (CallbackData->LoadContext->FilePathList);

-

-    CopyMem (Ptr, NvRamMap->OptionalData, StrSize (NvRamMap->OptionalData));

-  }

-

-  Status = gRT->SetVariable (

-                  BootString,

-                  &gEfiGlobalVariableGuid,

-                  VAR_FLAG,

-                  BufferSize,

-                  Buffer

-                  );

-

-  BootOrderList = BdsLibGetVariableAndSize (

-                    L"BootOrder",

-                    &gEfiGlobalVariableGuid,

-                    &BootOrderListSize

-                    );

-

-  NewBootOrderList = AllocateZeroPool (BootOrderListSize + sizeof (UINT16));

-  ASSERT (NewBootOrderList != NULL);

-  CopyMem (NewBootOrderList, BootOrderList, BootOrderListSize);

-  NewBootOrderList[BootOrderListSize / sizeof (UINT16)] = Index;

-

-  if (BootOrderList != NULL) {

-    EfiLibDeleteVariable (L"BootOrder", &gEfiGlobalVariableGuid);

-  }

-

-  Status = gRT->SetVariable (

-                  L"BootOrder",

-                  &gEfiGlobalVariableGuid,

-                  VAR_FLAG,

-                  BootOrderListSize + sizeof (UINT16),

-                  NewBootOrderList

-                  );

-

-  SafeFreePool (BootOrderList);

-  BootOrderList = NULL;

-  SafeFreePool (NewBootOrderList);

-  NewBootOrderList = NULL;

-  InsertTailList (&BootOptionMenu.Head, &NewMenuEntry->Link);

-  BootOptionMenu.MenuNumber++;

-

-  NvRamMap->DescriptionData[0]  = 0x0000;

-  NvRamMap->OptionalData[0]     = 0x0000;

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-Var_UpdateBootNext (

-  IN BMM_CALLBACK_DATA            *CallbackData

-  )

-{

-  BM_MENU_ENTRY     *NewMenuEntry;

-  BM_LOAD_CONTEXT   *NewLoadContext;

-  BMM_FAKE_NV_DATA  *CurrentFakeNVMap;

-  UINT16            Index;

-  EFI_STATUS        Status;

-

-  Status            = EFI_SUCCESS;

-  CurrentFakeNVMap  = CallbackData->BmmFakeNvData;

-  for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {

-    NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);

-    if (NULL == NewMenuEntry) {

-      return EFI_NOT_FOUND;

-    }

-

-    NewLoadContext              = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;

-    NewLoadContext->IsBootNext  = FALSE;

-  }

-

-  if (CurrentFakeNVMap->BootNext == BootOptionMenu.MenuNumber) {

-    EfiLibDeleteVariable (L"BootNext", &gEfiGlobalVariableGuid);

-    return EFI_SUCCESS;

-  }

-

-  NewMenuEntry = BOpt_GetMenuEntry (

-                  &BootOptionMenu,

-                  CurrentFakeNVMap->BootNext

-                  );

-  if (NULL == NewMenuEntry) {

-    return EFI_NOT_FOUND;

-  }

-

-  NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;

-  Status = gRT->SetVariable (

-                  L"BootNext",

-                  &gEfiGlobalVariableGuid,

-                  VAR_FLAG,

-                  sizeof (UINT16),

-                  &NewMenuEntry->OptionNumber

-                  );

-  NewLoadContext->IsBootNext              = TRUE;

-  CallbackData->BmmOldFakeNVData.BootNext = CurrentFakeNVMap->BootNext;

-  return Status;

-}

-

-EFI_STATUS

-Var_UpdateBootOrder (

-  IN BMM_CALLBACK_DATA            *CallbackData

-  )

-{

-  EFI_STATUS  Status;

-  UINT16      Index;

-  UINT16      *BootOrderList;

-  UINT16      *NewBootOrderList;

-  UINTN       BootOrderListSize;

-  UINT8       *Map;

-

-  BootOrderList     = NULL;

-  BootOrderListSize = 0;

-

-  //

-  // First check whether BootOrder is present in current configuration

-  //

-  BootOrderList = BdsLibGetVariableAndSize (

-                    L"BootOrder",

-                    &gEfiGlobalVariableGuid,

-                    &BootOrderListSize

-                    );

-

-  NewBootOrderList = AllocateZeroPool (BootOrderListSize);

-  if (!NewBootOrderList) {

-    return EFI_OUT_OF_RESOURCES;

-  }

-

-  Map = AllocateZeroPool (BootOrderListSize / sizeof (UINT16));

-  if (!Map) {

-    return EFI_OUT_OF_RESOURCES;

-  }

-  //

-  // If exists, delete it to hold new BootOrder

-  //

-  if (BootOrderList) {

-    EfiLibDeleteVariable (L"BootOrder", &gEfiGlobalVariableGuid);

-  }

-

-  for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {

-    NewBootOrderList[Index] = CallbackData->BmmFakeNvData->OptionOrder[Index] - 1;

-  }

-

-  Status = gRT->SetVariable (

-                  L"BootOrder",

-                  &gEfiGlobalVariableGuid,

-                  VAR_FLAG,

-                  BootOrderListSize,

-                  NewBootOrderList

-                  );

-  SafeFreePool (BootOrderList);

-  SafeFreePool (NewBootOrderList);

-  SafeFreePool (Map);

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  BOpt_FreeMenu (&BootOptionMenu);

-  BOpt_GetBootOptions (CallbackData);

-

-  return EFI_SUCCESS;

-

-}

-

-EFI_STATUS

-Var_UpdateDriverOrder (

-  IN BMM_CALLBACK_DATA            *CallbackData

-  )

-{

-  EFI_STATUS  Status;

-  UINT16      Index;

-  UINT16      *DriverOrderList;

-  UINT16      *NewDriverOrderList;

-  UINTN       DriverOrderListSize;

-

-  DriverOrderList     = NULL;

-  DriverOrderListSize = 0;

-

-  //

-  // First check whether DriverOrder is present in current configuration

-  //

-  DriverOrderList = BdsLibGetVariableAndSize (

-                      L"DriverOrder",

-                      &gEfiGlobalVariableGuid,

-                      &DriverOrderListSize

-                      );

-

-  NewDriverOrderList = AllocateZeroPool (DriverOrderListSize);

-

-  if (!NewDriverOrderList) {

-    return EFI_OUT_OF_RESOURCES;

-  }

-  //

-  // If exists, delete it to hold new DriverOrder

-  //

-  if (DriverOrderList) {

-    EfiLibDeleteVariable (L"DriverOrder", &gEfiGlobalVariableGuid);

-  }

-

-  for (Index = 0; Index < DriverOrderListSize; Index++) {

-    NewDriverOrderList[Index] = CallbackData->BmmFakeNvData->OptionOrder[Index] - 1;

-  }

-

-  Status = gRT->SetVariable (

-                  L"DriverOrder",

-                  &gEfiGlobalVariableGuid,

-                  VAR_FLAG,

-                  DriverOrderListSize,

-                  NewDriverOrderList

-                  );

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  SafeFreePool (DriverOrderList);

-

-  BOpt_FreeMenu (&DriverOptionMenu);

-  BOpt_GetDriverOptions (CallbackData);

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-Var_UpdateBBSOption (

-  IN BMM_CALLBACK_DATA            *CallbackData

-  )

-{

-  UINTN                       Index;

-  UINTN                       Index2;

-  VOID                        *BootOptionVar;

-  CHAR16                      VarName[100];

-  UINTN                       OptionSize;

-  UINT16                      FilePathSize;

-  UINT8                       *Ptr;

-  EFI_STATUS                  Status;

-  CHAR16                      DescString[100];

-  UINTN                       NewOptionSize;

-  UINT8                       *NewOptionPtr;

-  UINT8                       *TempPtr;

-  UINT32                      *Attribute;

-

-  BM_MENU_OPTION              *OptionMenu;

-  BM_LEGACY_DEVICE_CONTEXT    *LegacyDeviceContext;

-  UINT8                       *LegacyDev;

-  UINT8                       *VarData;

-  UINTN                       VarSize;

-  BM_MENU_ENTRY               *NewMenuEntry;

-  BM_LEGACY_DEV_ORDER_CONTEXT *DevOrder;

-  UINT8                       *OriginalPtr;

-  UINT8                       *DisMap;

-  UINTN                       Pos;

-  UINTN                       Bit;

-  UINT16                      *NewOrder;

-  UINT16                      Tmp;

-

-  LegacyDeviceContext = NULL;

-  DisMap              = NULL;

-  NewOrder            = NULL;

-

-  if (FORM_SET_FD_ORDER_ID == CallbackData->BmmPreviousPageId) {

-    OptionMenu            = (BM_MENU_OPTION *) &LegacyFDMenu;

-    LegacyDev             = CallbackData->BmmFakeNvData->LegacyFD;

-    CallbackData->BbsType = BBS_FLOPPY;

-  } else {

-    if (FORM_SET_HD_ORDER_ID == CallbackData->BmmPreviousPageId) {

-      OptionMenu            = (BM_MENU_OPTION *) &LegacyHDMenu;

-      LegacyDev             = CallbackData->BmmFakeNvData->LegacyHD;

-      CallbackData->BbsType = BBS_HARDDISK;

-    } else {

-      if (FORM_SET_CD_ORDER_ID == CallbackData->BmmPreviousPageId) {

-        OptionMenu            = (BM_MENU_OPTION *) &LegacyCDMenu;

-        LegacyDev             = CallbackData->BmmFakeNvData->LegacyCD;

-        CallbackData->BbsType = BBS_CDROM;

-      } else {

-        if (FORM_SET_NET_ORDER_ID == CallbackData->BmmPreviousPageId) {

-          OptionMenu            = (BM_MENU_OPTION *) &LegacyNETMenu;

-          LegacyDev             = CallbackData->BmmFakeNvData->LegacyNET;

-          CallbackData->BbsType = BBS_EMBED_NETWORK;

-        } else {

-          OptionMenu            = (BM_MENU_OPTION *) &LegacyBEVMenu;

-          LegacyDev             = CallbackData->BmmFakeNvData->LegacyBEV;

-          CallbackData->BbsType = BBS_BEV_DEVICE;

-        }

-      }

-    }

-  }

-

-  DisMap  = CallbackData->BmmOldFakeNVData.DisableMap;

-  Status  = EFI_SUCCESS;

-

-  //

-  // Find the first device's context

-  // If all devices are disabled( 0xFF == LegacyDev[0]), LegacyDeviceContext can be set to any VariableContext

-  // because we just use it to fill the desc string, and user can not see the string in UI

-  //

-  for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {

-    NewMenuEntry        = BOpt_GetMenuEntry (OptionMenu, Index);

-    LegacyDeviceContext = (BM_LEGACY_DEVICE_CONTEXT *) NewMenuEntry->VariableContext;

-    if (0xFF != LegacyDev[0] && LegacyDev[0] == LegacyDeviceContext->Index) {

-      DEBUG ((EFI_D_ERROR, "DescStr: %s\n", LegacyDeviceContext->Description));

-      break;

-    }

-  }

-  //

-  // Update the Variable "LegacyDevOrder"

-  //

-  VarData = (UINT8 *) BdsLibGetVariableAndSize (

-                        VarLegacyDevOrder,

-                        &EfiLegacyDevOrderGuid,

-                        &VarSize

-                        );

-

-  if (NULL == VarData) {

-    return EFI_NOT_FOUND;

-  }

-

-  OriginalPtr = VarData;

-  DevOrder    = (BM_LEGACY_DEV_ORDER_CONTEXT *) VarData;

-

-  while (VarData < VarData + VarSize) {

-    if (DevOrder->BbsType == CallbackData->BbsType) {

-      break;

-    }

-

-    VarData += sizeof (BBS_TYPE);

-    VarData += *(UINT16 *) VarData;

-    DevOrder = (BM_LEGACY_DEV_ORDER_CONTEXT *) VarData;

-  }

-

-  if (VarData >= VarData + VarSize) {

-    SafeFreePool (OriginalPtr);

-    return EFI_NOT_FOUND;

-  }

-

-  NewOrder = (UINT16 *) AllocateZeroPool (DevOrder->Length - sizeof (UINT16));

-  if (NULL == NewOrder) {

-    SafeFreePool (VarData);

-    return EFI_OUT_OF_RESOURCES;

-  }

-

-  for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {

-    if (0xFF == LegacyDev[Index]) {

-      break;

-    }

-

-    NewOrder[Index] = LegacyDev[Index];

-  }

-  //

-  // Only the enable/disable state of each boot device with same device type can be changed,

-  // so we can count on the index information in DevOrder.

-  // DisMap bit array is the only reliable source to check a device's en/dis state,

-  // so we use DisMap to set en/dis state of each item in NewOrder array

-  //

-  for (Index2 = 0; Index2 < OptionMenu->MenuNumber; Index2++) {

-    Tmp = *(UINT16 *) ((UINT8 *) DevOrder + sizeof (BBS_TYPE) + sizeof (UINT16) + Index2 * sizeof (UINT16));

-    Tmp &= 0xFF;

-    Pos = Tmp / 8;

-    Bit = 7 - (Tmp % 8);

-    if (DisMap[Pos] & (1 << Bit)) {

-      NewOrder[Index] = (UINT16) (0xFF00 | Tmp);

-      Index++;

-    }

-  }

-

-  CopyMem (

-    (UINT8 *) DevOrder + sizeof (BBS_TYPE) + sizeof (UINT16),

-    NewOrder,

-    DevOrder->Length - sizeof (UINT16)

-    );

-  SafeFreePool (NewOrder);

-

-  Status = gRT->SetVariable (

-                  VarLegacyDevOrder,

-                  &EfiLegacyDevOrderGuid,

-                  VAR_FLAG,

-                  VarSize,

-                  OriginalPtr

-                  );

-

-  SafeFreePool (OriginalPtr);

-

-  //

-  // Update Optional Data of Boot####

-  //

-  BootOptionVar = GetLegacyBootOptionVar (CallbackData->BbsType, &Index, &OptionSize);

-

-  if (NULL != BootOptionVar) {

-    CopyMem (

-      DescString,

-      LegacyDeviceContext->Description,

-      StrSize (LegacyDeviceContext->Description)

-      );

-

-    NewOptionSize = sizeof (UINT32) + sizeof (UINT16) + StrSize (DescString) + sizeof (BBS_TABLE) + sizeof (UINT16);

-

-    UnicodeSPrint (VarName, 100, L"Boot%04x", Index);

-

-    Ptr       = BootOptionVar;

-

-    Attribute = (UINT32 *) Ptr;

-    *Attribute |= LOAD_OPTION_ACTIVE;

-    if (0xFF == LegacyDev[0]) {

-      //

-      // Disable this legacy boot option

-      //

-      *Attribute &= ~LOAD_OPTION_ACTIVE;

-    }

-

-    Ptr += sizeof (UINT32);

-

-    FilePathSize = *(UINT16 *) Ptr;

-    Ptr += sizeof (UINT16);

-

-    NewOptionSize += FilePathSize;

-

-    NewOptionPtr = AllocateZeroPool (NewOptionSize);

-    if (NULL == NewOptionPtr) {

-      return EFI_OUT_OF_RESOURCES;

-    }

-

-    TempPtr = NewOptionPtr;

-

-    //

-    // Copy previous option data to new option except the description string

-    //

-    CopyMem (

-      TempPtr,

-      BootOptionVar,

-      sizeof (UINT32) + sizeof (UINT16)

-      );

-

-    TempPtr += (sizeof (UINT32) + sizeof (UINT16));

-

-    CopyMem (

-      TempPtr,

-      DescString,

-      StrSize (DescString)

-      );

-

-    TempPtr += StrSize (DescString);

-

-    //

-    // Description = (CHAR16 *)Ptr;

-    //

-    Ptr += StrSize ((CHAR16 *) Ptr);

-

-    CopyMem (

-      TempPtr,

-      Ptr,

-      FilePathSize

-      );

-

-    TempPtr += FilePathSize;

-

-    //

-    // DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)Ptr;

-    //

-    Ptr += FilePathSize;

-

-    //

-    // Now Ptr point to optional data, i.e. Bbs Table

-    //

-    CopyMem (

-      TempPtr,

-      LegacyDeviceContext->BbsTable,

-      sizeof (BBS_TABLE)

-      );

-

-    TempPtr += sizeof (BBS_TABLE);

-    *((UINT16 *) TempPtr) = (UINT16) LegacyDeviceContext->Index;

-

-    Status = gRT->SetVariable (

-                    VarName,

-                    &gEfiGlobalVariableGuid,

-                    VAR_FLAG,

-                    NewOptionSize,

-                    NewOptionPtr

-                    );

-

-    SafeFreePool (NewOptionPtr);

-    SafeFreePool (BootOptionVar);

-  }

-

-  BOpt_GetBootOptions (CallbackData);

-  return Status;

-}

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/bm.vfr b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/bm.vfr
deleted file mode 100644
index e907e18..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/bm.vfr
+++ /dev/null
@@ -1,495 +0,0 @@
-// *++

-//

-// Copyright (c) 2006, Intel Corporation                                                         

-// All rights reserved. This program and the accompanying materials                          

-// are licensed and made available under the terms and conditions of the BSD License         

-// which accompanies this distribution.  The full text of the license may be found at        

-// http://opensource.org/licenses/bsd-license.php                                            

-//                                                                                           

-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-// 

-// Module Name:

-//

-//   bm.vfr 

-// 

-// Abstract:

-// 

-//   Boot Maintenance Utility Formset

-// 

-// Revision History: 

-// 

-// --*/

-

-#include "BdsStrDefs.h" 

-#include "formguid.h"

-

-#pragma pack(1)

-

-//

-// This is the structure that will be used to store the 

-// question's current value. Use it at initialize time to 

-// set default value for each question. When using at run

-// time, this map is returned by the callback function,

-// so dynamically changing the question's value will be

-// possible through this mechanism

-//

-typedef struct {

-

-//

-// Three questions displayed at the main page

-// for Timeout, BootNext Variables respectively

-//

-  UINT16                    BootTimeOut;

-  UINT16                    BootNext;

-

-//

-// This is the COM1 Attributes value storage

-//

-  UINT8                     COM1BaudRate;

-  UINT8                     COM1DataRate;

-  UINT8                     COM1StopBits;

-  UINT8                     COM1Parity;

-  UINT8                     COM1TerminalType;

-  

-//

-// This is the COM2 Attributes value storage

-//

-  UINT8                     COM2BaudRate;

-  UINT8                     COM2DataRate;

-  UINT8                     COM2StopBits;

-  UINT8                     COM2Parity;

-  UINT8                     COM2TerminalType;

-

-// 

-// Driver Option Add Handle page storage

-//

-  UINT16                    DriverAddHandleDesc[100];

-  UINT16                    DriverAddHandleOptionalData[100];

-  UINT8                     DriverAddActive;

-  UINT8                     DriverAddForceReconnect;

-  

-//

-// Console Input/Output/Errorout using COM port check storage

-//

-  UINT8                     ConsoleInputCOM1;

-  UINT8                     ConsoleInputCOM2;

-  UINT8                     ConsoleOutputCOM1;

-  UINT8                     ConsoleOutputCOM2;

-  UINT8                     ConsoleErrorCOM1;

-  UINT8                     ConsoleErrorCOM2;

-

-//

-// At most 100 input/output/errorout device for console storage

-//

-  UINT8                     ConsoleCheck[100];

-

-//

-// Boot or Driver Option Order storage

-//

-  UINT8                     OptionOrder[100];

-  UINT8                     DriverOptionToBeDeleted[100];

-

-//

-// Boot Option Delete storage

-// 

-  UINT8                     BootOptionDel[100];

-  UINT8                     DriverOptionDel[100];

-  

-//

-// This is the Terminal Attributes value storage

-//

-  UINT8                     COMBaudRate;

-  UINT8                     COMDataRate;

-  UINT8                     COMStopBits;

-  UINT8                     COMParity;

-  UINT8                     COMTerminalType;

-  

-//

-// Legacy Device Order Selection Storage

-//

-  UINT8                     LegacyFD[100];

-  UINT8                     LegacyHD[100];

-  UINT8                     LegacyCD[100];

-  UINT8                     LegacyNET[100];

-  UINT8                     LegacyBEV[100];

-} BMM_FAKE_NV_DATA;

-#pragma pack()

-

-

-#define FORM_MAIN_ID                         0x0001

-#define FORM_BOOT_ADD_ID                     0x0002

-#define FORM_BOOT_DEL_ID                     0x0003

-#define FORM_BOOT_CHG_ID                     0x0004

-#define FORM_DRV_ADD_ID                      0x0005

-#define FORM_DRV_DEL_ID                      0x0006

-#define FORM_DRV_CHG_ID                      0x0007

-#define FORM_CON_MAIN_ID                     0x0008

-#define FORM_CON_IN_ID                       0x0009

-#define FORM_CON_OUT_ID                      0x000A

-#define FORM_CON_ERR_ID                      0x000B

-#define FORM_FILE_SEEK_ID                    0x000C

-#define FORM_FILE_NEW_SEEK_ID                0x000D

-#define FORM_DRV_ADD_FILE_ID                 0x000E

-#define FORM_DRV_ADD_HANDLE_ID               0x000F

-#define FORM_DRV_ADD_HANDLE_DESC_ID          0x0010

-#define FORM_BOOT_NEXT_ID                    0x0011

-#define FORM_TIME_OUT_ID                     0x0012

-#define FORM_RESET                           0x0013

-#define FORM_BOOT_SETUP_ID                   0x0014

-#define FORM_DRIVER_SETUP_ID                 0x0015

-#define FORM_BOOT_LEGACY_DEVICE_ID           0x0016

-#define FORM_CON_COM_ID                      0x0017

-#define FORM_CON_COM_SETUP_ID                0x0018

-#define FORM_SET_FD_ORDER_ID                 0x0019

-#define FORM_SET_HD_ORDER_ID                 0x001A

-#define FORM_SET_CD_ORDER_ID                 0x001B

-#define FORM_SET_NET_ORDER_ID                0x001C

-#define FORM_SET_BEV_ORDER_ID                0x001D

-									

-#define KEY_VALUE_BOOT_FROM_FILE             0x0092

-

-formset 

-  guid = MAIN_FORMSET_GUID,

-  title = STRING_TOKEN(STR_FORM_MAIN_TITLE),  // uint8 opcode, uint8 length, guid Handle, uint16 Title

-  help = STRING_TOKEN(STR_NULL_STRING),

-  class = 0,      

-  subclass = 0,

-

-  form formid = FORM_MAIN_ID,

-       title = STRING_TOKEN(STR_FORM_MAIN_TITLE);

-

-    goto FORM_BOOT_SETUP_ID,

-         prompt = STRING_TOKEN(STR_FORM_BOOT_SETUP_TITLE),

-         help = STRING_TOKEN(STR_FORM_BOOT_SETUP_HELP),

-         flags = INTERACTIVE | NV_ACCESS,

-         key = FORM_BOOT_SETUP_ID;

-

-    subtitle text = STRING_TOKEN(STR_NULL_STRING);

-

-    goto FORM_DRIVER_SETUP_ID,

-         prompt = STRING_TOKEN(STR_FORM_DRIVER_SETUP_TITLE),

-         help = STRING_TOKEN(STR_FORM_DRIVER_SETUP_HELP),

-         flags = INTERACTIVE | NV_ACCESS,

-         key = FORM_DRIVER_SETUP_ID;

-

-    subtitle text = STRING_TOKEN(STR_NULL_STRING);

-

-    goto FORM_CON_MAIN_ID,

-         prompt = STRING_TOKEN(STR_FORM_CON_MAIN_TITLE),

-         help = STRING_TOKEN(STR_FORM_CON_MAIN_HELP),

-         flags = INTERACTIVE | NV_ACCESS,

-         key = FORM_CON_MAIN_ID;

-   

-    subtitle text = STRING_TOKEN(STR_NULL_STRING);

-

-    text 

-         help   = STRING_TOKEN(STR_BOOT_FROM_FILE_HELP),  

-         text   = STRING_TOKEN(STR_BOOT_FROM_FILE),

-         text   = STRING_TOKEN(STR_NULL_STRING),

-         flags  = INTERACTIVE | NV_ACCESS,

-         key    = KEY_VALUE_BOOT_FROM_FILE;

-

-    subtitle text = STRING_TOKEN(STR_NULL_STRING);

-

-//    label FORM_MAIN_ID;

-

-    goto FORM_BOOT_NEXT_ID,

-         prompt = STRING_TOKEN(STR_FORM_BOOT_NEXT_TITLE),

-         help = STRING_TOKEN(STR_FORM_BOOT_NEXT_HELP),

-         flags = INTERACTIVE | NV_ACCESS,

-         key = FORM_BOOT_NEXT_ID;            

-

-    goto FORM_TIME_OUT_ID,

-         prompt = STRING_TOKEN(STR_FORM_TIME_OUT_TITLE),

-         help = STRING_TOKEN(STR_FORM_TIME_OUT_HELP),

-         flags = INTERACTIVE | NV_ACCESS,

-         key = FORM_TIME_OUT_ID;

-         

-    subtitle text = STRING_TOKEN(STR_NULL_STRING);

-

-    goto FORM_MAIN_ID,

-         prompt = STRING_TOKEN(STR_RESET),

-         help = STRING_TOKEN(STR_RESET),

-         flags = INTERACTIVE | NV_ACCESS,

-         key = FORM_RESET;

-         

-  endform;       

-

-  form formid = FORM_BOOT_SETUP_ID,

-       title = STRING_TOKEN(STR_FORM_BOOT_SETUP_TITLE);

-

-       goto FORM_MAIN_ID,

-            prompt = STRING_TOKEN(STR_FORM_GOTO_MAIN),

-            help = STRING_TOKEN(STR_FORM_GOTO_MAIN),

-            flags = INTERACTIVE | NV_ACCESS,

-            key = FORM_MAIN_ID;

-

-       goto FORM_BOOT_ADD_ID,

-            prompt = STRING_TOKEN(STR_FORM_BOOT_ADD_TITLE),

-            help = STRING_TOKEN(STR_FORM_BOOT_ADD_HELP),

-            flags = INTERACTIVE | NV_ACCESS,

-            key = FORM_BOOT_ADD_ID;

-      

-       goto FORM_BOOT_DEL_ID,

-            prompt = STRING_TOKEN(STR_FORM_BOOT_DEL_TITLE),

-            help = STRING_TOKEN(STR_FORM_NEXT_BOOT_HELP),

-            flags = INTERACTIVE | NV_ACCESS,

-            key = FORM_BOOT_DEL_ID;

-       

-       goto FORM_BOOT_CHG_ID,

-            prompt = STRING_TOKEN(STR_FORM_BOOT_CHG_TITLE),

-            help = STRING_TOKEN(STR_FORM_NEXT_BOOT_HELP),

-            flags = INTERACTIVE | NV_ACCESS,

-            key = FORM_BOOT_CHG_ID;

-

-       subtitle text = STRING_TOKEN(STR_NULL_STRING);

-       //

-	   // We will add "Select Legacy Boot Floppy Drive" and "Select Legacy Boot Hard Drive" 

-	   // here dynamically

-	   //

-       label FORM_BOOT_LEGACY_DEVICE_ID;

-

-  endform;       

-

-  form formid = FORM_DRIVER_SETUP_ID,

-       title = STRING_TOKEN(STR_FORM_DRIVER_SETUP_TITLE);

-

-       goto FORM_MAIN_ID,

-            prompt = STRING_TOKEN(STR_FORM_GOTO_MAIN),

-            help = STRING_TOKEN(STR_FORM_GOTO_MAIN),

-            flags = INTERACTIVE | NV_ACCESS,

-            key = FORM_MAIN_ID;

-

-       goto FORM_DRV_ADD_ID,

-            prompt = STRING_TOKEN(STR_FORM_DRV_ADD_TITLE),

-            help = STRING_TOKEN(STR_FORM_DRV_ADD_HELP),

-            flags = INTERACTIVE | NV_ACCESS,

-            key = FORM_DRV_ADD_ID;

-     

-       goto FORM_DRV_DEL_ID,

-            prompt = STRING_TOKEN(STR_FORM_DRV_DEL_TITLE),

-            help = STRING_TOKEN(STR_FORM_NEXT_BOOT_HELP),

-            flags = INTERACTIVE | NV_ACCESS,

-            key = FORM_DRV_DEL_ID;

-       

-       goto FORM_DRV_CHG_ID,

-            prompt = STRING_TOKEN(STR_FORM_DRV_CHG_TITLE),

-            help = STRING_TOKEN(STR_FORM_NEXT_BOOT_HELP),

-            flags = INTERACTIVE | NV_ACCESS,

-            key = FORM_DRV_CHG_ID;

-  endform;       

-

-  form formid = FORM_BOOT_ADD_ID,

-       title = STRING_TOKEN(STR_FORM_BOOT_ADD_TITLE);

-

-       label FORM_BOOT_ADD_ID;

-  endform;

-

-  form formid = FORM_BOOT_DEL_ID,

-       title = STRING_TOKEN(STR_FORM_BOOT_DEL_TITLE);

-

-       label FORM_BOOT_DEL_ID;

-  endform;

-

-  form formid = FORM_BOOT_CHG_ID,

-       title = STRING_TOKEN(STR_FORM_BOOT_CHG_TITLE);

-

-       label FORM_BOOT_CHG_ID;

-       

-       //

-       // This tag is added for bypassing issue of setup browser

-       // setup browser could not support dynamic form very well.

-       //

-       checkbox varid    = BMM_FAKE_NV_DATA.OptionOrder[0],

-           prompt   = STRING_TOKEN(STR_FORM_BOOT_CHG_TITLE),

-           help     = STRING_TOKEN(STR_FORM_BOOT_CHG_TITLE),  

-           flags    = 1,

-           key      = 0,

-       endcheckbox;

-      

-  endform;

-

-  form formid = FORM_BOOT_NEXT_ID,

-       title = STRING_TOKEN(STR_FORM_BOOT_NEXT_TITLE);

-

-       label FORM_BOOT_NEXT_ID;

-  endform;

-  

-  form formid = FORM_TIME_OUT_ID,

-       title = STRING_TOKEN(STR_FORM_TIME_OUT_TITLE);

-       

-       label FORM_TIME_OUT_ID;

-  endform;

-  

-  form formid = FORM_DRV_ADD_ID,

-       title = STRING_TOKEN(STR_FORM_DRV_ADD_TITLE);

-

-       goto FORM_MAIN_ID,

-            prompt = STRING_TOKEN(STR_FORM_GOTO_MAIN),

-            help = STRING_TOKEN(STR_FORM_GOTO_MAIN),

-            flags = INTERACTIVE | NV_ACCESS,

-            key = FORM_MAIN_ID;

-              

-       goto FORM_DRV_ADD_FILE_ID,

-            prompt = STRING_TOKEN(STR_FORM_DRV_ADD_FILE_TITLE),

-            help = STRING_TOKEN(STR_FORM_DRV_ADD_FILE_TITLE),

-            flags = INTERACTIVE | NV_ACCESS,

-            key = FORM_DRV_ADD_FILE_ID;

-

-  endform;

-

-  form formid = FORM_DRV_DEL_ID,

-       title = STRING_TOKEN(STR_FORM_DRV_DEL_TITLE);

-

-       label FORM_DRV_DEL_ID;

-

-  endform;

-

-  form formid = FORM_DRV_CHG_ID,

-       title = STRING_TOKEN(STR_FORM_DRV_CHG_TITLE);

-

-       label FORM_DRV_CHG_ID;

-      

-       //

-       // This tag is added for bypassing issue of setup browser

-       // setup browser could not support dynamic form very well.

-       //

-       checkbox varid    = BMM_FAKE_NV_DATA.OptionOrder[0],

-           prompt   = STRING_TOKEN(STR_FORM_DRV_CHG_TITLE),

-           help     = STRING_TOKEN(STR_FORM_DRV_CHG_TITLE),  

-           flags    = 1,

-           key      = 0,

-       endcheckbox;

-       

-  endform;

-

-  form formid = FORM_CON_MAIN_ID,

-       title = STRING_TOKEN(STR_FORM_CON_MAIN_TITLE);

-

-       goto FORM_MAIN_ID,

-       prompt = STRING_TOKEN(STR_FORM_GOTO_MAIN),

-       help = STRING_TOKEN(STR_FORM_GOTO_MAIN),

-       flags = INTERACTIVE | NV_ACCESS,

-       key = FORM_MAIN_ID;

-

-       goto FORM_CON_IN_ID,

-       prompt = STRING_TOKEN(STR_FORM_CON_IN_TITLE),

-       help = STRING_TOKEN(STR_FORM_CON_IN_HELP),

-       flags = INTERACTIVE | NV_ACCESS,

-       key = FORM_CON_IN_ID;

-

-       goto FORM_CON_OUT_ID,

-       prompt = STRING_TOKEN(STR_FORM_CON_OUT_TITLE),

-       help = STRING_TOKEN(STR_FORM_CON_OUT_HELP),

-       flags = INTERACTIVE | NV_ACCESS,

-       key = FORM_CON_OUT_ID;

-  

-       goto FORM_CON_ERR_ID,

-       prompt = STRING_TOKEN(STR_FORM_STD_ERR_TITLE),

-       help = STRING_TOKEN(STR_FORM_STD_ERR_HELP),

-       flags = INTERACTIVE | NV_ACCESS,

-       key = FORM_CON_ERR_ID;

-

-       goto FORM_CON_COM_ID,

-       prompt = STRING_TOKEN(STR_FORM_COM_TITLE),

-       help = STRING_TOKEN(STR_FORM_COM_HELP),

-       flags = INTERACTIVE | NV_ACCESS,

-       key = FORM_CON_COM_ID;

-  endform;

-

-  form formid = FORM_CON_COM_ID,

-       title = STRING_TOKEN(STR_FORM_COM_TITLE);

-

-       label FORM_CON_COM_ID;

-  endform;

-

-  form formid = FORM_CON_COM_SETUP_ID,

-       title = STRING_TOKEN(STR_CON_COM_SETUP);

-

-       label FORM_CON_COM_SETUP_ID;

-  endform;

-

-  form formid = FORM_FILE_SEEK_ID,

-       title = STRING_TOKEN(STR_FORM_BOOT_ADD_TITLE);

-

-       label FORM_FILE_SEEK_ID;

-  endform;

-

-  form formid = FORM_FILE_NEW_SEEK_ID,

-       title = STRING_TOKEN(STR_FORM_BOOT_ADD_TITLE);

-

-       label FORM_FILE_NEW_SEEK_ID;

-  endform;

-

-  form formid = FORM_DRV_ADD_FILE_ID,

-       title = STRING_TOKEN(STR_FORM_DRV_ADD_FILE_TITLE);

-

-       label FORM_DRV_ADD_FILE_ID;

-  endform;

-

-  form formid = FORM_DRV_ADD_HANDLE_ID,

-       title = STRING_TOKEN(STR_FORM_DRV_ADD_HANDLE_TITLE);

-

-       label FORM_DRV_ADD_HANDLE_ID;

-  endform;     

-

-  form formid = FORM_DRV_ADD_HANDLE_DESC_ID,

-       title = STRING_TOKEN(STR_FORM_DRV_ADD_DESC_TITLE);

-

-       label FORM_DRV_ADD_HANDLE_DESC_ID;

-

-  endform;

-

-  form formid = FORM_CON_IN_ID,

-       title = STRING_TOKEN(STR_FORM_CON_IN_TITLE);

-

-       label FORM_CON_IN_ID;

-

-  endform;

-

-  form formid = FORM_CON_OUT_ID,

-       title = STRING_TOKEN(STR_FORM_CON_OUT_TITLE);

-

-       label FORM_CON_OUT_ID;

-

-  endform;

-

-  form formid = FORM_CON_ERR_ID,

-       title = STRING_TOKEN(STR_FORM_STD_ERR_TITLE);

-

-       label FORM_CON_ERR_ID;

-

-  endform;

-

-  form formid = FORM_SET_FD_ORDER_ID,

-       title = STRING_TOKEN(STR_FORM_SET_FD_ORDER_TITLE);

-

-       label FORM_SET_FD_ORDER_ID;

-  endform;

-  

-  form formid = FORM_SET_HD_ORDER_ID,

-       title = STRING_TOKEN(STR_FORM_SET_HD_ORDER_TITLE);

-

-       label FORM_SET_HD_ORDER_ID;

-  endform;

-

-  form formid = FORM_SET_CD_ORDER_ID,

-       title = STRING_TOKEN(STR_FORM_SET_CD_ORDER_TITLE);

-

-       label FORM_SET_CD_ORDER_ID;

-  endform;

-

-  form formid = FORM_SET_NET_ORDER_ID,

-       title = STRING_TOKEN(STR_FORM_SET_NET_ORDER_TITLE);

-

-       label FORM_SET_NET_ORDER_ID;

-  endform;

-

-  form formid = FORM_SET_BEV_ORDER_ID,

-       title = STRING_TOKEN(STR_FORM_SET_BEV_ORDER_TITLE);

-

-       label FORM_SET_BEV_ORDER_ID;

-  endform;

-

-endformset;

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/bmstring.uni b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/bmstring.uni
deleted file mode 100644
index f646d8b..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/bmstring.uni
+++ /dev/null
Binary files differ
diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManager.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManager.c
deleted file mode 100644
index 77e079e..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManager.c
+++ /dev/null
@@ -1,355 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  BootManager.c

-

-Abstract:

-

-  The platform boot manager reference implement

-

---*/

-#include "BootManager.h"

-

-UINT16                            mKeyInput;

-LIST_ENTRY                        *mBootOptionsList;

-BDS_COMMON_OPTION                 *gOption;

-EFI_HII_HANDLE                    gBootManagerHandle;

-EFI_HANDLE                        BootManagerCallbackHandle;

-EFI_FORM_CALLBACK_PROTOCOL        BootManagerCallback;

-EFI_GUID                          gBmGuid = BOOT_MANAGER_GUID;

-

-extern EFI_FORM_BROWSER_PROTOCOL  *gBrowser;

-extern UINT8                      BootManagerVfrBin[];

-extern UINT8                      BdsStrings[];

-extern BOOLEAN                    gConnectAllHappened;

-

-EFI_STATUS

-EFIAPI

-BootManagerCallbackRoutine (

-  IN EFI_FORM_CALLBACK_PROTOCOL       *This,

-  IN UINT16                           KeyValue,

-  IN EFI_IFR_DATA_ARRAY               *DataArray,

-  OUT EFI_HII_CALLBACK_PACKET         **Packet

-  )

-/*++

-

-Routine Description:

-

-  This is the function that is called to provide results data to the driver.  This data

-  consists of a unique key which is used to identify what data is either being passed back

-  or being asked for.

-

-Arguments:

-

-  KeyValue -        A unique value which is sent to the original exporting driver so that it

-                    can identify the type of data to expect.  The format of the data tends to

-                    vary based on the op-code that geerated the callback.

-

-  Data -            A pointer to the data being sent to the original exporting driver.

-

-Returns:

-

---*/

-{

-  BDS_COMMON_OPTION       *Option;

-  LIST_ENTRY              *Link;

-  UINT16                  KeyCount;

-  EFI_HII_CALLBACK_PACKET *DataPacket;

-

-  //

-  // Initialize the key count

-  //

-  KeyCount = 0;

-

-  for (Link = mBootOptionsList->ForwardLink; Link != mBootOptionsList; Link = Link->ForwardLink) {

-    Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);

-

-    KeyCount++;

-

-    gOption = Option;

-

-    //

-    // Is this device the one chosen?

-    //

-    if (KeyCount == KeyValue) {

-      //

-      // Assigning the returned Key to a global allows the original routine to know what was chosen

-      //

-      mKeyInput = KeyValue;

-

-      *Packet   = AllocateZeroPool (sizeof (EFI_HII_CALLBACK_PACKET) + 2);

-      ASSERT (*Packet != NULL);

-

-      //

-      // Assign the buffer address to DataPacket

-      //

-      DataPacket                        = *Packet;

-

-      DataPacket->DataArray.EntryCount  = 1;

-      DataPacket->DataArray.NvRamMap    = NULL;

-      ((EFI_IFR_DATA_ENTRY *) (((EFI_IFR_DATA_ARRAY *)DataPacket) + 1))->Flags = EXIT_REQUIRED | NV_NOT_CHANGED;

-      return EFI_SUCCESS;

-    } else {

-      continue;

-    }

-  }

-

-  return EFI_SUCCESS;

-}

-

-VOID

-CallBootManager (

-  VOID

-  )

-/*++

-

-Routine Description:

-  Hook to enable UI timeout override behavior.

-

-Arguments:

-  BdsDeviceList - Device List that BDS needs to connect.

-

-  Entry - Pointer to current Boot Entry.

-

-Returns:

-  NONE

-

---*/

-{

-  EFI_STATUS          Status;

-  EFI_HII_PACKAGES    *PackageList;

-  BDS_COMMON_OPTION   *Option;

-  LIST_ENTRY          *Link;

-  EFI_HII_UPDATE_DATA *UpdateData;

-  CHAR16              *ExitData;

-  UINTN               ExitDataSize;

-  STRING_REF          Token;

-  STRING_REF          LastToken;

-  EFI_INPUT_KEY       Key;

-  UINT8               *Location;

-  EFI_GUID            BmGuid;

-  LIST_ENTRY          BdsBootOptionList;

-  BOOLEAN	          BootMngrMenuResetRequired;

-

-  gOption = NULL;

-  InitializeListHead (&BdsBootOptionList);

-

-  //

-  // Connect all prior to entering the platform setup menu.

-  //

-  if (!gConnectAllHappened) {

-    BdsLibConnectAllDriversToAllControllers ();

-    gConnectAllHappened = TRUE;

-  }

-  //

-  // BugBug: Here we can not remove the legacy refresh macro, so we need

-  // get the boot order every time from "BootOrder" variable.

-  // Recreate the boot option list base on the BootOrder variable

-  //

-  BdsLibEnumerateAllBootOption (&BdsBootOptionList);

-

-  //

-  // This GUID must be the same as what is defined in BootManagerVfr.vfr

-  //

-  BmGuid            = gBmGuid;

-

-  mBootOptionsList  = &BdsBootOptionList;

-

-  //

-  // Post our VFR to the HII database

-  //

-  PackageList = PreparePackages (2, &BmGuid, BootManagerVfrBin, BdsStrings);

-  Status      = Hii->NewPack (Hii, PackageList, &gBootManagerHandle);

-  FreePool (PackageList);

-

-  //

-  // This example does not implement worker functions

-  // for the NV accessor functions.  Only a callback evaluator

-  //

-  BootManagerCallback.NvRead    = NULL;

-  BootManagerCallback.NvWrite   = NULL;

-  BootManagerCallback.Callback  = BootManagerCallbackRoutine;

-

-  //

-  // Install protocol interface

-  //

-  BootManagerCallbackHandle = NULL;

-  Status = gBS->InstallProtocolInterface (

-                  &BootManagerCallbackHandle,

-                  &gEfiFormCallbackProtocolGuid,

-                  EFI_NATIVE_INTERFACE,

-                  &BootManagerCallback

-                  );

-  ASSERT_EFI_ERROR (Status);

-

-  LastToken = 0;

-  Hii->NewString (Hii, NULL, gBootManagerHandle, &LastToken, L" ");

-

-  //

-  // Allocate space for creation of UpdateData Buffer

-  //

-  UpdateData = AllocateZeroPool (0x1000);

-  ASSERT (UpdateData != NULL);

-

-  //

-  // Flag update pending in FormSet

-  //

-  UpdateData->FormSetUpdate = TRUE;

-  //

-  // Register CallbackHandle data for FormSet

-  //

-  UpdateData->FormCallbackHandle = (EFI_PHYSICAL_ADDRESS) (UINTN) BootManagerCallbackHandle;

-  UpdateData->FormUpdate  = FALSE;

-  UpdateData->FormTitle   = 0;

-  UpdateData->DataCount   = 1;

-

-  //

-  // Create blank space.  Since when we update the contents of IFR data at a label, it is

-  // inserted at the location of the label.  So if you want to add a string with an empty

-  // space afterwards, you need to add the space first and then the string like below.

-  //

-  Status = CreateSubTitleOpCode (

-            LastToken,        // Token Value for the string

-            &UpdateData->Data // Buffer containing created op-code

-            );

-

-  Hii->UpdateForm (Hii, gBootManagerHandle, (EFI_FORM_LABEL) 0x0000, TRUE, UpdateData);

-

-  //

-  // Create "Boot Option Menu" title

-  //

-  Status = CreateSubTitleOpCode (

-            STRING_TOKEN (STR_BOOT_OPTION_BANNER),  // Token Value for the string

-            &UpdateData->Data                       // Buffer containing created op-code

-            );

-

-  Hii->UpdateForm (Hii, gBootManagerHandle, (EFI_FORM_LABEL) 0x0000, TRUE, UpdateData);

-

-  Token                 = LastToken;

-  mKeyInput             = 0;

-

-  UpdateData->DataCount = 0;

-  Location              = (UINT8 *) &UpdateData->Data;

-

-  for (Link = BdsBootOptionList.ForwardLink; Link != &BdsBootOptionList; Link = Link->ForwardLink) {

-    Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);

-

-    //

-    // At this stage we are creating a menu entry, thus the Keys are reproduceable

-    //

-    mKeyInput++;

-    Token++;

-

-    Status = Hii->NewString (Hii, NULL, gBootManagerHandle, &Token, Option->Description);

-

-    //

-    // If we got an error it is almost certainly due to the token value being invalid.

-    // Therefore we will set the Token to 0 to automatically add a token.

-    //

-    if (EFI_ERROR (Status)) {

-      Token   = 0;

-      Status  = Hii->NewString (Hii, NULL, gBootManagerHandle, &Token, Option->Description);

-    }

-

-    Status = CreateGotoOpCode (

-              0x1000, // Form ID

-              Token,  // Token Value for the string

-              0,      // Help String (none)

-              EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,  // The Op-Code flags

-              mKeyInput,                                          // The Key to get a callback on

-              Location  // Buffer containing created op-code

-              );

-

-    UpdateData->DataCount++;

-    Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

-

-  }

-

-  Hii->UpdateForm (Hii, gBootManagerHandle, (EFI_FORM_LABEL) 0x0001, TRUE, UpdateData);

-

-  UpdateData->DataCount = 1;

-

-  //

-  // Create "Boot Option Menu" title

-  //

-  Status = CreateSubTitleOpCode (

-            STRING_TOKEN (STR_HELP_FOOTER), // Token Value for the string

-            &UpdateData->Data               // Buffer containing created op-code

-            );

-

-  Hii->UpdateForm (Hii, gBootManagerHandle, (EFI_FORM_LABEL) 0x0002, TRUE, UpdateData);

-

-  Status = CreateSubTitleOpCode (

-            LastToken,                      // Token Value for the string

-            &UpdateData->Data               // Buffer containing created op-code

-            );

-

-  Hii->UpdateForm (Hii, gBootManagerHandle, (EFI_FORM_LABEL) 0x0002, TRUE, UpdateData);

-

-  FreePool (UpdateData);

-

-  ASSERT (gBrowser);

-

-  BootMngrMenuResetRequired = FALSE;

-  gBrowser->SendForm (

-              gBrowser,

-              TRUE,

-              &gBootManagerHandle,

-              1,

-              NULL,

-              NULL,

-              NULL,

-              NULL,

-              &BootMngrMenuResetRequired

-              );

-

-  if (BootMngrMenuResetRequired) {

-    EnableResetRequired ();

-  }

-

-  Hii->ResetStrings (Hii, gBootManagerHandle);

-

-  if (gOption == NULL) {

-    return ;

-  }

-

-  //

-  //Will leave browser, check any reset required change is applied? if yes, reset system

-  //

-  SetupResetReminder ();

-

-  //

-  // BugBug: This code looks repeated from the BDS. Need to save code space.

-  //

-

-  //

-  // parse the selected option

-  //

-  Status = BdsLibBootViaBootOption (gOption, gOption->DevicePath, &ExitDataSize, &ExitData);

-

-  if (!EFI_ERROR (Status)) {

-    PlatformBdsBootSuccess (gOption);

-  } else {

-    PlatformBdsBootFail (gOption, Status, ExitData, ExitDataSize);

-    gST->ConOut->OutputString (

-                  gST->ConOut,

-                  GetStringById (STRING_TOKEN (STR_ANY_KEY_CONTINUE))

-                  );

-

-    //

-    // BdsLibUiWaitForSingleEvent (gST->ConIn->WaitForKey, 0);

-    //

-

-    gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);

-  }

-}

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManager.h b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManager.h
deleted file mode 100644
index 3a90932..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManager.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name: 

-

-  BootManager.h

-

-Abstract:

-

-  The platform boot manager reference implement

-

-Revision History

-

---*/

-

-#ifndef _EFI_BOOT_MANAGER_H

-#define _EFI_BOOT_MANAGER_H

-

-#include "Generic/Bds.h"

-#include "BdsPlatform.h"

-#include "Generic/String.h"

-

-EFI_STATUS

-EFIAPI

-BootManagerCallbackRoutine (

-  IN EFI_FORM_CALLBACK_PROTOCOL       *This,

-  IN UINT16                           KeyValue,

-  IN EFI_IFR_DATA_ARRAY               *DataArray,

-  OUT EFI_HII_CALLBACK_PACKET         **Packet

-  );

-

-VOID

-CallBootManager (

-  VOID

-);

-

-#define BOOT_MANAGER_GUID \

-  { \

-    0x847bc3fe, 0xb974, 0x446d, {0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b } \

-  }

-

-#endif

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManagerStrings.uni b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManagerStrings.uni
deleted file mode 100644
index 684ac2f..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManagerStrings.uni
+++ /dev/null
Binary files differ
diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManagerVfr.Vfr b/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManagerVfr.Vfr
deleted file mode 100644
index 7fb193a..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManagerVfr.Vfr
+++ /dev/null
@@ -1,55 +0,0 @@
-// *++

-//

-// Copyright (c) 2006, Intel Corporation                                                         

-// All rights reserved. This program and the accompanying materials                          

-// are licensed and made available under the terms and conditions of the BSD License         

-// which accompanies this distribution.  The full text of the license may be found at        

-// http://opensource.org/licenses/bsd-license.php                                            

-//                                                                                           

-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-// 

-// Module Name:

-//

-//   BootManager.vfr 

-// 

-// Abstract:

-// 

-//   Browser formset.

-// 

-// Revision History: 

-// 

-// --*/

-

-#include "BdsStrDefs.h"

-

-#define FORMSET_GUID  { 0x847bc3fe, 0xb974, 0x446d, { 0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b } } 

-

-#define BOOT_MANAGER_HEADER		 0x00

-#define BOOT_MANAGER_LABEL		 0x01

-#define BOOT_MANAGER_TAIL		 0x02

-

-

-#define BOOT_MANAGER_CLASS       0x00

-#define BOOT_MANAGER_SUBCLASS    0x01

-

-formset 

-  guid     = FORMSET_GUID,

-  title    = STRING_TOKEN(STR_BM_BANNER),  

-  help     = STRING_TOKEN(STR_LAST_STRING),

-  class    = BOOT_MANAGER_CLASS,      

-  subclass = BOOT_MANAGER_SUBCLASS,

-

-  form formid = 0x1000,

-       title  = STRING_TOKEN(STR_BM_BANNER);

-

-    label BOOT_MANAGER_HEADER;

-    label BOOT_MANAGER_LABEL;

-    //

-    // This is where we will dynamically add choices for the Boot Manager

-    //

-

-    label BOOT_MANAGER_TAIL;

-  endform;

-

-endformset;

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/Capsules.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/Capsules.c
deleted file mode 100644
index b33af03..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/Capsules.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  Capsules.c

-

-Abstract:

-

-  BDS routines to handle capsules.

-

---*/

-

-

-#include <Common/FlashMap.H>

-

-VOID

-BdsLockFv (

-  IN EFI_CPU_IO_PROTOCOL          *CpuIo,

-  IN EFI_FLASH_SUBAREA_ENTRY      *FlashEntry

-  );

-

-VOID

-BdsLockFv (

-  IN EFI_CPU_IO_PROTOCOL          *CpuIo,

-  IN EFI_FLASH_SUBAREA_ENTRY      *FlashEntry

-  )

-{

-  EFI_FV_BLOCK_MAP_ENTRY      *BlockMap;

-  EFI_FIRMWARE_VOLUME_HEADER  *FvHeader;

-  UINT64                      BaseAddress;

-  UINT8                       Data;

-  UINT32                      BlockLength;

-  UINTN                       Index;

-

-  BaseAddress = FlashEntry->Base - 0x400000 + 2;

-  FvHeader    = (EFI_FIRMWARE_VOLUME_HEADER *) ((UINTN) (FlashEntry->Base));

-  BlockMap    = &(FvHeader->FvBlockMap[0]);

-

-  while ((BlockMap->NumBlocks != 0) && (BlockMap->BlockLength != 0)) {

-    BlockLength = BlockMap->BlockLength;

-    for (Index = 0; Index < BlockMap->NumBlocks; Index++) {

-      CpuIo->Mem.Read (

-                  CpuIo,

-                  EfiCpuIoWidthUint8,

-                  BaseAddress,

-                  1,

-                  &Data

-                  );

-      Data = (UINT8) (Data | 0x3);

-      CpuIo->Mem.Write (

-                  CpuIo,

-                  EfiCpuIoWidthUint8,

-                  BaseAddress,

-                  1,

-                  &Data

-                  );

-      BaseAddress += BlockLength;

-    }

-

-    BlockMap++;

-  }

-}

-

-VOID

-BdsLockNonUpdatableFlash (

-  VOID

-  )

-{

-  EFI_FLASH_MAP_ENTRY_DATA  *FlashMapEntryData;

-  EFI_PEI_HOB_POINTERS      GuidHob;

-  EFI_STATUS                Status;

-  EFI_CPU_IO_PROTOCOL       *CpuIo;

-

-  Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, &CpuIo);

-  ASSERT_EFI_ERROR (Status);

-  

-  GuidHob.Raw = GetHobList ();

-  while ((GuidHob.Raw = GetNextGuidHob (&gEfiFlashMapHobGuid, GuidHob.Raw)) != NULL) {

-    FlashMapEntryData = (EFI_FLASH_MAP_ENTRY_DATA *) GET_GUID_HOB_DATA (GuidHob.Guid);

-

-    //

-    // Get the variable store area

-    //

-    if ((FlashMapEntryData->AreaType == EFI_FLASH_AREA_RECOVERY_BIOS) ||

-        (FlashMapEntryData->AreaType == EFI_FLASH_AREA_MAIN_BIOS)

-        ) {

-      BdsLockFv (CpuIo, &(FlashMapEntryData->Entries[0]));

-    }

-    GuidHob.Raw = GET_NEXT_HOB (GuidHob);

-  }

-

-  return ;

-}

-

-EFI_STATUS

-ProcessCapsules (

-  EFI_BOOT_MODE BootMode

-  )

-/*++

-

-Routine Description:

-

-  This routine is called to see if there are any capsules we need to process.

-  If the boot mode is not UPDATE, then we do nothing. Otherwise find the

-  capsule HOBS and produce firmware volumes for them via the DXE service.

-  Then call the dispatcher to dispatch drivers from them. Finally, check

-  the status of the updates.

-

-Arguments:

-

-  BootMode - the current boot mode

-

-Returns:

-  

-  EFI_INVALID_PARAMETER - boot mode is not correct for an update

-

-Note:

- 

- This function should be called by BDS in case we need to do some

- sort of processing even if there is no capsule to process. We

- need to do this if an earlier update went awry and we need to

- clear the capsule variable so on the next reset PEI does not see it and 

- think there is a capsule available.

-

---*/

-{

-  EFI_STATUS                  Status;

-  EFI_HOB_CAPSULE_VOLUME      *CvHob;

-  EFI_PHYSICAL_ADDRESS        BaseAddress;

-  UINT64                      Length;

-  EFI_FIRMWARE_VOLUME_HEADER  *FwVolHeader;

-  EFI_HANDLE                  FvProtocolHandle;

-

-  //

-  // We don't do anything else if the boot mode is not flash-update

-  //

-  if (BootMode != BOOT_ON_FLASH_UPDATE) {

-    return EFI_INVALID_PARAMETER;

-  }

-  //

-  // Only one capsule HOB allowed.

-  //

-  CvHob = GetFirstHob (EFI_HOB_TYPE_CV);

-  if (CvHob == NULL) {

-    //

-    // We didn't find a hob, so had no errors.

-    //

-    BdsLockNonUpdatableFlash ();

-    return EFI_SUCCESS;

-  }

-  

-  BaseAddress = CvHob->BaseAddress;

-  Length      = CvHob->Length;

-

-  Status      = EFI_SUCCESS;

-  //

-  // Now walk the capsule and call the core to process each

-  // firmware volume in it.

-  //

-  while (Length != 0) {

-    //

-    // Point to the next firmware volume header, and then

-    // call the DXE service to process it.

-    //

-    FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) BaseAddress;

-    if (FwVolHeader->FvLength > Length) {

-      //

-      // Notes: need to stuff this status somewhere so that the

-      // error can be detected at OS runtime

-      //

-      Status = EFI_VOLUME_CORRUPTED;

-      break;

-    }

-

-    Status = gDS->ProcessFirmwareVolume (

-                    (VOID *) (UINTN) BaseAddress,

-                    (UINTN) FwVolHeader->FvLength,

-                    &FvProtocolHandle

-                    );

-    if (EFI_ERROR (Status)) {

-      break;

-    }

-    //

-    // Call the dispatcher to dispatch any drivers from the produced firmware volume

-    //

-    gDS->Dispatch ();

-    //

-    // On to the next FV in the capsule

-    //

-    Length -= FwVolHeader->FvLength;

-    BaseAddress = (EFI_PHYSICAL_ADDRESS) ((UINTN) BaseAddress + FwVolHeader->FvLength);

-    //

-    // Notes: when capsule spec is finalized, if the requirement is made to

-    // have each FV in a capsule aligned, then we will need to align the

-    // BaseAddress and Length here.

-    //

-  }

-   

-

-  BdsLockNonUpdatableFlash ();

-

-  return Status;

-}

-

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/DeviceMngr/DeviceManager.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/DeviceMngr/DeviceManager.c
deleted file mode 100644
index 7189a6e..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/DeviceMngr/DeviceManager.c
+++ /dev/null
@@ -1,497 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  DeviceManager.c

-

-Abstract:

-

-  The platform device manager reference implement

-

---*/

-#include "DeviceManager.h"

-

-STATIC UINT16                     mTokenCount;

-EFI_FRONTPAGE_CALLBACK_INFO       FPCallbackInfo;

-extern UINTN                      gCallbackKey;

-extern EFI_FORM_BROWSER_PROTOCOL  *gBrowser;

-extern EFI_GUID                   gBdsStringPackGuid;

-extern BOOLEAN                    gConnectAllHappened;

-

-STRING_REF                        gStringTokenTable[] = {

-  STR_VIDEO_DEVICE,

-  STR_NETWORK_DEVICE,

-  STR_INPUT_DEVICE,

-  STR_ON_BOARD_DEVICE,

-  STR_OTHER_DEVICE,

-  STR_EMPTY_STRING,

-  0xFFFF

-};

-

-EFI_STATUS

-EFIAPI

-DeviceManagerCallbackRoutine (

-  IN EFI_FORM_CALLBACK_PROTOCOL       *This,

-  IN UINT16                           KeyValue,

-  IN EFI_IFR_DATA_ARRAY               *DataArray,

-  OUT EFI_HII_CALLBACK_PACKET         **Packet

-  )

-/*++

-

-Routine Description:

-

-  This is the function that is called to provide results data to the driver.  This data

-  consists of a unique key which is used to identify what data is either being passed back

-  or being asked for.

-

-Arguments:

-

-  KeyValue -        A unique value which is sent to the original exporting driver so that it

-                    can identify the type of data to expect.  The format of the data tends to

-                    vary based on the op-code that geerated the callback.

-

-  Data -            A pointer to the data being sent to the original exporting driver.

-

-Returns:

-

---*/

-{

-  //

-  // The KeyValue corresponds in this case to the handle which was requested to be displayed

-  //

-  EFI_FRONTPAGE_CALLBACK_INFO *CallbackInfo;

-

-  CallbackInfo = EFI_FP_CALLBACK_DATA_FROM_THIS (This);

-  switch (KeyValue) {

-  case 0x2000:

-    CallbackInfo->Data.VideoBIOS = (UINT8) (UINTN) (((EFI_IFR_DATA_ENTRY *)(DataArray + 1))->Data);

-    gRT->SetVariable (

-          L"VBIOS",

-          &gEfiGenericPlatformVariableGuid,

-          EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,

-          sizeof (UINT8),

-          &CallbackInfo->Data.VideoBIOS

-          );

-    break;

-

-  default:

-    break;

-  }

-

-  gCallbackKey = KeyValue;

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-InitializeDeviceManager (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  Initialize HII information for the FrontPage

-

-Arguments:

-  None

-

-Returns:

-

---*/

-{

-  EFI_STATUS          Status;

-  EFI_HII_PACKAGES    *PackageList;

-  EFI_HII_UPDATE_DATA *UpdateData;

-

-  //

-  // Allocate space for creation of UpdateData Buffer

-  //

-  UpdateData = AllocateZeroPool (0x1000);

-  ASSERT (UpdateData != NULL);

-

-  PackageList = PreparePackages (1, &gBdsStringPackGuid, DeviceManagerVfrBin);

-  Status      = Hii->NewPack (Hii, PackageList, &FPCallbackInfo.DevMgrHiiHandle);

-  FreePool (PackageList);

-

-  //

-  // This example does not implement worker functions for the NV accessor functions.  Only a callback evaluator

-  //

-  FPCallbackInfo.Signature                = EFI_FP_CALLBACK_DATA_SIGNATURE;

-  FPCallbackInfo.DevMgrCallback.NvRead    = NULL;

-  FPCallbackInfo.DevMgrCallback.NvWrite   = NULL;

-  FPCallbackInfo.DevMgrCallback.Callback  = DeviceManagerCallbackRoutine;

-

-  //

-  // Install protocol interface

-  //

-  FPCallbackInfo.CallbackHandle = NULL;

-

-  Status = gBS->InstallProtocolInterface (

-                  &FPCallbackInfo.CallbackHandle,

-                  &gEfiFormCallbackProtocolGuid,

-                  EFI_NATIVE_INTERFACE,

-                  &FPCallbackInfo.DevMgrCallback

-                  );

-

-  ASSERT_EFI_ERROR (Status);

-

-  //

-  // Flag update pending in FormSet

-  //

-  UpdateData->FormSetUpdate = TRUE;

-  //

-  // Register CallbackHandle data for FormSet

-  //

-  UpdateData->FormCallbackHandle = (EFI_PHYSICAL_ADDRESS) (UINTN) FPCallbackInfo.CallbackHandle;

-  //

-  // Simply registering the callback handle

-  //

-  Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) 0x0000, TRUE, UpdateData);

-

-  FreePool (UpdateData);

-  return Status;

-}

-

-EFI_STATUS

-CallDeviceManager (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  Call the browser and display the device manager

-

-Arguments:

-

-  None

-

-Returns:

-  EFI_SUCCESS            - Operation is successful.

-  EFI_INVALID_PARAMETER  - If the inputs to SendForm function is not valid.

-

---*/

-{

-  EFI_STATUS          Status;

-  UINTN               BufferSize;

-  UINTN               Count;

-  EFI_HII_HANDLE      Index;

-  UINT8               *Buffer;

-  EFI_IFR_FORM_SET    *FormSetData;

-  CHAR16              *String;

-  UINTN               StringLength;

-  EFI_HII_UPDATE_DATA *UpdateData;

-  STRING_REF          Token;

-  STRING_REF          TokenHelp;

-  IFR_OPTION          *IfrOptionList;

-  UINT8               *VideoOption;

-  UINTN               VideoOptionSize;

-  EFI_HII_HANDLE      *HiiHandles;

-  UINT16              HandleBufferLength;

-  BOOLEAN	          BootDeviceMngrMenuResetRequired;

-

-  IfrOptionList       = NULL;

-  VideoOption         = NULL;

-  HiiHandles          = NULL;

-  HandleBufferLength  = 0;

-

-  //

-  // Connect all prior to entering the platform setup menu.

-  //

-  if (!gConnectAllHappened) {

-    BdsLibConnectAllDriversToAllControllers ();

-    gConnectAllHappened = TRUE;

-  }

-  //

-  // Allocate space for creation of UpdateData Buffer

-  //

-  UpdateData = AllocateZeroPool (0x1000);

-  ASSERT (UpdateData != NULL);

-

-  Status        = EFI_SUCCESS;

-  Buffer        = NULL;

-  FormSetData   = NULL;

-  gCallbackKey  = 0;

-  if (mTokenCount == 0) {

-    Hii->NewString (Hii, NULL, FPCallbackInfo.DevMgrHiiHandle, &mTokenCount, L" ");

-  }

-

-  Token     = mTokenCount;

-  TokenHelp = (UINT16) (Token + 1);

-

-  //

-  // Reset the menu

-  //

-  for (Index = 0, Count = 1; Count < 0x10000; Count <<= 1, Index++) {

-    //

-    // We will strip off all previous menu entries

-    //

-    UpdateData->DataCount = 0xFF;

-

-    //

-    // Erase entries on this label

-    //

-    Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) Count, FALSE, UpdateData);

-

-    //

-    // Did we reach the end of the Token Table?

-    //

-    if (gStringTokenTable[Index] == 0xFFFF) {

-      break;

-    }

-

-    CreateSubTitleOpCode (gStringTokenTable[Index], &UpdateData->Data);

-    //

-    // Add a single menu item - in this case a subtitle for the device type

-    //

-    UpdateData->DataCount = 1;

-

-    //

-    // Add default title for this label

-    //

-    Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) Count, TRUE, UpdateData);

-  }

-  //

-  // Add a space and an exit string.  Remember since we add things at the label and push other things beyond the

-  // label down, we add this in reverse order

-  //

-  CreateSubTitleOpCode (STRING_TOKEN (STR_EXIT_STRING), &UpdateData->Data);

-  Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) Count, TRUE, UpdateData);

-  CreateSubTitleOpCode (STR_EMPTY_STRING, &UpdateData->Data);

-  Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) Count, TRUE, UpdateData);

-

-  //

-  // Get all the Hii handles

-  //

-  Status = BdsLibGetHiiHandles (Hii, &HandleBufferLength, &HiiHandles);

-  ASSERT_EFI_ERROR (Status);

-

-  for (Index = 1, BufferSize = 0; Index < HandleBufferLength; Index++) {

-    //

-    // Am not initializing Buffer since the first thing checked is the size

-    // this way I can get the real buffersize in the smallest code size

-    //

-    Status = Hii->GetForms (Hii, Index, 0, &BufferSize, Buffer);

-

-    if (Status != EFI_NOT_FOUND) {

-      //

-      // BufferSize should have the real size of the forms now

-      //

-      Buffer = AllocateZeroPool (BufferSize);

-      ASSERT (Buffer != NULL);

-

-      //

-      // Am not initializing Buffer since the first thing checked is the size

-      // this way I can get the real buffersize in the smallest code size

-      //

-      Status = Hii->GetForms (Hii, Index, 0, &BufferSize, Buffer);

-

-      //

-      // Skip EFI_HII_PACK_HEADER, advance to EFI_IFR_FORM_SET data.

-      //

-      FormSetData = (EFI_IFR_FORM_SET *) (Buffer + sizeof (EFI_HII_PACK_HEADER));

-

-      //

-      // If this formset belongs in the device manager, add it to the menu

-      //

-      if (FormSetData->Class != EFI_NON_DEVICE_CLASS) {

-

-        StringLength  = 0x1000;

-        String        = AllocateZeroPool (StringLength);

-        ASSERT (String != NULL);

-

-        Status  = Hii->GetString (Hii, Index, FormSetData->FormSetTitle, TRUE, NULL, &StringLength, String);

-        Status  = Hii->NewString (Hii, NULL, FPCallbackInfo.DevMgrHiiHandle, &Token, String);

-

-        //

-        // If token value exceeded real token value - we need to add a new token values

-        //

-        if (Status == EFI_INVALID_PARAMETER) {

-          Token     = 0;

-          TokenHelp = 0;

-          Status    = Hii->NewString (Hii, NULL, FPCallbackInfo.DevMgrHiiHandle, &Token, String);

-        }

-

-        StringLength = 0x1000;

-        if (FormSetData->Help == 0) {

-          TokenHelp = 0;

-        } else {

-          Status = Hii->GetString (Hii, Index, FormSetData->Help, TRUE, NULL, &StringLength, String);

-          if (StringLength == 0x02) {

-            TokenHelp = 0;

-          } else {

-            Status = Hii->NewString (Hii, NULL, FPCallbackInfo.DevMgrHiiHandle, &TokenHelp, String);

-            if (Status == EFI_INVALID_PARAMETER) {

-              TokenHelp = 0;

-              Status    = Hii->NewString (Hii, NULL, FPCallbackInfo.DevMgrHiiHandle, &TokenHelp, String);

-            }

-          }

-        }

-

-        FreePool (String);

-

-        CreateGotoOpCode (

-          0x1000,     // Device Manager Page

-          Token,      // Description String Token

-          TokenHelp,  // Description Help String Token

-          EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,  // Flag designating callback is active

-          (UINT16) Index,                                     // Callback key value

-          &UpdateData->Data                                   // Buffer to fill with op-code

-          );

-

-        //

-        // In the off-chance that we have lots of extra tokens allocated to the DeviceManager

-        // this ensures we are fairly re-using the tokens instead of constantly growing the token

-        // storage for this one handle.  If we incremented the token value beyond what it normally

-        // would use, we will fall back into the error path which seeds the token value with a 0

-        // so that we can correctly add a token value.

-        //

-        if (TokenHelp == 0) {

-          //

-          // Since we didn't add help, only advance Token by 1

-          //

-          Token++;

-        } else {

-          Token     = (UINT16) (Token + 2);

-          TokenHelp = (UINT16) (TokenHelp + 2);

-        }

-        //

-        // This for loop basically will take the Class value which is a bitmask and

-        // update the form for every active bit.  There will be a label at each bit

-        // location.  So if someone had a device which a class of EFI_DISK_DEVICE_CLASS |

-        // EFI_ON_BOARD_DEVICE_CLASS, this routine will unwind that mask and drop the menu entry

-        // on each corresponding label.

-        //

-        for (Count = 1; Count < 0x10000; Count <<= 1) {

-          //

-          // This is an active bit, so update the form

-          //

-          if (FormSetData->Class & Count) {

-            Hii->UpdateForm (

-                  Hii,

-                  FPCallbackInfo.DevMgrHiiHandle,

-                  (EFI_FORM_LABEL) (FormSetData->Class & Count),

-                  TRUE,

-                  UpdateData

-                  );

-          }

-        }

-      }

-

-      BufferSize = 0;

-      //

-      // Reset Buffer pointer to original location

-      //

-      FreePool (Buffer);

-    }

-  }

-  //

-  // Add oneof for video BIOS selection

-  //

-  VideoOption = BdsLibGetVariableAndSize (

-                  L"VBIOS",

-                  &gEfiGenericPlatformVariableGuid,

-                  &VideoOptionSize

-                  );

-  if (NULL == VideoOption) {

-    FPCallbackInfo.Data.VideoBIOS = 0;

-  } else {

-    FPCallbackInfo.Data.VideoBIOS = VideoOption[0];

-    FreePool (VideoOption);

-  }

-

-  ASSERT (FPCallbackInfo.Data.VideoBIOS <= 1);

-

-  IfrOptionList = AllocatePool (2 * sizeof (IFR_OPTION));

-  if (IfrOptionList != NULL) {

-    IfrOptionList[0].Flags        = EFI_IFR_FLAG_INTERACTIVE;

-    IfrOptionList[0].Key          = SET_VIDEO_BIOS_TYPE_QUESTION_ID + 0x2000;

-    IfrOptionList[0].StringToken  = STRING_TOKEN (STR_ONE_OF_PCI);

-    IfrOptionList[0].Value        = 0;

-    IfrOptionList[0].OptionString = NULL;

-    IfrOptionList[1].Flags        = EFI_IFR_FLAG_INTERACTIVE;

-    IfrOptionList[1].Key          = SET_VIDEO_BIOS_TYPE_QUESTION_ID + 0x2000;

-    IfrOptionList[1].StringToken  = STRING_TOKEN (STR_ONE_OF_AGP);

-    IfrOptionList[1].Value        = 1;

-    IfrOptionList[1].OptionString = NULL;

-    IfrOptionList[FPCallbackInfo.Data.VideoBIOS].Flags |= EFI_IFR_FLAG_DEFAULT;

-

-    CreateOneOfOpCode (

-      SET_VIDEO_BIOS_TYPE_QUESTION_ID,

-      (UINT8) 1,

-      STRING_TOKEN (STR_ONE_OF_VBIOS),

-      STRING_TOKEN (STR_ONE_OF_VBIOS_HELP),

-      IfrOptionList,

-      2,

-      &UpdateData->Data

-      );

-

-    UpdateData->DataCount = 4;

-    Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) EFI_VBIOS_CLASS, TRUE, UpdateData);

-    FreePool (IfrOptionList);

-  }

-

-  BootDeviceMngrMenuResetRequired = FALSE;

-  Status = gBrowser->SendForm (

-                      gBrowser,

-                      TRUE,                             // Use the database

-                      &FPCallbackInfo.DevMgrHiiHandle,  // The HII Handle

-                      1,

-                      NULL,

-                      FPCallbackInfo.CallbackHandle,

-                      (UINT8 *) &FPCallbackInfo.Data,

-                      NULL,

-                      &BootDeviceMngrMenuResetRequired

-                      );

-

-  if (BootDeviceMngrMenuResetRequired) {

-    EnableResetRequired ();

-  }

-

-  Hii->ResetStrings (Hii, FPCallbackInfo.DevMgrHiiHandle);

-

-  //

-  // We will have returned from processing a callback - user either hit ESC to exit, or selected

-  // a target to display

-  //

-  if (gCallbackKey != 0 && gCallbackKey < 0x2000) {

-    BootDeviceMngrMenuResetRequired = FALSE;

-    Status = gBrowser->SendForm (

-                        gBrowser,

-                        TRUE,                             // Use the database

-                        (EFI_HII_HANDLE *) &gCallbackKey, // The HII Handle

-                        1,

-                        NULL,

-                        NULL,                             // This is the handle that the interface to the callback was installed on

-                        NULL,

-                        NULL,

-                        &BootDeviceMngrMenuResetRequired

-                        );

-

-    if (BootDeviceMngrMenuResetRequired) {

-      EnableResetRequired ();

-    }

-    //

-    // Force return to Device Manager

-    //

-    gCallbackKey = 4;

-  }

-

-  if (gCallbackKey >= 0x2000) {

-    gCallbackKey = 4;

-  }

-

-  FreePool (UpdateData);

-  FreePool (HiiHandles);

-

-  return Status;

-}

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/DeviceMngr/DeviceManager.h b/EdkNt32Pkg/Dxe/PlatformBds/Generic/DeviceMngr/DeviceManager.h
deleted file mode 100644
index dd6d935..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/DeviceMngr/DeviceManager.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name: 

-

-  DeviceManager.c

-

-Abstract:

-

-  The platform device manager reference implement

-

-Revision History

-

---*/

-

-#ifndef _DEVICE_MANAGER_H

-#define _DEVICE_MANAGER_H

-

-#include "Generic/FrontPage.h"

-

-#define EFI_NON_DEVICE_CLASS              0x00  // Useful when you do not want something in the Device Manager

-#define EFI_DISK_DEVICE_CLASS             0x01

-#define EFI_VIDEO_DEVICE_CLASS            0x02

-#define EFI_NETWORK_DEVICE_CLASS          0x04

-#define EFI_INPUT_DEVICE_CLASS            0x08

-#define EFI_ON_BOARD_DEVICE_CLASS         0x10

-#define EFI_OTHER_DEVICE_CLASS            0x20

-

-EFI_STATUS

-EFIAPI

-DeviceManagerCallbackRoutine (

-  IN EFI_FORM_CALLBACK_PROTOCOL       *This,

-  IN UINT16                           KeyValue,

-  IN EFI_IFR_DATA_ARRAY               *DataArray,

-  OUT EFI_HII_CALLBACK_PACKET         **Packet

-  )

-;

-

-EFI_STATUS

-InitializeDeviceManager (

-  VOID

-  )

-;

-

-EFI_STATUS

-CallDeviceManager (

-  VOID

-  )

-;

-

-#endif

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/DeviceMngr/DeviceManagerStrings.uni b/EdkNt32Pkg/Dxe/PlatformBds/Generic/DeviceMngr/DeviceManagerStrings.uni
deleted file mode 100644
index f549ff2..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/DeviceMngr/DeviceManagerStrings.uni
+++ /dev/null
Binary files differ
diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/DeviceMngr/DeviceManagerVfr.Vfr b/EdkNt32Pkg/Dxe/PlatformBds/Generic/DeviceMngr/DeviceManagerVfr.Vfr
deleted file mode 100644
index 5497c6d..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/DeviceMngr/DeviceManagerVfr.Vfr
+++ /dev/null
@@ -1,75 +0,0 @@
-// *++

-//

-// Copyright (c) 2006, Intel Corporation                                                         

-// All rights reserved. This program and the accompanying materials                          

-// are licensed and made available under the terms and conditions of the BSD License         

-// which accompanies this distribution.  The full text of the license may be found at        

-// http://opensource.org/licenses/bsd-license.php                                            

-//                                                                                           

-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-// 

-// Module Name:

-//

-//   DeviceManagerVfr.vfr 

-// 

-// Abstract:

-// 

-//   Device Manager formset.

-// 

-// Revision History: 

-// 

-// --*/

-

-#include "BdsStrDefs.h"

-

-#define FORMSET_GUID  { 0x3ebfa8e6, 0x511d, 0x4b5b, { 0xa9, 0x5f, 0xfb, 0x38, 0x26, 0xf, 0x1c, 0x27 } }

-

-#define EFI_DISK_DEVICE_CLASS              0x01

-#define EFI_VIDEO_DEVICE_CLASS             0x02

-#define EFI_NETWORK_DEVICE_CLASS           0x04

-#define EFI_INPUT_DEVICE_CLASS             0x08

-#define EFI_ON_BOARD_DEVICE_CLASS          0x10

-#define EFI_OTHER_DEVICE_CLASS             0x20

-#define EFI_VBIOS_CLASS                    0x40

-

-#define DEVICE_MANAGER_CLASS               0x0000

-#define FRONT_PAGE_SUBCLASS		             0x0003

-

-formset 

-  guid     = FORMSET_GUID,

-  title    = STRING_TOKEN(STR_DEVICE_MANAGER_TITLE),  

-  help     = STRING_TOKEN(STR_EMPTY_STRING),

-  class    = DEVICE_MANAGER_CLASS,      

-  subclass = FRONT_PAGE_SUBCLASS,

-

-  form formid = 0x1000,

-       title  = STRING_TOKEN(STR_DEVICE_MANAGER_TITLE);

-

-    //

-    // This is where devices get added to the device manager hierarchy

-    //

-    subtitle text = STRING_TOKEN(STR_DISK_DEVICE);

-    label EFI_DISK_DEVICE_CLASS;

-

-    subtitle text = STRING_TOKEN(STR_VIDEO_DEVICE);

-    label EFI_VIDEO_DEVICE_CLASS;

-

-    subtitle text = STRING_TOKEN(STR_NETWORK_DEVICE);

-    label EFI_NETWORK_DEVICE_CLASS;

-

-    subtitle text = STRING_TOKEN(STR_INPUT_DEVICE);

-    label EFI_INPUT_DEVICE_CLASS;

-

-    subtitle text = STRING_TOKEN(STR_ON_BOARD_DEVICE);

-    label EFI_ON_BOARD_DEVICE_CLASS;

-

-    subtitle text = STRING_TOKEN(STR_OTHER_DEVICE);

-    label EFI_OTHER_DEVICE_CLASS;

-    

-    subtitle text = STRING_TOKEN(STR_EMPTY_STRING);

-    label EFI_VBIOS_CLASS;

-    

-  endform;

-endformset;

-

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPage.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPage.c
deleted file mode 100644
index 62ffd8f..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPage.c
+++ /dev/null
@@ -1,902 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  FrontPage.c

-

-Abstract:

-

-  FrontPage routines to handle the callbacks and browser calls

-

---*/

-

-#include "Bds.h"

-#include "BdsPlatform.h"

-#include "FrontPage.h"

-#include "String.h"

-

-EFI_GUID                    mProcessorSubClass  = EFI_PROCESSOR_SUBCLASS_GUID;

-EFI_GUID                    mMemorySubClass     = EFI_MEMORY_SUBCLASS_GUID;

-EFI_GUID                    mMiscSubClass       = EFI_MISC_SUBCLASS_GUID;

-

-UINT16                      mLastSelection;

-EFI_HII_HANDLE              gFrontPageHandle;

-EFI_HANDLE                  FrontPageCallbackHandle;

-EFI_FORM_CALLBACK_PROTOCOL  FrontPageCallback;

-EFI_FORM_BROWSER_PROTOCOL   *gBrowser;

-UINTN                       gCallbackKey;

-BOOLEAN                     gConnectAllHappened = FALSE;

-

-extern EFI_HII_HANDLE       gFrontPageHandle;

-extern EFI_GUID             gBdsStringPackGuid;

-

-EFI_STATUS

-EFIAPI

-FrontPageCallbackRoutine (

-  IN EFI_FORM_CALLBACK_PROTOCOL       *This,

-  IN UINT16                           KeyValue,

-  IN EFI_IFR_DATA_ARRAY               *DataArray,

-  OUT EFI_HII_CALLBACK_PACKET         **Packet

-  )

-/*++

-

-Routine Description:

-

-  This is the function that is called to provide results data to the driver.  This data

-  consists of a unique key which is used to identify what data is either being passed back

-  or being asked for.

-

-Arguments:

-

-  KeyValue -        A unique value which is sent to the original exporting driver so that it

-                    can identify the type of data to expect.  The format of the data tends to

-                    vary based on the op-code that geerated the callback.

-

-  Data -            A pointer to the data being sent to the original exporting driver.

-

-Returns:

-

---*/

-{

-  CHAR16        *LanguageString;

-  UINTN         Count;

-  CHAR16        UnicodeLang[3];

-  CHAR8         Lang[3];

-  EFI_STATUS    Status;

-  UINTN         Index;

-  CHAR16        *TmpStr;

-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;

-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;

-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color;

-

-  SetMem (&Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);

-  SetMem (&Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);

-  SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);

-

-  Count = 0;

-

-  //

-  // The first 4 entries in the Front Page are to be GUARANTEED to remain constant so IHV's can

-  // describe to their customers in documentation how to find their setup information (namely

-  // under the device manager and specific buckets)

-  //

-  switch (KeyValue) {

-  case 0x0001:

-    //

-    // This is the continue - clear the screen and return an error to get out of FrontPage loop

-    //

-    gCallbackKey = 1;

-    break;

-

-  case 0x1234:

-    //

-    // Collect the languages from what our current Language support is based on our VFR

-    //

-    Hii->GetPrimaryLanguages (Hii, gFrontPageHandle, &LanguageString);

-

-    //

-    // Based on the DataArray->Data->Data value, we can determine

-    // which language was chosen by the user

-    //

-    for (Index = 0; Count != (UINTN) (((EFI_IFR_DATA_ENTRY *) (DataArray + 1))->Data); Index += 3) {

-      Count++;

-    }

-    //

-    // Preserve the choice the user made

-    //

-    mLastSelection = (UINT16) Count;

-

-    //

-    // The Language (in Unicode format) the user chose

-    //

-    CopyMem (UnicodeLang, &LanguageString[Index], 6);

-

-    //

-    // Convert Unicode to ASCII (Since the ISO standard assumes ASCII equivalent abbreviations

-    // we can be safe in converting this Unicode stream to ASCII without any loss in meaning.

-    //

-    for (Index = 0; Index < 3; Index++) {

-      Lang[Index] = (CHAR8) UnicodeLang[Index];

-    }

-

-    Status = gRT->SetVariable (

-                    L"Lang",

-                    &gEfiGlobalVariableGuid,

-                    EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,

-                    3,

-                    Lang

-                    );

-

-    FreePool (LanguageString);

-    gCallbackKey = 2;

-    break;

-

-  case 0x1064:

-    //

-    // Boot Manager

-    //

-    gCallbackKey = 3;

-    break;

-

-  case 0x8567:

-    //

-    // Device Manager

-    //

-    gCallbackKey = 4;

-    break;

-

-  case 0x9876:

-    //

-    // Boot Maintenance Manager

-    //

-    gCallbackKey = 5;

-    break;

-

-  case 0xFFFE:

-

-    break;

-

-  case 0xFFFF:

-    //

-    // FrontPage TimeOut Callback

-    //

-    TmpStr = GetStringById (STRING_TOKEN (STR_START_BOOT_OPTION));

-    if (TmpStr != NULL) {

-      PlatformBdsShowProgress (

-        Foreground,

-        Background,

-        TmpStr,

-        Color,

-        (UINTN) (((EFI_IFR_DATA_ENTRY *) (DataArray+1))->Data),

-        0

-        );

-      FreePool (TmpStr);

-    }

-    break;

-

-  default:

-    gCallbackKey = 0;

-    break;

-  }

-

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-InitializeFrontPage (

-  BOOLEAN                         ReInitializeStrings

-  )

-/*++

-

-Routine Description:

-

-  Initialize HII information for the FrontPage

-

-Arguments:

-  None

-

-Returns:

-  EFI_SUCCESS       - The operation is successful.

-  EFI_DEVICE_ERROR  - If the dynamic opcode creation failed.

-

---*/

-{

-  EFI_STATUS          Status;

-  EFI_HII_PACKAGES    *PackageList;

-  EFI_HII_UPDATE_DATA *UpdateData;

-  IFR_OPTION          *OptionList;

-  CHAR16              *LanguageString;

-  UINTN               OptionCount;

-  UINTN               Index;

-  STRING_REF          Token;

-  UINT16              Key;

-  CHAR8               AsciiLang[4];

-  CHAR16              UnicodeLang[4];

-  CHAR16              Lang[4];

-  CHAR16              *StringBuffer;

-  UINTN               BufferSize;

-  UINT8               *TempBuffer;

-

-  UpdateData  = NULL;

-  OptionList  = NULL;

-

-  if (ReInitializeStrings) {

-    //

-    // BugBug: Dont' use a goto

-    //

-    goto ReInitStrings;

-  }

-  //

-  // Go ahead and initialize the Device Manager

-  //

-  InitializeDeviceManager ();

-

-  //

-  // BugBug: if FrontPageVfrBin is generated by a tool, why are we patching it here

-  //

-  TempBuffer    = (UINT8 *) FrontPageVfrBin;

-  TempBuffer    = TempBuffer + sizeof (EFI_HII_PACK_HEADER);

-  TempBuffer    = (UINT8 *) &((EFI_IFR_FORM_SET *) TempBuffer)->NvDataSize;

-  *TempBuffer   = 1;

-

-  gCallbackKey  = 0;

-

-  PackageList   = PreparePackages (1, &gBdsStringPackGuid, FrontPageVfrBin);

-

-  Status        = Hii->NewPack (Hii, PackageList, &gFrontPageHandle);

-

-  FreePool (PackageList);

-

-  //

-  // There will be only one FormConfig in the system

-  // If there is another out there, someone is trying to install us

-  // again.  Fail that scenario.

-  //

-  Status = gBS->LocateProtocol (

-                  &gEfiFormBrowserProtocolGuid,

-                  NULL,

-                  &gBrowser

-                  );

-

-  //

-  // This example does not implement worker functions

-  // for the NV accessor functions.  Only a callback evaluator

-  //

-  FrontPageCallback.NvRead    = NULL;

-  FrontPageCallback.NvWrite   = NULL;

-  FrontPageCallback.Callback  = FrontPageCallbackRoutine;

-

-  //

-  // Install protocol interface

-  //

-  FrontPageCallbackHandle = NULL;

-  Status = gBS->InstallProtocolInterface (

-                  &FrontPageCallbackHandle,

-                  &gEfiFormCallbackProtocolGuid,

-                  EFI_NATIVE_INTERFACE,

-                  &FrontPageCallback

-                  );

-  ASSERT_EFI_ERROR (Status);

-

-ReInitStrings:

-  //

-  // BugBug: This logic is in BdsInitLanguage. It should not be in two places!

-  //

-  BufferSize = 4;

-  Status = gRT->GetVariable (

-                  L"Lang",

-                  &gEfiGlobalVariableGuid,

-                  NULL,

-                  &BufferSize,

-                  AsciiLang

-                  );

-

-  for (Index = 0; Index < 3; Index++) {

-    UnicodeLang[Index] = (CHAR16) AsciiLang[Index];

-  }

-

-  UnicodeLang[3] = 0;

-

-  //

-  // Allocate space for creation of UpdateData Buffer

-  //

-  UpdateData = AllocateZeroPool (0x1000);

-  ASSERT (UpdateData != NULL);

-

-  OptionList = AllocateZeroPool (0x1000);

-  ASSERT (OptionList != NULL);

-

-  //

-  // Flag update pending in FormSet

-  //

-  UpdateData->FormSetUpdate = TRUE;

-  //

-  // Register CallbackHandle data for FormSet

-  //

-  UpdateData->FormCallbackHandle = (EFI_PHYSICAL_ADDRESS) (UINTN) FrontPageCallbackHandle;

-  UpdateData->FormUpdate  = FALSE;

-  UpdateData->FormTitle   = 0;

-  UpdateData->DataCount   = 1;

-

-  //

-  // Collect the languages from what our current Language support is based on our VFR

-  //

-  Hii->GetPrimaryLanguages (Hii, gFrontPageHandle, &LanguageString);

-

-  OptionCount = 0;

-

-  //

-  // Try for a 512 byte Buffer

-  //

-  BufferSize = 0x200;

-

-  //

-  // Allocate memory for our Form binary

-  //

-  StringBuffer = AllocateZeroPool (BufferSize);

-  ASSERT (StringBuffer != NULL);

-

-  for (Index = 0; LanguageString[Index] != 0; Index += 3) {

-    Token = 0;

-    CopyMem (Lang, &LanguageString[Index], 6);

-    Lang[3] = 0;

-

-    if (!StrCmp (Lang, UnicodeLang)) {

-      mLastSelection = (UINT16) OptionCount;

-    }

-

-    Status = Hii->GetString (Hii, gStringPackHandle, 1, TRUE, Lang, &BufferSize, StringBuffer);

-    Hii->NewString (Hii, NULL, gStringPackHandle, &Token, StringBuffer);

-    CopyMem (&OptionList[OptionCount].StringToken, &Token, sizeof (UINT16));

-    CopyMem (&OptionList[OptionCount].Value, &OptionCount, sizeof (UINT16));

-    Key = 0x1234;

-    CopyMem (&OptionList[OptionCount].Key, &Key, sizeof (UINT16));

-    OptionList[OptionCount].Flags = EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS;

-    OptionCount++;

-  }

-

-  FreePool (LanguageString);

-

-  if (ReInitializeStrings) {

-    FreePool (StringBuffer);

-    FreePool (OptionList);

-    return EFI_SUCCESS;

-  }

-

-  Status = CreateOneOfOpCode (

-            FRONT_PAGE_QUESTION_ID,                               // Question ID

-            FRONT_PAGE_DATA_WIDTH,                                // Data Width

-            (STRING_REF) STRING_TOKEN (STR_LANGUAGE_SELECT),      // Prompt Token

-            (STRING_REF) STRING_TOKEN (STR_LANGUAGE_SELECT_HELP), // Help Token

-            OptionList,       // List of Options

-            OptionCount,      // Number of Options

-            &UpdateData->Data // Data Buffer

-            );

-

-  //

-  // Assign the number of options and the oneof and endoneof op-codes to count

-  //

-  UpdateData->DataCount = (UINT8) (OptionCount + 2);

-

-  Hii->UpdateForm (Hii, gFrontPageHandle, (EFI_FORM_LABEL) 0x0002, TRUE, UpdateData);

-

-  FreePool (UpdateData);

-  //

-  // FreePool (OptionList);

-  //

-  FreePool (StringBuffer);

-  return Status;

-}

-

-EFI_STATUS

-CallFrontPage (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  Call the browser and display the front page

-

-Arguments:

-

-  None

-

-Returns:

-

---*/

-{

-  EFI_STATUS  Status;

-  UINT8       FakeNvRamMap[1];

-  BOOLEAN     FrontPageMenuResetRequired;

-

-  //

-  // Begin waiting for USER INPUT

-  //

-  REPORT_STATUS_CODE (

-        EFI_PROGRESS_CODE,

-        (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_INPUT_WAIT)

-        );

-

-  FakeNvRamMap[0] = (UINT8) mLastSelection;

-  FrontPageMenuResetRequired = FALSE;

-  Status = gBrowser->SendForm (

-                      gBrowser,

-                      TRUE,                     // Use the database

-                      &gFrontPageHandle,        // The HII Handle

-                      1,

-                      NULL,

-                      FrontPageCallbackHandle,  // This is the handle that the interface to the callback was installed on

-                      FakeNvRamMap,

-                      NULL,

-                      &FrontPageMenuResetRequired

-                      );

-  //

-  // Check whether user change any option setting which needs a reset to be effective

-  //

-  if (FrontPageMenuResetRequired) {

-    EnableResetRequired ();

-  }

-

-  Hii->ResetStrings (Hii, gFrontPageHandle);

-

-  return Status;

-}

-

-EFI_STATUS

-GetStringFromToken (

-  IN      EFI_GUID                  *ProducerGuid,

-  IN      STRING_REF                Token,

-  OUT     CHAR16                    **String

-  )

-/*++

-

-Routine Description:

-

-  Acquire the string associated with the ProducerGuid and return it.

-

-Arguments:

-

-  ProducerGuid - The Guid to search the HII database for

-  Token - The token value of the string to extract

-  String - The string that is extracted

-

-Returns:

-

-  EFI_SUCCESS - The function returns EFI_SUCCESS always.

-

---*/

-{

-  EFI_STATUS      Status;

-  UINT16          HandleBufferLength;

-  EFI_HII_HANDLE  *HiiHandleBuffer;

-  UINTN           StringBufferLength;

-  UINTN           NumberOfHiiHandles;

-  UINTN           Index;

-  UINT16          Length;

-  EFI_GUID        HiiGuid;

-

-  //

-  // Initialize params.

-  //

-  HandleBufferLength  = 0;

-  HiiHandleBuffer     = NULL;

-

-  //

-  // Get all the Hii handles

-  //

-  Status = BdsLibGetHiiHandles (Hii, &HandleBufferLength, &HiiHandleBuffer);

-  ASSERT_EFI_ERROR (Status);

-

-  //

-  // Get the Hii Handle that matches the StructureNode->ProducerName

-  //

-  NumberOfHiiHandles = HandleBufferLength / sizeof (EFI_HII_HANDLE);

-  for (Index = 0; Index < NumberOfHiiHandles; Index++) {

-    Length = 0;

-    Status = ExtractDataFromHiiHandle (

-              HiiHandleBuffer[Index],

-              &Length,

-              NULL,

-              &HiiGuid

-              );

-    if (CompareGuid (ProducerGuid, &HiiGuid)) {

-      break;

-    }

-  }

-  //

-  // Find the string based on the current language

-  //

-  StringBufferLength  = 0x100;

-  *String             = AllocateZeroPool (0x100);

-  Status = Hii->GetString (

-                  Hii,

-                  HiiHandleBuffer[Index],

-                  Token,

-                  FALSE,

-                  NULL,

-                  &StringBufferLength,

-                  *String

-                  );

-

-  if (EFI_ERROR (Status)) {

-    FreePool (*String);

-    *String = GetStringById (STRING_TOKEN (STR_MISSING_STRING));

-  }

-

-  FreePool (HiiHandleBuffer);

-  return EFI_SUCCESS;

-}

-

-VOID

-ConvertProcessorToString (

-  IN  EFI_PROCESSOR_CORE_FREQUENCY_DATA *ProcessorFrequency,

-  OUT CHAR16                            **String

-  )

-/*++

-

-Routine Description:

-

-  Convert Processor Frequency Data to a string

-

-Arguments:

-

-  ProcessorFrequency - The frequency data to process

-  String - The string that is created

-

-Returns:

-

---*/

-{

-  CHAR16  *StringBuffer;

-  UINTN   Index;

-  UINT32  FreqMhz;

-

-  if (ProcessorFrequency->Exponent >= 6) {

-    FreqMhz = ProcessorFrequency->Value;

-    for (Index = 0; Index < (UINTN) (ProcessorFrequency->Exponent - 6); Index++) {

-      FreqMhz *= 10;

-    }

-  } else {

-    FreqMhz = 0;

-  }

-

-  StringBuffer = AllocateZeroPool (0x20);

-  ASSERT (StringBuffer != NULL);

-  Index = UnicodeValueToString (StringBuffer, LEFT_JUSTIFY, FreqMhz / 1000, 3);

-  StrCat (StringBuffer, L".");

-  UnicodeValueToString (StringBuffer + Index + 1, PREFIX_ZERO, (FreqMhz % 1000) / 10, 2);

-  StrCat (StringBuffer, L" GHz");

-

-  *String = (CHAR16 *) StringBuffer;

-

-  return ;

-}

-

-VOID

-ConvertMemorySizeToString (

-  IN  UINT32          MemorySize,

-  OUT CHAR16          **String

-  )

-/*++

-

-Routine Description:

-

-  Convert Memory Size to a string

-

-Arguments:

-

-  MemorySize - The size of the memory to process

-  String - The string that is created

-

-Returns:

-

---*/

-{

-  CHAR16  *StringBuffer;

-

-  StringBuffer = AllocateZeroPool (0x20);

-  ASSERT (StringBuffer != NULL);

-  UnicodeValueToString (StringBuffer, LEFT_JUSTIFY, MemorySize, 6);

-  StrCat (StringBuffer, L" MB RAM");

-

-  *String = (CHAR16 *) StringBuffer;

-

-  return ;

-}

-

-VOID

-UpdateFrontPageStrings (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  Update the banner information for the Front Page based on DataHub information

-

-Arguments:

-

-  None

-

-Returns:

-

---*/

-{

-  EFI_STATUS                        Status;

-  STRING_REF                        TokenToUpdate;

-  CHAR16                            *NewString;

-  UINT64                            MonotonicCount;

-  EFI_DATA_HUB_PROTOCOL             *DataHub;

-  EFI_DATA_RECORD_HEADER            *Record;

-  EFI_SUBCLASS_TYPE1_HEADER         *DataHeader;

-  EFI_MISC_BIOS_VENDOR_DATA         *BiosVendor;

-  EFI_MISC_SYSTEM_MANUFACTURER_DATA *SystemManufacturer;

-  EFI_PROCESSOR_VERSION_DATA        *ProcessorVersion;

-  EFI_PROCESSOR_CORE_FREQUENCY_DATA *ProcessorFrequency;

-  EFI_MEMORY_ARRAY_START_ADDRESS_DATA *MemoryArray;

-  CHAR8                             LangCode[3];

-  CHAR16                            Lang[3];

-  UINTN                             Size;

-  UINTN                             Index;

-  BOOLEAN                           Find[5];

-

-  ZeroMem (Find, sizeof (Find));

-

-  //

-  // Update Front Page strings

-  //

-  Status = gBS->LocateProtocol (

-                  &gEfiDataHubProtocolGuid,

-                  NULL,

-                  &DataHub

-                  );

-  ASSERT_EFI_ERROR (Status);

-

-  Size = 3;

-

-  Status = gRT->GetVariable (

-                  L"Lang",

-                  &gEfiGlobalVariableGuid,

-                  NULL,

-                  &Size,

-                  LangCode

-                  );

-

-  for (Index = 0; Index < 3; Index++) {

-    Lang[Index] = (CHAR16) LangCode[Index];

-  }

-

-  MonotonicCount  = 0;

-  Record          = NULL;

-  do {

-    Status = DataHub->GetNextRecord (DataHub, &MonotonicCount, NULL, &Record);

-    if (Record->DataRecordClass == EFI_DATA_RECORD_CLASS_DATA) {

-      DataHeader = (EFI_SUBCLASS_TYPE1_HEADER *) (Record + 1);

-      if (CompareGuid (&Record->DataRecordGuid, &mMiscSubClass) &&

-          (DataHeader->RecordType == EFI_MISC_BIOS_VENDOR_RECORD_NUMBER)

-          ) {

-        BiosVendor = (EFI_MISC_BIOS_VENDOR_DATA *) (DataHeader + 1);

-        GetStringFromToken (&Record->ProducerName, BiosVendor->BiosVersion, &NewString);

-        TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_BIOS_VERSION;

-        Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString);

-        FreePool (NewString);

-        Find[0] = TRUE;

-      }

-

-      if (CompareGuid (&Record->DataRecordGuid, &mMiscSubClass) &&

-          (DataHeader->RecordType == EFI_MISC_SYSTEM_MANUFACTURER_RECORD_NUMBER)

-          ) {

-        SystemManufacturer = (EFI_MISC_SYSTEM_MANUFACTURER_DATA *) (DataHeader + 1);

-        GetStringFromToken (&Record->ProducerName, SystemManufacturer->SystemProductName, &NewString);

-        TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_COMPUTER_MODEL;

-        Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString);

-        FreePool (NewString);

-        Find[1] = TRUE;

-      }

-

-      if (CompareGuid (&Record->DataRecordGuid, &mProcessorSubClass) &&

-          (DataHeader->RecordType == ProcessorVersionRecordType)

-          ) {

-        ProcessorVersion = (EFI_PROCESSOR_VERSION_DATA *) (DataHeader + 1);

-        GetStringFromToken (&Record->ProducerName, *ProcessorVersion, &NewString);

-        TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_CPU_MODEL;

-        Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString);

-        FreePool (NewString);

-        Find[2] = TRUE;

-      }

-

-      if (CompareGuid (&Record->DataRecordGuid, &mProcessorSubClass) &&

-          (DataHeader->RecordType == ProcessorCoreFrequencyRecordType)

-          ) {

-        ProcessorFrequency = (EFI_PROCESSOR_CORE_FREQUENCY_DATA *) (DataHeader + 1);

-        ConvertProcessorToString (ProcessorFrequency, &NewString);

-        TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_CPU_SPEED;

-        Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString);

-        FreePool (NewString);

-        Find[3] = TRUE;

-      }

-

-      if (CompareGuid (&Record->DataRecordGuid, &mMemorySubClass) &&

-          (DataHeader->RecordType == EFI_MEMORY_ARRAY_START_ADDRESS_RECORD_NUMBER)

-          ) {

-        MemoryArray = (EFI_MEMORY_ARRAY_START_ADDRESS_DATA *) (DataHeader + 1);

-        ConvertMemorySizeToString((UINT32)(RShiftU64((MemoryArray->MemoryArrayEndAddress -

-                                  MemoryArray->MemoryArrayStartAddress + 1), 20)),

-                                  &NewString);

-        TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_MEMORY_SIZE;

-        Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString);

-        FreePool (NewString);

-        Find[4] = TRUE;

-      }

-    }

-  } while (!EFI_ERROR (Status) && (MonotonicCount != 0) && !(Find[0] && Find[1] && Find[2] && Find[3] && Find[4]));

-

-  return ;

-}

-

-VOID

-PlatformBdsEnterFrontPage (

-  IN UINT16                       TimeoutDefault,

-  IN BOOLEAN                      ConnectAllHappened

-  )

-/*++

-

-Routine Description:

-  This function is the main entry of the platform setup entry.

-  The function will present the main menu of the system setup,

-  this is the platform reference part and can be customize.

-

-Arguments:

-  TimeoutDefault     - The fault time out value before the system

-                       continue to boot.

-  ConnectAllHappened - The indicater to check if the connect all have

-                       already happended.

-

-Returns:

-  None

-

---*/

-{

-  EFI_STATUS                    Status;

-  EFI_HII_UPDATE_DATA           *UpdateData;

-  EFI_CONSOLE_CONTROL_PROTOCOL  *ConsoleControl;

-

-  //

-  // Indicate if we need connect all in the platform setup

-  //

-  if (ConnectAllHappened) {

-    gConnectAllHappened = TRUE;

-  }

-  //

-  // Allocate space for creation of Buffer

-  //

-  UpdateData = AllocateZeroPool (0x1000);

-  ASSERT (UpdateData != NULL);

-

-  UpdateData->FormSetUpdate       = FALSE;

-  UpdateData->FormCallbackHandle  = 0;

-  UpdateData->FormUpdate          = FALSE;

-  UpdateData->FormTitle           = 0;

-  UpdateData->DataCount           = 1;

-

-  //

-  // Remove Banner Op-code if any at this label

-  //

-  Hii->UpdateForm (Hii, gFrontPageHandle, (EFI_FORM_LABEL) 0xFFFF, FALSE, UpdateData);

-

-  //

-  // Create Banner Op-code which reflects correct timeout value

-  //

-  CreateBannerOpCode (

-    STRING_TOKEN (STR_TIME_OUT_PROMPT),

-    TimeoutDefault,

-    (UINT8) EFI_IFR_BANNER_TIMEOUT,

-    &UpdateData->Data

-    );

-

-  //

-  // Add Banner Op-code at this label

-  //

-  Hii->UpdateForm (Hii, gFrontPageHandle, (EFI_FORM_LABEL) 0xFFFF, TRUE, UpdateData);

-

-  do {

-

-    InitializeFrontPage (TRUE);

-

-    //

-    // Update Front Page strings

-    //

-    UpdateFrontPageStrings ();

-

-    gCallbackKey = 0;

-    PERF_START (0, "BdsTimeOut", "BDS", 0);

-    Status = CallFrontPage ();

-    PERF_END (0, "BdsTimeOut", "BDS", 0);

-

-    //

-    // If gCallbackKey is greater than 1 and less or equal to 5,

-    // it will lauch configuration utilities.

-    // 2 = set language

-    // 3 = boot manager

-    // 4 = device manager

-    // 5 = boot maintainenance manager

-    //

-    if ((gCallbackKey > 0x0001) && (gCallbackKey <= 0x0005)) {

-      REPORT_STATUS_CODE (

-            EFI_PROGRESS_CODE,

-            (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_USER_SETUP)

-            );

-    }

-    //

-    // Based on the key that was set, we can determine what to do

-    //

-    switch (gCallbackKey) {

-    //

-    // The first 4 entries in the Front Page are to be GUARANTEED to remain constant so IHV's can

-    // describe to their customers in documentation how to find their setup information (namely

-    // under the device manager and specific buckets)

-    //

-    // These entries consist of the Continue, Select language, Boot Manager, and Device Manager

-    //

-    case 0x0001:

-      //

-      // User hit continue

-      //

-      break;

-

-    case 0x0002:

-      //

-      // User made a language setting change - display front page again

-      //

-      break;

-

-    case 0x0003:

-      //

-      // User chose to run the Boot Manager

-      //

-      CallBootManager ();

-      break;

-

-    case 0x0004:

-      //

-      // Display the Device Manager

-      //

-      do {

-        CallDeviceManager();

-      } while (gCallbackKey == 4);

-      break;

-

-    case 0x0005:

-      //

-      // Display the Boot Maintenance Manager

-      //

-      BdsStartBootMaint ();

-      break;

-    }

-

-  } while ((Status == EFI_SUCCESS) && (gCallbackKey != 1));

-

-  //

-  //Will leave browser, check any reset required change is applied? if yes, reset system

-  //

-  SetupResetReminder ();

-

-  //

-  // Automatically load current entry

-  // Note: The following lines of code only execute when Auto boot

-  // takes affect

-  //

-  Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, &ConsoleControl);

-  ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenText);

-

-}

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPage.h b/EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPage.h
deleted file mode 100644
index 5c33252..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPage.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  FrontPage.h

-

-Abstract:

-

-  FrontPage routines to handle the callbacks and browser calls

-

-Revision History

-

---*/

-

-#ifndef _FRONT_PAGE_H

-#define _FRONT_PAGE_H

-

-#include "Generic/DeviceMngr/DeviceManager.h"

-#include "Generic/BootMaint/BootMaint.h"

-#include "Generic/BootMngr/BootManager.h"

-

-//

-// This is the VFR compiler generated header file which defines the

-// string identifiers.

-//

-#include "BdsStrDefs.h"

-#define EFI_DISK_DEVICE_CLASS           0x01

-#define EFI_VIDEO_DEVICE_CLASS          0x02

-#define EFI_NETWORK_DEVICE_CLASS        0x04

-#define EFI_INPUT_DEVICE_CLASS          0x08

-#define EFI_ON_BOARD_DEVICE_CLASS       0x10

-#define EFI_OTHER_DEVICE_CLASS          0x20

-#define EFI_VBIOS_CLASS                 0x40

-

-#define SET_VIDEO_BIOS_TYPE_QUESTION_ID 0x00

-

-#pragma pack(1)

-typedef struct {

-  UINT8 VideoBIOS;

-} MyDevMgrIfrNVData;

-#pragma pack()

-

-#define EFI_FP_CALLBACK_DATA_SIGNATURE  EFI_SIGNATURE_32 ('F', 'P', 'C', 'B')

-#define EFI_FP_CALLBACK_DATA_FROM_THIS(a) \

-  CR (a, \

-      EFI_FRONTPAGE_CALLBACK_INFO, \

-      DevMgrCallback, \

-      EFI_FP_CALLBACK_DATA_SIGNATURE \

-      )

-

-typedef struct {

-  UINTN                       Signature;

-  MyDevMgrIfrNVData           Data;

-  EFI_HII_HANDLE              DevMgrHiiHandle;

-  EFI_HANDLE                  CallbackHandle;

-  EFI_FORM_CALLBACK_PROTOCOL  DevMgrCallback;

-} EFI_FRONTPAGE_CALLBACK_INFO;

-

-//

-// These are the VFR compiler generated data representing our VFR data.

-//

-// BugBug: we should put g in front of these tool generated globals.

-//         maybe even gVrf would be a better prefix

-//

-extern UINT8  FrontPageVfrBin[];

-extern UINT8  FrontPageStringsStr[];

-extern UINT8  DeviceManagerVfrBin[];

-extern UINT8  DeviceManagerStringsStr[];

-

-#define FRONT_PAGE_QUESTION_ID  0x0000

-#define FRONT_PAGE_DATA_WIDTH   0x01

-

-EFI_STATUS

-InitializeFrontPage (

-  IN BOOLEAN    ReInitializeStrings

-  );

-

-BOOLEAN

-TimeCompare (

-  IN EFI_TIME               *FirstTime,

-  IN EFI_TIME               *SecondTime

-  );

-

-VOID

-PlatformBdsEnterFrontPage (

-  IN UINT16                 TimeoutDefault,

-  IN BOOLEAN                ConnectAllHappened

-  );

-

-#endif // _FRONT_PAGE_H_

-

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPageStrings.uni b/EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPageStrings.uni
deleted file mode 100644
index 76dbdcf..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPageStrings.uni
+++ /dev/null
Binary files differ
diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPageVfr.Vfr b/EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPageVfr.Vfr
deleted file mode 100644
index 77efd2d..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPageVfr.Vfr
+++ /dev/null
@@ -1,159 +0,0 @@
-// *++

-//

-// Copyright (c) 2006, Intel Corporation                                                         

-// All rights reserved. This program and the accompanying materials                          

-// are licensed and made available under the terms and conditions of the BSD License         

-// which accompanies this distribution.  The full text of the license may be found at        

-// http://opensource.org/licenses/bsd-license.php                                            

-//                                                                                           

-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-// 

-// Module Name:

-//

-//   FrontPageVfr.vfr 

-// 

-// Abstract:

-// 

-//   Browser formset.

-// 

-// Revision History: 

-// 

-// --*/

-

-#include "BdsStrDefs.h"

-

-#define FORMSET_GUID  { 0x9e0c30bc, 0x3f06, 0x4ba6, { 0x82, 0x88, 0x9, 0x17, 0x9b, 0x85, 0x5d, 0xbe } }

-

-#define FRONT_PAGE_ITEM_ONE    0x0001

-#define FRONT_PAGE_ITEM_TWO    0x0002

-#define FRONT_PAGE_ITEM_THREE  0x0003

-#define FRONT_PAGE_ITEM_FOUR   0x0004

-#define FRONT_PAGE_ITEM_FIVE   0x0005

-

-#define FRONT_PAGE_TIMEOUT     0xFFFF

-#define FRONT_PAGE_CLASS       0x0000

-#define FRONT_PAGE_SUBCLASS    0x0002

-

-formset 

-  guid     = FORMSET_GUID,

-  title    = STRING_TOKEN(STR_FRONT_PAGE_TITLE),  

-  help     = STRING_TOKEN(STR_NULL_STRING),

-  class    = FRONT_PAGE_CLASS,      

-  subclass = FRONT_PAGE_SUBCLASS,

-

-  form formid = 0x1000,

-       title  = STRING_TOKEN(STR_FRONT_PAGE_TITLE);

-

-    banner 

-      title = STRING_TOKEN(STR_FRONT_PAGE_COMPUTER_MODEL),

-      line  0,

-      align left;

-    

-    banner 

-      title = STRING_TOKEN(STR_FRONT_PAGE_CPU_MODEL),

-      line  1,

-      align left;

-    

-    banner 

-      title = STRING_TOKEN(STR_FRONT_PAGE_CPU_SPEED),

-      line  1,

-      align right;

-    

-    banner 

-      title = STRING_TOKEN(STR_FRONT_PAGE_BIOS_VERSION),

-      line  2,

-      align left;

-    

-    banner 

-      title = STRING_TOKEN(STR_FRONT_PAGE_MEMORY_SIZE),

-      line  2,

-      align right;

-

-//    banner 

-//      title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_0_LEFT),

-//      line  0,

-//      align left;

-    

-//    banner 

-//      title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_0_RIGHT),

-//      line  0,

-//      align right;

-    

-//    banner 

-//      title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_1_LEFT),

-//      line  1,

-//      align left;

-    

-//    banner 

-//      title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_1_RIGHT),

-//      line  1,

-//      align right;

-    

-//    banner 

-//      title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_2_LEFT),

-//      line  2,

-//      align left;

-    

-//    banner 

-//      title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_3_LEFT),

-//      line  3,

-//      align left;

-

-    goto FRONT_PAGE_ITEM_ONE, 

-      prompt  = STRING_TOKEN(STR_CONTINUE_PROMPT), 

-      help    = STRING_TOKEN(STR_CONTINUE_HELP),

-      flags   = INTERACTIVE | NV_ACCESS, 

-      key     = 0x0001;

-

-    label FRONT_PAGE_ITEM_TWO;

-    //

-    // This is where we will dynamically add a OneOf type op-code to select Languages from the

-    // currently available choices

-    //

-

-    goto FRONT_PAGE_ITEM_THREE, 

-      prompt  = STRING_TOKEN(STR_BOOT_MANAGER), 

-      help    = STRING_TOKEN(STR_BOOT_MANAGER_HELP),

-      flags   = INTERACTIVE | NV_ACCESS, 

-      key     = 0x1064;

-

-    goto FRONT_PAGE_ITEM_FOUR, 

-      prompt  = STRING_TOKEN(STR_DEVICE_MANAGER), 

-      help    = STRING_TOKEN(STR_DEVICE_MANAGER_HELP),

-      flags   = INTERACTIVE | NV_ACCESS, 

-      key     = 0x8567;

-

-    goto FRONT_PAGE_ITEM_FIVE, 

-      prompt  = STRING_TOKEN(STR_BOOT_MAINT_MANAGER), 

-      help    = STRING_TOKEN(STR_BOOT_MAINT_MANAGER_HELP),

-      flags   = INTERACTIVE | NV_ACCESS, 

-      key     = 0x9876;

-

-    label FRONT_PAGE_TIMEOUT;

-//  If one wanted to hard-code a value one could do it below, but our implementation follows EFI architecture

-//  and honors the TimeOut NV variable

-//

-//    banner

-//      title = STRING_TOKEN(STR_TIME_OUT_PROMPT),

-//      timeout = 0x000A;

-    

-  endform;

-

-  form formid = FRONT_PAGE_ITEM_ONE,

-       title  = STRING_TOKEN(STR_FRONT_PAGE_TITLE);  

-  endform;

-

-  form formid = FRONT_PAGE_ITEM_THREE,

-       title  = STRING_TOKEN(STR_FRONT_PAGE_TITLE);  

-  endform;

-

-  form formid = FRONT_PAGE_ITEM_FOUR,

-       title  = STRING_TOKEN(STR_FRONT_PAGE_TITLE);  

-  endform;

-

-  form formid = FRONT_PAGE_ITEM_FIVE,

-       title  = STRING_TOKEN(STR_FRONT_PAGE_TITLE);  

-  endform;

-

-endformset;

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/Language.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/Language.c
deleted file mode 100644
index 7057cab..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/Language.c
+++ /dev/null
@@ -1,431 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  language.c

-

-Abstract:

-

- Language settings

-

-Revision History

-

---*/

-

-#include "String.h"

-#include "Language.h"

-

-#define NARROW_GLYPH_NUMBER 8

-#define WIDE_GLYPH_NUMBER   75

-

-//

-// Default language code, currently is English

-//

-CHAR8 *mDefaultLangCode = "eng";

-

-typedef struct {

-  EFI_HII_FONT_PACK FixedLength;

-  EFI_NARROW_GLYPH  NarrowArray[NARROW_GLYPH_NUMBER];

-  EFI_WIDE_GLYPH    WideArray[WIDE_GLYPH_NUMBER];

-} FONT_PACK;

-

-FONT_PACK mFontPack = {

-  sizeof (EFI_HII_FONT_PACK) + (NARROW_GLYPH_NUMBER * sizeof (EFI_NARROW_GLYPH)) + (WIDE_GLYPH_NUMBER * sizeof (EFI_WIDE_GLYPH)),

-  EFI_HII_FONT,

-  NARROW_GLYPH_NUMBER,

-  WIDE_GLYPH_NUMBER,

-  {     // Narrow Glyphs

-    {

-      0x05d0,

-      0x00,

-      {

-        0x00,

-        0x00,

-        0x00,

-        0x4E,

-        0x6E,

-        0x62,

-        0x32,

-        0x32,

-        0x3C,

-        0x68,

-        0x4C,

-        0x4C,

-        0x46,

-        0x76,

-        0x72,

-        0x00,

-        0x00,

-        0x00,

-        0x00

-      }

-    },

-    {

-      0x05d1,

-      0x00,

-      {

-        0x00,

-        0x00,

-        0x00,

-        0x78,

-        0x7C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x7E,

-        0x7E,

-        0x00,

-        0x00,

-        0x00,

-        0x00

-      }

-    },

-    {

-      0x05d2,

-      0x00,

-      {

-        0x00,

-        0x00,

-        0x00,

-        0x78,

-        0x7C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x1C,

-        0x3E,

-        0x66,

-        0x66,

-        0x00,

-        0x00,

-        0x00,

-        0x00

-      }

-    },

-    {

-      0x05d3,

-      0x00,

-      {

-        0x00,

-        0x00,

-        0x00,

-        0x7E,

-        0x7E,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x00,

-        0x00,

-        0x00,

-        0x00

-      }

-    },

-    {

-      0x05d4,

-      0x00,

-      {

-        0x00,

-        0x00,

-        0x00,

-        0x7C,

-        0x7E,

-        0x06,

-        0x06,

-        0x06,

-        0x06,

-        0x66,

-        0x66,

-        0x66,

-        0x66,

-        0x66,

-        0x66,

-        0x00,

-        0x00,

-        0x00,

-        0x00

-      }

-    },

-    {

-      0x05d5,

-      0x00,

-      {

-        0x00,

-        0x00,

-        0x00,

-        0x3C,

-        0x3C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x0C,

-        0x00,

-        0x00,

-        0x00,

-        0x00

-      }

-    },

-    {

-      0x05d6,

-      0x00,

-      {

-        0x00,

-        0x00,

-        0x00,

-        0x38,

-        0x38,

-        0x1E,

-        0x1E,

-        0x18,

-        0x18,

-        0x18,

-        0x18,

-        0x18,

-        0x18,

-        0x18,

-        0x18,

-        0x00,

-        0x00,

-        0x00,

-        0x00

-      }

-    },

-    {

-      0x0000,

-      0x00,

-      {

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00

-      }

-    }

-  },

-  {     // Wide Glyphs

-    {

-      0x0020,

-      0x00,

-      {

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00

-      },

-      {

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00,

-        0x00

-      },

-      {

-        0x00,

-        0x00,

-        0x00

-      }

-    },  //

-  }

-};

-

-VOID

-ExportFonts (

-  VOID

-  )

-/*++

-

-Routine Description:

-  Routine to export glyphs to the HII database.  This is in addition to whatever is defined in the Graphics Console driver.

-

-Arguments:

-  None

-

-Returns:

-

---*/

-{

-  EFI_HII_HANDLE    HiiHandle;

-  EFI_HII_PACKAGES  *PackageList;

-

-  PackageList = PreparePackages (1, NULL, &mFontPack);

-  //

-  // Register our Fonts into the global database

-  //

-  HiiHandle = 0;

-  Hii->NewPack (Hii, PackageList, &HiiHandle);

-

-  FreePool (PackageList);

-}

-

-VOID

-InitializeLanguage (

-  BOOLEAN LangCodesSettingRequired

-  )

-/*++

-

-Routine Description:

-  Determine the current language that will be used

-  based on language related EFI Variables

-

-Arguments:

-  LangCodesSettingRequired - If required to set LangCode variable

-

-Returns:

-

---*/

-{

-  EFI_STATUS  Status;

-  UINTN       Index;

-  UINTN       Size;

-  CHAR8       LangCode[ISO_639_2_ENTRY_SIZE];

-  CHAR8       *LangCodes;

-  CHAR16      *LanguageString;

-

-  LanguageString  = NULL;

-  LangCodes       = NULL;

-

-  ExportFonts ();

-

-  //

-  // Collect the languages from what our current Language support is based on our VFR

-  //

-  Hii->GetPrimaryLanguages (Hii, gStringPackHandle, &LanguageString);

-

-  LangCodes = AllocatePool (StrLen (LanguageString));

-  ASSERT (LangCodes);

-

-  //

-  // Convert LanguageString from Unicode to EFI defined ASCII LangCodes

-  //

-  for (Index = 0; LanguageString[Index] != 0x0000; Index++) {

-    LangCodes[Index] = (CHAR8) LanguageString[Index];

-  }

-

-  LangCodes[Index] = 0;

-

-  if (LangCodesSettingRequired) {

-    Status = gRT->SetVariable (

-                    L"LangCodes",

-                    &gEfiGlobalVariableGuid,

-                    EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,

-                    AsciiStrLen (LangCodes),

-                    LangCodes

-                    );

-  }

-  //

-  // Find current LangCode from Lang NV Variable

-  //

-  Size = ISO_639_2_ENTRY_SIZE;

-  Status = gRT->GetVariable (

-                  L"Lang",

-                  &gEfiGlobalVariableGuid,

-                  NULL,

-                  &Size,

-                  &LangCode

-                  );

-

-  if (!EFI_ERROR (Status)) {

-    Status = EFI_NOT_FOUND;

-    for (Index = 0; LangCodes[Index] != 0; Index += ISO_639_2_ENTRY_SIZE) {

-      if (CompareMem (&LangCodes[Index], LangCode, ISO_639_2_ENTRY_SIZE) == 0) {

-        Status = EFI_SUCCESS;

-        break;

-      }

-    }

-  }

-  //

-  // If we cannot get language code from Lang variable,

-  // or LangCode cannot be found from language table,

-  // set the mDefaultLangCode to Lang variable.

-  //

-  if (EFI_ERROR (Status)) {

-    Status = gRT->SetVariable (

-                    L"Lang",

-                    &gEfiGlobalVariableGuid,

-                    EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,

-                    ISO_639_2_ENTRY_SIZE,

-                    mDefaultLangCode

-                    );

-  }

-

-  if (LangCodes) {

-    FreePool (LangCodes);

-  }

-

-  if (LanguageString != NULL) {

-    FreePool (LanguageString);

-  }

-

-}

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/Language.h b/EdkNt32Pkg/Dxe/PlatformBds/Generic/Language.h
deleted file mode 100644
index a7c32ec..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/Language.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  Language.h

-

-Abstract:

-  

-  Language setting

-

-Revision History

-

---*/

-

-#ifndef _LANGUAGE_H

-#define _LANGUAGE_H

-

-#define ISO_639_2_ENTRY_SIZE  3

-

-VOID

-InitializeLanguage (

-  BOOLEAN LangCodesSettingRequired

-  );

-

-#endif // _LANGUAGE_H_

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/MemoryTest.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/MemoryTest.c
deleted file mode 100644
index 40467c0..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/MemoryTest.c
+++ /dev/null
@@ -1,431 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  MemoryTest.c

-

-Abstract:

-

-  Perform the platform memory test

-

---*/

-

-#include "bds.h"

-#include "BdsPlatform.h"

-#include "String.h"

-

-//

-// BDS Platform Functions

-//

-EFI_STATUS

-PlatformBdsShowProgress (

-  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground,

-  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground,

-  IN CHAR16        *Title,

-  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor,

-  IN UINTN         Progress,

-  IN UINTN         PreviousValue

-  )

-/*++

-

-Routine Description:

-

-  Show progress bar with title above it. It only works in UGA mode.

-

-Arguments:

-

-  TitleForeground - Foreground color for Title.

-  TitleBackground - Background color for Title.

-  Title           - Title above progress bar.

-  ProgressColor   - Progress bar color.

-  Progress        - Progress (0-100)

-

-Returns:

-

-  EFI_STATUS      - Success update the progress bar

-

---*/

-{

-  EFI_STATUS            Status;

-  EFI_GRAPHICS_OUTPUT_PROTOCOL   *GraphicsOutput;

-  EFI_UGA_DRAW_PROTOCOL *UgaDraw;

-  UINT32                SizeOfX;

-  UINT32                SizeOfY;

-  UINT32                ColorDepth;

-  UINT32                RefreshRate;

-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL  Color;

-  UINTN                 BlockHeight;

-  UINTN                 BlockWidth;

-  UINTN                 BlockNum;

-  UINTN                 PosX;

-  UINTN                 PosY;

-  UINTN                 Index;

-

-  if (Progress > 100) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  UgaDraw = NULL;

-  Status = gBS->HandleProtocol (

-                  gST->ConsoleOutHandle,

-                  &gEfiGraphicsOutputProtocolGuid,

-                  &GraphicsOutput

-                  );

-  if (EFI_ERROR (Status)) {

-    GraphicsOutput = NULL;

-

-    Status = gBS->HandleProtocol (

-                    gST->ConsoleOutHandle,

-                    &gEfiUgaDrawProtocolGuid,

-                    &UgaDraw

-                    );

-    if (EFI_ERROR (Status)) {

-      return EFI_UNSUPPORTED;

-    }

-  }

-

-  if (GraphicsOutput != NULL) {

-    SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;

-    SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;

-  } else {

-    Status = UgaDraw->GetMode (

-                        UgaDraw,

-                        &SizeOfX,

-                        &SizeOfY,

-                        &ColorDepth,

-                        &RefreshRate

-                        );

-    if (EFI_ERROR (Status)) {

-      return EFI_UNSUPPORTED;

-    }

-  }

-

-  BlockWidth  = SizeOfX / 100;

-  BlockHeight = SizeOfY / 50;

-

-  BlockNum    = Progress;

-

-  PosX        = 0;

-  PosY        = SizeOfY * 48 / 50;

-

-  if (BlockNum == 0) {

-    //

-    // Clear progress area

-    //

-    SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);

-

-    if (GraphicsOutput != NULL) {

-      Status = GraphicsOutput->Blt (

-                          GraphicsOutput,

-                          &Color,

-                          EfiBltVideoFill,

-                          0,

-                          0,

-                          0,

-                          PosY - GLYPH_HEIGHT - 1,

-                          SizeOfX,

-                          SizeOfY - (PosY - GLYPH_HEIGHT - 1),

-                          SizeOfX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)

-                          );

-    } else {

-      Status = UgaDraw->Blt (

-                          UgaDraw,

-                          (EFI_UGA_PIXEL *) &Color,

-                          EfiUgaVideoFill,

-                          0,

-                          0,

-                          0,

-                          PosY - GLYPH_HEIGHT - 1,

-                          SizeOfX,

-                          SizeOfY - (PosY - GLYPH_HEIGHT - 1),

-                          SizeOfX * sizeof (EFI_UGA_PIXEL)

-                          );

-    }

-  }

-  //

-  // Show progress by drawing blocks

-  //

-  for (Index = PreviousValue; Index < BlockNum; Index++) {

-    PosX = Index * BlockWidth;

-    if (GraphicsOutput != NULL) {

-      Status = GraphicsOutput->Blt (

-                          GraphicsOutput,

-                          &ProgressColor,

-                          EfiBltVideoFill,

-                          0,

-                          0,

-                          PosX,

-                          PosY,

-                          BlockWidth - 1,

-                          BlockHeight,

-                          (BlockWidth) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)

-                          );

-    } else {

-      Status = UgaDraw->Blt (

-                          UgaDraw,

-                          (EFI_UGA_PIXEL *) &ProgressColor,

-                          EfiUgaVideoFill,

-                          0,

-                          0,

-                          PosX,

-                          PosY,

-                          BlockWidth - 1,

-                          BlockHeight,

-                          (BlockWidth) * sizeof (EFI_UGA_PIXEL)

-                          );

-    }

-  }

-

-  PrintXY (

-    (SizeOfX - StrLen (Title) * GLYPH_WIDTH) / 2,

-    PosY - GLYPH_HEIGHT - 1,

-    &TitleForeground,

-    &TitleBackground,

-    Title

-    );

-

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-BdsMemoryTest (

-  IN EXTENDMEM_COVERAGE_LEVEL Level

-  )

-/*++

-

-Routine Description:

-

-  Perform the memory test base on the memory test intensive level,

-  and update the memory resource.

-

-Arguments:

-

-  Level  - The memory test intensive level.

-

-Returns:

-

-  EFI_STATUS      - Success test all the system memory and update

-                    the memory resource

-

---*/

-{

-  EFI_STATUS                        Status;

-  EFI_STATUS                        InitStatus;

-  EFI_STATUS                        KeyStatus;

-  EFI_STATUS                        ReturnStatus;

-  BOOLEAN                           RequireSoftECCInit;

-  EFI_GENERIC_MEMORY_TEST_PROTOCOL  *GenMemoryTest;

-  UINT64                            TestedMemorySize;

-  UINT64                            TotalMemorySize;

-  UINTN                             TestPercent;

-  UINT64                            PreviousValue;

-  BOOLEAN                           ErrorOut;

-  BOOLEAN                           TestAbort;

-  EFI_INPUT_KEY                     Key;

-  CHAR16                            StrPercent[16];

-  CHAR16                            *StrTotalMemory;

-  CHAR16                            *Pos;

-  CHAR16                            *TmpStr;

-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL     Foreground;

-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL     Background;

-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL     Color;

-  UINT8                             Value;

-  UINTN                             DataSize;

-

-  ReturnStatus = EFI_SUCCESS;

-  ZeroMem (&Key, sizeof (EFI_INPUT_KEY));

-

-  Pos = AllocatePool (128);

-

-  if (Pos == NULL) {

-    return ReturnStatus;

-  }

-

-  StrTotalMemory    = Pos;

-

-  TestedMemorySize  = 0;

-  TotalMemorySize   = 0;

-  PreviousValue     = 0;

-  ErrorOut          = FALSE;

-  TestAbort         = FALSE;

-

-  SetMem (&Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);

-  SetMem (&Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);

-  SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);

-

-  RequireSoftECCInit = FALSE;

-

-  gST->ConOut->ClearScreen (gST->ConOut);

-  gST->ConOut->SetAttribute (gST->ConOut, EFI_YELLOW | EFI_BRIGHT);

-  gST->ConOut->EnableCursor (gST->ConOut, FALSE);

-

-  Status = gBS->LocateProtocol (

-                  &gEfiGenericMemTestProtocolGuid,

-                  NULL,

-                  &GenMemoryTest

-                  );

-  if (EFI_ERROR (Status)) {

-    FreePool (Pos);

-    return EFI_SUCCESS;

-  }

-

-  InitStatus = GenMemoryTest->MemoryTestInit (

-                                GenMemoryTest,

-                                Level,

-                                &RequireSoftECCInit

-                                );

-  if (InitStatus == EFI_NO_MEDIA) {

-    //

-    // The PEI codes also have the relevant memory test code to check the memory,

-    // it can select to test some range of the memory or all of them. If PEI code

-    // checks all the memory, this BDS memory test will has no not-test memory to

-    // do the test, and then the status of EFI_NO_MEDIA will be returned by

-    // "MemoryTestInit". So it does not need to test memory again, just return.

-    //

-    FreePool (Pos);

-    return EFI_SUCCESS;

-  }

-

-  gST->ConOut->SetCursorPosition (gST->ConOut, 0, 2);

-  TmpStr = GetStringById (STRING_TOKEN (STR_ESC_TO_SKIP_MEM_TEST));

-

-  if (TmpStr != NULL) {

-    gST->ConOut->OutputString (gST->ConOut, TmpStr);

-    FreePool (TmpStr);

-  }

-

-  do {

-    Status = GenMemoryTest->PerformMemoryTest (

-                              GenMemoryTest,

-                              &TestedMemorySize,

-                              &TotalMemorySize,

-                              &ErrorOut,

-                              TestAbort

-                              );

-    if (ErrorOut && (Status == EFI_DEVICE_ERROR)) {

-      TmpStr = GetStringById (STRING_TOKEN (STR_SYSTEM_MEM_ERROR));

-      if (TmpStr != NULL) {

-        PrintXY (10, 10, NULL, NULL, TmpStr);

-        gST->ConOut->SetCursorPosition (gST->ConOut, 0, 4);

-        gST->ConOut->OutputString (gST->ConOut, TmpStr);

-        FreePool (TmpStr);

-      }

-

-      ASSERT (0);

-    }

-

-    TestPercent = (UINTN) DivU64x32 (

-                            DivU64x32 (MultU64x32 (TestedMemorySize, 100), 16),

-                            (UINTN)DivU64x32 (TotalMemorySize, 16)

-                            );

-    if (TestPercent != PreviousValue) {

-      UnicodeValueToString (StrPercent, 0, TestPercent, 0);

-      gST->ConOut->SetCursorPosition (gST->ConOut, 0, 0);

-      TmpStr = GetStringById (STRING_TOKEN (STR_MEMORY_TEST_PERCENT));

-      if (TmpStr != NULL) {

-        BdsLibOutputStrings (gST->ConOut, StrPercent, TmpStr, NULL);

-        FreePool (TmpStr);

-      }

-

-      TmpStr = GetStringById (STRING_TOKEN (STR_PERFORM_MEM_TEST));

-      if (TmpStr != NULL) {

-        PlatformBdsShowProgress (

-          Foreground,

-          Background,

-          TmpStr,

-          Color,

-          TestPercent,

-          (UINTN) PreviousValue

-          );

-        FreePool (TmpStr);

-      }

-    }

-

-    PreviousValue = TestPercent;

-

-    KeyStatus     = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);

-    if (Key.ScanCode == SCAN_ESC) {

-      if (!RequireSoftECCInit) {

-        TmpStr = GetStringById (STRING_TOKEN (STR_PERFORM_MEM_TEST));

-        if (TmpStr != NULL) {

-          PlatformBdsShowProgress (

-            Foreground,

-            Background,

-            TmpStr,

-            Color,

-            100,

-            (UINTN) PreviousValue

-            );

-          FreePool (TmpStr);

-        }

-

-        gST->ConOut->SetCursorPosition (gST->ConOut, 0, 0);

-        gST->ConOut->OutputString (gST->ConOut, L"100");

-        Status = GenMemoryTest->Finished (GenMemoryTest);

-        goto Done;

-      }

-

-      TestAbort = TRUE;

-    }

-  } while (Status != EFI_NOT_FOUND);

-

-  Status = GenMemoryTest->Finished (GenMemoryTest);

-

-Done:

-  UnicodeValueToString (StrTotalMemory, COMMA_TYPE, (UINTN) TotalMemorySize, 0);

-  if (StrTotalMemory[0] == L',') {

-    StrTotalMemory++;

-  }

-

-  TmpStr = GetStringById (STRING_TOKEN (STR_MEM_TEST_COMPLETED));

-  if (TmpStr != NULL) {

-    StrCat (StrTotalMemory, TmpStr);

-    FreePool (TmpStr);

-  }

-

-  gST->ConOut->ClearScreen (gST->ConOut);

-  gST->ConOut->SetAttribute (gST->ConOut, EFI_YELLOW | EFI_BRIGHT);

-  gST->ConOut->EnableCursor (gST->ConOut, FALSE);

-  gST->ConOut->OutputString (gST->ConOut, StrTotalMemory);

-  PlatformBdsShowProgress (

-    Foreground,

-    Background,

-    StrTotalMemory,

-    Color,

-    100,

-    (UINTN) PreviousValue

-    );

-

-  FreePool (Pos);

-

-  DataSize = sizeof (Value);

-  Status = gRT->GetVariable (

-                  L"BootState",

-                  &gEfiBootStateGuid,

-                  NULL,

-                  &DataSize,

-                  &Value

-                  );

-

-  if (EFI_ERROR (Status)) {

-    Value = 1;

-    gRT->SetVariable (

-          L"BootState",

-          &gEfiBootStateGuid,

-          EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,

-          sizeof (Value),

-          &Value

-          );

-  }

-

-  return ReturnStatus;

-}

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/String.c b/EdkNt32Pkg/Dxe/PlatformBds/Generic/String.c
deleted file mode 100644
index 604528d..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/String.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  string.c

-

-Abstract:

-

-  String support

-

-Revision History

-

---*/

-

-#include "Bds.h"

-#include "String.h"

-#include "Language.h"

-

-extern UINT8  BdsStrings[];

-

-EFI_GUID      gBdsStringPackGuid = { 0x7bac95d3, 0xddf, 0x42f3, 0x9e, 0x24, 0x7c, 0x64, 0x49, 0x40, 0x37, 0x9a };

-

-EFI_STATUS

-InitializeStringSupport (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  Initialize HII global accessor for string support

-

-Arguments:

-  None

-

-Returns:

-  String from ID.

-

---*/

-{

-  EFI_STATUS        Status;

-  EFI_HII_PACKAGES  *PackageList;

-  //

-  // There should only ever be one HII protocol

-  //

-  Status = gBS->LocateProtocol (

-                  &gEfiHiiProtocolGuid,

-                  NULL,

-                  &Hii

-                  );

-  if (!EFI_ERROR (Status)) {

-    PackageList = PreparePackages (1, &gBdsStringPackGuid, BdsStrings);

-    Status      = Hii->NewPack (Hii, PackageList, &gStringPackHandle);

-    FreePool (PackageList);

-  }

-

-  return Status;

-}

-

-CHAR16 *

-GetStringById (

-  IN  STRING_REF   Id

-  )

-/*++

-

-Routine Description:

-

-  Get string by string id from HII Interface

-

-Arguments:

-

-  Id       - String ID.

-

-Returns:

-

-  CHAR16 * - String from ID.

-  NULL     - If error occurs.

-

---*/

-{

-  CHAR16      *String;

-  UINTN       StringLength;

-  EFI_STATUS  Status;

-

-  //

-  // Set default string size assumption at no more than 256 bytes

-  //

-  StringLength  = 0x100;

-

-  String        = AllocateZeroPool (StringLength);

-  if (String == NULL) {

-    //

-    // If this happens, we are oh-so-dead, but return a NULL in any case.

-    //

-    return NULL;

-  }

-  //

-  // Get the current string for the current Language

-  //

-  Status = Hii->GetString (Hii, gStringPackHandle, Id, FALSE, NULL, &StringLength, String);

-  if (EFI_ERROR (Status)) {

-    if (Status == EFI_BUFFER_TOO_SMALL) {

-      //

-      // Free the old pool

-      //

-      FreePool (String);

-

-      //

-      // Allocate new pool with correct value

-      //

-      String = AllocatePool (StringLength);

-      ASSERT (String != NULL);

-

-      Status = Hii->GetString (Hii, gStringPackHandle, Id, FALSE, NULL, &StringLength, String);

-      if (!EFI_ERROR (Status)) {

-        return String;

-      }

-    }

-

-    return NULL;

-  }

-

-  return String;

-}

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/String.h b/EdkNt32Pkg/Dxe/PlatformBds/Generic/String.h
deleted file mode 100644
index 0800feb..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/String.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  string.h

-

-Abstract:

-  

-  String support

-

-Revision History

-

---*/

-

-#ifndef _STRING_H_

-#define _STRING_H_

-

-//

-// This is the VFR compiler generated header file which defines the

-// string identifiers.

-//

-#include "BdsStrDefs.h"

-

-//

-// String Definition Guid for BDS Platform

-//

-#define EFI_BDS_PLATFORM_GUID \

-  { \

-    0x7777E939, 0xD57E, 0x4DCB, {0xA0, 0x8E, 0x64, 0xD7, 0x98, 0x57, 0x1E, 0x0F } \

-  }

-

-EFI_HII_HANDLE    gStringPackHandle;

-EFI_HII_PROTOCOL  *Hii;

-

-CHAR16            *

-GetStringById (

-  IN  STRING_REF   Id

-  );

-

-EFI_STATUS

-InitializeStringSupport (

-  VOID

-  );

-

-EFI_STATUS

-CallFrontPage (

-  VOID

-  );

-

-#endif // _STRING_H_

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/Generic/Strings.uni b/EdkNt32Pkg/Dxe/PlatformBds/Generic/Strings.uni
deleted file mode 100644
index 41a6b9a..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/Generic/Strings.uni
+++ /dev/null
Binary files differ
diff --git a/EdkNt32Pkg/Dxe/PlatformBds/PlatformBds.msa b/EdkNt32Pkg/Dxe/PlatformBds/PlatformBds.msa
deleted file mode 100644
index 052b1d8..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/PlatformBds.msa
+++ /dev/null
@@ -1,231 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">

-  <MsaHeader>

-    <ModuleName>Bds</ModuleName>

-    <ModuleType>DXE_DRIVER</ModuleType>

-    <GuidValue>A6F691AC-31C8-4444-854C-E2C1A6950F92</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>Platfrom BDS driver</Abstract>

-    <Description>

-      Do platform action customized by IBV/OEM.

-    </Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>Bds</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiDriverEntryPoint</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>EdkGraphicsLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DxeServicesTableLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>PerformanceLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>PrintLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>EdkIfrSupportLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>ReportStatusCodeLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>HobLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>EdkGenericBdsLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>MemoryAllocationLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseMemoryLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiBootServicesTableLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiRuntimeServicesTableLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DevicePathLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>HiiLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>PeCoffLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>PlatformData.c</Filename>

-    <Filename>BdsPlatform.h</Filename>

-    <Filename>BdsPlatform.c</Filename>

-    <Filename>Generic/Bds.h</Filename>

-    <Filename>Generic/BdsEntry.c</Filename>

-    <Filename>Generic/FrontPage.h</Filename>

-    <Filename>Generic/FrontPage.c</Filename>

-    <Filename>Generic/FrontPageStrings.uni</Filename>

-    <Filename>Generic/FrontPageVfr.Vfr</Filename>

-    <Filename>Generic/Language.h</Filename>

-    <Filename>Generic/Language.c</Filename>

-    <Filename>Generic/String.h</Filename>

-    <Filename>Generic/String.c</Filename>

-    <Filename>Generic/Strings.uni</Filename>

-    <Filename>Generic/Capsules.c</Filename>

-    <Filename>Generic/MemoryTest.c</Filename>

-    <Filename>Generic/BootMaint/bmstring.uni</Filename>

-    <Filename>Generic/BootMaint/bm.vfr</Filename>

-    <Filename>Generic/BootMaint/BBSsupport.h</Filename>

-    <Filename>Generic/BootMaint/BootMaint.h</Filename>

-    <Filename>Generic/BootMaint/FormGuid.h</Filename>

-    <Filename>Generic/BootMaint/BmLib.c</Filename>

-    <Filename>Generic/BootMaint/BootOption.c</Filename>

-    <Filename>Generic/BootMaint/ConsoleOption.c</Filename>

-    <Filename>Generic/BootMaint/Data.c</Filename>

-    <Filename>Generic/BootMaint/Variable.c</Filename>

-    <Filename>Generic/BootMaint/UpdatePage.c</Filename>

-    <Filename>Generic/BootMaint/BBSsupport.c</Filename>

-    <Filename>Generic/BootMaint/BootMaint.c</Filename>

-    <Filename>Generic/BootMaint/FileExplorer.c</Filename>

-    <Filename>Generic/BootMaint/FE.vfr</Filename>

-    <Filename>Generic/BootMngr/BootManager.h</Filename>

-    <Filename>Generic/BootMngr/BootManager.c</Filename>

-    <Filename>Generic/BootMngr/BootManagerStrings.uni</Filename>

-    <Filename>Generic/BootMngr/BootManagerVfr.Vfr</Filename>

-    <Filename>Generic/DeviceMngr/DeviceManager.h</Filename>

-    <Filename>Generic/DeviceMngr/DeviceManager.c</Filename>

-    <Filename>Generic/DeviceMngr/DeviceManagerStrings.uni</Filename>

-    <Filename>Generic/DeviceMngr/DeviceManagerVfr.Vfr</Filename>

-    <Filename>Generic/Bds.dxs</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <Protocols>

-    <Protocol Usage="ALWAYS_PRODUCED">

-      <ProtocolCName>gEfiBdsArchProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="ALWAYS_CONSUMED">

-      <ProtocolCName>gEfiLegacyBiosProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="ALWAYS_CONSUMED">

-      <ProtocolCName>gEfiHiiProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="ALWAYS_CONSUMED">

-      <ProtocolCName>gEfiFormCallbackProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="ALWAYS_CONSUMED">

-      <ProtocolCName>gEfiDataHubProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="ALWAYS_CONSUMED">

-      <ProtocolCName>gEfiFormBrowserProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="ALWAYS_CONSUMED">

-      <ProtocolCName>gEfiConsoleControlProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="ALWAYS_CONSUMED">

-      <ProtocolCName>gEfiCpuIoProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="SOMETIMES_CONSUMED">

-      <ProtocolCName>gEfiUgaDrawProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="SOMETIMES_CONSUMED">

-      <ProtocolCName>gEfiLoadFileProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="SOMETIMES_CONSUMED">

-      <ProtocolCName>gEfiSimpleFileSystemProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="ALWAYS_CONSUMED">

-      <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="SOMETIMES_CONSUMED">

-      <ProtocolCName>gEfiBlockIoProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="ALWAYS_CONSUMED">

-      <ProtocolCName>gEfiSerialIoProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="SOMETIMES_CONSUMED">

-      <ProtocolCName>gEfiGenericMemTestProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="SOMETIMES_CONSUMED">

-      <ProtocolCName>gEfiGraphicsOutputProtocolGuid</ProtocolCName>

-    </Protocol>

-  </Protocols>

-  <Hobs>

-    <HobTypes HobGuidCName="gEfiFlashMapHobGuid" Usage="ALWAYS_CONSUMED">

-      <HobType>GUID_EXTENSION</HobType>

-    </HobTypes>

-  </Hobs>

-  <DataHubs>

-    <DataHubRecord Usage="SOMETIMES_CONSUMED">

-      <DataHubCName>BiosVendor</DataHubCName>

-    </DataHubRecord>

-    <DataHubRecord Usage="SOMETIMES_CONSUMED">

-      <DataHubCName>SystemManufacturer</DataHubCName>

-    </DataHubRecord>

-    <DataHubRecord Usage="SOMETIMES_CONSUMED">

-      <DataHubCName>ProcessorVersion</DataHubCName>

-    </DataHubRecord>

-    <DataHubRecord Usage="SOMETIMES_CONSUMED">

-      <DataHubCName>ProcessorFrequency</DataHubCName>

-    </DataHubRecord>

-    <DataHubRecord Usage="SOMETIMES_CONSUMED">

-      <DataHubCName>MemoryArray</DataHubCName>

-    </DataHubRecord>

-  </DataHubs>

-  <Guids>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiBootStateGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiGlobalVariableGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiGenericPlatformVariableGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiFileSystemVolumeLabelInfoIdGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiFileInfoGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="SOMETIMES_CONSUMED">

-      <GuidCName>gEfiDefaultBmpLogoGuid</GuidCName>

-    </GuidCNames>

-  </Guids>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-    <Extern>

-      <ModuleEntryPoint>BdsInitialize</ModuleEntryPoint>

-    </Extern>

-  </Externs>

-</ModuleSurfaceArea>

diff --git a/EdkNt32Pkg/Dxe/PlatformBds/PlatformData.c b/EdkNt32Pkg/Dxe/PlatformBds/PlatformData.c
deleted file mode 100644
index 8202c02..0000000
--- a/EdkNt32Pkg/Dxe/PlatformBds/PlatformData.c
+++ /dev/null
@@ -1,228 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  PlatformData.c

-

-Abstract:

-

-  Defined the platform specific device path which will be used by

-  platform Bbd to perform the platform policy connect.

-

---*/

-

-#include "Generic/Bds.h"

-#include "BdsPlatform.h"

-

-//

-// Predefined platform default time out value

-//

-UINT16                      gPlatformBootTimeOutDefault = 10;

-

-//

-// Platform specific keyboard device path

-//

-NT_PLATFORM_UGA_DEVICE_PATH gUgaDevicePath0 = {

-  {

-    HARDWARE_DEVICE_PATH,

-    HW_VENDOR_DP,

-    (UINT8) (sizeof (VENDOR_DEVICE_PATH)),

-    (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),

-    EFI_WIN_NT_THUNK_PROTOCOL_GUID

-  },

-  {

-    HARDWARE_DEVICE_PATH,

-    HW_VENDOR_DP,

-    (UINT8) (sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)),

-    (UINT8) ((sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)) >> 8),

-    EFI_WIN_NT_UGA_GUID,

-    0

-  },

-  gEndEntire

-};

-

-NT_PLATFORM_UGA_DEVICE_PATH gUgaDevicePath1 = {

-  {

-    HARDWARE_DEVICE_PATH,

-    HW_VENDOR_DP,

-    (UINT8) (sizeof (VENDOR_DEVICE_PATH)),

-    (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),

-    EFI_WIN_NT_THUNK_PROTOCOL_GUID

-  },

-  {

-    HARDWARE_DEVICE_PATH,

-    HW_VENDOR_DP,

-    (UINT8) (sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)),

-    (UINT8) ((sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)) >> 8),

-    EFI_WIN_NT_UGA_GUID,

-    1

-  },

-  gEndEntire

-};

-

-NT_PLATFORM_GOP_DEVICE_PATH gGopDevicePath0 = {

-  {

-    HARDWARE_DEVICE_PATH,

-    HW_VENDOR_DP,

-    (UINT8) (sizeof (VENDOR_DEVICE_PATH)),

-    (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),

-    EFI_WIN_NT_THUNK_PROTOCOL_GUID

-  },

-  {

-    HARDWARE_DEVICE_PATH,

-    HW_VENDOR_DP,

-    (UINT8) (sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)),

-    (UINT8) ((sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)) >> 8),

-    EFI_WIN_NT_GOP_GUID,

-    0

-  },

-  gEndEntire

-};

-

-NT_PLATFORM_GOP_DEVICE_PATH gGopDevicePath1 = {

-  {

-    HARDWARE_DEVICE_PATH,

-    HW_VENDOR_DP,

-    (UINT8) (sizeof (VENDOR_DEVICE_PATH)),

-    (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),

-    EFI_WIN_NT_THUNK_PROTOCOL_GUID

-  },

-  {

-    HARDWARE_DEVICE_PATH,

-    HW_VENDOR_DP,

-    (UINT8) (sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)),

-    (UINT8) ((sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)) >> 8),

-    EFI_WIN_NT_GOP_GUID,

-    1

-  },

-  gEndEntire

-};

-

-//

-// Platform specific serial device path

-//

-NT_ISA_SERIAL_DEVICE_PATH   gNtSerialDevicePath0 = {

-  {

-    HARDWARE_DEVICE_PATH,

-    HW_VENDOR_DP,

-    (UINT8) (sizeof (VENDOR_DEVICE_PATH)),

-    (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),

-    EFI_WIN_NT_THUNK_PROTOCOL_GUID

-  },

-  {

-    HARDWARE_DEVICE_PATH,

-    HW_VENDOR_DP,

-    (UINT8) (sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)),

-    (UINT8) ((sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)) >> 8),

-    EFI_WIN_NT_SERIAL_PORT_GUID

-  },

-  {

-    MESSAGING_DEVICE_PATH,

-    MSG_UART_DP,

-    (UINT8) (sizeof (UART_DEVICE_PATH)),

-    (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8),

-    0,

-    115200,

-    8,

-    1,

-    1

-  },

-  {

-    MESSAGING_DEVICE_PATH,

-    MSG_VENDOR_DP,

-    (UINT8) (sizeof (VENDOR_DEVICE_PATH)),

-    (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),

-    DEVICE_PATH_MESSAGING_PC_ANSI

-  },

-  gEndEntire

-};

-

-NT_ISA_SERIAL_DEVICE_PATH   gNtSerialDevicePath1 = {

-  {

-    HARDWARE_DEVICE_PATH,

-    HW_VENDOR_DP,

-    (UINT8) (sizeof (VENDOR_DEVICE_PATH)),

-    (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),

-    EFI_WIN_NT_THUNK_PROTOCOL_GUID

-  },

-  {

-    HARDWARE_DEVICE_PATH,

-    HW_VENDOR_DP,

-    (UINT8) (sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)),

-    (UINT8) ((sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)) >> 8),

-    EFI_WIN_NT_SERIAL_PORT_GUID,

-    1

-  },

-  {

-    MESSAGING_DEVICE_PATH,

-    MSG_UART_DP,

-    (UINT8) (sizeof (UART_DEVICE_PATH)),

-    (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8),

-    0,

-    115200,

-    8,

-    1,

-    1

-  },

-  {

-    MESSAGING_DEVICE_PATH,

-    MSG_VENDOR_DP,

-    (UINT8) (sizeof (VENDOR_DEVICE_PATH)),

-    (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),

-    DEVICE_PATH_MESSAGING_PC_ANSI

-  },

-  gEndEntire

-};

-

-//

-// Predefined platform default console device path

-//

-BDS_CONSOLE_CONNECT_ENTRY   gPlatformConsole[] = {

-  {

-    (EFI_DEVICE_PATH_PROTOCOL *) &gNtSerialDevicePath0,

-    (CONSOLE_OUT | CONSOLE_IN)

-  },

-  {

-    (EFI_DEVICE_PATH_PROTOCOL *) &gNtSerialDevicePath1,

-    (CONSOLE_OUT | CONSOLE_IN)

-  },

-  {

-    (EFI_DEVICE_PATH_PROTOCOL *) &gUgaDevicePath0,

-    (CONSOLE_OUT | CONSOLE_IN)

-  },

-  {

-    (EFI_DEVICE_PATH_PROTOCOL *) &gUgaDevicePath1,

-    (CONSOLE_OUT | CONSOLE_IN)

-  },

-  {

-    (EFI_DEVICE_PATH_PROTOCOL *) &gGopDevicePath0,

-    (CONSOLE_OUT | CONSOLE_IN)

-  },

-  {

-    (EFI_DEVICE_PATH_PROTOCOL *) &gGopDevicePath1,

-    (CONSOLE_OUT | CONSOLE_IN)

-  },

-  {

-    NULL,

-    0

-  }

-};

-

-//

-// Predefined platform specific driver option

-//

-EFI_DEVICE_PATH_PROTOCOL    *gPlatformDriverOption[] = { NULL };

-

-//

-// Predefined platform connect sequence

-//

-EFI_DEVICE_PATH_PROTOCOL    *gPlatformConnectSequence[] = { NULL };

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/ComponentName.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/ComponentName.c
deleted file mode 100644
index fb9cc42..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/ComponentName.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  ComponentName.c

-

-Abstract:

-

---*/

-

-#include "WinNtBlockIo.h"

-

-//

-// EFI Component Name Functions

-//

-EFI_STATUS

-EFIAPI

-WinNtBlockIoComponentNameGetDriverName (

-  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,

-  IN  CHAR8                        *Language,

-  OUT CHAR16                       **DriverName

-  );

-

-EFI_STATUS

-EFIAPI

-WinNtBlockIoComponentNameGetControllerName (

-  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,

-  IN  EFI_HANDLE                                      ControllerHandle,

-  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,

-  IN  CHAR8                                           *Language,

-  OUT CHAR16                                          **ControllerName

-  );

-

-//

-// EFI Component Name Protocol

-//

-EFI_COMPONENT_NAME_PROTOCOL     gWinNtBlockIoComponentName = {

-  WinNtBlockIoComponentNameGetDriverName,

-  WinNtBlockIoComponentNameGetControllerName,

-  "eng"

-};

-

-static EFI_UNICODE_STRING_TABLE mWinNtBlockIoDriverNameTable[] = {

-  { "eng", L"Windows Block I/O Driver" },

-  { NULL , NULL }

-};

-

-EFI_STATUS

-EFIAPI

-WinNtBlockIoComponentNameGetDriverName (

-  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,

-  IN  CHAR8                        *Language,

-  OUT CHAR16                       **DriverName

-  )

-/*++

-

-  Routine Description:

-    Retrieves a Unicode string that is the user readable name of the EFI Driver.

-

-  Arguments:

-    This       - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.

-    Language   - A pointer to a three character ISO 639-2 language identifier.

-                 This is the language of the driver name that that the caller 

-                 is requesting, and it must match one of the languages specified

-                 in SupportedLanguages.  The number of languages supported by a 

-                 driver is up to the driver writer.

-    DriverName - A pointer to the Unicode string to return.  This Unicode string

-                 is the name of the driver specified by This in the language 

-                 specified by Language.

-

-  Returns:

-    EFI_SUCCESS           - The Unicode string for the Driver specified by This

-                            and the language specified by Language was returned 

-                            in DriverName.

-    EFI_INVALID_PARAMETER - Language is NULL.

-    EFI_INVALID_PARAMETER - DriverName is NULL.

-    EFI_UNSUPPORTED       - The driver specified by This does not support the 

-                            language specified by Language.

-

---*/

-{

-  return LookupUnicodeString (

-          Language,

-          gWinNtBlockIoComponentName.SupportedLanguages,

-          mWinNtBlockIoDriverNameTable,

-          DriverName

-          );

-}

-

-EFI_STATUS

-EFIAPI

-WinNtBlockIoComponentNameGetControllerName (

-  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,

-  IN  EFI_HANDLE                                      ControllerHandle,

-  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,

-  IN  CHAR8                                           *Language,

-  OUT CHAR16                                          **ControllerName

-  )

-/*++

-

-  Routine Description:

-    Retrieves a Unicode string that is the user readable name of the controller

-    that is being managed by an EFI Driver.

-

-  Arguments:

-    This             - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.

-    ControllerHandle - The handle of a controller that the driver specified by 

-                       This is managing.  This handle specifies the controller 

-                       whose name is to be returned.

-    ChildHandle      - The handle of the child controller to retrieve the name 

-                       of.  This is an optional parameter that may be NULL.  It 

-                       will be NULL for device drivers.  It will also be NULL 

-                       for a bus drivers that wish to retrieve the name of the 

-                       bus controller.  It will not be NULL for a bus driver 

-                       that wishes to retrieve the name of a child controller.

-    Language         - A pointer to a three character ISO 639-2 language 

-                       identifier.  This is the language of the controller name 

-                       that that the caller is requesting, and it must match one

-                       of the languages specified in SupportedLanguages.  The 

-                       number of languages supported by a driver is up to the 

-                       driver writer.

-    ControllerName   - A pointer to the Unicode string to return.  This Unicode

-                       string is the name of the controller specified by 

-                       ControllerHandle and ChildHandle in the language specified

-                       by Language from the point of view of the driver specified

-                       by This. 

-

-  Returns:

-    EFI_SUCCESS           - The Unicode string for the user readable name in the 

-                            language specified by Language for the driver 

-                            specified by This was returned in DriverName.

-    EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.

-    EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.

-    EFI_INVALID_PARAMETER - Language is NULL.

-    EFI_INVALID_PARAMETER - ControllerName is NULL.

-    EFI_UNSUPPORTED       - The driver specified by This is not currently managing 

-                            the controller specified by ControllerHandle and 

-                            ChildHandle.

-    EFI_UNSUPPORTED       - The driver specified by This does not support the 

-                            language specified by Language.

-

---*/

-{

-  EFI_STATUS              Status;

-  EFI_BLOCK_IO_PROTOCOL   *BlockIo;

-  WIN_NT_BLOCK_IO_PRIVATE *Private;

-

-  //

-  // This is a device driver, so ChildHandle must be NULL.

-  //

-  if (ChildHandle != NULL) {

-    return EFI_UNSUPPORTED;

-  }

-  //

-  // Make sure this driver is currently managing ControllerHandle

-  //

-  Status = EfiTestManagedDevice (

-             ControllerHandle,

-             gWinNtBlockIoDriverBinding.DriverBindingHandle,

-             &gEfiWinNtIoProtocolGuid

-             );

-  if (EFI_ERROR (Status)) {

-    return EFI_UNSUPPORTED;

-  }

-  //

-  // Get our context back

-  //

-  Status = gBS->OpenProtocol (

-                  ControllerHandle,

-                  &gEfiBlockIoProtocolGuid,

-                  &BlockIo,

-                  gWinNtBlockIoDriverBinding.DriverBindingHandle,

-                  ControllerHandle,

-                  EFI_OPEN_PROTOCOL_GET_PROTOCOL

-                  );

-  if (EFI_ERROR (Status)) {

-    return EFI_UNSUPPORTED;

-  }

-

-  Private = WIN_NT_BLOCK_IO_PRIVATE_DATA_FROM_THIS (BlockIo);

-

-  return LookupUnicodeString (

-          Language,

-          gWinNtBlockIoComponentName.SupportedLanguages,

-          Private->ControllerNameTable,

-          ControllerName

-          );

-}

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverConfiguration.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverConfiguration.c
deleted file mode 100644
index 672ea5f..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverConfiguration.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  DriverConfiguration.c

-

-Abstract:

-

---*/

-

-#include "WinNtBlockIo.h"

-

-//

-// EFI Driver Configuration Functions

-//

-EFI_STATUS

-EFIAPI

-WinNtBlockIoDriverConfigurationSetOptions (

-  IN  EFI_DRIVER_CONFIGURATION_PROTOCOL                      *This,

-  IN  EFI_HANDLE                                             ControllerHandle,

-  IN  EFI_HANDLE                                             ChildHandle  OPTIONAL,

-  IN  CHAR8                                                  *Language,

-  OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED               *ActionRequired

-  );

-

-EFI_STATUS

-EFIAPI

-WinNtBlockIoDriverConfigurationOptionsValid (

-  IN  EFI_DRIVER_CONFIGURATION_PROTOCOL               *This,

-  IN  EFI_HANDLE                                      ControllerHandle,

-  IN  EFI_HANDLE                                      ChildHandle  OPTIONAL

-  );

-

-EFI_STATUS

-EFIAPI

-WinNtBlockIoDriverConfigurationForceDefaults (

-  IN  EFI_DRIVER_CONFIGURATION_PROTOCOL                      *This,

-  IN  EFI_HANDLE                                             ControllerHandle,

-  IN  EFI_HANDLE                                             ChildHandle  OPTIONAL,

-  IN  UINT32                                                 DefaultType,

-  OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED               *ActionRequired

-  );

-

-//

-// EFI Driver Configuration Protocol

-//

-EFI_DRIVER_CONFIGURATION_PROTOCOL gWinNtBlockIoDriverConfiguration = {

-  WinNtBlockIoDriverConfigurationSetOptions,

-  WinNtBlockIoDriverConfigurationOptionsValid,

-  WinNtBlockIoDriverConfigurationForceDefaults,

-  LANGUAGESUPPORTED

-};

-

-EFI_STATUS

-EFIAPI

-WinNtBlockIoDriverConfigurationSetOptions (

-  IN  EFI_DRIVER_CONFIGURATION_PROTOCOL                      *This,

-  IN  EFI_HANDLE                                             ControllerHandle,

-  IN  EFI_HANDLE                                             ChildHandle  OPTIONAL,

-  IN  CHAR8                                                  *Language,

-  OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED               *ActionRequired

-  )

-/*++

-

-  Routine Description:

-    Allows the user to set controller specific options for a controller that a

-    driver is currently managing.

-

-  Arguments:

-    This             - A pointer to the EFI_DRIVER_CONFIGURATION_ PROTOCOL instance.

-    ControllerHandle - The handle of the controller to set options on.

-    ChildHandle      - The handle of the child controller to set options on.  This

-                       is an optional parameter that may be NULL.  It will be NULL

-                       for device drivers, and for a bus drivers that wish to set

-                       options for the bus controller.  It will not be NULL for a

-                       bus driver that wishes to set options for one of its child

-                       controllers.

-    Language         - A pointer to a three character ISO 639-2 language identifier.

-                       This is the language of the user interface that should be

-                       presented to the user, and it must match one of the languages

-                       specified in SupportedLanguages.  The number of languages

-                       supported by a driver is up to the driver writer.

-    ActionRequired   - A pointer to the action that the calling agent is required

-                       to perform when this function returns.  See "Related

-                       Definitions" for a list of the actions that the calling

-                       agent is required to perform prior to accessing

-                       ControllerHandle again.

-

-  Returns:

-    EFI_SUCCESS           - The driver specified by This successfully set the

-                            configuration options for the controller specified

-                            by ControllerHandle..

-    EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.

-    EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.

-    EFI_INVALID_PARAMETER - ActionRequired is NULL.

-    EFI_UNSUPPORTED       - The driver specified by This does not support setting

-                            configuration options for the controller specified by

-                            ControllerHandle and ChildHandle.

-    EFI_UNSUPPORTED       - The driver specified by This does not support the

-                            language specified by Language.

-    EFI_DEVICE_ERROR      - A device error occurred while attempt to set the

-                            configuration options for the controller specified

-                            by ControllerHandle and ChildHandle.

-    EFI_OUT_RESOURCES     - There are not enough resources available to set the

-                            configuration options for the controller specified

-                            by ControllerHandle and ChildHandle.

-

---*/

-{

-  EFI_STATUS            Status;

-  EFI_BLOCK_IO_PROTOCOL *BlockIo;

-  CHAR8                 *SupportedLanguage;

-

-  SupportedLanguage = This->SupportedLanguages;

-

-  Status            = EFI_UNSUPPORTED;

-  while (*SupportedLanguage != 0) {

-    if (AsciiStrnCmp (Language, SupportedLanguage, 3) == 0) {

-      Status = EFI_SUCCESS;

-    }

-

-    SupportedLanguage += 3;

-  }

-

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  if (ActionRequired == NULL || ControllerHandle == NULL) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  if (ChildHandle != NULL) {

-    return EFI_UNSUPPORTED;

-  }

-

-  //

-  // Validate controller handle

-  //

-  Status = gBS->OpenProtocol (

-                  ControllerHandle,

-                  &gEfiWinNtIoProtocolGuid,

-                  &BlockIo,

-                  gWinNtBlockIoDriverBinding.DriverBindingHandle,

-                  ControllerHandle,

-                  EFI_OPEN_PROTOCOL_BY_DRIVER

-                  );

-

-  if (!EFI_ERROR (Status)) {

-    gBS->CloseProtocol (

-          ControllerHandle,

-          &gEfiWinNtIoProtocolGuid,

-          gWinNtBlockIoDriverBinding.DriverBindingHandle,

-          ControllerHandle

-          );

-

-    return EFI_UNSUPPORTED;

-  }

-

-  if (Status == EFI_UNSUPPORTED) {

-    return Status;

-  } else if (Status != EFI_ALREADY_STARTED) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  *ActionRequired = EfiDriverConfigurationActionNone;

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtBlockIoDriverConfigurationOptionsValid (

-  IN  EFI_DRIVER_CONFIGURATION_PROTOCOL               *This,

-  IN  EFI_HANDLE                                      ControllerHandle,

-  IN  EFI_HANDLE                                      ChildHandle  OPTIONAL

-  )

-/*++

-

-  Routine Description:

-    Tests to see if a controller's current configuration options are valid.

-

-  Arguments:

-    This             - A pointer to the EFI_DRIVER_CONFIGURATION_PROTOCOL instance.

-    ControllerHandle - The handle of the controller to test if it's current

-                       configuration options are valid.

-    ChildHandle      - The handle of the child controller to test if it's current

-                       configuration options are valid.  This is an optional

-                       parameter that may be NULL.  It will be NULL for device

-                       drivers.  It will also be NULL for a bus drivers that wish

-                       to test the configuration options for the bus controller.

-                       It will not be NULL for a bus driver that wishes to test

-                       configuration options for one of its child controllers.

-

-  Returns:

-    EFI_SUCCESS           - The controller specified by ControllerHandle and

-                            ChildHandle that is being managed by the driver

-                            specified by This has a valid set of  configuration

-                            options.

-    EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.

-    EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.

-    EFI_UNSUPPORTED       - The driver specified by This is not currently

-                            managing the controller specified by ControllerHandle

-                            and ChildHandle.

-    EFI_DEVICE_ERROR      - The controller specified by ControllerHandle and

-                            ChildHandle that is being managed by the driver

-                            specified by This has an invalid set of configuration

-                            options.

-

---*/

-{

-  EFI_STATUS            Status;

-  EFI_BLOCK_IO_PROTOCOL *BlockIo;

-

-  if (ChildHandle != NULL) {

-    return EFI_UNSUPPORTED;

-  }

-

-  if (ControllerHandle == NULL) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  //

-  // Validate controller handle

-  //

-  Status = gBS->OpenProtocol (

-                  ControllerHandle,

-                  &gEfiWinNtIoProtocolGuid,

-                  &BlockIo,

-                  gWinNtBlockIoDriverBinding.DriverBindingHandle,

-                  ControllerHandle,

-                  EFI_OPEN_PROTOCOL_BY_DRIVER

-                  );

-

-  if (!EFI_ERROR (Status)) {

-    gBS->CloseProtocol (

-          ControllerHandle,

-          &gEfiWinNtIoProtocolGuid,

-          gWinNtBlockIoDriverBinding.DriverBindingHandle,

-          ControllerHandle

-          );

-

-    return EFI_UNSUPPORTED;

-  }

-

-  if (Status == EFI_UNSUPPORTED) {

-    return Status;

-  } else if (Status != EFI_ALREADY_STARTED) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtBlockIoDriverConfigurationForceDefaults (

-  IN  EFI_DRIVER_CONFIGURATION_PROTOCOL                      *This,

-  IN  EFI_HANDLE                                             ControllerHandle,

-  IN  EFI_HANDLE                                             ChildHandle  OPTIONAL,

-  IN  UINT32                                                 DefaultType,

-  OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED               *ActionRequired

-  )

-/*++

-

-  Routine Description:

-    Forces a driver to set the default configuration options for a controller.

-

-  Arguments:

-    This             - A pointer to the EFI_DRIVER_CONFIGURATION_ PROTOCOL instance.

-    ControllerHandle - The handle of the controller to force default configuration options on.

-    ChildHandle      - The handle of the child controller to force default configuration options on  This is an optional parameter that may be NULL.  It will be NULL for device drivers.  It will also be NULL for a bus drivers that wish to force default configuration options for the bus controller.  It will not be NULL for a bus driver that wishes to force default configuration options for one of its child controllers.

-    DefaultType      - The type of default configuration options to force on the controller specified by ControllerHandle and ChildHandle.  See Table 9-1 for legal values.  A DefaultType of 0x00000000 must be supported by this protocol.

-    ActionRequired   - A pointer to the action that the calling agent is required to perform when this function returns.  See "Related Definitions" in Section 9.1for a list of the actions that the calling agent is required to perform prior to accessing ControllerHandle again.

-

-  Returns:

-    EFI_SUCCESS           - The driver specified by This successfully forced the default configuration options on the controller specified by ControllerHandle and ChildHandle.

-    EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.

-    EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.

-    EFI_INVALID_PARAMETER - ActionRequired is NULL.

-    EFI_UNSUPPORTED       - The driver specified by This does not support forcing the default configuration options on the controller specified by ControllerHandle and ChildHandle.

-    EFI_UNSUPPORTED       - The driver specified by This does not support the configuration type specified by DefaultType.

-    EFI_DEVICE_ERROR      - A device error occurred while attempt to force the default configuration options on the controller specified by  ControllerHandle and ChildHandle.

-    EFI_OUT_RESOURCES     - There are not enough resources available to force the default configuration options on the controller specified by ControllerHandle and ChildHandle.

-

---*/

-{

-  EFI_STATUS            Status;

-  EFI_BLOCK_IO_PROTOCOL *BlockIo;

-

-  if (ChildHandle != NULL) {

-    return EFI_UNSUPPORTED;

-  }

-

-  if (ActionRequired == NULL || ControllerHandle == NULL) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  //

-  // Validate controller handle

-  //

-  Status = gBS->OpenProtocol (

-                  ControllerHandle,

-                  &gEfiWinNtIoProtocolGuid,

-                  &BlockIo,

-                  gWinNtBlockIoDriverBinding.DriverBindingHandle,

-                  ControllerHandle,

-                  EFI_OPEN_PROTOCOL_BY_DRIVER

-                  );

-

-  if (!EFI_ERROR (Status)) {

-    gBS->CloseProtocol (

-          ControllerHandle,

-          &gEfiWinNtIoProtocolGuid,

-          gWinNtBlockIoDriverBinding.DriverBindingHandle,

-          ControllerHandle

-          );

-

-    return EFI_UNSUPPORTED;

-  }

-

-  if (Status == EFI_UNSUPPORTED) {

-    return Status;

-  } else if (Status != EFI_ALREADY_STARTED) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  *ActionRequired = EfiDriverConfigurationActionNone;

-  return EFI_SUCCESS;

-}

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverDiagnostics.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverDiagnostics.c
deleted file mode 100644
index 83532e2..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverDiagnostics.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  DriverDiagnostics.c

-

-Abstract:

-

---*/

-

-#include "WinNtBlockIo.h"

-

-//

-// EFI Driver Diagnostics Functions

-//

-EFI_STATUS

-EFIAPI

-WinNtBlockIoDriverDiagnosticsRunDiagnostics (

-  IN  EFI_DRIVER_DIAGNOSTICS_PROTOCOL               *This,

-  IN  EFI_HANDLE                                    ControllerHandle,

-  IN  EFI_HANDLE                                    ChildHandle  OPTIONAL,

-  IN  EFI_DRIVER_DIAGNOSTIC_TYPE                    DiagnosticType,

-  IN  CHAR8                                         *Language,

-  OUT EFI_GUID                                      **ErrorType,

-  OUT UINTN                                         *BufferSize,

-  OUT CHAR16                                        **Buffer

-  );

-

-//

-// EFI Driver Diagnostics Protocol

-//

-EFI_DRIVER_DIAGNOSTICS_PROTOCOL gWinNtBlockIoDriverDiagnostics = {

-  WinNtBlockIoDriverDiagnosticsRunDiagnostics,

-  LANGUAGESUPPORTED

-};

-

-EFI_STATUS

-EFIAPI

-WinNtBlockIoDriverDiagnosticsRunDiagnostics (

-  IN  EFI_DRIVER_DIAGNOSTICS_PROTOCOL               *This,

-  IN  EFI_HANDLE                                    ControllerHandle,

-  IN  EFI_HANDLE                                    ChildHandle  OPTIONAL,

-  IN  EFI_DRIVER_DIAGNOSTIC_TYPE                    DiagnosticType,

-  IN  CHAR8                                         *Language,

-  OUT EFI_GUID                                      **ErrorType,

-  OUT UINTN                                         *BufferSize,

-  OUT CHAR16                                        **Buffer

-  )

-/*++

-

-  Routine Description:

-    Runs diagnostics on a controller.

-

-  Arguments:

-    This             - A pointer to the EFI_DRIVER_DIAGNOSTICS_PROTOCOL instance.

-    ControllerHandle - The handle of the controller to run diagnostics on.

-    ChildHandle      - The handle of the child controller to run diagnostics on

-                       This is an optional parameter that may be NULL.  It will

-                       be NULL for device drivers.  It will also be NULL for a

-                       bus drivers that wish to run diagnostics on the bus

-                       controller.  It will not be NULL for a bus driver that

-                       wishes to run diagnostics on one of its child controllers.

-    DiagnosticType   - Indicates type of diagnostics to perform on the controller

-                       specified by ControllerHandle and ChildHandle.   See

-                       "Related Definitions" for the list of supported types.

-    Language         - A pointer to a three character ISO 639-2 language

-                       identifier.  This is the language in which the optional

-                       error message should be returned in Buffer, and it must

-                       match one of the languages specified in SupportedLanguages.

-                       The number of languages supported by a driver is up to

-                       the driver writer.

-    ErrorType        - A GUID that defines the format of the data returned in

-                       Buffer.

-    BufferSize       - The size, in bytes, of the data returned in Buffer.

-    Buffer           - A buffer that contains a Null-terminated Unicode string

-                       plus some additional data whose format is defined by

-                       ErrorType.  Buffer is allocated by this function with

-                       AllocatePool(), and it is the caller's responsibility

-                       to free it with a call to FreePool().

-

-  Returns:

-    EFI_SUCCESS           - The controller specified by ControllerHandle and

-                            ChildHandle passed the diagnostic.

-    EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.

-    EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid

-                            EFI_HANDLE.

-    EFI_INVALID_PARAMETER - Language is NULL.

-    EFI_INVALID_PARAMETER - ErrorType is NULL.

-    EFI_INVALID_PARAMETER - BufferType is NULL.

-    EFI_INVALID_PARAMETER - Buffer is NULL.

-    EFI_UNSUPPORTED       - The driver specified by This does not support

-                            running diagnostics for the controller specified

-                            by ControllerHandle and ChildHandle.

-    EFI_UNSUPPORTED       - The driver specified by This does not support the

-                            type of diagnostic specified by DiagnosticType.

-    EFI_UNSUPPORTED       - The driver specified by This does not support the

-                            language specified by Language.

-    EFI_OUT_OF_RESOURCES  - There are not enough resources available to complete

-                            the diagnostics.

-    EFI_OUT_OF_RESOURCES  - There are not enough resources available to return

-                            the status information in ErrorType, BufferSize,

-                            and Buffer.

-    EFI_DEVICE_ERROR      - The controller specified by ControllerHandle and

-                            ChildHandle did not pass the diagnostic.

-

---*/

-{

-  EFI_STATUS            Status;

-  EFI_BLOCK_IO_PROTOCOL *BlockIo;

-  CHAR8                 *SupportedLanguage;

-

-  if (Language         == NULL ||

-      ErrorType        == NULL ||

-      Buffer           == NULL ||

-      ControllerHandle == NULL ||

-      BufferSize       == NULL) {

-

-    return EFI_INVALID_PARAMETER;

-  }

-

-  SupportedLanguage = This->SupportedLanguages;

-

-  Status            = EFI_UNSUPPORTED;

-  while (*SupportedLanguage != 0) {

-    if (AsciiStrnCmp (Language, SupportedLanguage, 3) == 0) {

-      Status = EFI_SUCCESS;

-      break;

-    }

-

-    SupportedLanguage += 3;

-  }

-

-  if (EFI_ERROR (Status)) {

-    return EFI_UNSUPPORTED;

-  }

-

-  *ErrorType  = NULL;

-  *BufferSize = 0;

-  if (DiagnosticType != EfiDriverDiagnosticTypeStandard) {

-    *ErrorType  = &gEfiBlockIoProtocolGuid;

-    *BufferSize = 0x60;

-    Buffer = AllocatePool ((UINTN) (*BufferSize));

-    CopyMem (*Buffer, L"Windows Block I/O Driver Diagnostics Failed\n", *BufferSize);

-    return EFI_DEVICE_ERROR;

-  }

-

-  //

-  // Validate controller handle

-  //

-  Status = gBS->OpenProtocol (

-                  ControllerHandle,

-                  &gEfiWinNtIoProtocolGuid,

-                  &BlockIo,

-                  gWinNtBlockIoDriverBinding.DriverBindingHandle,

-                  ControllerHandle,

-                  EFI_OPEN_PROTOCOL_BY_DRIVER

-                  );

-

-  if (!EFI_ERROR (Status)) {

-    gBS->CloseProtocol (

-          ControllerHandle,

-          &gEfiWinNtIoProtocolGuid,

-          gWinNtBlockIoDriverBinding.DriverBindingHandle,

-          ControllerHandle

-          );

-

-    return EFI_UNSUPPORTED;

-  }

-

-  if (Status == EFI_UNSUPPORTED) {

-    return Status;

-  } else if (Status != EFI_ALREADY_STARTED) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  return EFI_SUCCESS;

-}

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.c
deleted file mode 100644
index effc8fa..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.c
+++ /dev/null
@@ -1,1104 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  WinNtBlockIo.c

-

-Abstract:

-

-  Produce block IO abstractions for real devices on your PC using Win32 APIs.

-  The configuration of what devices to mount or emulate comes from NT

-  environment variables. The variables must be visible to the Microsoft*

-  Developer Studio for them to work.

-

-  <F>ixed       - Fixed disk like a hard drive.

-  <R>emovable   - Removable media like a floppy or CD-ROM.

-  Read <O>nly   - Write protected device.

-  Read <W>rite  - Read write device.

-  <block count> - Decimal number of blocks a device supports.

-  <block size>  - Decimal number of bytes per block.

-

-  NT envirnonment variable contents. '<' and '>' are not part of the variable,

-  they are just used to make this help more readable. There should be no

-  spaces between the ';'. Extra spaces will break the variable. A '!' is

-  used to seperate multiple devices in a variable.

-

-  EFI_WIN_NT_VIRTUAL_DISKS =

-    <F | R><O | W>;<block count>;<block size>[!...]

-

-  EFI_WIN_NT_PHYSICAL_DISKS =

-    <drive letter>:<F | R><O | W>;<block count>;<block size>[!...]

-

-  Virtual Disks: These devices use a file to emulate a hard disk or removable

-                 media device.

-

-    Thus a 20 MB emulated hard drive would look like:

-    EFI_WIN_NT_VIRTUAL_DISKS=FW;40960;512

-

-    A 1.44MB emulated floppy with a block size of 1024 would look like:

-    EFI_WIN_NT_VIRTUAL_DISKS=RW;1440;1024

-

-  Physical Disks: These devices use NT to open a real device in your system

-

-    Thus a 120 MB floppy would look like:

-    EFI_WIN_NT_PHYSICAL_DISKS=B:RW;245760;512

-

-    Thus a standard CD-ROM floppy would look like:

-    EFI_WIN_NT_PHYSICAL_DISKS=Z:RO;307200;2048

-

-

-  * Other names and brands may be claimed as the property of others.

-

---*/

-

-#include "WinNtBlockIo.h"

-

-EFI_DRIVER_BINDING_PROTOCOL gWinNtBlockIoDriverBinding = {

-  WinNtBlockIoDriverBindingSupported,

-  WinNtBlockIoDriverBindingStart,

-  WinNtBlockIoDriverBindingStop,

-  0xa,

-  NULL,

-  NULL

-};

-

-

-EFI_STATUS

-EFIAPI

-WinNtBlockIoDriverBindingSupported (

-  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

-  IN  EFI_HANDLE                   Handle,

-  IN  EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath

-  )

-/*++

-

-Routine Description:

-

-Arguments:

-

-Returns:

-

-  None

-

---*/

-// TODO:    This - add argument and description to function comment

-// TODO:    Handle - add argument and description to function comment

-// TODO:    RemainingDevicePath - add argument and description to function comment

-{

-  EFI_STATUS              Status;

-  EFI_WIN_NT_IO_PROTOCOL  *WinNtIo;

-

-  //

-  // Open the IO Abstraction(s) needed to perform the supported test

-  //

-  Status = gBS->OpenProtocol (

-                  Handle,

-                  &gEfiWinNtIoProtocolGuid,

-                  &WinNtIo,

-                  This->DriverBindingHandle,

-                  Handle,

-                  EFI_OPEN_PROTOCOL_BY_DRIVER

-                  );

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  //

-  // Make sure the WinNtThunkProtocol is valid

-  //

-  Status = EFI_UNSUPPORTED;

-  if (WinNtIo->WinNtThunk->Signature == EFI_WIN_NT_THUNK_PROTOCOL_SIGNATURE) {

-

-    //

-    // Check the GUID to see if this is a handle type the driver supports

-    //

-    if (CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtVirtualDisksGuid) ||

-        CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtPhysicalDisksGuid) ) {

-      Status = EFI_SUCCESS;

-    }

-  }

-

-  //

-  // Close the I/O Abstraction(s) used to perform the supported test

-  //

-  gBS->CloseProtocol (

-        Handle,

-        &gEfiWinNtIoProtocolGuid,

-        This->DriverBindingHandle,

-        Handle

-        );

-

-  return Status;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtBlockIoDriverBindingStart (

-  IN  EFI_DRIVER_BINDING_PROTOCOL   *This,

-  IN  EFI_HANDLE                    Handle,

-  IN  EFI_DEVICE_PATH_PROTOCOL      *RemainingDevicePath

-  )

-/*++

-

-Routine Description:

-

-Arguments:

-

-Returns:

-

-  None

-

---*/

-// TODO:    This - add argument and description to function comment

-// TODO:    Handle - add argument and description to function comment

-// TODO:    RemainingDevicePath - add argument and description to function comment

-{

-  EFI_STATUS                  Status;

-  EFI_WIN_NT_IO_PROTOCOL      *WinNtIo;

-  WIN_NT_RAW_DISK_DEVICE_TYPE DiskType;

-  UINT16                      Buffer[FILENAME_BUFFER_SIZE];

-  CHAR16                      *Str;

-  BOOLEAN                     RemovableMedia;

-  BOOLEAN                     WriteProtected;

-  UINTN                       NumberOfBlocks;

-  UINTN                       BlockSize;

-

-  //

-  // Grab the protocols we need

-  //

-  Status = gBS->OpenProtocol (

-                  Handle,

-                  &gEfiWinNtIoProtocolGuid,

-                  &WinNtIo,

-                  This->DriverBindingHandle,

-                  Handle,

-                  EFI_OPEN_PROTOCOL_BY_DRIVER

-                  );

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  //

-  // Set DiskType

-  //

-  if (CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtVirtualDisksGuid)) {

-    DiskType = EfiWinNtVirtualDisks;

-  } else if (CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtPhysicalDisksGuid)) {

-    DiskType = EfiWinNtPhysicalDisks;

-  } else {

-    Status = EFI_UNSUPPORTED;

-    goto Done;

-  }

-

-  Status  = EFI_NOT_FOUND;

-  Str     = WinNtIo->EnvString;

-  if (DiskType == EfiWinNtVirtualDisks) {

-    WinNtIo->WinNtThunk->SPrintf (

-                          Buffer,

-                          sizeof (Buffer),

-                          L"Diskfile%d",

-                          WinNtIo->InstanceNumber

-                          );

-  } else {

-    if (*Str >= 'A' && *Str <= 'Z' || *Str >= 'a' && *Str <= 'z') {

-      WinNtIo->WinNtThunk->SPrintf (Buffer, sizeof (Buffer), L"\\\\.\\%c:", *Str);

-    } else {

-      WinNtIo->WinNtThunk->SPrintf (Buffer, sizeof (Buffer), L"\\\\.\\PHYSICALDRIVE%c", *Str);

-    }

-

-    Str++;

-    if (*Str != ':') {

-      Status = EFI_NOT_FOUND;

-      goto Done;

-    }

-

-    Str++;

-  }

-

-  if (*Str == 'R' || *Str == 'F') {

-    RemovableMedia = (BOOLEAN) (*Str == 'R');

-    Str++;

-    if (*Str == 'O' || *Str == 'W') {

-      WriteProtected  = (BOOLEAN) (*Str == 'O');

-      Str             = GetNextElementPastTerminator (Str, ';');

-

-      NumberOfBlocks  = Atoi (Str);

-      if (NumberOfBlocks != 0) {

-        Str       = GetNextElementPastTerminator (Str, ';');

-        BlockSize = Atoi (Str);

-        if (BlockSize != 0) {

-          //

-          // If we get here the variable is valid so do the work.

-          //

-          Status = WinNtBlockIoCreateMapping (

-                    WinNtIo,

-                    Handle,

-                    Buffer,

-                    WriteProtected,

-                    RemovableMedia,

-                    NumberOfBlocks,

-                    BlockSize,

-                    DiskType

-                    );

-

-        }

-      }

-    }

-  }

-

-Done:

-  if (EFI_ERROR (Status)) {

-    gBS->CloseProtocol (

-          Handle,

-          &gEfiWinNtIoProtocolGuid,

-          This->DriverBindingHandle,

-          Handle

-          );

-  }

-

-  return Status;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtBlockIoDriverBindingStop (

-  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

-  IN  EFI_HANDLE                   Handle,

-  IN  UINTN                        NumberOfChildren,

-  IN  EFI_HANDLE                   *ChildHandleBuffer

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This              - TODO: add argument description

-  Handle            - TODO: add argument description

-  NumberOfChildren  - TODO: add argument description

-  ChildHandleBuffer - TODO: add argument description

-

-Returns:

-

-  EFI_UNSUPPORTED - TODO: Add description for return value

-

---*/

-{

-  EFI_BLOCK_IO_PROTOCOL   *BlockIo;

-  EFI_STATUS              Status;

-  WIN_NT_BLOCK_IO_PRIVATE *Private;

-

-  //

-  // Get our context back

-  //

-  Status = gBS->OpenProtocol (

-                  Handle,

-                  &gEfiBlockIoProtocolGuid,

-                  &BlockIo,

-                  This->DriverBindingHandle,

-                  Handle,

-                  EFI_OPEN_PROTOCOL_GET_PROTOCOL

-                  );

-  if (EFI_ERROR (Status)) {

-    return EFI_UNSUPPORTED;

-  }

-

-  Private = WIN_NT_BLOCK_IO_PRIVATE_DATA_FROM_THIS (BlockIo);

-

-  //

-  // BugBug: If we need to kick people off, we need to make Uninstall Close the handles.

-  //         We could pass in our image handle or FLAG our open to be closed via

-  //         Unistall (== to saying any CloseProtocol will close our open)

-  //

-  Status = gBS->UninstallMultipleProtocolInterfaces (

-                  Private->EfiHandle,

-                  &gEfiBlockIoProtocolGuid,

-                  &Private->BlockIo,

-                  NULL

-                  );

-  if (!EFI_ERROR (Status)) {

-

-    Status = gBS->CloseProtocol (

-                    Handle,

-                    &gEfiWinNtIoProtocolGuid,

-                    This->DriverBindingHandle,

-                    Handle

-                    );

-

-    //

-    // Shut down our device

-    //

-    Private->WinNtThunk->CloseHandle (Private->NtHandle);

-

-    //

-    // Free our instance data

-    //

-    FreeUnicodeStringTable (Private->ControllerNameTable);

-

-    FreePool (Private);

-  }

-

-  return Status;

-}

-

-STATIC

-CHAR16 *

-GetNextElementPastTerminator (

-  IN  CHAR16  *EnvironmentVariable,

-  IN  CHAR16  Terminator

-  )

-/*++

-

-Routine Description:

-

-  Worker function to parse environment variables.

-

-Arguments:

-  EnvironmentVariable - Envirnment variable to parse.

-

-  Terminator          - Terminator to parse for.

-

-Returns:

-

-  Pointer to next eliment past the first occurence of Terminator or the '\0'

-  at the end of the string.

-

---*/

-{

-  CHAR16  *Ptr;

-

-  for (Ptr = EnvironmentVariable; *Ptr != '\0'; Ptr++) {

-    if (*Ptr == Terminator) {

-      Ptr++;

-      break;

-    }

-  }

-

-  return Ptr;

-}

-

-STATIC

-EFI_STATUS

-WinNtBlockIoCreateMapping (

-  IN EFI_WIN_NT_IO_PROTOCOL             *WinNtIo,

-  IN EFI_HANDLE                         EfiDeviceHandle,

-  IN CHAR16                             *Filename,

-  IN BOOLEAN                            ReadOnly,

-  IN BOOLEAN                            RemovableMedia,

-  IN UINTN                              NumberOfBlocks,

-  IN UINTN                              BlockSize,

-  IN WIN_NT_RAW_DISK_DEVICE_TYPE        DeviceType

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  WinNtIo         - TODO: add argument description

-  EfiDeviceHandle - TODO: add argument description

-  Filename        - TODO: add argument description

-  ReadOnly        - TODO: add argument description

-  RemovableMedia  - TODO: add argument description

-  NumberOfBlocks  - TODO: add argument description

-  BlockSize       - TODO: add argument description

-  DeviceType      - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-{

-  EFI_STATUS              Status;

-  EFI_BLOCK_IO_PROTOCOL   *BlockIo;

-  WIN_NT_BLOCK_IO_PRIVATE *Private;

-  UINTN                   Index;

-

-  WinNtIo->WinNtThunk->SetErrorMode (SEM_FAILCRITICALERRORS);

-

-  Private = AllocatePool (sizeof (WIN_NT_BLOCK_IO_PRIVATE));

-  ASSERT (Private != NULL);

-

-  EfiInitializeLock (&Private->Lock, TPL_NOTIFY);

-

-  Private->WinNtThunk = WinNtIo->WinNtThunk;

-

-  Private->Signature  = WIN_NT_BLOCK_IO_PRIVATE_SIGNATURE;

-  Private->LastBlock  = NumberOfBlocks - 1;

-  Private->BlockSize  = BlockSize;

-

-  for (Index = 0; Filename[Index] != 0; Index++) {

-    Private->Filename[Index] = Filename[Index];

-  }

-

-  Private->Filename[Index]      = 0;

-

-  Private->ReadMode             = GENERIC_READ | (ReadOnly ? 0 : GENERIC_WRITE);

-  Private->ShareMode            = FILE_SHARE_READ | FILE_SHARE_WRITE;

-

-  Private->NumberOfBlocks       = NumberOfBlocks;

-  Private->DeviceType           = DeviceType;

-  Private->NtHandle             = INVALID_HANDLE_VALUE;

-

-  Private->ControllerNameTable  = NULL;

-

-  AddUnicodeString (

-    "eng",

-    gWinNtBlockIoComponentName.SupportedLanguages,

-    &Private->ControllerNameTable,

-    Private->Filename

-    );

-

-  BlockIo = &Private->BlockIo;

-  BlockIo->Revision = EFI_BLOCK_IO_PROTOCOL_REVISION;

-  BlockIo->Media = &Private->Media;

-  BlockIo->Media->BlockSize = Private->BlockSize;

-  BlockIo->Media->LastBlock = Private->NumberOfBlocks - 1;

-  BlockIo->Media->MediaId = 0;;

-

-  BlockIo->Reset = WinNtBlockIoResetBlock;

-  BlockIo->ReadBlocks = WinNtBlockIoReadBlocks;

-  BlockIo->WriteBlocks = WinNtBlockIoWriteBlocks;

-  BlockIo->FlushBlocks = WinNtBlockIoFlushBlocks;

-

-  BlockIo->Media->ReadOnly = ReadOnly;

-  BlockIo->Media->RemovableMedia = RemovableMedia;

-  BlockIo->Media->LogicalPartition = FALSE;

-  BlockIo->Media->MediaPresent = TRUE;

-  BlockIo->Media->WriteCaching = FALSE;

-

-  if (DeviceType == EfiWinNtVirtualDisks) {

-    BlockIo->Media->IoAlign = 1;

-

-    //

-    // Create a file to use for a virtual disk even if it does not exist.

-    //

-    Private->OpenMode = OPEN_ALWAYS;

-  } else if (DeviceType == EfiWinNtPhysicalDisks) {

-    //

-    // Physical disk and floppy devices require 4 byte alignment.

-    //

-    BlockIo->Media->IoAlign = 4;

-

-    //

-    // You can only open a physical device if it exists.

-    //

-    Private->OpenMode = OPEN_EXISTING;

-  } else {

-    ASSERT (FALSE);

-  }

-

-  Private->EfiHandle  = EfiDeviceHandle;

-  Status              = WinNtBlockIoOpenDevice (Private);

-  if (!EFI_ERROR (Status)) {

-

-    Status = gBS->InstallMultipleProtocolInterfaces (

-                    &Private->EfiHandle,

-                    &gEfiBlockIoProtocolGuid,

-                    &Private->BlockIo,

-                    NULL

-                    );

-    if (EFI_ERROR (Status)) {

-      FreeUnicodeStringTable (Private->ControllerNameTable);

-      FreePool (Private);

-    }

-

-    DEBUG ((EFI_D_INIT, "BlockDevice added: %s\n", Filename));

-  }

-

-  return Status;

-}

-

-STATIC

-EFI_STATUS

-WinNtBlockIoOpenDevice (

-  WIN_NT_BLOCK_IO_PRIVATE                 *Private

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-{

-  EFI_STATUS            Status;

-  UINT64                FileSize;

-  UINT64                EndOfFile;

-  EFI_BLOCK_IO_PROTOCOL *BlockIo;

-

-  BlockIo = &Private->BlockIo;

-  EfiAcquireLock (&Private->Lock);

-

-  //

-  // If the device is already opened, close it

-  //

-  if (Private->NtHandle != INVALID_HANDLE_VALUE) {

-    BlockIo->Reset (BlockIo, FALSE);

-  }

-

-  //

-  // Open the device

-  //

-  Private->NtHandle = Private->WinNtThunk->CreateFile (

-                                            Private->Filename,

-                                            Private->ReadMode,

-                                            Private->ShareMode,

-                                            NULL,

-                                            Private->OpenMode,

-                                            0,

-                                            NULL

-                                            );

-

-  Status = Private->WinNtThunk->GetLastError ();

-

-  if (Private->NtHandle == INVALID_HANDLE_VALUE) {

-    DEBUG ((EFI_D_INFO, "PlOpenBlock: Could not open %s, %x\n", Private->Filename, Private->WinNtThunk->GetLastError ()));

-    BlockIo->Media->MediaPresent  = FALSE;

-    Status                        = EFI_NO_MEDIA;

-    goto Done;

-  }

-

-  if (!BlockIo->Media->MediaPresent) {

-    //

-    // BugBug: try to emulate if a CD appears - notify drivers to check it out

-    //

-    BlockIo->Media->MediaPresent = TRUE;

-    EfiReleaseLock (&Private->Lock);

-    EfiAcquireLock (&Private->Lock);

-  }

-

-  //

-  // get the size of the file

-  //

-  Status = SetFilePointer64 (Private, 0, &FileSize, FILE_END);

-

-  if (EFI_ERROR (Status)) {

-    FileSize = MultU64x32 (Private->NumberOfBlocks, Private->BlockSize);

-    if (Private->DeviceType == EfiWinNtVirtualDisks) {

-      DEBUG ((EFI_D_ERROR, "PlOpenBlock: Could not get filesize of %s\n", Private->Filename));

-      Status = EFI_UNSUPPORTED;

-      goto Done;

-    }

-  }

-

-  if (Private->NumberOfBlocks == 0) {

-    Private->NumberOfBlocks = DivU64x32 (FileSize, Private->BlockSize);

-  }

-

-  EndOfFile = MultU64x32 (Private->NumberOfBlocks, Private->BlockSize);

-

-  if (FileSize != EndOfFile) {

-    //

-    // file is not the proper size, change it

-    //

-    DEBUG ((EFI_D_INIT, "PlOpenBlock: Initializing block device: %hs\n", Private->Filename));

-

-    //

-    // first set it to 0

-    //

-    SetFilePointer64 (Private, 0, NULL, FILE_BEGIN);

-    Private->WinNtThunk->SetEndOfFile (Private->NtHandle);

-

-    //

-    // then set it to the needed file size (OS will zero fill it)

-    //

-    SetFilePointer64 (Private, EndOfFile, NULL, FILE_BEGIN);

-    Private->WinNtThunk->SetEndOfFile (Private->NtHandle);

-  }

-

-  DEBUG ((EFI_D_INIT, "%HPlOpenBlock: opened %s%N\n", Private->Filename));

-  Status = EFI_SUCCESS;

-

-Done:

-  if (EFI_ERROR (Status)) {

-    if (Private->NtHandle != INVALID_HANDLE_VALUE) {

-      BlockIo->Reset (BlockIo, FALSE);

-    }

-  }

-

-  EfiReleaseLock (&Private->Lock);

-  return Status;

-}

-

-STATIC

-EFI_STATUS

-WinNtBlockIoError (

-  IN WIN_NT_BLOCK_IO_PRIVATE      *Private

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-{

-  EFI_BLOCK_IO_PROTOCOL *BlockIo;

-  EFI_STATUS            Status;

-  BOOLEAN               ReinstallBlockIoFlag;

-

-  BlockIo = &Private->BlockIo;

-

-  switch (Private->WinNtThunk->GetLastError ()) {

-

-  case ERROR_NOT_READY:

-    Status                        = EFI_NO_MEDIA;

-    BlockIo->Media->ReadOnly      = FALSE;

-    BlockIo->Media->MediaPresent  = FALSE;

-    ReinstallBlockIoFlag          = FALSE;

-    break;

-

-  case ERROR_WRONG_DISK:

-    BlockIo->Media->ReadOnly      = FALSE;

-    BlockIo->Media->MediaPresent  = TRUE;

-    BlockIo->Media->MediaId += 1;

-    ReinstallBlockIoFlag  = TRUE;

-    Status                = EFI_MEDIA_CHANGED;

-    break;

-

-  case ERROR_WRITE_PROTECT:

-    BlockIo->Media->ReadOnly  = TRUE;

-    ReinstallBlockIoFlag      = FALSE;

-    Status                    = EFI_WRITE_PROTECTED;

-    break;

-

-  default:

-    ReinstallBlockIoFlag  = FALSE;

-    Status                = EFI_DEVICE_ERROR;

-    break;

-  }

-

-  if (ReinstallBlockIoFlag) {

-    BlockIo->Reset (BlockIo, FALSE);

-

-    gBS->ReinstallProtocolInterface (

-          Private->EfiHandle,

-          &gEfiBlockIoProtocolGuid,

-          BlockIo,

-          BlockIo

-          );

-  }

-

-  return Status;

-}

-

-STATIC

-EFI_STATUS

-WinNtBlockIoReadWriteCommon (

-  IN  WIN_NT_BLOCK_IO_PRIVATE     *Private,

-  IN UINT32                       MediaId,

-  IN EFI_LBA                      Lba,

-  IN UINTN                        BufferSize,

-  IN VOID                         *Buffer,

-  IN CHAR8                        *CallerName

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private     - TODO: add argument description

-  MediaId     - TODO: add argument description

-  Lba         - TODO: add argument description

-  BufferSize  - TODO: add argument description

-  Buffer      - TODO: add argument description

-  CallerName  - TODO: add argument description

-

-Returns:

-

-  EFI_NO_MEDIA - TODO: Add description for return value

-  EFI_MEDIA_CHANGED - TODO: Add description for return value

-  EFI_INVALID_PARAMETER - TODO: Add description for return value

-  EFI_SUCCESS - TODO: Add description for return value

-  EFI_BAD_BUFFER_SIZE - TODO: Add description for return value

-  EFI_INVALID_PARAMETER - TODO: Add description for return value

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  EFI_STATUS  Status;

-  UINTN       BlockSize;

-  UINT64      LastBlock;

-  INT64       DistanceToMove;

-  UINT64      DistanceMoved;

-

-  if (Private->NtHandle == INVALID_HANDLE_VALUE) {

-    Status = WinNtBlockIoOpenDevice (Private);

-    if (EFI_ERROR (Status)) {

-      return Status;

-    }

-  }

-

-  if (!Private->Media.MediaPresent) {

-    DEBUG ((EFI_D_INIT, "%s: No Media\n", CallerName));

-    return EFI_NO_MEDIA;

-  }

-

-  if (Private->Media.MediaId != MediaId) {

-    return EFI_MEDIA_CHANGED;

-  }

-

-  if ((UINT32) Buffer % Private->Media.IoAlign != 0) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  //

-  // Verify buffer size

-  //

-  BlockSize = Private->BlockSize;

-  if (BufferSize == 0) {

-    DEBUG ((EFI_D_INIT, "%s: Zero length read\n", CallerName));

-    return EFI_SUCCESS;

-  }

-

-  if ((BufferSize % BlockSize) != 0) {

-    DEBUG ((EFI_D_INIT, "%s: Invalid read size\n", CallerName));

-    return EFI_BAD_BUFFER_SIZE;

-  }

-

-  LastBlock = Lba + (BufferSize / BlockSize) - 1;

-  if (LastBlock > Private->LastBlock) {

-    DEBUG ((EFI_D_INIT, "ReadBlocks: Attempted to read off end of device\n"));

-    return EFI_INVALID_PARAMETER;

-  }

-  //

-  // Seek to End of File

-  //

-  DistanceToMove = MultU64x32 (Lba, BlockSize);

-  Status = SetFilePointer64 (Private, DistanceToMove, &DistanceMoved, FILE_BEGIN);

-

-  if (EFI_ERROR (Status)) {

-    DEBUG ((EFI_D_INIT, "WriteBlocks: SetFilePointer failed\n"));

-    return WinNtBlockIoError (Private);

-  }

-

-  return EFI_SUCCESS;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtBlockIoReadBlocks (

-  IN EFI_BLOCK_IO_PROTOCOL  *This,

-  IN UINT32                 MediaId,

-  IN EFI_LBA                Lba,

-  IN UINTN                  BufferSize,

-  OUT VOID                  *Buffer

-  )

-/*++

-

-  Routine Description:

-    Read BufferSize bytes from Lba into Buffer.

-

-  Arguments:

-    This       - Protocol instance pointer.

-    MediaId    - Id of the media, changes every time the media is replaced.

-    Lba        - The starting Logical Block Address to read from

-    BufferSize - Size of Buffer, must be a multiple of device block size.

-    Buffer     - Buffer containing read data

-

-  Returns:

-    EFI_SUCCESS           - The data was read correctly from the device.

-    EFI_DEVICE_ERROR      - The device reported an error while performing the read.

-    EFI_NO_MEDIA          - There is no media in the device.

-    EFI_MEDIA_CHANGED     - The MediaId does not matched the current device.

-    EFI_BAD_BUFFER_SIZE   - The Buffer was not a multiple of the block size of the

-                            device.

-    EFI_INVALID_PARAMETER - The read request contains device addresses that are not

-                            valid for the device.

-

---*/

-{

-  WIN_NT_BLOCK_IO_PRIVATE *Private;

-  BOOL                    Flag;

-  EFI_STATUS              Status;

-  DWORD                   BytesRead;

-  EFI_TPL                 OldTpl;

-

-  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);

-

-  Private = WIN_NT_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);

-

-  Status  = WinNtBlockIoReadWriteCommon (Private, MediaId, Lba, BufferSize, Buffer, "WinNtReadBlocks");

-  if (EFI_ERROR (Status)) {

-    goto Done;

-  }

-

-  Flag = Private->WinNtThunk->ReadFile (Private->NtHandle, Buffer, (DWORD) BufferSize, (LPDWORD) &BytesRead, NULL);

-  if (!Flag || (BytesRead != BufferSize)) {

-    DEBUG ((EFI_D_INIT, "ReadBlocks: ReadFile failed. (%d)\n", Private->WinNtThunk->GetLastError ()));

-    Status = WinNtBlockIoError (Private);

-    goto Done;

-  }

-

-  //

-  // If we wrote then media is present.

-  //

-  This->Media->MediaPresent = TRUE;

-  Status = EFI_SUCCESS;

-

-Done:

-  gBS->RestoreTPL (OldTpl);

-  return Status;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtBlockIoWriteBlocks (

-  IN EFI_BLOCK_IO_PROTOCOL  *This,

-  IN UINT32                 MediaId,

-  IN EFI_LBA                Lba,

-  IN UINTN                  BufferSize,

-  IN VOID                   *Buffer

-  )

-/*++

-

-  Routine Description:

-    Write BufferSize bytes from Lba into Buffer.

-

-  Arguments:

-    This       - Protocol instance pointer.

-    MediaId    - Id of the media, changes every time the media is replaced.

-    Lba        - The starting Logical Block Address to read from

-    BufferSize - Size of Buffer, must be a multiple of device block size.

-    Buffer     - Buffer containing read data

-

-  Returns:

-    EFI_SUCCESS           - The data was written correctly to the device.

-    EFI_WRITE_PROTECTED   - The device can not be written to.

-    EFI_DEVICE_ERROR      - The device reported an error while performing the write.

-    EFI_NO_MEDIA          - There is no media in the device.

-    EFI_MEDIA_CHNAGED     - The MediaId does not matched the current device.

-    EFI_BAD_BUFFER_SIZE   - The Buffer was not a multiple of the block size of the

-                            device.

-    EFI_INVALID_PARAMETER - The write request contains a LBA that is not

-                            valid for the device.

-

---*/

-{

-  WIN_NT_BLOCK_IO_PRIVATE *Private;

-  UINTN                   BytesWritten;

-  BOOL                    Flag;

-  EFI_STATUS              Status;

-  EFI_TPL                 OldTpl;

-

-  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);

-

-  Private = WIN_NT_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);

-

-  Status  = WinNtBlockIoReadWriteCommon (Private, MediaId, Lba, BufferSize, Buffer, "WinNtWriteBlocks");

-  if (EFI_ERROR (Status)) {

-    goto Done;

-  }

-

-  Flag = Private->WinNtThunk->WriteFile (Private->NtHandle, Buffer, (DWORD) BufferSize, (LPDWORD) &BytesWritten, NULL);

-  if (!Flag || (BytesWritten != BufferSize)) {

-    DEBUG ((EFI_D_INIT, "ReadBlocks: WriteFile failed. (%d)\n", Private->WinNtThunk->GetLastError ()));

-    Status = WinNtBlockIoError (Private);

-    goto Done;

-  }

-

-  //

-  // If the write succeeded, we are not write protected and media is present.

-  //

-  This->Media->MediaPresent = TRUE;

-  This->Media->ReadOnly     = FALSE;

-  Status = EFI_SUCCESS;

-

-Done:

-  gBS->RestoreTPL (OldTpl);

-  return Status;

-

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtBlockIoFlushBlocks (

-  IN EFI_BLOCK_IO_PROTOCOL  *This

-  )

-/*++

-

-  Routine Description:

-    Flush the Block Device.

-

-  Arguments:

-    This             - Protocol instance pointer.

-

-  Returns:

-    EFI_SUCCESS      - All outstanding data was written to the device

-    EFI_DEVICE_ERROR - The device reported an error while writting back the data

-    EFI_NO_MEDIA     - There is no media in the device.

-

---*/

-{

-  return EFI_SUCCESS;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtBlockIoResetBlock (

-  IN EFI_BLOCK_IO_PROTOCOL  *This,

-  IN BOOLEAN                ExtendedVerification

-  )

-/*++

-

-  Routine Description:

-    Reset the Block Device.

-

-  Arguments:

-    This                 - Protocol instance pointer.

-    ExtendedVerification - Driver may perform diagnostics on reset.

-

-  Returns:

-    EFI_SUCCESS           - The device was reset.

-    EFI_DEVICE_ERROR      - The device is not functioning properly and could

-                            not be reset.

-

---*/

-{

-  WIN_NT_BLOCK_IO_PRIVATE *Private;

-  EFI_TPL                 OldTpl;

-

-  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);

-

-  Private = WIN_NT_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);

-

-  if (Private->NtHandle != INVALID_HANDLE_VALUE) {

-    Private->WinNtThunk->CloseHandle (Private->NtHandle);

-    Private->NtHandle = INVALID_HANDLE_VALUE;

-  }

-

-  gBS->RestoreTPL (OldTpl);

-

-  return EFI_SUCCESS;

-}

-

-UINTN

-Atoi (

-  CHAR16  *String

-  )

-/*++

-

-Routine Description:

-

-  Convert a unicode string to a UINTN

-

-Arguments:

-

-  String - Unicode string.

-

-Returns:

-

-  UINTN of the number represented by String.

-

---*/

-{

-  UINTN   Number;

-  CHAR16  *Str;

-

-  //

-  // skip preceeding white space

-  //

-  Str = String;

-  while ((*Str) && (*Str == ' ')) {

-    Str++;

-  }

-  //

-  // Convert ot a Number

-  //

-  Number = 0;

-  while (*Str != '\0') {

-    if ((*Str >= '0') && (*Str <= '9')) {

-      Number = (Number * 10) +*Str - '0';

-    } else {

-      break;

-    }

-

-    Str++;

-  }

-

-  return Number;

-}

-

-EFI_STATUS

-SetFilePointer64 (

-  IN  WIN_NT_BLOCK_IO_PRIVATE    *Private,

-  IN  INT64                      DistanceToMove,

-  OUT UINT64                     *NewFilePointer,

-  IN  DWORD                      MoveMethod

-  )

-/*++

-

-This function extends the capability of SetFilePointer to accept 64 bit parameters

-

---*/

-// TODO: function comment is missing 'Routine Description:'

-// TODO: function comment is missing 'Arguments:'

-// TODO: function comment is missing 'Returns:'

-// TODO:    Private - add argument and description to function comment

-// TODO:    DistanceToMove - add argument and description to function comment

-// TODO:    NewFilePointer - add argument and description to function comment

-// TODO:    MoveMethod - add argument and description to function comment

-{

-  EFI_STATUS    Status;

-  LARGE_INTEGER LargeInt;

-  UINT32        ErrorCode;

-

-  LargeInt.QuadPart = DistanceToMove;

-  Status            = EFI_SUCCESS;

-

-  LargeInt.LowPart = Private->WinNtThunk->SetFilePointer (

-                                            Private->NtHandle,

-                                            LargeInt.LowPart,

-                                            &LargeInt.HighPart,

-                                            MoveMethod

-                                            );

-

-  if (LargeInt.LowPart == -1 &&

-      (ErrorCode = Private->WinNtThunk->GetLastError ()) != NO_ERROR) {

-    Status = EFI_INVALID_PARAMETER;

-  }

-

-  if (NewFilePointer != NULL) {

-    *NewFilePointer = LargeInt.QuadPart;

-  }

-

-  return Status;

-}

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.h b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.h
deleted file mode 100644
index 59d4b54..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.h
+++ /dev/null
@@ -1,471 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  WinNtBlockIo.h

-

-Abstract:

-

-  Produce block IO abstractions for real devices on your PC using Win32 APIs.

-  The configuration of what devices to mount or emulate comes from NT 

-  environment variables. The variables must be visible to the Microsoft* 

-  Developer Studio for them to work.

-

-  * Other names and brands may be claimed as the property of others.

-

---*/

-

-#ifndef _WIN_NT_BLOCK_IO_H_

-#define _WIN_NT_BLOCK_IO_H_

-

-

-

-#define FILENAME_BUFFER_SIZE  80

-

-//

-// Language supported for driverconfiguration protocol

-//

-#define LANGUAGESUPPORTED "eng"

-

-typedef enum {

-  EfiWinNtVirtualDisks,

-  EfiWinNtPhysicalDisks,

-  EifWinNtMaxTypeDisks

-} WIN_NT_RAW_DISK_DEVICE_TYPE;

-

-#define WIN_NT_BLOCK_IO_PRIVATE_SIGNATURE EFI_SIGNATURE_32 ('N', 'T', 'b', 'k')

-typedef struct {

-  UINTN                       Signature;

-

-  EFI_LOCK                    Lock;

-

-  CHAR16                      Filename[FILENAME_BUFFER_SIZE];

-  UINTN                       ReadMode;

-  UINTN                       ShareMode;

-  UINTN                       OpenMode;

-

-  HANDLE                      NtHandle;

-  WIN_NT_RAW_DISK_DEVICE_TYPE DeviceType;

-

-  UINT64                      LastBlock;

-  UINTN                       BlockSize;

-  UINT64                      NumberOfBlocks;

-

-  EFI_HANDLE                  EfiHandle;

-  EFI_BLOCK_IO_PROTOCOL       BlockIo;

-  EFI_BLOCK_IO_MEDIA          Media;

-

-  EFI_UNICODE_STRING_TABLE    *ControllerNameTable;

-

-  EFI_WIN_NT_THUNK_PROTOCOL   *WinNtThunk;

-

-} WIN_NT_BLOCK_IO_PRIVATE;

-

-#define WIN_NT_BLOCK_IO_PRIVATE_DATA_FROM_THIS(a) \

-         CR(a, WIN_NT_BLOCK_IO_PRIVATE, BlockIo, WIN_NT_BLOCK_IO_PRIVATE_SIGNATURE)

-

-#define LIST_BUFFER_SIZE  512

-

-//

-// Block I/O Global Variables

-//

-extern EFI_DRIVER_BINDING_PROTOCOL        gWinNtBlockIoDriverBinding;

-extern EFI_COMPONENT_NAME_PROTOCOL        gWinNtBlockIoComponentName;

-extern EFI_DRIVER_CONFIGURATION_PROTOCOL  gWinNtBlockIoDriverConfiguration;

-extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL    gWinNtBlockIoDriverDiagnostics;

-

-//

-// EFI Driver Binding Functions

-//

-EFI_STATUS

-EFIAPI

-WinNtBlockIoDriverBindingSupported (

-  IN EFI_DRIVER_BINDING_PROTOCOL    *This,

-  IN  EFI_HANDLE                    Handle,

-  IN  EFI_DEVICE_PATH_PROTOCOL      *RemainingDevicePath

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This                - TODO: add argument description

-  Handle              - TODO: add argument description

-  RemainingDevicePath - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-WinNtBlockIoDriverBindingStart (

-  IN EFI_DRIVER_BINDING_PROTOCOL    *This,

-  IN  EFI_HANDLE                    Handle,

-  IN  EFI_DEVICE_PATH_PROTOCOL      *RemainingDevicePath

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This                - TODO: add argument description

-  Handle              - TODO: add argument description

-  RemainingDevicePath - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-WinNtBlockIoDriverBindingStop (

-  IN  EFI_DRIVER_BINDING_PROTOCOL   *This,

-  IN  EFI_HANDLE                    Handle,

-  IN  UINTN                         NumberOfChildren,

-  IN  EFI_HANDLE                    *ChildHandleBuffer

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This              - TODO: add argument description

-  Handle            - TODO: add argument description

-  NumberOfChildren  - TODO: add argument description

-  ChildHandleBuffer - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-//

-// Block IO protocol member functions

-//

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtBlockIoReadBlocks (

-  IN EFI_BLOCK_IO_PROTOCOL  *This,

-  IN UINT32                 MediaId,

-  IN EFI_LBA                Lba,

-  IN UINTN                  BufferSize,

-  OUT VOID                  *Buffer

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This        - TODO: add argument description

-  MediaId     - TODO: add argument description

-  Lba         - TODO: add argument description

-  BufferSize  - TODO: add argument description

-  Buffer      - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtBlockIoWriteBlocks (

-  IN EFI_BLOCK_IO_PROTOCOL  *This,

-  IN UINT32                 MediaId,

-  IN EFI_LBA                Lba,

-  IN UINTN                  BufferSize,

-  IN VOID                   *Buffer

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This        - TODO: add argument description

-  MediaId     - TODO: add argument description

-  Lba         - TODO: add argument description

-  BufferSize  - TODO: add argument description

-  Buffer      - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtBlockIoFlushBlocks (

-  IN EFI_BLOCK_IO_PROTOCOL  *This

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtBlockIoResetBlock (

-  IN EFI_BLOCK_IO_PROTOCOL  *This,

-  IN BOOLEAN                ExtendedVerification

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This                  - TODO: add argument description

-  ExtendedVerification  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-//

-// Private Worker functions

-//

-STATIC

-EFI_STATUS

-WinNtBlockIoCreateMapping (

-  IN EFI_WIN_NT_IO_PROTOCOL             *WinNtIo,

-  IN EFI_HANDLE                         EfiDeviceHandle,

-  IN CHAR16                             *Filename,

-  IN BOOLEAN                            ReadOnly,

-  IN BOOLEAN                            RemovableMedia,

-  IN UINTN                              NumberOfBlocks,

-  IN UINTN                              BlockSize,

-  IN WIN_NT_RAW_DISK_DEVICE_TYPE        DeviceType

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  WinNtIo         - TODO: add argument description

-  EfiDeviceHandle - TODO: add argument description

-  Filename        - TODO: add argument description

-  ReadOnly        - TODO: add argument description

-  RemovableMedia  - TODO: add argument description

-  NumberOfBlocks  - TODO: add argument description

-  BlockSize       - TODO: add argument description

-  DeviceType      - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-EFI_STATUS

-WinNtBlockIoReadWriteCommon (

-  IN  WIN_NT_BLOCK_IO_PRIVATE *Private,

-  IN UINT32                   MediaId,

-  IN EFI_LBA                  Lba,

-  IN UINTN                    BufferSize,

-  IN VOID                     *Buffer,

-  IN CHAR8                    *CallerName

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private     - TODO: add argument description

-  MediaId     - TODO: add argument description

-  Lba         - TODO: add argument description

-  BufferSize  - TODO: add argument description

-  Buffer      - TODO: add argument description

-  CallerName  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-EFI_STATUS

-WinNtBlockIoError (

-  IN WIN_NT_BLOCK_IO_PRIVATE      *Private

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-EFI_STATUS

-WinNtBlockIoOpenDevice (

-  WIN_NT_BLOCK_IO_PRIVATE         *Private

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-CHAR16                                    *

-GetNextElementPastTerminator (

-  IN  CHAR16  *EnvironmentVariable,

-  IN  CHAR16  Terminator

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  EnvironmentVariable - TODO: add argument description

-  Terminator          - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-

-

-EFI_STATUS

-SetFilePointer64 (

-  IN  WIN_NT_BLOCK_IO_PRIVATE    *Private,

-  IN  INT64                      DistanceToMove,

-  OUT UINT64                     *NewFilePointer,

-  IN  DWORD                      MoveMethod

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private         - TODO: add argument description

-  DistanceToMove  - TODO: add argument description

-  NewFilePointer  - TODO: add argument description

-  MoveMethod      - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-UINTN

-Atoi (

-  CHAR16  *String

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  String  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-#endif

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.msa
deleted file mode 100644
index afbf8de..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.msa
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>WinNtBlockIo</ModuleName>

-    <ModuleType>UEFI_DRIVER</ModuleType>

-    <GuidValue>F479E147-A125-11d4-BCFC-0080C73C8881</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>Block Io driver</Abstract>

-    <Description>Produce block IO abstractions for real devices on your PC using Win32 APIs.

-      The configuration of what devices to mount or emulate comes from NT

-      environment variables. The variables must be visible to the Microsoft*

-      Developer Studio for them to work.</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>WinNtBlockIo</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiDriverModelLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiDriverEntryPoint</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseMemoryLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiBootServicesTableLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>MemoryAllocationLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>WinNtBlockIo.h</Filename>

-    <Filename>WinNtBlockIo.c</Filename>

-    <Filename>ComponentName.c</Filename>

-    <Filename>DriverConfiguration.c</Filename>

-    <Filename>DriverDiagnostics.c</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <Protocols>

-    <Protocol Usage="TO_START">

-      <ProtocolCName>gEfiWinNtIoProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="BY_START">

-      <ProtocolCName>gEfiBlockIoProtocolGuid</ProtocolCName>

-    </Protocol>

-  </Protocols>

-  <Guids>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiWinNtVirtualDisksGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="SOMETIMES_CONSUMED">

-      <GuidCName>gEfiWinNtPhysicalDisksGuid</GuidCName>

-    </GuidCNames>

-  </Guids>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-    <Extern>

-      <DriverBinding>gWinNtBlockIoDriverBinding</DriverBinding>

-      <ComponentName>gWinNtBlockIoComponentName</ComponentName>

-      <DriverDiag>gWinNtBlockIoDriverDiagnostics</DriverDiag>

-    </Extern>

-  </Externs>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ComponentName.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ComponentName.c
deleted file mode 100644
index 81db085..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ComponentName.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  ComponentName.c

-

-Abstract:

-

---*/

-

-#include "Console.h"

-

-//

-// EFI Component Name Functions

-//

-EFI_STATUS

-EFIAPI

-WinNtConsoleComponentNameGetDriverName (

-  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,

-  IN  CHAR8                        *Language,

-  OUT CHAR16                       **DriverName

-  );

-

-EFI_STATUS

-EFIAPI

-WinNtConsoleComponentNameGetControllerName (

-  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,

-  IN  EFI_HANDLE                                      ControllerHandle,

-  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,

-  IN  CHAR8                                           *Language,

-  OUT CHAR16                                          **ControllerName

-  );

-

-//

-// EFI Component Name Protocol

-//

-EFI_COMPONENT_NAME_PROTOCOL     gWinNtConsoleComponentName = {

-  WinNtConsoleComponentNameGetDriverName,

-  WinNtConsoleComponentNameGetControllerName,

-  "eng"

-};

-

-static EFI_UNICODE_STRING_TABLE mWinNtConsoleDriverNameTable[] = {

-  { "eng", L"Windows Text Console Driver" },

-  { NULL , NULL }

-};

-

-EFI_STATUS

-EFIAPI

-WinNtConsoleComponentNameGetDriverName (

-  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,

-  IN  CHAR8                        *Language,

-  OUT CHAR16                       **DriverName

-  )

-/*++

-

-  Routine Description:

-    Retrieves a Unicode string that is the user readable name of the EFI Driver.

-

-  Arguments:

-    This       - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.

-    Language   - A pointer to a three character ISO 639-2 language identifier.

-                 This is the language of the driver name that that the caller 

-                 is requesting, and it must match one of the languages specified

-                 in SupportedLanguages.  The number of languages supported by a 

-                 driver is up to the driver writer.

-    DriverName - A pointer to the Unicode string to return.  This Unicode string

-                 is the name of the driver specified by This in the language 

-                 specified by Language.

-

-  Returns:

-    EFI_SUCCESS           - The Unicode string for the Driver specified by This

-                            and the language specified by Language was returned 

-                            in DriverName.

-    EFI_INVALID_PARAMETER - Language is NULL.

-    EFI_INVALID_PARAMETER - DriverName is NULL.

-    EFI_UNSUPPORTED       - The driver specified by This does not support the 

-                            language specified by Language.

-

---*/

-{

-  return LookupUnicodeString (

-          Language,

-          gWinNtConsoleComponentName.SupportedLanguages,

-          mWinNtConsoleDriverNameTable,

-          DriverName

-          );

-}

-

-EFI_STATUS

-EFIAPI

-WinNtConsoleComponentNameGetControllerName (

-  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,

-  IN  EFI_HANDLE                                      ControllerHandle,

-  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,

-  IN  CHAR8                                           *Language,

-  OUT CHAR16                                          **ControllerName

-  )

-/*++

-

-  Routine Description:

-    Retrieves a Unicode string that is the user readable name of the controller

-    that is being managed by an EFI Driver.

-

-  Arguments:

-    This             - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.

-    ControllerHandle - The handle of a controller that the driver specified by 

-                       This is managing.  This handle specifies the controller 

-                       whose name is to be returned.

-    ChildHandle      - The handle of the child controller to retrieve the name 

-                       of.  This is an optional parameter that may be NULL.  It 

-                       will be NULL for device drivers.  It will also be NULL 

-                       for a bus drivers that wish to retrieve the name of the 

-                       bus controller.  It will not be NULL for a bus driver 

-                       that wishes to retrieve the name of a child controller.

-    Language         - A pointer to a three character ISO 639-2 language 

-                       identifier.  This is the language of the controller name 

-                       that that the caller is requesting, and it must match one

-                       of the languages specified in SupportedLanguages.  The 

-                       number of languages supported by a driver is up to the 

-                       driver writer.

-    ControllerName   - A pointer to the Unicode string to return.  This Unicode

-                       string is the name of the controller specified by 

-                       ControllerHandle and ChildHandle in the language specified

-                       by Language from the point of view of the driver specified

-                       by This. 

-

-  Returns:

-    EFI_SUCCESS           - The Unicode string for the user readable name in the 

-                            language specified by Language for the driver 

-                            specified by This was returned in DriverName.

-    EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.

-    EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.

-    EFI_INVALID_PARAMETER - Language is NULL.

-    EFI_INVALID_PARAMETER - ControllerName is NULL.

-    EFI_UNSUPPORTED       - The driver specified by This is not currently managing 

-                            the controller specified by ControllerHandle and 

-                            ChildHandle.

-    EFI_UNSUPPORTED       - The driver specified by This does not support the 

-                            language specified by Language.

-

---*/

-{

-  EFI_STATUS                      Status;

-  EFI_SIMPLE_TEXT_OUT_PROTOCOL    *SimpleTextOut;

-  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;

-

-  //

-  // This is a device driver, so ChildHandle must be NULL.

-  //

-  if (ChildHandle != NULL) {

-    return EFI_UNSUPPORTED;

-  }

-  //

-  // Make sure this driver is currently managing ControllerHandle

-  //

-  Status = EfiTestManagedDevice (

-             ControllerHandle,

-             gWinNtConsoleDriverBinding.DriverBindingHandle,

-             &gEfiWinNtIoProtocolGuid

-             );

-  if (EFI_ERROR (Status)) {

-    return EFI_UNSUPPORTED;

-  }

-  //

-  // Get out context back

-  //

-  Status = gBS->OpenProtocol (

-                  ControllerHandle,

-                  &gEfiSimpleTextOutProtocolGuid,

-                  &SimpleTextOut,

-                  gWinNtConsoleDriverBinding.DriverBindingHandle,

-                  ControllerHandle,

-                  EFI_OPEN_PROTOCOL_GET_PROTOCOL

-                  );

-  if (EFI_ERROR (Status)) {

-    return EFI_UNSUPPORTED;

-  }

-

-  Private = WIN_NT_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (SimpleTextOut);

-

-  return LookupUnicodeString (

-          Language,

-          gWinNtConsoleComponentName.SupportedLanguages,

-          Private->ControllerNameTable,

-          ControllerName

-          );

-}

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.c
deleted file mode 100644
index e32ffe8..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  Console.c

-

-Abstract:

-

-  Console based on Win32 APIs.

-

---*/

-

-#include "Console.h"

-

-EFI_STATUS

-EFIAPI

-WinNtConsoleDriverBindingSupported (

-  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

-  IN  EFI_HANDLE                   Handle,

-  IN  EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath

-  );

-

-EFI_STATUS

-EFIAPI

-WinNtConsoleDriverBindingStart (

-  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

-  IN  EFI_HANDLE                   Handle,

-  IN  EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath

-  );

-

-EFI_STATUS

-EFIAPI

-WinNtConsoleDriverBindingStop (

-  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

-  IN  EFI_HANDLE                   Handle,

-  IN  UINTN                        NumberOfChildren,

-  IN  EFI_HANDLE                   *ChildHandleBuffer

-  );

-

-EFI_DRIVER_BINDING_PROTOCOL gWinNtConsoleDriverBinding = {

-  WinNtConsoleDriverBindingSupported,

-  WinNtConsoleDriverBindingStart,

-  WinNtConsoleDriverBindingStop,

-  0xa,

-  NULL,

-  NULL

-};

-

-

-EFI_STATUS

-EFIAPI

-WinNtConsoleDriverBindingSupported (

-  IN  EFI_DRIVER_BINDING_PROTOCOL   *This,

-  IN  EFI_HANDLE                    Handle,

-  IN  EFI_DEVICE_PATH_PROTOCOL      *RemainingDevicePath

-  )

-/*++

-

-Routine Description:

-

-Arguments:

-

-Returns:

-

-  None

-

---*/

-// TODO:    This - add argument and description to function comment

-// TODO:    Handle - add argument and description to function comment

-// TODO:    RemainingDevicePath - add argument and description to function comment

-{

-  EFI_STATUS              Status;

-  EFI_WIN_NT_IO_PROTOCOL  *WinNtIo;

-

-  //

-  // Open the IO Abstraction(s) needed to perform the supported test

-  //

-  Status = gBS->OpenProtocol (

-                  Handle,

-                  &gEfiWinNtIoProtocolGuid,

-                  &WinNtIo,

-                  This->DriverBindingHandle,

-                  Handle,

-                  EFI_OPEN_PROTOCOL_BY_DRIVER

-                  );

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  //

-  // Make sure that the WinNt Thunk Protocol is valid

-  //

-  Status = EFI_UNSUPPORTED;

-  if (WinNtIo->WinNtThunk->Signature == EFI_WIN_NT_THUNK_PROTOCOL_SIGNATURE) {

-

-    //

-    // Check the GUID to see if this is a handle type the driver supports

-    //

-    if (CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtConsoleGuid)) {

-      Status = EFI_SUCCESS;

-    }

-  }

-

-  //

-  // Close the I/O Abstraction(s) used to perform the supported test

-  //

-  gBS->CloseProtocol (

-        Handle,

-        &gEfiWinNtIoProtocolGuid,

-        This->DriverBindingHandle,

-        Handle

-        );

-

-  return Status;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtConsoleDriverBindingStart (

-  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

-  IN  EFI_HANDLE                   Handle,

-  IN  EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath

-  )

-/*++

-

-Routine Description:

-

-Arguments:

-

-Returns:

-

-  None

-

---*/

-// TODO:    This - add argument and description to function comment

-// TODO:    Handle - add argument and description to function comment

-// TODO:    RemainingDevicePath - add argument and description to function comment

-{

-  EFI_STATUS                      Status;

-  EFI_WIN_NT_IO_PROTOCOL          *WinNtIo;

-  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;

-

-  //

-  // Grab the IO abstraction we need to get any work done

-  //

-  Status = gBS->OpenProtocol (

-                  Handle,

-                  &gEfiWinNtIoProtocolGuid,

-                  &WinNtIo,

-                  This->DriverBindingHandle,

-                  Handle,

-                  EFI_OPEN_PROTOCOL_BY_DRIVER

-                  );

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  Private = AllocatePool (sizeof (WIN_NT_SIMPLE_TEXT_PRIVATE_DATA));

-  if (Private == NULL) {

-    goto Done;

-  }

-

-  ZeroMem (Private, sizeof (WIN_NT_SIMPLE_TEXT_PRIVATE_DATA));

-

-  Private->Signature  = WIN_NT_SIMPLE_TEXT_PRIVATE_DATA_SIGNATURE;

-  Private->Handle     = Handle;

-  Private->WinNtIo    = WinNtIo;

-  Private->WinNtThunk = WinNtIo->WinNtThunk;

-

-  WinNtSimpleTextOutOpenWindow (Private);

-  WinNtSimpleTextInAttachToWindow (Private);

-

-  Status = gBS->InstallMultipleProtocolInterfaces (

-                  &Handle,

-                  &gEfiSimpleTextOutProtocolGuid,

-                  &Private->SimpleTextOut,

-                  &gEfiSimpleTextInProtocolGuid,

-                  &Private->SimpleTextIn,

-                  NULL

-                  );

-  if (!EFI_ERROR (Status)) {

-    return Status;

-  }

-

-Done:

-  gBS->CloseProtocol (

-        Handle,

-        &gEfiWinNtIoProtocolGuid,

-        This->DriverBindingHandle,

-        Handle

-        );

-  if (Private != NULL) {

-

-    FreeUnicodeStringTable (Private->ControllerNameTable);

-

-    if (Private->NtOutHandle != NULL) {

-      Private->WinNtThunk->CloseHandle (Private->NtOutHandle);

-    }

-

-    if (Private->SimpleTextIn.WaitForKey != NULL) {

-      gBS->CloseEvent (Private->SimpleTextIn.WaitForKey);

-    }

-

-    FreePool (Private);

-  }

-

-  return Status;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtConsoleDriverBindingStop (

-  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

-  IN  EFI_HANDLE                   Handle,

-  IN  UINTN                        NumberOfChildren,

-  IN  EFI_HANDLE                   *ChildHandleBuffer

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This              - TODO: add argument description

-  Handle            - TODO: add argument description

-  NumberOfChildren  - TODO: add argument description

-  ChildHandleBuffer - TODO: add argument description

-

-Returns:

-

-  EFI_UNSUPPORTED - TODO: Add description for return value

-

---*/

-{

-  EFI_SIMPLE_TEXT_OUT_PROTOCOL    *SimpleTextOut;

-  EFI_STATUS                      Status;

-  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;

-

-  //

-  // Kick people off our interface???

-  //

-  Status = gBS->OpenProtocol (

-                  Handle,

-                  &gEfiSimpleTextOutProtocolGuid,

-                  &SimpleTextOut,

-                  This->DriverBindingHandle,

-                  Handle,

-                  EFI_OPEN_PROTOCOL_GET_PROTOCOL

-                  );

-  if (EFI_ERROR (Status)) {

-    return EFI_UNSUPPORTED;

-  }

-

-  Private = WIN_NT_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (SimpleTextOut);

-

-  ASSERT (Private->Handle == Handle);

-

-  Status = gBS->UninstallMultipleProtocolInterfaces (

-                  Handle,

-                  &gEfiSimpleTextOutProtocolGuid,

-                  &Private->SimpleTextOut,

-                  &gEfiSimpleTextInProtocolGuid,

-                  &Private->SimpleTextIn,

-                  NULL

-                  );

-  if (!EFI_ERROR (Status)) {

-

-    //

-    // Shut down our device

-    //

-    Status = gBS->CloseProtocol (

-                    Handle,

-                    &gEfiWinNtIoProtocolGuid,

-                    This->DriverBindingHandle,

-                    Handle

-                    );

-

-    Status = gBS->CloseEvent (Private->SimpleTextIn.WaitForKey);

-    ASSERT_EFI_ERROR (Status);

-

-    Private->WinNtThunk->CloseHandle (Private->NtOutHandle);

-    //

-    // DO NOT close Private->NtInHandle. It points to StdIn and not

-    //  the Private->NtOutHandle is StdIn and should not be closed!

-    //

-    FreeUnicodeStringTable (Private->ControllerNameTable);

-

-    FreePool (Private);

-  }

-

-  return Status;

-}

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.h b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.h
deleted file mode 100644
index 1c8a26b..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.h
+++ /dev/null
@@ -1,512 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  Console.h

-

-Abstract:

-

-  Console based on Win32 APIs.

-

-  This file attaches a SimpleTextIn protocol to a previously open window.

-  

-  The constructor for this protocol depends on an open window. Currently

-  the SimpleTextOut protocol creates a window when it's constructor is called.

-  Thus this code must run after the constructor for the SimpleTextOut 

-  protocol

-  

---*/

-

-#ifndef _CONSOLE_H_

-#define _CONSOLE_H_

-

-

-

-#define WIN_NT_SIMPLE_TEXT_PRIVATE_DATA_SIGNATURE \

-          EFI_SIGNATURE_32('N','T','s','c')

-

-typedef struct {

-  UINT64                        Signature;

-

-  EFI_HANDLE                    Handle;

-

-  EFI_SIMPLE_TEXT_OUT_PROTOCOL  SimpleTextOut;

-  EFI_SIMPLE_TEXT_OUTPUT_MODE   SimpleTextOutMode;

-

-  EFI_WIN_NT_IO_PROTOCOL        *WinNtIo;

-  EFI_WIN_NT_THUNK_PROTOCOL     *WinNtThunk;

-

-  //

-  // SimpleTextOut Private Data including Win32 types.

-  //

-  HANDLE                        NtOutHandle;

-  HANDLE                        NtInHandle;

-

-  COORD                         MaxScreenSize;

-  COORD                         Possition;

-  WORD                          Attribute;

-  BOOLEAN                       CursorEnable;

-

-  EFI_SIMPLE_TEXT_IN_PROTOCOL   SimpleTextIn;

-

-  EFI_UNICODE_STRING_TABLE      *ControllerNameTable;

-

-} WIN_NT_SIMPLE_TEXT_PRIVATE_DATA;

-

-#define WIN_NT_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS(a) \

-         CR(a, WIN_NT_SIMPLE_TEXT_PRIVATE_DATA, SimpleTextOut, WIN_NT_SIMPLE_TEXT_PRIVATE_DATA_SIGNATURE)

-

-#define WIN_NT_SIMPLE_TEXT_IN_PRIVATE_DATA_FROM_THIS(a) \

-         CR(a, WIN_NT_SIMPLE_TEXT_PRIVATE_DATA, SimpleTextIn, WIN_NT_SIMPLE_TEXT_PRIVATE_DATA_SIGNATURE)

-

-//

-// Console Globale Variables

-//

-extern EFI_DRIVER_BINDING_PROTOCOL  gWinNtConsoleDriverBinding;

-extern EFI_COMPONENT_NAME_PROTOCOL  gWinNtConsoleComponentName;

-

-typedef struct {

-  UINTN ColumnsX;

-  UINTN RowsY;

-} WIN_NT_SIMPLE_TEXT_OUT_MODE;

-

-//

-// Simple Text Out protocol member functions

-//

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSimpleTextOutReset (

-  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL     *This,

-  IN BOOLEAN                          ExtendedVerification

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This                  - TODO: add argument description

-  ExtendedVerification  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSimpleTextOutOutputString (

-  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL   *This,

-  IN CHAR16                         *String

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This    - TODO: add argument description

-  String  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSimpleTextOutTestString (

-  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL   *This,

-  IN CHAR16                         *String

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This    - TODO: add argument description

-  String  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSimpleTextOutQueryMode (

-  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL   *This,

-  IN UINTN                          ModeNumber,

-  OUT UINTN                         *Columns,

-  OUT UINTN                         *Rows

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This        - TODO: add argument description

-  ModeNumber  - TODO: add argument description

-  Columns     - TODO: add argument description

-  Rows        - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSimpleTextOutSetMode (

-  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL   *This,

-  IN UINTN                          ModeNumber

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This        - TODO: add argument description

-  ModeNumber  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSimpleTextOutSetAttribute (

-  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL   *This,

-  IN UINTN                          Attribute

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This      - TODO: add argument description

-  Attribute - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSimpleTextOutClearScreen (

-  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL   *This

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSimpleTextOutSetCursorPosition (

-  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL   *This,

-  IN UINTN                          Column,

-  IN UINTN                          Row

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This    - TODO: add argument description

-  Column  - TODO: add argument description

-  Row     - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSimpleTextOutEnableCursor (

-  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL   *This,

-  IN BOOLEAN                        Enable

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This    - TODO: add argument description

-  Enable  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-//

-// Simple Text Out constructor and destructor.

-//

-EFI_STATUS

-WinNtSimpleTextOutOpenWindow (

-  IN OUT  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-WinNtSimpleTextOutCloseWindow (

-  IN OUT  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Console

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Console - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-//

-// Simple Text In protocol member functions.

-//

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSimpleTextInReset (

-  IN EFI_SIMPLE_TEXT_IN_PROTOCOL          *This,

-  IN BOOLEAN                              ExtendedVerification

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This                  - TODO: add argument description

-  ExtendedVerification  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSimpleTextInReadKeyStroke (

-  IN EFI_SIMPLE_TEXT_IN_PROTOCOL          *This,

-  OUT EFI_INPUT_KEY                       *Key

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This  - TODO: add argument description

-  Key   - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-VOID

-EFIAPI

-WinNtSimpleTextInWaitForKey (

-  IN EFI_EVENT          Event,

-  IN VOID               *Context

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Event   - TODO: add argument description

-  Context - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-//

-// Simple Text In constructor

-//

-EFI_STATUS

-WinNtSimpleTextInAttachToWindow (

-  IN  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-//

-// Main Entry Point

-//

-EFI_STATUS

-EFIAPI

-InitializeWinNtConsole (

-  IN EFI_HANDLE           ImageHandle,

-  IN EFI_SYSTEM_TABLE     *SystemTable

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  ImageHandle - TODO: add argument description

-  SystemTable - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-AppendDevicePathInstanceToVar (

-  IN  CHAR16                    *VariableName,

-  IN  EFI_DEVICE_PATH_PROTOCOL  *DevicePathInstance

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  VariableName        - TODO: add argument description

-  DevicePathInstance  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-#endif

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ConsoleIn.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ConsoleIn.c
deleted file mode 100644
index eaee537..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ConsoleIn.c
+++ /dev/null
@@ -1,357 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  ConsoleIn.c

-

-Abstract:

-

-  Console based on Win32 APIs.

-

-  This file attaches a SimpleTextIn protocol to a previously open window.

-

-  The constructor for this protocol depends on an open window. Currently

-  the SimpleTextOut protocol creates a window when it's constructor is called.

-  Thus this code must run after the constructor for the SimpleTextOut

-  protocol

-

---*/

-

-#include "Console.h"

-

-//

-// Private worker functions

-//

-STATIC

-EFI_STATUS

-WinNtSimpleTextInCheckKey (

-  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA  *Private

-  );

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleTextInReset (

-  IN EFI_SIMPLE_TEXT_IN_PROTOCOL          *This,

-  IN BOOLEAN                              ExtendedVerification

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This                  - TODO: add argument description

-  ExtendedVerification  - TODO: add argument description

-

-Returns:

-

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;

-

-  Private = WIN_NT_SIMPLE_TEXT_IN_PRIVATE_DATA_FROM_THIS (This);

-  return EFI_SUCCESS;

-}

-

-STATIC

-EFI_STATUS

-WinNtConvertInputRecordToEfiKey (

-  IN  INPUT_RECORD    *InputRecord,

-  OUT EFI_INPUT_KEY   *Key

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  InputRecord - TODO: add argument description

-  Key         - TODO: add argument description

-

-Returns:

-

-  EFI_NOT_READY - TODO: Add description for return value

-  EFI_NOT_READY - TODO: Add description for return value

-  EFI_NOT_READY - TODO: Add description for return value

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  //

-  // Make sure InputRecord is an event that represents a keypress

-  //

-  if (InputRecord->EventType == KEY_EVENT) {

-    if (!InputRecord->Event.KeyEvent.bKeyDown) {

-      return EFI_NOT_READY;

-    }

-  } else {

-    return EFI_NOT_READY;

-  }

-

-  //

-  // Check to see if we should return a scan code in place of Unicode character.

-  //

-  Key->ScanCode     = 0;

-  Key->UnicodeChar  = 0;

-  if ((InputRecord->Event.KeyEvent.dwControlKeyState & (NUMLOCK_ON | ENHANCED_KEY)) != NUMLOCK_ON) {

-    //

-    // Only check these scan codes if num lock is off.

-    //

-    switch (InputRecord->Event.KeyEvent.wVirtualScanCode) {

-      case 0x48: Key->ScanCode = SCAN_UP;         break;

-      case 0x50: Key->ScanCode = SCAN_DOWN;       break;

-      case 0x4d: Key->ScanCode = SCAN_RIGHT;      break;

-      case 0x4b: Key->ScanCode = SCAN_LEFT;       break;

-      case 0x47: Key->ScanCode = SCAN_HOME;       break;

-      case 0x4F: Key->ScanCode = SCAN_END;        break;

-      case 0x52: Key->ScanCode = SCAN_INSERT;     break;

-      case 0x53: Key->ScanCode = SCAN_DELETE;     break;

-      case 0x49: Key->ScanCode = SCAN_PAGE_UP;    break;

-      case 0x51: Key->ScanCode = SCAN_PAGE_DOWN;  break;

-    }

-  }

-

-  switch (InputRecord->Event.KeyEvent.wVirtualScanCode) {

-    case 0x3b: Key->ScanCode = SCAN_F1;   break;

-    case 0x3c: Key->ScanCode = SCAN_F2;   break;

-    case 0x3d: Key->ScanCode = SCAN_F3;   break;

-    case 0x3e: Key->ScanCode = SCAN_F4;   break;

-    case 0x3f: Key->ScanCode = SCAN_F5;   break;

-    case 0x40: Key->ScanCode = SCAN_F6;   break;

-    case 0x41: Key->ScanCode = SCAN_F7;   break;

-    case 0x42: Key->ScanCode = SCAN_F8;   break;

-    case 0x43: Key->ScanCode = SCAN_F9;   break;

-    case 0x44: Key->ScanCode = SCAN_F10;  break;

-    case 0x01: Key->ScanCode = SCAN_ESC;  break;

-  }

-

-  //

-  // If there's a scan code pass it, and don't pass the char code

-  //

-  if (Key->ScanCode == 0) {

-    Key->UnicodeChar = InputRecord->Event.KeyEvent.uChar.UnicodeChar;

-    if (Key->UnicodeChar == 0) {

-      return EFI_NOT_READY;

-    }

-  }

-

-  return EFI_SUCCESS;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSimpleTextInReadKeyStroke (

-  IN EFI_SIMPLE_TEXT_IN_PROTOCOL          *This,

-  OUT EFI_INPUT_KEY                       *Key

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This  - TODO: add argument description

-  Key   - TODO: add argument description

-

-Returns:

-

-  EFI_DEVICE_ERROR - TODO: Add description for return value

-  EFI_NOT_READY - TODO: Add description for return value

-

---*/

-{

-  EFI_STATUS                      Status;

-  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;

-  INPUT_RECORD                    InputRecord;

-  DWORD                           NtEventCount;

-

-  Private = WIN_NT_SIMPLE_TEXT_IN_PRIVATE_DATA_FROM_THIS (This);

-

-  Status  = WinNtSimpleTextInCheckKey (Private);

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  do {

-

-    if (!Private->WinNtThunk->ReadConsoleInput (Private->NtInHandle, &InputRecord, 1, &NtEventCount)) {

-      return EFI_DEVICE_ERROR;

-    }

-

-    if (NtEventCount == 0) {

-      return EFI_NOT_READY;

-    }

-

-    //

-    // Convert the Input Record to an EFI Keystroke.

-    //

-    Status = WinNtConvertInputRecordToEfiKey (&InputRecord, Key);

-  } while (EFI_ERROR (Status));

-

-  return Status;

-}

-

-STATIC

-VOID

-EFIAPI

-WinNtSimpleTextInWaitForKey (

-  IN EFI_EVENT          Event,

-  IN VOID               *Context

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Event   - TODO: add argument description

-  Context - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-{

-  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;

-  EFI_STATUS                      Status;

-

-  Private = (WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *) Context;

-  Status  = WinNtSimpleTextInCheckKey (Private);

-  if (!EFI_ERROR (Status)) {

-    gBS->SignalEvent (Event);

-  }

-}

-

-STATIC

-EFI_STATUS

-WinNtSimpleTextInCheckKey (

-  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA   *Private

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-{

-  INPUT_RECORD  *InputRecord;

-  DWORD         NtEventCount;

-  DWORD         ActualNtEventCount;

-  EFI_STATUS    Status;

-  BOOLEAN       Success;

-  UINTN         Index;

-  EFI_INPUT_KEY Key;

-

-  InputRecord   = NULL;

-  NtEventCount  = 0;

-  Private->WinNtThunk->GetNumberOfConsoleInputEvents (Private->NtInHandle, &NtEventCount);

-  if (NtEventCount == 0) {

-    Status = EFI_NOT_READY;

-    goto Done;

-  }

-

-  InputRecord = AllocatePool (sizeof (INPUT_RECORD) * NtEventCount);

-  if (InputRecord == NULL) {

-    Status = EFI_NOT_READY;

-    goto Done;

-  }

-

-  Success = (BOOLEAN) Private->WinNtThunk->PeekConsoleInput (

-                                            Private->NtInHandle,

-                                            InputRecord,

-                                            NtEventCount,

-                                            &ActualNtEventCount

-                                            );

-  if (!Success) {

-    Status = EFI_NOT_READY;

-    goto Done;

-  }

-

-  Status = EFI_NOT_READY;

-  for (Index = 0; Index < (UINTN) ActualNtEventCount; Index++) {

-    //

-    // Convert the Input Record to an EFI Keystroke.

-    //

-    Status = WinNtConvertInputRecordToEfiKey (&InputRecord[Index], &Key);

-    if (!EFI_ERROR (Status)) {

-      Status = EFI_SUCCESS;

-      goto Done;

-    }

-  }

-

-Done:

-  if (InputRecord != NULL) {

-    FreePool (InputRecord);

-  }

-

-  return Status;

-}

-

-EFI_STATUS

-WinNtSimpleTextInAttachToWindow (

-  IN  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-{

-  EFI_STATUS  Status;

-

-  Private->NtInHandle                 = Private->WinNtThunk->GetStdHandle (STD_INPUT_HANDLE);

-

-  Private->SimpleTextIn.Reset         = WinNtSimpleTextInReset;

-  Private->SimpleTextIn.ReadKeyStroke = WinNtSimpleTextInReadKeyStroke;

-

-  Status = gBS->CreateEvent (

-                  EVT_NOTIFY_WAIT,

-                  TPL_NOTIFY,

-                  WinNtSimpleTextInWaitForKey,

-                  Private,

-                  &Private->SimpleTextIn.WaitForKey

-                  );

-  ASSERT_EFI_ERROR (Status);

-

-  return Status;

-}

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ConsoleOut.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ConsoleOut.c
deleted file mode 100644
index cab3768..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ConsoleOut.c
+++ /dev/null
@@ -1,638 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  ConsoleOut.c

-

-Abstract:

-

-  Console based on Win32 APIs. 

-

-  This file creates an Win32 window and attaches a SimpleTextOut protocol.

-

---*/

-

-#include "Console.h"

-//

-// Private worker functions.

-//

-

-STATIC

-VOID

-WinNtSimpleTextOutScrollScreen (

-  IN OUT  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Console

-  );

-

-STATIC

-VOID

-WinNtSimpleTextOutPutChar (

-  IN OUT  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA     *Console,

-  IN      CHAR16                              Char

-  );

-

-//

-// Modeule Global for Simple Text Out Mode.

-//

-#define MAX_SIMPLE_TEXT_OUT_MODE  \

-        (sizeof(mWinNtSimpleTextOutSupportedModes)/sizeof(WIN_NT_SIMPLE_TEXT_OUT_MODE))

-

-STATIC WIN_NT_SIMPLE_TEXT_OUT_MODE  mWinNtSimpleTextOutSupportedModes[] = {

-  { 80, 25 },         

-  { 80, 50 },         

-  { 80, 43 },         

-  { 100, 100 },       

-  { 100, 999 }         

-};

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSimpleTextOutReset (

-  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL         *This,

-  IN BOOLEAN                              ExtendedVerification

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This                  - TODO: add argument description

-  ExtendedVerification  - TODO: add argument description

-

-Returns:

-

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;

-

-  Private = WIN_NT_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);

-

-  WinNtSimpleTextOutSetAttribute (This, EFI_TEXT_ATTR (This->Mode->Attribute & 0x0F, EFI_BACKGROUND_BLACK));

-

-  WinNtSimpleTextOutSetMode (This, 0);

-  return EFI_SUCCESS;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSimpleTextOutOutputString (

-  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL           *This,

-  IN CHAR16                                 *String

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This    - TODO: add argument description

-  String  - TODO: add argument description

-

-Returns:

-

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;

-  CHAR16                          *Str;

-

-  Private = WIN_NT_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);

-

-  for (Str = String; *Str != '\0'; Str++) {

-    switch (*Str) {

-    case '\n':

-      if (Private->Possition.Y == (Private->MaxScreenSize.Y - 1)) {

-        WinNtSimpleTextOutScrollScreen (Private);

-      }

-

-      if (Private->Possition.Y < (Private->MaxScreenSize.Y - 1)) {

-        Private->Possition.Y++;

-        This->Mode->CursorRow++;

-      }

-      break;

-

-    case '\r':

-      Private->Possition.X      = 0;

-      This->Mode->CursorColumn  = 0;

-      break;

-

-    case '\b':

-      if (Private->Possition.X > 0) {

-        Private->Possition.X--;

-        This->Mode->CursorColumn--;

-      }

-      break;

-

-    default:

-      WinNtSimpleTextOutPutChar (Private, *Str);

-    }

-  }

-

-  return EFI_SUCCESS;

-}

-

-STATIC

-VOID

-WinNtSimpleTextOutPutChar (

-  IN OUT  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA   *Console,

-  IN      CHAR16                            Char

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Console - TODO: add argument description

-  Char    - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-{

-  SMALL_RECT  Region;

-  COORD       StrCoordinate;

-  COORD       StrSize;

-  CHAR_INFO   CharInfo;

-  BOOL        Flag;

-

-  CharInfo.Char.UnicodeChar = Char;

-  CharInfo.Attributes       = Console->Attribute;

-

-  StrSize.X                 = 1;

-  StrSize.Y                 = 1;

-  StrCoordinate.X           = 0;

-  StrCoordinate.Y           = 0;

-

-  Region.Left               = (INT16) Console->Possition.X;

-  Region.Top                = (INT16) Console->Possition.Y;

-  Region.Right              = (INT16) (Console->Possition.X + 1);

-  Region.Bottom             = (INT16) Console->Possition.Y;

-

-  Console->WinNtThunk->WriteConsoleOutput (

-                        Console->NtOutHandle,

-                        &CharInfo,

-                        StrSize,

-                        StrCoordinate,

-                        &Region

-                        );

-

-  if (Console->Possition.X >= (Console->MaxScreenSize.X - 1)) {

-    //

-    // If you print off the end wrap around

-    //

-    Console->SimpleTextOut.OutputString (&Console->SimpleTextOut, L"\n\r");

-  } else {

-    Console->Possition.X++;

-    Console->SimpleTextOut.Mode->CursorColumn++;

-  }

-

-  Flag = Console->WinNtThunk->SetConsoleCursorPosition (Console->NtOutHandle, Console->Possition);

-}

-

-STATIC

-VOID

-WinNtSimpleTextOutScrollScreen (

-  IN OUT  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Console

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Console - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-{

-  SMALL_RECT  Scroll;

-  CHAR_INFO   CharInfo;

-  COORD       Origin;

-

-  CharInfo.Char.UnicodeChar = ' ';

-  CharInfo.Attributes       = Console->Attribute;

-

-  Origin.X                  = 0;

-  Origin.Y                  = 0;

-

-  Scroll.Top                = 1;

-  Scroll.Left               = 0;

-  Scroll.Right              = (INT16) Console->MaxScreenSize.X;

-  Scroll.Bottom             = (INT16) Console->MaxScreenSize.Y;

-

-  Console->WinNtThunk->ScrollConsoleScreenBuffer (

-                        Console->NtOutHandle,

-                        &Scroll,

-                        NULL,

-                        Origin,

-                        &CharInfo

-                        );

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSimpleTextOutTestString (

-  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL           *This,

-  IN CHAR16                                 *String

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This    - TODO: add argument description

-  String  - TODO: add argument description

-

-Returns:

-

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;

-

-  Private = WIN_NT_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);

-

-  //

-  // BugBug: The correct answer would be a function of what code pages

-  //         are currently loaded? For now we will just return success.

-  //

-  return EFI_SUCCESS;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSimpleTextOutQueryMode (

-  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL           *This,

-  IN UINTN                                  ModeNumber,

-  OUT UINTN                                 *Columns,

-  OUT UINTN                                 *Rows

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This        - TODO: add argument description

-  ModeNumber  - TODO: add argument description

-  Columns     - TODO: add argument description

-  Rows        - TODO: add argument description

-

-Returns:

-

-  EFI_INVALID_PARAMETER - TODO: Add description for return value

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;

-

-  Private = WIN_NT_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);

-

-  if (ModeNumber > MAX_SIMPLE_TEXT_OUT_MODE) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  *Columns  = mWinNtSimpleTextOutSupportedModes[ModeNumber].ColumnsX;

-  *Rows     = mWinNtSimpleTextOutSupportedModes[ModeNumber].RowsY;

-

-  return EFI_SUCCESS;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSimpleTextOutSetMode (

-  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL           *This,

-  IN UINTN                                  ModeNumber

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This        - TODO: add argument description

-  ModeNumber  - TODO: add argument description

-

-Returns:

-

-  EFI_INVALID_PARAMETER - TODO: Add description for return value

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;

-

-  Private = WIN_NT_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);

-

-  if (ModeNumber > MAX_SIMPLE_TEXT_OUT_MODE) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  Private->MaxScreenSize.X  = (WORD) mWinNtSimpleTextOutSupportedModes[ModeNumber].ColumnsX;

-  Private->MaxScreenSize.Y  = (WORD) mWinNtSimpleTextOutSupportedModes[ModeNumber].RowsY;

-

-  Private->WinNtThunk->SetConsoleScreenBufferSize (Private->NtOutHandle, Private->MaxScreenSize);

-  Private->WinNtThunk->SetConsoleActiveScreenBuffer (Private->NtOutHandle);

-

-  This->Mode->Mode = (INT32) ModeNumber;

-

-  This->EnableCursor (This, TRUE);

-  This->ClearScreen (This);

-  return EFI_SUCCESS;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSimpleTextOutSetAttribute (

-  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL   *This,

-  IN UINTN                          Attribute

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This      - TODO: add argument description

-  Attribute - TODO: add argument description

-

-Returns:

-

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;

-

-  Private               = WIN_NT_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);

-

-  Private->Attribute    = (WORD) Attribute;

-  This->Mode->Attribute = (INT32) Attribute;

-

-  return EFI_SUCCESS;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSimpleTextOutClearScreen (

-  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL   *This

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This  - TODO: add argument description

-

-Returns:

-

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;

-  DWORD                           ConsoleWindow;

-

-  Private = WIN_NT_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);

-

-  This->SetCursorPosition (This, 0, 0);

-

-  Private->WinNtThunk->FillConsoleOutputCharacter (

-                        Private->NtOutHandle,

-                        ' ',

-                        Private->MaxScreenSize.X * Private->MaxScreenSize.Y,

-                        Private->Possition,

-                        &ConsoleWindow

-                        );

-  Private->WinNtThunk->FillConsoleOutputAttribute (

-                        Private->NtOutHandle,

-                        Private->Attribute,

-                        Private->MaxScreenSize.X * Private->MaxScreenSize.Y,

-                        Private->Possition,

-                        &ConsoleWindow

-                        );

-

-  return EFI_SUCCESS;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSimpleTextOutSetCursorPosition (

-  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL           *This,

-  IN UINTN                                  Column,

-  IN UINTN                                  Row

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This    - TODO: add argument description

-  Column  - TODO: add argument description

-  Row     - TODO: add argument description

-

-Returns:

-

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;

-

-  Private                   = WIN_NT_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);

-

-  Private->Possition.X      = (WORD) Column;

-  This->Mode->CursorColumn  = (INT32) Column;

-

-  Private->Possition.Y      = (WORD) Row;

-  This->Mode->CursorRow     = (INT32) Row;

-  Private->WinNtThunk->SetConsoleCursorPosition (Private->NtOutHandle, Private->Possition);

-

-  return EFI_SUCCESS;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSimpleTextOutEnableCursor (

-  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL   *This,

-  IN BOOLEAN                        Enable

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This    - TODO: add argument description

-  Enable  - TODO: add argument description

-

-Returns:

-

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;

-  CONSOLE_CURSOR_INFO             Info;

-

-  Private                   = WIN_NT_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);

-  Private->CursorEnable     = Enable;

-  This->Mode->CursorVisible = Enable;

-

-  Private->WinNtThunk->GetConsoleCursorInfo (Private->NtOutHandle, &Info);

-  Info.bVisible = Enable;

-  Private->WinNtThunk->SetConsoleCursorInfo (Private->NtOutHandle, &Info);

-

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-WinNtSimpleTextOutOpenWindow (

-  IN OUT  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-{

-  EFI_SIMPLE_TEXT_OUT_PROTOCOL  *SimpleTextOut;

-  CHAR16                        *WindowName;

-

-  WindowName          = Private->WinNtIo->EnvString;

-  Private->Attribute  = FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY;

-  if (*WindowName == '?') {

-    Private->Attribute  = BACKGROUND_RED | FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN;

-    WindowName          = L"EFI Emulator Error Console";

-  }

-

-  AddUnicodeString (

-    "eng",

-    gWinNtConsoleComponentName.SupportedLanguages,

-    &Private->ControllerNameTable,

-    WindowName

-    );

-

-  //

-  // Fill in protocol member functions

-  //

-  SimpleTextOut                     = &Private->SimpleTextOut;

-  SimpleTextOut->Reset              = WinNtSimpleTextOutReset;

-  SimpleTextOut->OutputString       = WinNtSimpleTextOutOutputString;

-  SimpleTextOut->TestString         = WinNtSimpleTextOutTestString;

-  SimpleTextOut->QueryMode          = WinNtSimpleTextOutQueryMode;

-  SimpleTextOut->SetMode            = WinNtSimpleTextOutSetMode;

-  SimpleTextOut->SetAttribute       = WinNtSimpleTextOutSetAttribute;

-  SimpleTextOut->ClearScreen        = WinNtSimpleTextOutClearScreen;

-  SimpleTextOut->SetCursorPosition  = WinNtSimpleTextOutSetCursorPosition;

-  SimpleTextOut->EnableCursor       = WinNtSimpleTextOutEnableCursor;

-

-  //

-  // Initialize SimpleTextOut protocol mode structure

-  //

-  SimpleTextOut->Mode             = &Private->SimpleTextOutMode;

-  SimpleTextOut->Mode->MaxMode    = MAX_SIMPLE_TEXT_OUT_MODE;

-  SimpleTextOut->Mode->Attribute  = (INT32) Private->Attribute;

-

-  //

-  // Open the window an initialize it!

-  //

-  Private->NtOutHandle = Private->WinNtThunk->CreateConsoleScreenBuffer (

-                                                GENERIC_WRITE | GENERIC_READ,

-                                                FILE_SHARE_WRITE | FILE_SHARE_READ,

-                                                NULL,

-                                                CONSOLE_TEXTMODE_BUFFER,

-                                                NULL

-                                                );

-  Private->WinNtThunk->SetConsoleTitle (WindowName);

-

-  return SimpleTextOut->SetMode (SimpleTextOut, 0);

-}

-

-EFI_STATUS

-WinNtSimpleTextOutCloseWindow (

-  IN OUT  WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Console

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Console - TODO: add argument description

-

-Returns:

-

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  Console->WinNtThunk->CloseHandle (Console->NtOutHandle);

-  return EFI_SUCCESS;

-}

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/WinNtConsole.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/WinNtConsole.msa
deleted file mode 100644
index 595213e..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/WinNtConsole.msa
+++ /dev/null
@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>WinNtConsole</ModuleName>

-    <ModuleType>UEFI_DRIVER</ModuleType>

-    <GuidValue>263631d7-5836-4b74-be48-ee22e92ce5d3</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>Console Dxe driver</Abstract>

-    <Description>Simulate console with WinAPI</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>WinNtConsole</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiDriverModelLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiDriverEntryPoint</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseMemoryLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiBootServicesTableLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>MemoryAllocationLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>Console.h</Filename>

-    <Filename>Console.c</Filename>

-    <Filename>ConsoleIn.c</Filename>

-    <Filename>ConsoleOut.c</Filename>

-    <Filename>ComponentName.c</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <Protocols>

-    <Protocol Usage="TO_START">

-      <ProtocolCName>gEfiWinNtIoProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="BY_START">

-      <ProtocolCName>gEfiSimpleTextOutProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="BY_START">

-      <ProtocolCName>gEfiSimpleTextInProtocolGuid</ProtocolCName>

-    </Protocol>

-  </Protocols>

-  <Guids>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiWinNtConsoleGuid</GuidCName>

-    </GuidCNames>

-  </Guids>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-    <Extern>

-      <DriverBinding>gWinNtConsoleDriverBinding</DriverBinding>

-      <ComponentName>gWinNtConsoleComponentName</ComponentName>

-    </Extern>

-  </Externs>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/ComponentName.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/ComponentName.c
deleted file mode 100644
index 8bdf113..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/ComponentName.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/** @file
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution.  The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
-  ComponentName.c
-
-Abstract:
-
-
-**/
-
-#include "WinNtGop.h"
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-WinNtGopComponentNameGetDriverName (
-  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
-  IN  CHAR8                        *Language,
-  OUT CHAR16                       **DriverName
-  );
-
-EFI_STATUS
-EFIAPI
-WinNtGopComponentNameGetControllerName (
-  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,
-  IN  EFI_HANDLE                                      ControllerHandle,
-  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
-  IN  CHAR8                                           *Language,
-  OUT CHAR16                                          **ControllerName
-  );
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL     gWinNtGopComponentName = {
-  WinNtGopComponentNameGetDriverName,
-  WinNtGopComponentNameGetControllerName,
-  "eng"
-};
-
-static EFI_UNICODE_STRING_TABLE mWinNtGopDriverNameTable[] = {
-  { "eng", L"Windows GOP Driver" },
-  { NULL , NULL }
-};
-
-
-/**
-  Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
-  @param  This                   A pointer to the EFI_COMPONENT_NAME_PROTOCOL
-                                 instance.
-  @param  Language               A pointer to a three character ISO 639-2 language
-                                 identifier. This is the language of the driver
-                                 name that that the caller  is requesting, and it
-                                 must match one of the languages specified in
-                                 SupportedLanguages.  The number of languages
-                                 supported by a  driver is up to the driver writer.
-  @param  DriverName             A pointer to the Unicode string to return.  This
-                                 Unicode string is the name of the driver specified
-                                 by This in the language  specified by Language.
-
-  @retval EFI_SUCCESS            The Unicode string for the Driver specified by
-                                 This and the language specified by Language was
-                                 returned  in DriverName.
-  @retval EFI_INVALID_PARAMETER  Language is NULL.
-  @retval EFI_INVALID_PARAMETER  DriverName is NULL.
-  @retval EFI_UNSUPPORTED        The driver specified by This does not support the
-                                 language specified by Language.
-
-**/
-EFI_STATUS
-EFIAPI
-WinNtGopComponentNameGetDriverName (
-  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
-  IN  CHAR8                        *Language,
-  OUT CHAR16                       **DriverName
-  )
-{
-  return LookupUnicodeString (
-          Language,
-          gWinNtGopComponentName.SupportedLanguages,
-          mWinNtGopDriverNameTable,
-          DriverName
-          );
-}
-
-
-/**
-  Retrieves a Unicode string that is the user readable name of the controller
-  that is being managed by an EFI Driver.
-
-  @param  This                   A pointer to the EFI_COMPONENT_NAME_PROTOCOL
-                                 instance.
-  @param  ControllerHandle       The handle of a controller that the driver
-                                 specified by  This is managing.  This handle
-                                 specifies the controller  whose name is to be
-                                 returned.
-  @param  ChildHandle            The handle of the child controller to retrieve the
-                                 name  of.  This is an optional parameter that may
-                                 be NULL.  It  will be NULL for device drivers.  It
-                                 will also be NULL  for a bus drivers that wish to
-                                 retrieve the name of the  bus controller.  It will
-                                 not be NULL for a bus driver  that wishes to
-                                 retrieve the name of a child controller.
-  @param  Language               A pointer to a three character ISO 639-2 language
-                                 identifier.  This is the language of the
-                                 controller name  that that the caller is
-                                 requesting, and it must match one of the languages
-                                 specified in SupportedLanguages.  The  number of
-                                 languages supported by a driver is up to the
-                                 driver writer.
-  @param  ControllerName         A pointer to the Unicode string to return.  This
-                                 Unicode string is the name of the controller
-                                 specified by  ControllerHandle and ChildHandle in
-                                 the language specified by Language from the point
-                                 of view of the driver specified by This.
-
-  @retval EFI_SUCCESS            The Unicode string for the user readable name in
-                                 the  language specified by Language for the driver
-                                  specified by This was returned in DriverName.
-  @retval EFI_INVALID_PARAMETER  ControllerHandle is not a valid EFI_HANDLE.
-  @retval EFI_INVALID_PARAMETER  ChildHandle is not NULL and it is not a valid
-                                 EFI_HANDLE.
-  @retval EFI_INVALID_PARAMETER  Language is NULL.
-  @retval EFI_INVALID_PARAMETER  ControllerName is NULL.
-  @retval EFI_UNSUPPORTED        The driver specified by This is not currently
-                                 managing  the controller specified by
-                                 ControllerHandle and  ChildHandle.
-  @retval EFI_UNSUPPORTED        The driver specified by This does not support the
-                                 language specified by Language.
-
-**/
-EFI_STATUS
-EFIAPI
-WinNtGopComponentNameGetControllerName (
-  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,
-  IN  EFI_HANDLE                                      ControllerHandle,
-  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
-  IN  CHAR8                                           *Language,
-  OUT CHAR16                                          **ControllerName
-  )
-{
-  EFI_STATUS                   Status;
-  EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
-  GOP_PRIVATE_DATA             *Private;
-
-  //
-  // This is a device driver, so ChildHandle must be NULL.
-  //
-  if (ChildHandle != NULL) {
-    return EFI_UNSUPPORTED;
-  }
-  //

-  // Make sure this driver is currently managing ControllerHandle

-  //

-  Status = EfiTestManagedDevice (

-             ControllerHandle,

-             gWinNtGopDriverBinding.DriverBindingHandle,

-             &gEfiWinNtIoProtocolGuid

-             );

-  if (EFI_ERROR (Status)) {

-    return EFI_UNSUPPORTED;

-  }

-  //

-  // Get our context back
-  //
-  Status = gBS->OpenProtocol (
-                  ControllerHandle,
-                  &gEfiGraphicsOutputProtocolGuid,
-                  &GraphicsOutput,
-                  gWinNtGopDriverBinding.DriverBindingHandle,
-                  ControllerHandle,
-                  EFI_OPEN_PROTOCOL_GET_PROTOCOL
-                  );
-  if (EFI_ERROR (Status)) {
-    return EFI_UNSUPPORTED;
-  }
-
-  Private = GOP_PRIVATE_DATA_FROM_THIS (GraphicsOutput);
-
-  return LookupUnicodeString (
-          Language,
-          gWinNtGopComponentName.SupportedLanguages,
-          Private->ControllerNameTable,
-          ControllerName
-          );
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.h b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.h
deleted file mode 100644
index b1341cb..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.h
+++ /dev/null
@@ -1,321 +0,0 @@
-/** @file
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution.  The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
-  WinNtGop.h
-
-Abstract:
-
-  Private data for the Gop driver that is bound to the WinNt Thunk protocol
-
-
-**/
-
-#ifndef _WIN_NT_GOP_H_
-#define _WIN_NT_GOP_H_
-
-//@MT:#include "EfiWinNT.h"
-//@MT:#include "Tiano.h"
-//@MT:#include "EfiDriverLib.h"
-
-//
-// Driver Consumed Protocols
-//
-//@MT:#include EFI_PROTOCOL_DEFINITION (DevicePath)
-//@MT:#include EFI_PROTOCOL_DEFINITION (WinNtIo)
-
-//
-// Driver Produced Protocols
-//
-//@MT:#include EFI_PROTOCOL_DEFINITION (DriverBinding)
-//@MT:#include EFI_PROTOCOL_DEFINITION (ComponentName)
-//@MT:#include EFI_PROTOCOL_DEFINITION (GraphicsOutput)
-//@MT:#include "LinkedList.h"
-
-#define MAX_Q 256
-
-typedef struct {
-  UINTN         Front;
-  UINTN         Rear;
-  UINTN         Count;
-  EFI_INPUT_KEY Q[MAX_Q];
-} GOP_QUEUE_FIXED;
-
-#define WIN_NT_GOP_CLASS_NAME       L"WinNtGopWindow"
-
-#define GOP_PRIVATE_DATA_SIGNATURE  EFI_SIGNATURE_32 ('S', 'g', 'o', 'N')
-
-#define GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER 0xffff
-
-typedef struct {
-  UINT32                     HorizontalResolution;
-  UINT32                     VerticalResolution;
-  UINT32                     ColorDepth;
-  UINT32                     RefreshRate;
-} GOP_MODE_DATA;
-
-typedef struct {
-  UINT64                        Signature;
-
-  EFI_HANDLE                    Handle;
-  EFI_GRAPHICS_OUTPUT_PROTOCOL  GraphicsOutput;
-  EFI_SIMPLE_TEXT_IN_PROTOCOL   SimpleTextIn;
-
-  EFI_WIN_NT_THUNK_PROTOCOL     *WinNtThunk;
-
-  EFI_UNICODE_STRING_TABLE      *ControllerNameTable;
-
-  //
-  // GOP Private Data for QueryMode ()
-  //
-  GOP_MODE_DATA                 *ModeData;
-
-  //
-  // GOP Private Data knowing when to start hardware
-  //
-  BOOLEAN                       HardwareNeedsStarting;
-
-  CHAR16                        *WindowName;
-  CHAR16                        Buffer[160];
-
-  HANDLE                        ThreadInited; // Semaphore
-  HANDLE                        ThreadHandle; // Thread
-  DWORD                         ThreadId;
-
-  HWND                          WindowHandle;
-  WNDCLASSEX                    WindowsClass;
-
-  //
-  // This screen is used to redraw the scree when windows events happen. It's
-  // updated in the main thread and displayed in the windows thread.
-  //
-  BITMAPV4HEADER                *VirtualScreenInfo;
-  RGBQUAD                       *VirtualScreen;
-
-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL *FillLine;
-
-  //
-  // Keyboard Queue used by Simple Text In. WinProc thread adds, and main
-  // thread removes.
-  //
-  CRITICAL_SECTION              QCriticalSection;
-  GOP_QUEUE_FIXED               Queue;
-
-} GOP_PRIVATE_DATA;
-
-#define GOP_PRIVATE_DATA_FROM_THIS(a)  \
-         CR(a, GOP_PRIVATE_DATA, GraphicsOutput, GOP_PRIVATE_DATA_SIGNATURE)
-
-#define GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS(a)  \
-         CR(a, GOP_PRIVATE_DATA, SimpleTextIn, GOP_PRIVATE_DATA_SIGNATURE)
-
-//
-// Global Protocol Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL  gWinNtGopDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL  gWinNtGopComponentName;
-
-//
-// Gop Hardware abstraction internal worker functions
-//
-
-/**
-  TODO: Add function description
-
-  @param  WinNtIo              TODO: add argument description
-
-  @return TODO: add return values
-
-**/
-EFI_STATUS
-WinNtGopSupported (
-  IN  EFI_WIN_NT_IO_PROTOCOL  *WinNtIo
-  )
-;
-
-
-/**
-  TODO: Add function description
-
-  @param  Private              TODO: add argument description
-
-  @return TODO: add return values
-
-**/
-EFI_STATUS
-WinNtGopConstructor (
-  IN  GOP_PRIVATE_DATA    *Private
-  )
-;
-
-
-/**
-  TODO: Add function description
-
-  @param  Private              TODO: add argument description
-
-  @return TODO: add return values
-
-**/
-EFI_STATUS
-WinNtGopDestructor (
-  IN  GOP_PRIVATE_DATA    *Private
-  )
-;
-
-//
-// EFI 1.1 driver model prototypes for Win NT GOP
-//
-
-
-/**
-  TODO: Add function description
-
-  @param  ImageHandle          TODO: add argument description
-  @param  SystemTable          TODO: add argument description
-
-  @return TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-WinNtGopInitialize (
-  IN EFI_HANDLE            ImageHandle,
-  IN EFI_SYSTEM_TABLE      *SystemTable
-  )
-;
-
-
-/**
-  TODO: Add function description
-
-  @param  This                 TODO: add argument description
-  @param  Handle               TODO: add argument description
-  @param  RemainingDevicePath  TODO: add argument description
-
-  @return TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-WinNtGopDriverBindingSupported (
-  IN  EFI_DRIVER_BINDING_PROTOCOL     *This,
-  IN  EFI_HANDLE                      Handle,
-  IN  EFI_DEVICE_PATH_PROTOCOL        *RemainingDevicePath
-  )
-;
-
-
-/**
-  TODO: Add function description
-
-  @param  This                 TODO: add argument description
-  @param  Handle               TODO: add argument description
-  @param  RemainingDevicePath  TODO: add argument description
-
-  @return TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-WinNtGopDriverBindingStart (
-  IN  EFI_DRIVER_BINDING_PROTOCOL     *This,
-  IN  EFI_HANDLE                      Handle,
-  IN  EFI_DEVICE_PATH_PROTOCOL        *RemainingDevicePath
-  )
-;
-
-
-/**
-  TODO: Add function description
-
-  @param  This                 TODO: add argument description
-  @param  Handle               TODO: add argument description
-  @param  NumberOfChildren     TODO: add argument description
-  @param  ChildHandleBuffer    TODO: add argument description
-
-  @return TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-WinNtGopDriverBindingStop (
-  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,
-  IN  EFI_HANDLE                   Handle,
-  IN  UINTN                        NumberOfChildren,
-  IN  EFI_HANDLE                   *ChildHandleBuffer
-  )
-;
-
-
-/**
-  TODO: Add function description
-
-  @param  Private              TODO: add argument description
-  @param  Key                  TODO: add argument description
-
-  @return TODO: add return values
-
-**/
-EFI_STATUS
-GopPrivateAddQ (
-  IN  GOP_PRIVATE_DATA    *Private,
-  IN  EFI_INPUT_KEY       Key
-  )
-;
-
-
-/**
-  TODO: Add function description
-
-  @param  Private              TODO: add argument description
-
-  @return TODO: add return values
-
-**/
-EFI_STATUS
-WinNtGopInitializeSimpleTextInForWindow (
-  IN  GOP_PRIVATE_DATA    *Private
-  )
-;
-
-
-/**
-  TODO: Add function description
-
-  @param  Private              TODO: add argument description
-
-  @return TODO: add return values
-
-**/
-EFI_STATUS
-WinNtGopDestroySimpleTextInForWindow (
-  IN  GOP_PRIVATE_DATA    *Private
-  )
-;
-
-
-/**
-  TODO: Add function description
-
-  @param  String               TODO: add argument description
-
-  @return TODO: add return values
-
-**/
-UINTN
-Atoi (
-  IN  CHAR16  *String
-  )
-;
-
-#endif
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.msa
deleted file mode 100644
index 3874252..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.msa
+++ /dev/null
@@ -1,95 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>WinNtGop</ModuleName>

-    <ModuleType>UEFI_DRIVER</ModuleType>

-    <GuidValue>29b3c4c6-e5aa-49e4-8ce0-2772f782ddc2</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>Gop Driver</Abstract>

-    <Description>GOP is short hand for UEFI Graphics Output protocol.

-      This file is a verision of GopIo the uses WinNtThunk system calls as an IO

-      abstraction. For a PCI device WinNtIo would be replaced with

-      a PCI IO abstraction that abstracted a specific PCI device.</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>WinNtGop</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiDriverModelLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiDriverEntryPoint</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseMemoryLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiBootServicesTableLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>MemoryAllocationLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>WinNtGopScreen.c</Filename>

-    <Filename>WinNtGopInput.c</Filename>

-    <Filename>WinNtGop.h</Filename>

-    <Filename>ComponentName.c</Filename>

-    <Filename>WinNtGopDriver.c</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <Protocols>

-    <Protocol Usage="TO_START">

-      <ProtocolCName>gEfiWinNtIoProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="BY_START">

-      <ProtocolCName>gEfiSimpleTextInProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="BY_START">

-      <ProtocolCName>gEfiGraphicsOutputProtocolGuid</ProtocolCName>

-    </Protocol>

-  </Protocols>

-  <Events>

-    <CreateEvents>

-      <EventTypes EventGuidCName="gEfiEventExitBootServicesGuid" Usage="SOMETIMES_CONSUMED">

-        <EventType>EVENT_GROUP_GUID</EventType>

-      </EventTypes>

-    </CreateEvents>

-  </Events>

-  <Guids>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiWinNtGopGuid</GuidCName>

-    </GuidCNames>

-  </Guids>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-    <Extern>

-      <DriverBinding>gWinNtGopDriverBinding</DriverBinding>

-      <ComponentName>gWinNtGopComponentName</ComponentName>

-    </Extern>

-  </Externs>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopDriver.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopDriver.c
deleted file mode 100644
index bf2abc4..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopDriver.c
+++ /dev/null
@@ -1,316 +0,0 @@
-/** @file
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution.  The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
-  WinNtGopDriver.c
-
-Abstract:
-
-  This file implements the UEFI Device Driver model requirements for GOP
-
-  GOP is short hand for Graphics Output Protocol.
-
-
-**/
-
-#include "WinNtGop.h"
-
-EFI_DRIVER_BINDING_PROTOCOL gWinNtGopDriverBinding = {
-  WinNtGopDriverBindingSupported,
-  WinNtGopDriverBindingStart,
-  WinNtGopDriverBindingStop,
-  0xa,
-  NULL,
-  NULL
-};
-
-/**
-
-
-  @return None
-
-**/
-// TODO:    This - add argument and description to function comment
-// TODO:    Handle - add argument and description to function comment
-// TODO:    RemainingDevicePath - add argument and description to function comment
-EFI_STATUS
-EFIAPI
-WinNtGopDriverBindingSupported (
-  IN  EFI_DRIVER_BINDING_PROTOCOL     *This,
-  IN  EFI_HANDLE                      Handle,
-  IN  EFI_DEVICE_PATH_PROTOCOL        *RemainingDevicePath
-  )
-{
-  EFI_STATUS              Status;
-  EFI_WIN_NT_IO_PROTOCOL  *WinNtIo;
-
-  //
-  // Open the IO Abstraction(s) needed to perform the supported test
-  //
-  Status = gBS->OpenProtocol (
-                  Handle,
-                  &gEfiWinNtIoProtocolGuid,
-                  &WinNtIo,
-                  This->DriverBindingHandle,
-                  Handle,
-                  EFI_OPEN_PROTOCOL_BY_DRIVER
-                  );
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
-  Status = WinNtGopSupported (WinNtIo);
-
-  //
-  // Close the I/O Abstraction(s) used to perform the supported test
-  //
-  gBS->CloseProtocol (
-        Handle,
-        &gEfiWinNtIoProtocolGuid,
-        This->DriverBindingHandle,
-        Handle
-        );
-
-  return Status;
-}
-
-
-/**
-
-
-  @return None
-
-**/
-// TODO:    This - add argument and description to function comment
-// TODO:    Handle - add argument and description to function comment
-// TODO:    RemainingDevicePath - add argument and description to function comment
-// TODO:    EFI_UNSUPPORTED - add return value to function comment
-EFI_STATUS
-EFIAPI
-WinNtGopDriverBindingStart (
-  IN  EFI_DRIVER_BINDING_PROTOCOL     *This,
-  IN  EFI_HANDLE                      Handle,
-  IN  EFI_DEVICE_PATH_PROTOCOL        *RemainingDevicePath
-  )
-{
-  EFI_WIN_NT_IO_PROTOCOL  *WinNtIo;
-  EFI_STATUS              Status;
-  GOP_PRIVATE_DATA        *Private;
-
-  //
-  // Grab the protocols we need
-  //
-  Status = gBS->OpenProtocol (
-                  Handle,
-                  &gEfiWinNtIoProtocolGuid,
-                  &WinNtIo,
-                  This->DriverBindingHandle,
-                  Handle,
-                  EFI_OPEN_PROTOCOL_BY_DRIVER
-                  );
-  if (EFI_ERROR (Status)) {
-    return EFI_UNSUPPORTED;
-  }
-
-  //
-  // Allocate Private context data for SGO inteface.
-  //
-  Private = NULL;
-  Private = AllocatePool (sizeof (GOP_PRIVATE_DATA));
-  if (Private == NULL) {
-    goto Done;
-  }
-  //
-  // Set up context record
-  //
-  Private->Signature            = GOP_PRIVATE_DATA_SIGNATURE;
-  Private->Handle               = Handle;
-  Private->WinNtThunk           = WinNtIo->WinNtThunk;
-
-  Private->ControllerNameTable  = NULL;
-
-  AddUnicodeString (
-    "eng",
-    gWinNtGopComponentName.SupportedLanguages,
-    &Private->ControllerNameTable,
-    WinNtIo->EnvString
-    );
-
-  Private->WindowName = WinNtIo->EnvString;
-
-  Status              = WinNtGopConstructor (Private);
-  if (EFI_ERROR (Status)) {
-    goto Done;
-  }
-  //
-  // Publish the Gop interface to the world
-  //
-  Status = gBS->InstallMultipleProtocolInterfaces (
-                  &Private->Handle,
-                  &gEfiGraphicsOutputProtocolGuid,
-                  &Private->GraphicsOutput,
-                  &gEfiSimpleTextInProtocolGuid,
-                  &Private->SimpleTextIn,
-                  NULL
-                  );
-
-Done:
-  if (EFI_ERROR (Status)) {
-
-    gBS->CloseProtocol (
-          Handle,
-          &gEfiWinNtIoProtocolGuid,
-          This->DriverBindingHandle,
-          Handle
-          );
-
-    if (Private != NULL) {
-      //
-      // On Error Free back private data
-      //
-      if (Private->ControllerNameTable != NULL) {
-        FreeUnicodeStringTable (Private->ControllerNameTable);
-      }
-
-      FreePool (Private);
-    }
-  }
-
-  return Status;
-}
-
-
-/**
-
-
-  @return None
-
-**/
-// TODO:    This - add argument and description to function comment
-// TODO:    Handle - add argument and description to function comment
-// TODO:    NumberOfChildren - add argument and description to function comment
-// TODO:    ChildHandleBuffer - add argument and description to function comment
-// TODO:    EFI_NOT_STARTED - add return value to function comment
-// TODO:    EFI_DEVICE_ERROR - add return value to function comment
-EFI_STATUS
-EFIAPI
-WinNtGopDriverBindingStop (
-  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,
-  IN  EFI_HANDLE                   Handle,
-  IN  UINTN                        NumberOfChildren,
-  IN  EFI_HANDLE                   *ChildHandleBuffer
-  )
-{
-  EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
-  EFI_STATUS                   Status;
-  GOP_PRIVATE_DATA             *Private;
-
-  Status = gBS->OpenProtocol (
-                  Handle,
-                  &gEfiGraphicsOutputProtocolGuid,
-                  &GraphicsOutput,
-                  This->DriverBindingHandle,
-                  Handle,
-                  EFI_OPEN_PROTOCOL_GET_PROTOCOL
-                  );
-  if (EFI_ERROR (Status)) {
-    //
-    // If the GOP interface does not exist the driver is not started
-    //
-    return EFI_NOT_STARTED;
-  }
-
-  //
-  // Get our private context information
-  //
-  Private = GOP_PRIVATE_DATA_FROM_THIS (GraphicsOutput);
-
-  //
-  // Remove the SGO interface from the system
-  //
-  Status = gBS->UninstallMultipleProtocolInterfaces (
-                  Private->Handle,
-                  &gEfiGraphicsOutputProtocolGuid,
-                  &Private->GraphicsOutput,
-                  &gEfiSimpleTextInProtocolGuid,
-                  &Private->SimpleTextIn,
-                  NULL
-                  );
-  if (!EFI_ERROR (Status)) {
-    //
-    // Shutdown the hardware
-    //
-    Status = WinNtGopDestructor (Private);
-    if (EFI_ERROR (Status)) {
-      return EFI_DEVICE_ERROR;
-    }
-
-    gBS->CloseProtocol (
-          Handle,
-          &gEfiWinNtIoProtocolGuid,
-          This->DriverBindingHandle,
-          Handle
-          );
-
-    //
-    // Free our instance data
-    //
-    FreeUnicodeStringTable (Private->ControllerNameTable);
-
-    FreePool (Private);
-
-  }
-
-  return Status;
-}
-
-
-/**
-  Convert a unicode string to a UINTN
-
-  @param  String  Unicode string.
-
-  @return UINTN of the number represented by String.
-
-**/
-UINTN
-Atoi (
-  CHAR16  *String
-  )
-{
-  UINTN   Number;
-  CHAR16  *Str;
-
-  //
-  // skip preceeding white space
-  //
-  Str = String;
-  while ((*Str) && (*Str == ' ' || *Str == '"')) {
-    Str++;
-  }
-
-  //
-  // Convert ot a Number
-  //
-  Number = 0;
-  while (*Str != '\0') {
-    if ((*Str >= '0') && (*Str <= '9')) {
-      Number = (Number * 10) +*Str - '0';
-    } else {
-      break;
-    }
-
-    Str++;
-  }
-
-  return Number;
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopInput.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopInput.c
deleted file mode 100644
index 385e32f..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopInput.c
+++ /dev/null
@@ -1,352 +0,0 @@
-/** @file
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution.  The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
-  WinNtGopInput.c
-
-Abstract:
-
-  This file produces the Simple Text In for an Gop window.
-
-  This stuff is linked at the hip to the Window, since the window
-  processing is done in a thread kicked off in WinNtGopImplementation.c
-
-  Since the window information is processed in an other thread we need
-  a keyboard Queue to pass data about. The Simple Text In code just
-  takes data off the Queue. The WinProc message loop takes keyboard input
-  and places it in the Queue.
-
-
-**/
-
-#include "WinNtGop.h"
-
-
-/**
-  TODO: Add function description
-
-  @param  Private               TODO: add argument description
-
-  @retval EFI_SUCCESS           TODO: Add description for return value
-
-**/
-EFI_STATUS
-GopPrivateCreateQ (
-  IN  GOP_PRIVATE_DATA    *Private
-  )
-{
-  Private->WinNtThunk->InitializeCriticalSection (&Private->QCriticalSection);
-
-  Private->Queue.Front  = 0;
-  Private->Queue.Rear   = MAX_Q - 1;
-  Private->Queue.Count  = 0;
-  return EFI_SUCCESS;
-}
-
-
-/**
-  TODO: Add function description
-
-  @param  Private               TODO: add argument description
-
-  @retval EFI_SUCCESS           TODO: Add description for return value
-
-**/
-EFI_STATUS
-GopPrivateDestroyQ (
-  IN  GOP_PRIVATE_DATA    *Private
-  )
-{
-  Private->Queue.Count = 0;
-  Private->WinNtThunk->DeleteCriticalSection (&Private->QCriticalSection);
-  return EFI_SUCCESS;
-}
-
-
-/**
-  TODO: Add function description
-
-  @param  Private               TODO: add argument description
-  @param  Key                   TODO: add argument description
-
-  @retval EFI_NOT_READY         TODO: Add description for return value
-  @retval EFI_SUCCESS           TODO: Add description for return value
-
-**/
-EFI_STATUS
-GopPrivateAddQ (
-  IN  GOP_PRIVATE_DATA    *Private,
-  IN  EFI_INPUT_KEY       Key
-  )
-{
-  Private->WinNtThunk->EnterCriticalSection (&Private->QCriticalSection);
-
-  if (Private->Queue.Count == MAX_Q) {
-    Private->WinNtThunk->LeaveCriticalSection (&Private->QCriticalSection);
-    return EFI_NOT_READY;
-  }
-
-  Private->Queue.Rear                   = (Private->Queue.Rear + 1) % MAX_Q;
-  Private->Queue.Q[Private->Queue.Rear] = Key;
-  Private->Queue.Count++;
-
-  Private->WinNtThunk->LeaveCriticalSection (&Private->QCriticalSection);
-  return EFI_SUCCESS;
-}
-
-
-/**
-  TODO: Add function description
-
-  @param  Private               TODO: add argument description
-  @param  Key                   TODO: add argument description
-
-  @retval EFI_NOT_READY         TODO: Add description for return value
-  @retval EFI_SUCCESS           TODO: Add description for return value
-
-**/
-EFI_STATUS
-GopPrivateDeleteQ (
-  IN  GOP_PRIVATE_DATA    *Private,
-  OUT EFI_INPUT_KEY       *Key
-  )
-{
-  Private->WinNtThunk->EnterCriticalSection (&Private->QCriticalSection);
-
-  if (Private->Queue.Count == 0) {
-    Private->WinNtThunk->LeaveCriticalSection (&Private->QCriticalSection);
-    return EFI_NOT_READY;
-  }
-
-  *Key                  = Private->Queue.Q[Private->Queue.Front];
-  Private->Queue.Front  = (Private->Queue.Front + 1) % MAX_Q;
-  Private->Queue.Count--;
-
-  Private->WinNtThunk->LeaveCriticalSection (&Private->QCriticalSection);
-  return EFI_SUCCESS;
-}
-
-
-/**
-  TODO: Add function description
-
-  @param  Private               TODO: add argument description
-
-  @retval EFI_NOT_READY         TODO: Add description for return value
-  @retval EFI_SUCCESS           TODO: Add description for return value
-
-**/
-EFI_STATUS
-GopPrivateCheckQ (
-  IN  GOP_PRIVATE_DATA    *Private
-  )
-{
-  if (Private->Queue.Count == 0) {
-    return EFI_NOT_READY;
-  }
-
-  return EFI_SUCCESS;
-}
-
-//
-// Simple Text In implementation.
-//
-
-
-/**
-  TODO: Add function description
-
-  @param  This                  TODO: add argument description
-  @param  ExtendedVerification  TODO: add argument description
-
-  @retval EFI_SUCCESS           TODO: Add description for return value
-
-**/
-EFI_STATUS
-EFIAPI
-WinNtGopSimpleTextInReset (
-  IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL          *This,
-  IN BOOLEAN                              ExtendedVerification
-  )
-{
-  GOP_PRIVATE_DATA  *Private;
-  EFI_INPUT_KEY     Key;
-  EFI_TPL           OldTpl;
-
-  Private = GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS (This);
-
-  //
-  // Enter critical section
-  //
-  OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
-  //
-  // A reset is draining the Queue
-  //
-  while (GopPrivateDeleteQ (Private, &Key) == EFI_SUCCESS)
-    ;
-
-  //
-  // Leave critical section and return
-  //
-  gBS->RestoreTPL (OldTpl);
-  return EFI_SUCCESS;
-}
-
-
-/**
-  TODO: Add function description
-
-  @param  This                  TODO: add argument description
-  @param  Key                   TODO: add argument description
-
-  @return TODO: add return values
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtGopSimpleTextInReadKeyStroke (
-  IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL          *This,
-  OUT EFI_INPUT_KEY                       *Key
-  )
-{
-  GOP_PRIVATE_DATA  *Private;
-  EFI_STATUS        Status;
-  EFI_TPL           OldTpl;
-
-  Private = GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS (This);
-
-  //
-  // Enter critical section
-  //
-  OldTpl  = gBS->RaiseTPL (TPL_NOTIFY);
-
-  Status  = GopPrivateCheckQ (Private);
-  if (!EFI_ERROR (Status)) {
-    //
-    // If a Key press exists try and read it.
-    //
-    Status = GopPrivateDeleteQ (Private, Key);
-  }
-
-  //
-  // Leave critical section and return
-  //
-  gBS->RestoreTPL (OldTpl);
-
-  return Status;
-}
-
-
-/**
-  TODO: Add function description
-
-  @param  Event                 TODO: add argument description
-  @param  Context               TODO: add argument description
-
-  @return TODO: add return values
-
-**/
-STATIC
-VOID
-EFIAPI
-WinNtGopSimpleTextInWaitForKey (
-  IN EFI_EVENT          Event,
-  IN VOID               *Context
-  )
-{
-  GOP_PRIVATE_DATA  *Private;
-  EFI_STATUS        Status;
-  EFI_TPL           OldTpl;
-
-  Private = (GOP_PRIVATE_DATA *) Context;
-
-  //
-  // Enter critical section
-  //
-  OldTpl  = gBS->RaiseTPL (TPL_NOTIFY);
-
-  Status  = GopPrivateCheckQ (Private);
-  if (!EFI_ERROR (Status)) {
-    //
-    // If a there is a key in the queue signal our event.
-    //
-    gBS->SignalEvent (Event);
-  } else {
-    //
-    // We need to sleep or NT will schedule this thread with such high
-    // priority that WinProc thread will never run and we will not see
-    // keyboard input. This Sleep makes the syste run 10x faster, so don't
-    // remove it.
-    //
-    Private->WinNtThunk->Sleep (1);
-  }
-
-  //
-  // Leave critical section and return
-  //
-  gBS->RestoreTPL (OldTpl);
-}
-
-
-/**
-  TODO: Add function description
-
-  @param  Private               TODO: add argument description
-
-  @return TODO: add return values
-
-**/
-EFI_STATUS
-WinNtGopInitializeSimpleTextInForWindow (
-  IN  GOP_PRIVATE_DATA    *Private
-  )
-{
-  EFI_STATUS  Status;
-
-  GopPrivateCreateQ (Private);
-
-  //
-  // Initialize Simple Text In protoocol
-  //
-  Private->SimpleTextIn.Reset         = WinNtGopSimpleTextInReset;
-  Private->SimpleTextIn.ReadKeyStroke = WinNtGopSimpleTextInReadKeyStroke;
-
-  Status = gBS->CreateEvent (
-                  EVT_NOTIFY_WAIT,
-                  TPL_NOTIFY,
-                  WinNtGopSimpleTextInWaitForKey,
-                  Private,
-                  &Private->SimpleTextIn.WaitForKey
-                  );
-
-  return Status;
-}
-
-
-/**
-  TODO: Add function description
-
-  @param  Private               TODO: add argument description
-
-  @retval EFI_SUCCESS           TODO: Add description for return value
-
-**/
-EFI_STATUS
-WinNtGopDestroySimpleTextInForWindow (
-  IN  GOP_PRIVATE_DATA    *Private
-  )
-{
-  GopPrivateDestroyQ (Private);
-  return EFI_SUCCESS;
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopScreen.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopScreen.c
deleted file mode 100644
index 1923c34..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopScreen.c
+++ /dev/null
@@ -1,996 +0,0 @@
-/** @file
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution.  The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
-    WinNtGopScreen.c
-
-Abstract:
-
-  This file produces the graphics abstration of GOP. It is called by
-  WinNtGopDriver.c file which deals with the EFI 1.1 driver model.
-  This file just does graphics.
-
-
-**/
-
-#include "WinNtGop.h"
-
-EFI_WIN_NT_THUNK_PROTOCOL *mWinNt;
-DWORD                     mTlsIndex         = TLS_OUT_OF_INDEXES;
-DWORD                     mTlsIndexUseCount = 0;  // lets us know when we can free mTlsIndex.
-static EFI_EVENT          mGopScreenExitBootServicesEvent;
-GOP_MODE_DATA mGopModeData[] = {
-    {800, 600, 0, 0},
-    {640, 480, 0, 0},
-    {720, 400, 0, 0},
-    {1024, 768, 0, 0},
-    {1280, 1024, 0, 0}
-    };
-
-EFI_STATUS
-WinNtGopStartWindow (
-  IN  GOP_PRIVATE_DATA    *Private,
-  IN  UINT32              HorizontalResolution,
-  IN  UINT32              VerticalResolution,
-  IN  UINT32              ColorDepth,
-  IN  UINT32              RefreshRate
-  );
-
-STATIC
-VOID
-EFIAPI
-KillNtGopThread (
-  IN EFI_EVENT  Event,
-  IN VOID       *Context
-  );
-
-//
-// GOP Protocol Member Functions
-//
-
-
-/**
-  Graphics Output protocol interface to get video mode
-
-  @param  This                   Protocol instance pointer.
-  @param  ModeNumber             The mode number to return information on.
-  @param  Info                   Caller allocated buffer that returns information
-                                 about ModeNumber.
-  @param  SizeOfInfo             A pointer to the size, in bytes, of the Info
-                                 buffer.
-
-  @retval EFI_SUCCESS            Mode information returned.
-  @retval EFI_BUFFER_TOO_SMALL   The Info buffer was too small.
-  @retval EFI_DEVICE_ERROR       A hardware error occurred trying to retrieve the
-                                 video mode.
-  @retval EFI_NOT_STARTED        Video display is not initialized. Call SetMode ()
-  @retval EFI_INVALID_PARAMETER  One of the input args was NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-WinNtGopQuerytMode (
-  IN  EFI_GRAPHICS_OUTPUT_PROTOCOL          *This,
-  IN  UINT32                                ModeNumber,
-  OUT UINTN                                 *SizeOfInfo,
-  OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  **Info
-  )
-{
-  GOP_PRIVATE_DATA  *Private;
-
-  Private = GOP_PRIVATE_DATA_FROM_THIS (This);
-
-  if (Info == NULL || SizeOfInfo == NULL || (UINTN) ModeNumber >= This->Mode->MaxMode) {
-    return EFI_INVALID_PARAMETER;
-  }
-
-  *Info = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));
-  if (*Info == NULL) {
-    return EFI_OUT_OF_RESOURCES;
-  }
-
-  *SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
-
-  (*Info)->Version = 0;
-  (*Info)->HorizontalResolution = Private->ModeData[ModeNumber].HorizontalResolution;
-  (*Info)->VerticalResolution   = Private->ModeData[ModeNumber].VerticalResolution;
-  (*Info)->PixelFormat = PixelBlueGreenRedReserved8BitPerColor;
-  (*Info)->PixelsPerScanLine = (*Info)->HorizontalResolution;
-
-  return EFI_SUCCESS;
-}
-
-
-/**
-  Graphics Output protocol interface to set video mode
-
-  @param  This                   Protocol instance pointer.
-  @param  ModeNumber             The mode number to be set.
-
-  @retval EFI_SUCCESS            Graphics mode was changed.
-  @retval EFI_DEVICE_ERROR       The device had an error and could not complete the
-                                 request.
-  @retval EFI_UNSUPPORTED        ModeNumber is not supported by this device.
-
-**/
-EFI_STATUS
-EFIAPI
-WinNtGopSetMode (
-  IN  EFI_GRAPHICS_OUTPUT_PROTOCOL * This,
-  IN  UINT32                       ModeNumber
-  )
-{
-  EFI_STATUS                    Status;
-  GOP_PRIVATE_DATA              *Private;
-  GOP_MODE_DATA *ModeData;
-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL Fill;
-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL *NewFillLine;
-  RECT                          Rect;
-  UINTN                         Size;
-  UINTN                         Width;
-  UINTN                         Height;
-
-  Private = GOP_PRIVATE_DATA_FROM_THIS (This);
-
-  if (ModeNumber >= This->Mode->MaxMode) {
-    return EFI_UNSUPPORTED;
-  }
-
-  if (ModeNumber == This->Mode->Mode) {
-    return EFI_SUCCESS;
-  }
-
-  ModeData = &Private->ModeData[ModeNumber];
-  This->Mode->Mode = ModeNumber;
-  Private->GraphicsOutput.Mode->Info->HorizontalResolution = ModeData->HorizontalResolution;
-  Private->GraphicsOutput.Mode->Info->VerticalResolution = ModeData->VerticalResolution;
-  Private->GraphicsOutput.Mode->Info->PixelsPerScanLine = ModeData->HorizontalResolution;
-
-  if (Private->HardwareNeedsStarting) {
-    Status = WinNtGopStartWindow (
-              Private,
-              ModeData->HorizontalResolution,
-              ModeData->VerticalResolution,
-              ModeData->ColorDepth,
-              ModeData->RefreshRate
-              );
-    if (EFI_ERROR (Status)) {
-      return EFI_DEVICE_ERROR;
-    }
-
-    Private->HardwareNeedsStarting = FALSE;
-  } else {
-    //
-    // Change the resolution and resize of the window
-    //
-
-    //
-    // Free the old buffer. We do not save the content of the old buffer since the
-    // screen is to be cleared anyway. Clearing the screen is required by the EFI spec.
-    // See UEFI spec -EFI_GRAPHICS_OUTPUT_PROTOCOL.SetMode()
-    //
-    Private->WinNtThunk->HeapFree (Private->WinNtThunk->GetProcessHeap (), 0, Private->VirtualScreenInfo);
-
-    //
-    // Allocate DIB frame buffer directly from NT for performance enhancement
-    // This buffer is the virtual screen/frame buffer. This buffer is not the
-    // same a a frame buffer. The first row of this buffer will be the bottom
-    // line of the image. This is an artifact of the way we draw to the screen.
-    //
-    Size = ModeData->HorizontalResolution * ModeData->VerticalResolution * sizeof (RGBQUAD) + sizeof (BITMAPV4HEADER);
-    Private->VirtualScreenInfo = Private->WinNtThunk->HeapAlloc (
-                                                        Private->WinNtThunk->GetProcessHeap (),
-                                                        HEAP_ZERO_MEMORY,
-                                                        Size
-                                                        );
-
-    //
-    // Update the virtual screen info data structure
-    //
-    Private->VirtualScreenInfo->bV4Size           = sizeof (BITMAPV4HEADER);
-    Private->VirtualScreenInfo->bV4Width          = ModeData->HorizontalResolution;
-    Private->VirtualScreenInfo->bV4Height         = ModeData->VerticalResolution;
-    Private->VirtualScreenInfo->bV4Planes         = 1;
-    Private->VirtualScreenInfo->bV4BitCount       = 32;
-    //
-    // uncompressed
-    //
-    Private->VirtualScreenInfo->bV4V4Compression  = BI_RGB;
-
-    //
-    // The rest of the allocated memory block is the virtual screen buffer
-    //
-    Private->VirtualScreen = (RGBQUAD *) (Private->VirtualScreenInfo + 1);
-
-    //
-    // Use the AdjuctWindowRect fuction to calculate the real width and height
-    // of the new window including the border and caption
-    //
-    Rect.left   = 0;
-    Rect.top    = 0;
-    Rect.right  = ModeData->HorizontalResolution;
-    Rect.bottom = ModeData->VerticalResolution;
-
-    Private->WinNtThunk->AdjustWindowRect (&Rect, WS_OVERLAPPEDWINDOW, 0);
-
-    Width   = Rect.right - Rect.left;
-    Height  = Rect.bottom - Rect.top;
-
-    //
-    // Retrieve the original window position information
-    //
-    Private->WinNtThunk->GetWindowRect (Private->WindowHandle, &Rect);
-
-    //
-    // Adjust the window size
-    //
-    Private->WinNtThunk->MoveWindow (Private->WindowHandle, Rect.left, Rect.top, Width, Height, TRUE);
-
-  }
-
-  NewFillLine = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * ModeData->HorizontalResolution);
-  if (NewFillLine == NULL) {
-    return EFI_DEVICE_ERROR;
-  }
-
-  if (Private->FillLine != NULL) {
-    FreePool (Private->FillLine);
-  }
-
-  Private->FillLine             = NewFillLine;
-
-  Fill.Red                      = 0x00;
-  Fill.Green                    = 0x00;
-  Fill.Blue                     = 0x00;
-  This->Blt (
-          This,
-          &Fill,
-          EfiBltVideoFill,
-          0,
-          0,
-          0,
-          0,
-          ModeData->HorizontalResolution,
-          ModeData->VerticalResolution,
-          ModeData->HorizontalResolution * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
-          );
-  return EFI_SUCCESS;
-}
-
-
-/**
-  Blt pixels from the rectangle (Width X Height) formed by the BltBuffer
-  onto the graphics screen starting a location (X, Y). (0, 0) is defined as
-  the upper left hand side of the screen. (X, Y) can be outside of the
-  current screen geometry and the BltBuffer will be cliped when it is
-  displayed. X and Y can be negative or positive. If Width or Height is
-  bigger than the current video screen the image will be clipped.
-
-  @param  This                   Protocol instance pointer.
-  @param  X                      X location on graphics screen.
-  @param  Y                      Y location on the graphics screen.
-  @param  Width                  Width of BltBuffer.
-  @param  Height                 Hight of BltBuffer
-  @param  BltOperation           Operation to perform on BltBuffer and video memory
-  @param  BltBuffer              Buffer containing data to blt into video buffer.
-                                 This  buffer has a size of
-                                 Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
-  @param  SourceX                If the BltOperation is a EfiCopyBlt this is the
-                                 source of the copy. For other BLT operations this
-                                 argument is not used.
-  @param  SourceX                If the BltOperation is a EfiCopyBlt this is the
-                                 source of the copy. For other BLT operations this
-                                 argument is not used.
-
-  @retval EFI_SUCCESS            The palette is updated with PaletteArray.
-  @retval EFI_INVALID_PARAMETER  BltOperation is not valid.
-  @retval EFI_DEVICE_ERROR       A hardware error occured writting to the video
-                                 buffer.
-
-**/
-// TODO:    SourceY - add argument and description to function comment
-// TODO:    DestinationX - add argument and description to function comment
-// TODO:    DestinationY - add argument and description to function comment
-// TODO:    Delta - add argument and description to function comment
-EFI_STATUS
-EFIAPI
-WinNtGopBlt (
-  IN  EFI_GRAPHICS_OUTPUT_PROTOCOL                   *This,
-  IN  EFI_GRAPHICS_OUTPUT_BLT_PIXEL                           *BltBuffer, OPTIONAL
-  IN  EFI_GRAPHICS_OUTPUT_BLT_OPERATION                   BltOperation,
-  IN  UINTN                                   SourceX,
-  IN  UINTN                                   SourceY,
-  IN  UINTN                                   DestinationX,
-  IN  UINTN                                   DestinationY,
-  IN  UINTN                                   Width,
-  IN  UINTN                                   Height,
-  IN  UINTN                                   Delta         OPTIONAL
-  )
-{
-  GOP_PRIVATE_DATA              *Private;
-  EFI_TPL                       OriginalTPL;
-  UINTN                         DstY;
-  UINTN                         SrcY;
-  RGBQUAD                       *VScreen;
-  RGBQUAD                       *VScreenSrc;
-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt;
-  UINTN                         Index;
-  RECT                          Rect;
-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL *FillPixel;
-  UINT32                        VerticalResolution;
-  UINT32                        HorizontalResolution;
-
-  Private = GOP_PRIVATE_DATA_FROM_THIS (This);
-
-  if ((BltOperation < 0) || (BltOperation >= EfiGraphicsOutputBltOperationMax)) {
-    return EFI_INVALID_PARAMETER;
-  }
-
-  if (Width == 0 || Height == 0) {
-    return EFI_INVALID_PARAMETER;
-  }
-  //
-  // If Delta is zero, then the entire BltBuffer is being used, so Delta
-  // is the number of bytes in each row of BltBuffer.  Since BltBuffer is Width pixels size,
-  // the number of bytes in each row can be computed.
-  //
-  if (Delta == 0) {
-    Delta = Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
-  }
-
-  //
-  // We need to fill the Virtual Screen buffer with the blt data.
-  // The virtual screen is upside down, as the first row is the bootom row of
-  // the image.
-  //
-  VerticalResolution = This->Mode->Info->VerticalResolution;
-  HorizontalResolution = This->Mode->Info->HorizontalResolution;
-  if (BltOperation == EfiBltVideoToBltBuffer) {
-
-    //
-    // Video to BltBuffer: Source is Video, destination is BltBuffer
-    //
-    if (SourceY + Height > VerticalResolution) {
-      return EFI_INVALID_PARAMETER;
-    }
-
-    if (SourceX + Width > HorizontalResolution) {
-      return EFI_INVALID_PARAMETER;
-    }
-    //
-    // We have to raise to TPL Notify, so we make an atomic write the frame buffer.
-    // We would not want a timer based event (Cursor, ...) to come in while we are
-    // doing this operation.
-    //
-    OriginalTPL = gBS->RaiseTPL (TPL_NOTIFY);
-
-    for (SrcY = SourceY, DstY = DestinationY; DstY < (Height + DestinationY); SrcY++, DstY++) {
-      Blt = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) ((UINT8 *) BltBuffer + (DstY * Delta) + DestinationX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
-      VScreen = &Private->VirtualScreen[(VerticalResolution - SrcY - 1) * HorizontalResolution + SourceX];
-      CopyMem (Blt, VScreen, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * Width);
-    }
-  } else {
-    //
-    // BltBuffer to Video: Source is BltBuffer, destination is Video
-    //
-    if (DestinationY + Height > VerticalResolution) {
-      return EFI_INVALID_PARAMETER;
-    }
-
-    if (DestinationX + Width > HorizontalResolution) {
-      return EFI_INVALID_PARAMETER;
-    }
-
-    //
-    // We have to raise to TPL Notify, so we make an atomic write the frame buffer.
-    // We would not want a timer based event (Cursor, ...) to come in while we are
-    // doing this operation.
-    //
-    OriginalTPL = gBS->RaiseTPL (TPL_NOTIFY);
-
-    if (BltOperation == EfiBltVideoFill) {
-      FillPixel = BltBuffer;
-      for (Index = 0; Index < Width; Index++) {
-        Private->FillLine[Index] = *FillPixel;
-      }
-    }
-
-    for (Index = 0; Index < Height; Index++) {
-      if (DestinationY <= SourceY) {
-        SrcY  = SourceY + Index;
-        DstY  = DestinationY + Index;
-      } else {
-        SrcY  = SourceY + Height - Index - 1;
-        DstY  = DestinationY + Height - Index - 1;
-      }
-
-      VScreen = &Private->VirtualScreen[(VerticalResolution - DstY - 1) * HorizontalResolution + DestinationX];
-      switch (BltOperation) {
-      case EfiBltBufferToVideo:
-        Blt = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) ((UINT8 *) BltBuffer + (SrcY * Delta) + SourceX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
-        CopyMem (VScreen, Blt, Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
-        break;
-
-      case EfiBltVideoToVideo:
-        VScreenSrc = &Private->VirtualScreen[(VerticalResolution - SrcY - 1) * HorizontalResolution + SourceX];
-        CopyMem (VScreen, VScreenSrc, Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
-        break;
-
-      case EfiBltVideoFill:
-        CopyMem (VScreen, Private->FillLine, Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
-        break;
-      }
-    }
-  }
-
-  if (BltOperation != EfiBltVideoToBltBuffer) {
-    //
-    // Mark the area we just blted as Invalid so WM_PAINT will update.
-    //
-    Rect.left   = DestinationX;
-    Rect.top    = DestinationY;
-    Rect.right  = DestinationX + Width;
-    Rect.bottom = DestinationY + Height;
-    Private->WinNtThunk->InvalidateRect (Private->WindowHandle, &Rect, FALSE);
-
-    //
-    // Send the WM_PAINT message to the thread that is drawing the window. We
-    // are in the main thread and the window drawing is in a child thread.
-    // There is a child thread per window. We have no CriticalSection or Mutex
-    // since we write the data and the other thread displays the data. While
-    // we may miss some data for a short period of time this is no different than
-    // a write combining on writes to a frame buffer.
-    //
-
-    Private->WinNtThunk->UpdateWindow (Private->WindowHandle);
-  }
-
-  gBS->RestoreTPL (OriginalTPL);
-
-  return EFI_SUCCESS;
-}
-
-//
-// Construction and Destruction functions
-//
-
-
-/**
-
-
-  @return None
-
-**/
-// TODO:    WinNtIo - add argument and description to function comment
-// TODO:    EFI_UNSUPPORTED - add return value to function comment
-// TODO:    EFI_SUCCESS - add return value to function comment
-EFI_STATUS
-WinNtGopSupported (
-  IN  EFI_WIN_NT_IO_PROTOCOL  *WinNtIo
-  )
-{
-  //
-  // Check to see if the IO abstraction represents a device type we support.
-  //
-  // This would be replaced a check of PCI subsystem ID, etc.
-  //
-  if (!CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtGopGuid)) {
-    return EFI_UNSUPPORTED;
-  }
-
-  return EFI_SUCCESS;
-}
-
-
-/**
-  Win32 Windows event handler.
-
-  See Win32 Book
-
-  @return See Win32 Book
-
-**/
-// TODO:    hwnd - add argument and description to function comment
-// TODO:    iMsg - add argument and description to function comment
-// TODO:    wParam - add argument and description to function comment
-// TODO:    lParam - add argument and description to function comment
-LRESULT
-CALLBACK
-WinNtGopThreadWindowProc (
-  IN  HWND    hwnd,
-  IN  UINT    iMsg,
-  IN  WPARAM  wParam,
-  IN  LPARAM  lParam
-  )
-{
-  GOP_PRIVATE_DATA  *Private;
-  UINTN             Size;
-  HDC               Handle;
-  PAINTSTRUCT       PaintStruct;
-  LPARAM            Index;
-  EFI_INPUT_KEY     Key;
-
-  //
-  // BugBug - if there are two instances of this DLL in memory (such as is
-  // the case for ERM), the correct instance of this function may not be called.
-  // This also means that the address of the mTlsIndex value will be wrong, and
-  // the value may be wrong too.
-  //
-
-
-  //
-  // Use mTlsIndex global to get a Thread Local Storage version of Private.
-  // This works since each Gop protocol has a unique Private data instance and
-  // a unique thread.
-  //
-  Private = mWinNt->TlsGetValue (mTlsIndex);
-  ASSERT (NULL != Private);
-
-  switch (iMsg) {
-  case WM_CREATE:
-    Size = Private->GraphicsOutput.Mode->Info->HorizontalResolution * Private->GraphicsOutput.Mode->Info->VerticalResolution * sizeof (RGBQUAD);
-
-    //
-    // Allocate DIB frame buffer directly from NT for performance enhancement
-    // This buffer is the virtual screen/frame buffer. This buffer is not the
-    // same a a frame buffer. The first fow of this buffer will be the bottom
-    // line of the image. This is an artifact of the way we draw to the screen.
-    //
-    Private->VirtualScreenInfo = Private->WinNtThunk->HeapAlloc (
-                                                        Private->WinNtThunk->GetProcessHeap (),
-                                                        HEAP_ZERO_MEMORY,
-                                                        Size
-                                                        );
-
-    Private->VirtualScreenInfo->bV4Size           = sizeof (BITMAPV4HEADER);
-    Private->VirtualScreenInfo->bV4Width          = Private->GraphicsOutput.Mode->Info->HorizontalResolution;
-    Private->VirtualScreenInfo->bV4Height         = Private->GraphicsOutput.Mode->Info->VerticalResolution;
-    Private->VirtualScreenInfo->bV4Planes         = 1;
-    Private->VirtualScreenInfo->bV4BitCount       = 32;
-    //
-    // uncompressed
-    //
-    Private->VirtualScreenInfo->bV4V4Compression  = BI_RGB;
-    Private->VirtualScreen = (RGBQUAD *) (Private->VirtualScreenInfo + 1);
-    return 0;
-
-  case WM_PAINT:
-    //
-    // I have not found a way to convert hwnd into a Private context. So for
-    // now we use this API to convert hwnd to Private data.
-    //
-
-    Handle = mWinNt->BeginPaint (hwnd, &PaintStruct);
-
-    mWinNt->SetDIBitsToDevice (
-              Handle,                                     // Destination Device Context
-              0,                                          // Destination X - 0
-              0,                                          // Destination Y - 0
-              Private->GraphicsOutput.Mode->Info->HorizontalResolution,              // Width
-              Private->GraphicsOutput.Mode->Info->VerticalResolution,                // Height
-              0,                                          // Source X
-              0,                                          // Source Y
-              0,                                          // DIB Start Scan Line
-              Private->GraphicsOutput.Mode->Info->VerticalResolution,                // Number of scan lines
-              Private->VirtualScreen,                     // Address of array of DIB bits
-              (BITMAPINFO *) Private->VirtualScreenInfo,  // Address of structure with bitmap info
-              DIB_RGB_COLORS                              // RGB or palette indexes
-              );
-
-    mWinNt->EndPaint (hwnd, &PaintStruct);
-    return 0;
-
-  //
-  // F10 and the ALT key do not create a WM_KEYDOWN message, thus this special case
-  //
-  case WM_SYSKEYDOWN:
-    Key.ScanCode = 0;
-    switch (wParam) {
-    case VK_F10:
-      Key.ScanCode    = SCAN_F10;
-      Key.UnicodeChar = 0;
-      GopPrivateAddQ (Private, Key);
-      return 0;
-    }
-    break;
-
-  case WM_KEYDOWN:
-    Key.ScanCode = 0;
-    switch (wParam) {
-    case VK_HOME:       Key.ScanCode = SCAN_HOME;       break;
-    case VK_END:        Key.ScanCode = SCAN_END;        break;
-    case VK_LEFT:       Key.ScanCode = SCAN_LEFT;       break;
-    case VK_RIGHT:      Key.ScanCode = SCAN_RIGHT;      break;
-    case VK_UP:         Key.ScanCode = SCAN_UP;         break;
-    case VK_DOWN:       Key.ScanCode = SCAN_DOWN;       break;
-    case VK_DELETE:     Key.ScanCode = SCAN_DELETE;     break;
-    case VK_INSERT:     Key.ScanCode = SCAN_INSERT;     break;
-    case VK_PRIOR:      Key.ScanCode = SCAN_PAGE_UP;    break;
-    case VK_NEXT:       Key.ScanCode = SCAN_PAGE_DOWN;  break;
-    case VK_ESCAPE:     Key.ScanCode = SCAN_ESC;        break;
-
-    case VK_F1:   Key.ScanCode = SCAN_F1;   break;
-    case VK_F2:   Key.ScanCode = SCAN_F2;   break;
-    case VK_F3:   Key.ScanCode = SCAN_F3;   break;
-    case VK_F4:   Key.ScanCode = SCAN_F4;   break;
-    case VK_F5:   Key.ScanCode = SCAN_F5;   break;
-    case VK_F6:   Key.ScanCode = SCAN_F6;   break;
-    case VK_F7:   Key.ScanCode = SCAN_F7;   break;
-    case VK_F8:   Key.ScanCode = SCAN_F8;   break;
-    case VK_F9:   Key.ScanCode = SCAN_F9;   break;
-    case VK_F11:  Key.ScanCode = SCAN_F11;  break;
-    case VK_F12:  Key.ScanCode = SCAN_F12;  break;
-    }
-
-    if (Key.ScanCode != 0) {
-      Key.UnicodeChar = 0;
-      GopPrivateAddQ (Private, Key);
-    }
-
-    return 0;
-
-  case WM_CHAR:
-    //
-    // The ESC key also generate WM_CHAR.
-    //
-    if (wParam == 0x1B) {
-      return 0;
-    }
-
-    for (Index = 0; Index < (lParam & 0xffff); Index++) {
-      if (wParam != 0) {
-        Key.UnicodeChar = (CHAR16) wParam;
-        Key.ScanCode    = 0;
-        GopPrivateAddQ (Private, Key);
-      }
-    }
-
-    return 0;
-
-  case WM_CLOSE:
-    //
-    // This close message is issued by user, core is not aware of this,
-    // so don't release the window display resource, just hide the window.
-    //
-    Private->WinNtThunk->ShowWindow (Private->WindowHandle, SW_HIDE);
-    return 0;
-
-  case WM_DESTROY:
-    mWinNt->DestroyWindow (hwnd);
-    mWinNt->PostQuitMessage (0);
-
-    mWinNt->HeapFree (Private->WinNtThunk->GetProcessHeap (), 0, Private->VirtualScreenInfo);
-
-    mWinNt->ExitThread (0);
-    return 0;
-
-  default:
-    break;
-  };
-
-  return mWinNt->DefWindowProc (hwnd, iMsg, wParam, lParam);
-}
-
-
-/**
-  This thread simulates the end of WinMain () aplication. Each Winow nededs
-  to process it's events. The messages are dispatched to
-  WinNtGopThreadWindowProc ().
-  Be very careful sine WinNtGopThreadWinMain () and WinNtGopThreadWindowProc ()
-  are running in a seperate thread. We have to do this to process the events.
-
-  @param  lpParameter            Handle of window to manage.
-
-  @return if a WM_QUIT message is returned exit.
-
-**/
-DWORD
-WINAPI
-WinNtGopThreadWinMain (
-  LPVOID    lpParameter
-  )
-{
-  MSG               Message;
-  GOP_PRIVATE_DATA  *Private;
-  ATOM              Atom;
-  RECT              Rect;
-
-  Private = (GOP_PRIVATE_DATA *) lpParameter;
-  ASSERT (NULL != Private);
-
-  //
-  // Since each thread has unique private data, save the private data in Thread
-  // Local Storage slot. Then the shared global mTlsIndex can be used to get
-  // thread specific context.
-  //
-  Private->WinNtThunk->TlsSetValue (mTlsIndex, Private);
-
-  Private->ThreadId                   = Private->WinNtThunk->GetCurrentThreadId ();
-
-  Private->WindowsClass.cbSize        = sizeof (WNDCLASSEX);
-  Private->WindowsClass.style         = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
-  Private->WindowsClass.lpfnWndProc   = WinNtGopThreadWindowProc;
-  Private->WindowsClass.cbClsExtra    = 0;
-  Private->WindowsClass.cbWndExtra    = 0;
-  Private->WindowsClass.hInstance     = NULL;
-  Private->WindowsClass.hIcon         = Private->WinNtThunk->LoadIcon (NULL, IDI_APPLICATION);
-  Private->WindowsClass.hCursor       = Private->WinNtThunk->LoadCursor (NULL, IDC_ARROW);
-  Private->WindowsClass.hbrBackground = (HBRUSH) COLOR_WINDOW;
-  Private->WindowsClass.lpszMenuName  = NULL;
-  Private->WindowsClass.lpszClassName = WIN_NT_GOP_CLASS_NAME;
-  Private->WindowsClass.hIconSm       = Private->WinNtThunk->LoadIcon (NULL, IDI_APPLICATION);
-
-  //
-  // This call will fail after the first time, but thats O.K. since we only need
-  // WIN_NT_GOP_CLASS_NAME to exist to create the window.
-  //
-  // Note: Multiple instances of this DLL will use the same instance of this
-  // Class, including the callback function, unless the Class is unregistered and
-  // successfully registered again.
-  //
-  Atom = Private->WinNtThunk->RegisterClassEx (&Private->WindowsClass);
-
-  //
-  // Setting Rect values to allow for the AdjustWindowRect to provide
-  // us the correct sizes for the client area when doing the CreateWindowEx
-  //
-  Rect.top    = 0;
-  Rect.bottom = Private->GraphicsOutput.Mode->Info->VerticalResolution;
-  Rect.left   = 0;
-  Rect.right  = Private->GraphicsOutput.Mode->Info->HorizontalResolution;
-
-  Private->WinNtThunk->AdjustWindowRect (&Rect, WS_OVERLAPPEDWINDOW, 0);
-
-  Private->WindowHandle = Private->WinNtThunk->CreateWindowEx (
-                                                0,
-                                                WIN_NT_GOP_CLASS_NAME,
-                                                Private->WindowName,
-                                                WS_OVERLAPPEDWINDOW,
-                                                CW_USEDEFAULT,
-                                                CW_USEDEFAULT,
-                                                Rect.right - Rect.left,
-                                                Rect.bottom - Rect.top,
-                                                NULL,
-                                                NULL,
-                                                NULL,
-                                                &Private
-                                                );
-
-  //
-  // The reset of this thread is the standard winows program. We need a sperate
-  // thread since we must process the message loop to make windows act like
-  // windows.
-  //
-
-  Private->WinNtThunk->ShowWindow (Private->WindowHandle, SW_SHOW);
-  Private->WinNtThunk->UpdateWindow (Private->WindowHandle);
-
-  //
-  // Let the main thread get some work done
-  //
-  Private->WinNtThunk->ReleaseSemaphore (Private->ThreadInited, 1, NULL);
-
-  //
-  // This is the message loop that all Windows programs need.
-  //
-  while (Private->WinNtThunk->GetMessage (&Message, Private->WindowHandle, 0, 0)) {
-    Private->WinNtThunk->TranslateMessage (&Message);
-    Private->WinNtThunk->DispatchMessage (&Message);
-  }
-
-  return Message.wParam;
-}
-
-
-/**
-  TODO: Add function description
-
-  @param  Private                TODO: add argument description
-  @param  HorizontalResolution   TODO: add argument description
-  @param  VerticalResolution     TODO: add argument description
-  @param  ColorDepth             TODO: add argument description
-  @param  RefreshRate            TODO: add argument description
-
-  @return TODO: add return values
-
-**/
-EFI_STATUS
-WinNtGopStartWindow (
-  IN  GOP_PRIVATE_DATA    *Private,
-  IN  UINT32              HorizontalResolution,
-  IN  UINT32              VerticalResolution,
-  IN  UINT32              ColorDepth,
-  IN  UINT32              RefreshRate
-  )
-{
-  EFI_STATUS          Status;
-  DWORD               NewThreadId;
-
-  mWinNt  = Private->WinNtThunk;
-
-  //
-  // Initialize a Thread Local Storge variable slot. We use TLS to get the
-  // correct Private data instance into the windows thread.
-  //
-  if (mTlsIndex == TLS_OUT_OF_INDEXES) {
-    ASSERT (0 == mTlsIndexUseCount);
-    mTlsIndex = Private->WinNtThunk->TlsAlloc ();
-  }
-
-  //
-  // always increase the use count!
-  //
-  mTlsIndexUseCount++;
-
-  //
-  // Register to be notified on exit boot services so we can destroy the window.
-  //
-  Status = gBS->CreateEvent (
-                  EVT_SIGNAL_EXIT_BOOT_SERVICES,
-                  TPL_CALLBACK,
-                  KillNtGopThread,
-                  Private,
-                  &mGopScreenExitBootServicesEvent
-                  );
-
-  Private->ThreadInited = Private->WinNtThunk->CreateSemaphore (NULL, 0, 1, NULL);
-  Private->ThreadHandle = Private->WinNtThunk->CreateThread (
-                                                NULL,
-                                                0,
-                                                WinNtGopThreadWinMain,
-                                                (VOID *) Private,
-                                                0,
-                                                &NewThreadId
-                                                );
-
-  //
-  // The other thread has entered the windows message loop so we can
-  // continue our initialization.
-  //
-  Private->WinNtThunk->WaitForSingleObject (Private->ThreadInited, INFINITE);
-  Private->WinNtThunk->CloseHandle (Private->ThreadInited);
-
-  return Status;
-}
-
-
-/**
-
-
-  @return None
-
-**/
-// TODO:    Private - add argument and description to function comment
-// TODO:    EFI_SUCCESS - add return value to function comment
-EFI_STATUS
-WinNtGopConstructor (
-  GOP_PRIVATE_DATA    *Private
-  )
-{
-  Private->ModeData = mGopModeData;
-
-  Private->GraphicsOutput.QueryMode = WinNtGopQuerytMode;
-  Private->GraphicsOutput.SetMode = WinNtGopSetMode;
-  Private->GraphicsOutput.Blt            = WinNtGopBlt;
-
-  //
-  // Allocate buffer for Graphics Output Protocol mode information
-  //
-  Private->GraphicsOutput.Mode = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE));
-  if (Private->GraphicsOutput.Mode == NULL) {
-    return EFI_OUT_OF_RESOURCES;
-  }
-  Private->GraphicsOutput.Mode->Info = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));
-  if (Private->GraphicsOutput.Mode->Info == NULL) {
-    return EFI_OUT_OF_RESOURCES;
-  }
-
-  Private->GraphicsOutput.Mode->MaxMode = sizeof(mGopModeData) / sizeof(GOP_MODE_DATA);
-  //
-  // Till now, we have no idea about the window size.
-  //
-  Private->GraphicsOutput.Mode->Mode = GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER;
-  Private->GraphicsOutput.Mode->Info->Version = 0;
-  Private->GraphicsOutput.Mode->Info->HorizontalResolution = 0;
-  Private->GraphicsOutput.Mode->Info->VerticalResolution = 0;
-  Private->GraphicsOutput.Mode->Info->PixelFormat = PixelBltOnly;
-  Private->GraphicsOutput.Mode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
-  Private->GraphicsOutput.Mode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) (UINTN) NULL;
-  Private->GraphicsOutput.Mode->FrameBufferSize = 0;
-
-  Private->HardwareNeedsStarting  = TRUE;
-  Private->FillLine               = NULL;
-
-  WinNtGopInitializeSimpleTextInForWindow (Private);
-
-  return EFI_SUCCESS;
-}
-
-
-/**
-
-
-  @return None
-
-**/
-// TODO:    Private - add argument and description to function comment
-// TODO:    EFI_SUCCESS - add return value to function comment
-EFI_STATUS
-WinNtGopDestructor (
-  GOP_PRIVATE_DATA     *Private
-  )
-{
-  UINT32  UnregisterReturn;
-
-  if (!Private->HardwareNeedsStarting) {
-    //
-    // BugBug: Shutdown GOP Hardware and any child devices.
-    //
-    Private->WinNtThunk->SendMessage (Private->WindowHandle, WM_DESTROY, 0, 0);
-    Private->WinNtThunk->CloseHandle (Private->ThreadHandle);
-
-    mTlsIndexUseCount--;
-
-    //
-    // The callback function for another window could still be called,
-    // so we need to make sure there are no more users of mTlsIndex.
-    //
-    if (0 == mTlsIndexUseCount) {
-      ASSERT (TLS_OUT_OF_INDEXES != mTlsIndex);
-
-      Private->WinNtThunk->TlsFree (mTlsIndex);
-      mTlsIndex = TLS_OUT_OF_INDEXES;
-
-      UnregisterReturn = Private->WinNtThunk->UnregisterClass (
-                                                Private->WindowsClass.lpszClassName,
-                                                Private->WindowsClass.hInstance
-                                                );
-    }
-
-    WinNtGopDestroySimpleTextInForWindow (Private);
-  }
-
-  //
-  // Free graphics output protocol occupied resource
-  //
-  if (Private->GraphicsOutput.Mode != NULL) {
-    if (Private->GraphicsOutput.Mode->Info != NULL) {
-      FreePool (Private->GraphicsOutput.Mode->Info);
-    }
-    FreePool (Private->GraphicsOutput.Mode);
-  }
-
-  return EFI_SUCCESS;
-}
-
-
-/**
-  This is the GOP screen's callback notification function for exit-boot-services.
-  All we do here is call WinNtGopDestructor().
-
-  @param  Event                  not used
-  @param  Context                pointer to the Private structure.
-
-  @return None.
-
-**/
-STATIC
-VOID
-EFIAPI
-KillNtGopThread (
-  IN EFI_EVENT  Event,
-  IN VOID       *Context
-  )
-{
-  EFI_STATUS  Status;
-  Status = WinNtGopDestructor (Context);
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/ComponentName.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/ComponentName.c
deleted file mode 100644
index d22f030..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/ComponentName.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  ComponentName.c

-

-Abstract:

-

---*/

-

-#include "WinNtSerialIo.h"

-

-//

-// EFI Component Name Functions

-//

-EFI_STATUS

-EFIAPI

-WinNtSerialIoComponentNameGetDriverName (

-  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,

-  IN  CHAR8                        *Language,

-  OUT CHAR16                       **DriverName

-  );

-

-EFI_STATUS

-EFIAPI

-WinNtSerialIoComponentNameGetControllerName (

-  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,

-  IN  EFI_HANDLE                                      ControllerHandle,

-  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,

-  IN  CHAR8                                           *Language,

-  OUT CHAR16                                          **ControllerName

-  );

-

-//

-// EFI Component Name Protocol

-//

-EFI_COMPONENT_NAME_PROTOCOL     gWinNtSerialIoComponentName = {

-  WinNtSerialIoComponentNameGetDriverName,

-  WinNtSerialIoComponentNameGetControllerName,

-  "eng"

-};

-

-static EFI_UNICODE_STRING_TABLE mWinNtSerialIoDriverNameTable[] = {

-  { "eng", L"Windows Serial I/O Driver" },

-  { NULL , NULL }

-};

-

-EFI_STATUS

-EFIAPI

-WinNtSerialIoComponentNameGetDriverName (

-  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,

-  IN  CHAR8                        *Language,

-  OUT CHAR16                       **DriverName

-  )

-/*++

-

-  Routine Description:

-    Retrieves a Unicode string that is the user readable name of the EFI Driver.

-

-  Arguments:

-    This       - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.

-    Language   - A pointer to a three character ISO 639-2 language identifier.

-                 This is the language of the driver name that that the caller 

-                 is requesting, and it must match one of the languages specified

-                 in SupportedLanguages.  The number of languages supported by a 

-                 driver is up to the driver writer.

-    DriverName - A pointer to the Unicode string to return.  This Unicode string

-                 is the name of the driver specified by This in the language 

-                 specified by Language.

-

-  Returns:

-    EFI_SUCCESS           - The Unicode string for the Driver specified by This

-                            and the language specified by Language was returned 

-                            in DriverName.

-    EFI_INVALID_PARAMETER - Language is NULL.

-    EFI_INVALID_PARAMETER - DriverName is NULL.

-    EFI_UNSUPPORTED       - The driver specified by This does not support the 

-                            language specified by Language.

-

---*/

-{

-  return LookupUnicodeString (

-          Language,

-          gWinNtSerialIoComponentName.SupportedLanguages,

-          mWinNtSerialIoDriverNameTable,

-          DriverName

-          );

-}

-

-EFI_STATUS

-EFIAPI

-WinNtSerialIoComponentNameGetControllerName (

-  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,

-  IN  EFI_HANDLE                                      ControllerHandle,

-  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,

-  IN  CHAR8                                           *Language,

-  OUT CHAR16                                          **ControllerName

-  )

-/*++

-

-  Routine Description:

-    Retrieves a Unicode string that is the user readable name of the controller

-    that is being managed by an EFI Driver.

-

-  Arguments:

-    This             - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.

-    ControllerHandle - The handle of a controller that the driver specified by 

-                       This is managing.  This handle specifies the controller 

-                       whose name is to be returned.

-    ChildHandle      - The handle of the child controller to retrieve the name 

-                       of.  This is an optional parameter that may be NULL.  It 

-                       will be NULL for device drivers.  It will also be NULL 

-                       for a bus drivers that wish to retrieve the name of the 

-                       bus controller.  It will not be NULL for a bus driver 

-                       that wishes to retrieve the name of a child controller.

-    Language         - A pointer to a three character ISO 639-2 language 

-                       identifier.  This is the language of the controller name 

-                       that that the caller is requesting, and it must match one

-                       of the languages specified in SupportedLanguages.  The 

-                       number of languages supported by a driver is up to the 

-                       driver writer.

-    ControllerName   - A pointer to the Unicode string to return.  This Unicode

-                       string is the name of the controller specified by 

-                       ControllerHandle and ChildHandle in the language specified

-                       by Language from the point of view of the driver specified

-                       by This. 

-

-  Returns:

-    EFI_SUCCESS           - The Unicode string for the user readable name in the 

-                            language specified by Language for the driver 

-                            specified by This was returned in DriverName.

-    EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.

-    EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.

-    EFI_INVALID_PARAMETER - Language is NULL.

-    EFI_INVALID_PARAMETER - ControllerName is NULL.

-    EFI_UNSUPPORTED       - The driver specified by This is not currently managing 

-                            the controller specified by ControllerHandle and 

-                            ChildHandle.

-    EFI_UNSUPPORTED       - The driver specified by This does not support the 

-                            language specified by Language.

-

---*/

-{

-  EFI_STATUS                    Status;

-  EFI_SERIAL_IO_PROTOCOL        *SerialIo;

-  WIN_NT_SERIAL_IO_PRIVATE_DATA *Private;

-

-  //

-  // Make sure this driver is currently managing ControllHandle

-  //

-  Status = EfiTestManagedDevice (

-             ControllerHandle,

-             gWinNtSerialIoDriverBinding.DriverBindingHandle,

-             &gEfiWinNtIoProtocolGuid

-             );

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  //

-  // This is a bus driver, so ChildHandle must not be NULL.

-  //

-  if (ChildHandle == NULL) {

-    return EFI_UNSUPPORTED;

-  }

-

-  Status = EfiTestChildHandle (

-             ControllerHandle,

-             ChildHandle,

-             &gEfiWinNtIoProtocolGuid

-             );

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  //

-  // Get our context back

-  //

-  Status = gBS->OpenProtocol (

-                  ChildHandle,

-                  &gEfiSerialIoProtocolGuid,

-                  &SerialIo,

-                  gWinNtSerialIoDriverBinding.DriverBindingHandle,

-                  ChildHandle,

-                  EFI_OPEN_PROTOCOL_GET_PROTOCOL

-                  );

-  if (EFI_ERROR (Status)) {

-    return EFI_UNSUPPORTED;

-  }

-

-  Private = WIN_NT_SERIAL_IO_PRIVATE_DATA_FROM_THIS (SerialIo);

-

-  return LookupUnicodeString (

-          Language,

-          gWinNtSerialIoComponentName.SupportedLanguages,

-          Private->ControllerNameTable,

-          ControllerName

-          );

-}

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.c
deleted file mode 100644
index 954c0e1..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.c
+++ /dev/null
@@ -1,1406 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  WinNtSerialIo.c

-

-Abstract:

-

-  Our DriverBinding member functions operate on the handles

-  created by the NT Bus driver.

-

-  Handle(1) - WinNtIo - DevicePath(1)

-

-  If a serial port is added to the system this driver creates a new handle.

-  The new handle is required, since the serial device must add an UART device

-  pathnode.

-

-  Handle(2) - SerialIo - DevicePath(1)\UART

-

-  The driver then adds a gEfiWinNtSerialPortGuid as a protocol to Handle(1).

-  The instance data for this protocol is the private data used to create

-  Handle(2).

-

-  Handle(1) - WinNtIo - DevicePath(1) - WinNtSerialPort

-

-  If the driver is unloaded Handle(2) is removed from the system and

-  gEfiWinNtSerialPortGuid is removed from Handle(1).

-

-  Note: Handle(1) is any handle created by the Win NT Bus driver that is passed

-  into the DriverBinding member functions of this driver. This driver requires

-  a Handle(1) to contain a WinNtIo protocol, a DevicePath protocol, and

-  the TypeGuid in the WinNtIo must be gEfiWinNtSerialPortGuid.

-

-  If Handle(1) contains a gEfiWinNtSerialPortGuid protocol then the driver is

-  loaded on the device.

-

---*/

-

-#include "WinNtSerialIo.h"

-

-EFI_DRIVER_BINDING_PROTOCOL gWinNtSerialIoDriverBinding = {

-  WinNtSerialIoDriverBindingSupported,

-  WinNtSerialIoDriverBindingStart,

-  WinNtSerialIoDriverBindingStop,

-  0xa,

-  NULL,

-  NULL

-};

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSerialIoDriverBindingSupported (

-  IN  EFI_DRIVER_BINDING_PROTOCOL   *This,

-  IN  EFI_HANDLE                    Handle,

-  IN  EFI_DEVICE_PATH_PROTOCOL      *RemainingDevicePath

-  )

-/*++

-

-Routine Description:

-

-Arguments:

-

-Returns:

-

-  None

-

---*/

-// TODO:    This - add argument and description to function comment

-// TODO:    Handle - add argument and description to function comment

-// TODO:    RemainingDevicePath - add argument and description to function comment

-// TODO:    EFI_SUCCESS - add return value to function comment

-// TODO:    EFI_SUCCESS - add return value to function comment

-{

-  EFI_STATUS                Status;

-  EFI_DEVICE_PATH_PROTOCOL  *ParentDevicePath;

-  EFI_WIN_NT_IO_PROTOCOL    *WinNtIo;

-  UART_DEVICE_PATH          *UartNode;

-

-  //

-  // Open the IO Abstraction(s) needed to perform the supported test

-  //

-  Status = gBS->OpenProtocol (

-                  Handle,

-                  &gEfiDevicePathProtocolGuid,

-                  &ParentDevicePath,

-                  This->DriverBindingHandle,

-                  Handle,

-                  EFI_OPEN_PROTOCOL_BY_DRIVER

-                  );

-  if (Status == EFI_ALREADY_STARTED) {

-    return EFI_SUCCESS;

-  }

-

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  gBS->CloseProtocol (

-        Handle,

-        &gEfiDevicePathProtocolGuid,

-        This->DriverBindingHandle,

-        Handle

-        );

-

-  Status = gBS->OpenProtocol (

-                  Handle,

-                  &gEfiWinNtIoProtocolGuid,

-                  &WinNtIo,

-                  This->DriverBindingHandle,

-                  Handle,

-                  EFI_OPEN_PROTOCOL_BY_DRIVER

-                  );

-  if (Status == EFI_ALREADY_STARTED) {

-    return EFI_SUCCESS;

-  }

-

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  //

-  // Make sure that the WinNt Thunk Protocol is valid

-  //

-  if (WinNtIo->WinNtThunk->Signature != EFI_WIN_NT_THUNK_PROTOCOL_SIGNATURE) {

-    Status = EFI_UNSUPPORTED;

-    goto Error;

-  }

-

-  //

-  // Check the GUID to see if this is a handle type the driver supports

-  //

-  if (!CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtSerialPortGuid)) {

-    Status = EFI_UNSUPPORTED;

-    goto Error;

-  }

-

-  if (RemainingDevicePath != NULL) {

-    Status    = EFI_UNSUPPORTED;

-    UartNode  = (UART_DEVICE_PATH *) RemainingDevicePath;

-    if (UartNode->Header.Type != MESSAGING_DEVICE_PATH ||

-        UartNode->Header.SubType != MSG_UART_DP ||

-        DevicePathNodeLength((EFI_DEVICE_PATH_PROTOCOL *)UartNode) != sizeof(UART_DEVICE_PATH)) {

-      goto Error;

-    }

-    if (UartNode->BaudRate < 0 || UartNode->BaudRate > SERIAL_PORT_MAX_BAUD_RATE) {

-      goto Error;

-    }

-    if (UartNode->Parity < NoParity || UartNode->Parity > SpaceParity) {

-      goto Error;

-    }

-    if (UartNode->DataBits < 5 || UartNode->DataBits > 8) {

-      goto Error;

-    }

-    if (UartNode->StopBits < OneStopBit || UartNode->StopBits > TwoStopBits) {

-      goto Error;

-    }

-    if ((UartNode->DataBits == 5) && (UartNode->StopBits == TwoStopBits)) {

-      goto Error;

-    }

-    if ((UartNode->DataBits >= 6) && (UartNode->DataBits <= 8) && (UartNode->StopBits == OneFiveStopBits)) {

-      goto Error;

-    }

-    Status = EFI_SUCCESS;

-  }

-

-Error:

-  //

-  // Close the I/O Abstraction(s) used to perform the supported test

-  //

-  gBS->CloseProtocol (

-        Handle,

-        &gEfiWinNtIoProtocolGuid,

-        This->DriverBindingHandle,

-        Handle

-        );

-

-  return Status;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSerialIoDriverBindingStart (

-  IN  EFI_DRIVER_BINDING_PROTOCOL   *This,

-  IN  EFI_HANDLE                    Handle,

-  IN  EFI_DEVICE_PATH_PROTOCOL      *RemainingDevicePath

-  )

-/*++

-

-Routine Description:

-

-Arguments:

-

-Returns:

-

-  None

-

---*/

-// TODO:    This - add argument and description to function comment

-// TODO:    Handle - add argument and description to function comment

-// TODO:    RemainingDevicePath - add argument and description to function comment

-// TODO:    EFI_SUCCESS - add return value to function comment

-// TODO:    EFI_SUCCESS - add return value to function comment

-{

-  EFI_STATUS                          Status;

-  EFI_WIN_NT_IO_PROTOCOL              *WinNtIo;

-  WIN_NT_SERIAL_IO_PRIVATE_DATA       *Private;

-  HANDLE                              NtHandle;

-  UART_DEVICE_PATH                    Node;

-  EFI_DEVICE_PATH_PROTOCOL            *ParentDevicePath;

-  EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;

-  UINTN                               EntryCount;

-  UINTN                               Index;

-  EFI_SERIAL_IO_PROTOCOL              *SerialIo;

-

-  Private   = NULL;

-  NtHandle  = INVALID_HANDLE_VALUE;

-

-  //

-  // Grab the protocols we need

-  //

-  Status = gBS->OpenProtocol (

-                  Handle,

-                  &gEfiDevicePathProtocolGuid,

-                  &ParentDevicePath,

-                  This->DriverBindingHandle,

-                  Handle,

-                  EFI_OPEN_PROTOCOL_BY_DRIVER

-                  );

-  if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {

-    return Status;

-  }

-

-  //

-  // Grab the IO abstraction we need to get any work done

-  //

-  Status = gBS->OpenProtocol (

-                  Handle,

-                  &gEfiWinNtIoProtocolGuid,

-                  &WinNtIo,

-                  This->DriverBindingHandle,

-                  Handle,

-                  EFI_OPEN_PROTOCOL_BY_DRIVER

-                  );

-  if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {

-    gBS->CloseProtocol (

-          Handle,

-          &gEfiDevicePathProtocolGuid,

-          This->DriverBindingHandle,

-          Handle

-          );

-    return Status;

-  }

-

-  if (Status == EFI_ALREADY_STARTED) {

-

-    if (RemainingDevicePath == NULL) {

-      return EFI_SUCCESS;

-    }

-

-    //

-    // Make sure a child handle does not already exist.  This driver can only

-    // produce one child per serial port.

-    //

-    Status = gBS->OpenProtocolInformation (

-                    Handle,

-                    &gEfiWinNtIoProtocolGuid,

-                    &OpenInfoBuffer,

-                    &EntryCount

-                    );

-    if (EFI_ERROR (Status)) {

-      return Status;

-    }

-

-    Status = EFI_ALREADY_STARTED;

-    for (Index = 0; Index < EntryCount; Index++) {

-      if (OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) {

-        Status = gBS->OpenProtocol (

-                        OpenInfoBuffer[Index].ControllerHandle,

-                        &gEfiSerialIoProtocolGuid,

-                        &SerialIo,

-                        This->DriverBindingHandle,

-                        Handle,

-                        EFI_OPEN_PROTOCOL_GET_PROTOCOL

-                        );

-        if (!EFI_ERROR (Status)) {

-          CopyMem (&Node, RemainingDevicePath, sizeof (UART_DEVICE_PATH));

-          Status = SerialIo->SetAttributes (

-                              SerialIo,

-                              Node.BaudRate,

-                              SerialIo->Mode->ReceiveFifoDepth,

-                              SerialIo->Mode->Timeout,

-                              Node.Parity,

-                              Node.DataBits,

-                              Node.StopBits

-                              );

-        }

-        break;

-      }

-    }

-

-    FreePool (OpenInfoBuffer);

-    return Status;

-  }

-

-  //

-  // Check to see if we can access the hardware device. If it's Open in NT we

-  // will not get access.

-  //

-  NtHandle = WinNtIo->WinNtThunk->CreateFile (

-                                    WinNtIo->EnvString,

-                                    GENERIC_READ | GENERIC_WRITE,

-                                    0,

-                                    NULL,

-                                    OPEN_EXISTING,

-                                    0,

-                                    NULL

-                                    );

-  if (NtHandle == INVALID_HANDLE_VALUE) {

-    Status = EFI_DEVICE_ERROR;

-    goto Error;

-  }

-

-  //

-  // Construct Private data

-  //

-  Private = AllocatePool (sizeof (WIN_NT_SERIAL_IO_PRIVATE_DATA));

-  if (Private == NULL) {

-    goto Error;

-  }

-

-  //

-  // This signature must be valid before any member function is called

-  //

-  Private->Signature              = WIN_NT_SERIAL_IO_PRIVATE_DATA_SIGNATURE;

-  Private->NtHandle               = NtHandle;

-  Private->ControllerHandle       = Handle;

-  Private->Handle                 = NULL;

-  Private->WinNtThunk             = WinNtIo->WinNtThunk;

-  Private->ParentDevicePath       = ParentDevicePath;

-  Private->ControllerNameTable    = NULL;

-

-  Private->SoftwareLoopbackEnable = FALSE;

-  Private->HardwareLoopbackEnable = FALSE;

-  Private->HardwareFlowControl    = FALSE;

-  Private->Fifo.First             = 0;

-  Private->Fifo.Last              = 0;

-  Private->Fifo.Surplus           = SERIAL_MAX_BUFFER_SIZE;

-

-  AddUnicodeString (

-    "eng",

-    gWinNtSerialIoComponentName.SupportedLanguages,

-    &Private->ControllerNameTable,

-    WinNtIo->EnvString

-    );

-

-  Private->SerialIo.Revision      = SERIAL_IO_INTERFACE_REVISION;

-  Private->SerialIo.Reset         = WinNtSerialIoReset;

-  Private->SerialIo.SetAttributes = WinNtSerialIoSetAttributes;

-  Private->SerialIo.SetControl    = WinNtSerialIoSetControl;

-  Private->SerialIo.GetControl    = WinNtSerialIoGetControl;

-  Private->SerialIo.Write         = WinNtSerialIoWrite;

-  Private->SerialIo.Read          = WinNtSerialIoRead;

-  Private->SerialIo.Mode          = &Private->SerialIoMode;

-

-  if (RemainingDevicePath != NULL) {

-    //

-    // Match the configuration of the RemainingDevicePath. IsHandleSupported()

-    // already checked to make sure the RemainingDevicePath contains settings

-    // that we can support.

-    //

-    CopyMem (&Private->UartDevicePath, RemainingDevicePath, sizeof (UART_DEVICE_PATH));

-  } else {

-    //

-    // Build the device path by appending the UART node to the ParentDevicePath

-    // from the WinNtIo handle. The Uart setings are zero here, since

-    // SetAttribute() will update them to match the default setings.

-    //

-    ZeroMem (&Private->UartDevicePath, sizeof (UART_DEVICE_PATH));

-    Private->UartDevicePath.Header.Type     = MESSAGING_DEVICE_PATH;

-    Private->UartDevicePath.Header.SubType  = MSG_UART_DP;

-    SetDevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) &Private->UartDevicePath, sizeof (UART_DEVICE_PATH));

-  }

-

-  //

-  // Build the device path by appending the UART node to the ParentDevicePath

-  // from the WinNtIo handle. The Uart setings are zero here, since

-  // SetAttribute() will update them to match the current setings.

-  //

-  Private->DevicePath = AppendDevicePathNode (

-                          ParentDevicePath,

-                          (EFI_DEVICE_PATH_PROTOCOL *) &Private->UartDevicePath

-                          );

-  if (Private->DevicePath == NULL) {

-    Status = EFI_OUT_OF_RESOURCES;

-    goto Error;

-  }

-

-  //

-  // Fill in Serial I/O Mode structure based on either the RemainingDevicePath or defaults.

-  //

-  Private->SerialIoMode.ControlMask       = SERIAL_CONTROL_MASK;

-  Private->SerialIoMode.Timeout           = SERIAL_TIMEOUT_DEFAULT;

-  Private->SerialIoMode.BaudRate          = Private->UartDevicePath.BaudRate;

-  Private->SerialIoMode.ReceiveFifoDepth  = SERIAL_FIFO_DEFAULT;

-  Private->SerialIoMode.DataBits          = Private->UartDevicePath.DataBits;

-  Private->SerialIoMode.Parity            = Private->UartDevicePath.Parity;

-  Private->SerialIoMode.StopBits          = Private->UartDevicePath.StopBits;

-

-  //

-  // Issue a reset to initialize the COM port

-  //

-  Status = Private->SerialIo.Reset (&Private->SerialIo);

-  if (EFI_ERROR (Status)) {

-    goto Error;

-  }

-

-  //

-  // Create new child handle

-  //

-  Status = gBS->InstallMultipleProtocolInterfaces (

-                  &Private->Handle,

-                  &gEfiSerialIoProtocolGuid,

-                  &Private->SerialIo,

-                  &gEfiDevicePathProtocolGuid,

-                  Private->DevicePath,

-                  NULL

-                  );

-  if (EFI_ERROR (Status)) {

-    goto Error;

-  }

-

-  //

-  // Open For Child Device

-  //

-  Status = gBS->OpenProtocol (

-                  Handle,

-                  &gEfiWinNtIoProtocolGuid,

-                  &WinNtIo,

-                  This->DriverBindingHandle,

-                  Private->Handle,

-                  EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER

-                  );

-  if (EFI_ERROR (Status)) {

-    goto Error;

-  }

-

-  return EFI_SUCCESS;

-

-Error:

-  //

-  // Use the Stop() function to free all resources allocated in Start()

-  //

-  if (Private != NULL) {

-    if (Private->Handle != NULL) {

-      This->Stop (This, Handle, 1, &Private->Handle);

-    } else {

-      if (NtHandle != INVALID_HANDLE_VALUE) {

-        Private->WinNtThunk->CloseHandle (NtHandle);

-      }

-

-      if (Private->DevicePath != NULL) {

-        FreePool (Private->DevicePath);

-      }

-

-      FreeUnicodeStringTable (Private->ControllerNameTable);

-

-      FreePool (Private);

-    }

-  }

-

-  This->Stop (This, Handle, 0, NULL);

-

-  return Status;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSerialIoDriverBindingStop (

-  IN  EFI_DRIVER_BINDING_PROTOCOL   *This,

-  IN  EFI_HANDLE                    Handle,

-  IN  UINTN                         NumberOfChildren,

-  IN  EFI_HANDLE                    *ChildHandleBuffer

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This              - TODO: add argument description

-  Handle            - TODO: add argument description

-  NumberOfChildren  - TODO: add argument description

-  ChildHandleBuffer - TODO: add argument description

-

-Returns:

-

-  EFI_DEVICE_ERROR - TODO: Add description for return value

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  EFI_STATUS                    Status;

-  UINTN                         Index;

-  BOOLEAN                       AllChildrenStopped;

-  EFI_SERIAL_IO_PROTOCOL        *SerialIo;

-  WIN_NT_SERIAL_IO_PRIVATE_DATA *Private;

-  EFI_WIN_NT_IO_PROTOCOL        *WinNtIo;

-

-  //

-  // Complete all outstanding transactions to Controller.

-  // Don't allow any new transaction to Controller to be started.

-  //

-

-  if (NumberOfChildren == 0) {

-    //

-    // Close the bus driver

-    //

-    Status = gBS->CloseProtocol (

-                    Handle,

-                    &gEfiWinNtIoProtocolGuid,

-                    This->DriverBindingHandle,

-                    Handle

-                    );

-    Status = gBS->CloseProtocol (

-                    Handle,

-                    &gEfiDevicePathProtocolGuid,

-                    This->DriverBindingHandle,

-                    Handle

-                    );

-    return Status;

-  }

-

-  AllChildrenStopped = TRUE;

-

-  for (Index = 0; Index < NumberOfChildren; Index++) {

-    Status = gBS->OpenProtocol (

-                    ChildHandleBuffer[Index],

-                    &gEfiSerialIoProtocolGuid,

-                    &SerialIo,

-                    This->DriverBindingHandle,

-                    Handle,

-                    EFI_OPEN_PROTOCOL_GET_PROTOCOL

-                    );

-    if (!EFI_ERROR (Status)) {

-      Private = WIN_NT_SERIAL_IO_PRIVATE_DATA_FROM_THIS (SerialIo);

-

-      ASSERT (Private->Handle == ChildHandleBuffer[Index]);

-

-      Status = gBS->CloseProtocol (

-                      Handle,

-                      &gEfiWinNtIoProtocolGuid,

-                      This->DriverBindingHandle,

-                      ChildHandleBuffer[Index]

-                      );

-

-      Status = gBS->UninstallMultipleProtocolInterfaces (

-                      ChildHandleBuffer[Index],

-                      &gEfiSerialIoProtocolGuid,

-                      &Private->SerialIo,

-                      &gEfiDevicePathProtocolGuid,

-                      Private->DevicePath,

-                      NULL

-                      );

-

-      if (EFI_ERROR (Status)) {

-        gBS->OpenProtocol (

-              Handle,

-              &gEfiWinNtIoProtocolGuid,

-              (VOID **) &WinNtIo,

-              This->DriverBindingHandle,

-              ChildHandleBuffer[Index],

-              EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER

-              );

-      } else {

-        Private->WinNtThunk->CloseHandle (Private->NtHandle);

-

-        FreePool (Private->DevicePath);

-

-        FreeUnicodeStringTable (Private->ControllerNameTable);

-

-        FreePool (Private);

-      }

-    }

-

-    if (EFI_ERROR (Status)) {

-      AllChildrenStopped = FALSE;

-    }

-  }

-

-  if (!AllChildrenStopped) {

-    return EFI_DEVICE_ERROR;

-  }

-

-  return EFI_SUCCESS;

-}

-

-//

-// Serial IO Protocol member functions

-//

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSerialIoReset (

-  IN EFI_SERIAL_IO_PROTOCOL *This

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-{

-  WIN_NT_SERIAL_IO_PRIVATE_DATA *Private;

-  EFI_TPL                       Tpl;

-

-  Tpl     = gBS->RaiseTPL (TPL_NOTIFY);

-

-  Private = WIN_NT_SERIAL_IO_PRIVATE_DATA_FROM_THIS (This);

-

-  Private->WinNtThunk->PurgeComm (

-                        Private->NtHandle,

-                        PURGE_TXCLEAR | PURGE_RXCLEAR

-                        );

-

-  gBS->RestoreTPL (Tpl);

-

-  return This->SetAttributes (

-                This,

-                This->Mode->BaudRate,

-                This->Mode->ReceiveFifoDepth,

-                This->Mode->Timeout,

-                This->Mode->Parity,

-                (UINT8) This->Mode->DataBits,

-                This->Mode->StopBits

-                );

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSerialIoSetAttributes (

-  IN EFI_SERIAL_IO_PROTOCOL *This,

-  IN UINT64                 BaudRate,

-  IN UINT32                 ReceiveFifoDepth,

-  IN UINT32                 Timeout,

-  IN EFI_PARITY_TYPE        Parity,

-  IN UINT8                  DataBits,

-  IN EFI_STOP_BITS_TYPE     StopBits

-  )

-/*++

-

-Routine Description:

-

-  This function is used to set the attributes.

-

-Arguments:

-

-  This              - A pointer to the EFI_SERIAL_IO_PROTOCOL structrue.

-  BaudRate          - The Baud rate of the serial device.

-  ReceiveFifoDepth  - The request depth of fifo on receive side.

-  Timeout           - the request timeout for a single charact.

-  Parity            - The type of parity used in serial device.

-  DataBits          - Number of deata bits used in serial device.

-  StopBits          - Number of stop bits used in serial device.

-

-Returns:

-  Status code

-

-  None

-

---*/

-// TODO:    EFI_SUCCESS - add return value to function comment

-// TODO:    EFI_DEVICE_ERROR - add return value to function comment

-// TODO:    EFI_DEVICE_ERROR - add return value to function comment

-// TODO:    EFI_DEVICE_ERROR - add return value to function comment

-// TODO:    EFI_SUCCESS - add return value to function comment

-// TODO:    EFI_DEVICE_ERROR - add return value to function comment

-// TODO:    EFI_SUCCESS - add return value to function comment

-{

-  EFI_STATUS                    Status;

-  WIN_NT_SERIAL_IO_PRIVATE_DATA *Private;

-  COMMTIMEOUTS                  PortTimeOuts;

-  DWORD                         ConvertedTime;

-  BOOL                          Result;

-  EFI_DEVICE_PATH_PROTOCOL      *NewDevicePath;

-  EFI_TPL                       Tpl;

-

-  Tpl     = gBS->RaiseTPL (TPL_NOTIFY);

-

-  Private = WIN_NT_SERIAL_IO_PRIVATE_DATA_FROM_THIS (This);

-

-  //

-  //  Some of our arguments have defaults if a null value is passed in, and

-  //   we must set the default values if a null argument is passed in.

-  //

-  if (BaudRate == 0) {

-    BaudRate = SERIAL_BAUD_DEFAULT;

-  }

-

-  if (ReceiveFifoDepth == 0) {

-    ReceiveFifoDepth = SERIAL_FIFO_DEFAULT;

-  }

-

-  if (Timeout == 0) {

-    Timeout = SERIAL_TIMEOUT_DEFAULT;

-  }

-

-  if (Parity == DefaultParity) {

-    Parity = NoParity;

-  }

-

-  if (DataBits == 0) {

-    DataBits = SERIAL_DATABITS_DEFAULT;

-  }

-

-  if (StopBits == DefaultStopBits) {

-    StopBits = OneStopBit;

-  }

-  //

-  // See if the new attributes already match the current attributes

-  //

-  if (Private->UartDevicePath.BaudRate       == BaudRate         &&

-      Private->UartDevicePath.DataBits       == DataBits         &&

-      Private->UartDevicePath.Parity         == Parity           &&

-      Private->UartDevicePath.StopBits       == StopBits         &&

-      Private->SerialIoMode.ReceiveFifoDepth == ReceiveFifoDepth &&

-      Private->SerialIoMode.Timeout          == Timeout             ) {

-    gBS->RestoreTPL(Tpl);

-    return EFI_SUCCESS;

-  }

-

-  //

-  //  Get current values from NT

-  //

-  ZeroMem (&Private->NtDCB, sizeof (DCB));

-  Private->NtDCB.DCBlength = sizeof (DCB);

-

-  if (!Private->WinNtThunk->GetCommState (Private->NtHandle, &Private->NtDCB)) {

-    Private->NtError = Private->WinNtThunk->GetLastError ();

-    DEBUG ((EFI_D_ERROR, "SerialSetAttributes: GetCommState %d\n", Private->NtError));

-    gBS->RestoreTPL (Tpl);

-    return EFI_DEVICE_ERROR;

-  }

-

-  //

-  // Map EFI com setting to NT

-  //

-  Private->NtDCB.BaudRate         = ConvertBaud2Nt (BaudRate);

-  Private->NtDCB.ByteSize         = ConvertData2Nt (DataBits);

-  Private->NtDCB.Parity           = ConvertParity2Nt (Parity);

-  Private->NtDCB.StopBits         = ConvertStop2Nt (StopBits);

-

-  Private->NtDCB.fBinary          = TRUE;

-  Private->NtDCB.fParity          = Private->NtDCB.Parity == NOPARITY ? FALSE : TRUE;

-  Private->NtDCB.fOutxCtsFlow     = FALSE;

-  Private->NtDCB.fOutxDsrFlow     = FALSE;

-  Private->NtDCB.fDtrControl      = DTR_CONTROL_ENABLE;

-  Private->NtDCB.fDsrSensitivity  = FALSE;

-  Private->NtDCB.fOutX            = FALSE;

-  Private->NtDCB.fInX             = FALSE;

-  Private->NtDCB.fRtsControl      = RTS_CONTROL_ENABLE;

-  Private->NtDCB.fNull            = FALSE;

-

-  //

-  //  Set new values

-  //

-  Result = Private->WinNtThunk->SetCommState (Private->NtHandle, &Private->NtDCB);

-  if (!Result) {

-    Private->NtError = Private->WinNtThunk->GetLastError ();

-    DEBUG ((EFI_D_ERROR, "SerialSetAttributes: SetCommState %d\n", Private->NtError));

-    gBS->RestoreTPL (Tpl);

-    return EFI_DEVICE_ERROR;

-  }

-

-  //

-  //  Set com port read/write timeout values

-  //

-  ConvertedTime = ConvertTime2Nt (Timeout);

-  PortTimeOuts.ReadIntervalTimeout = MAXDWORD;

-  PortTimeOuts.ReadTotalTimeoutMultiplier = 0;

-  PortTimeOuts.ReadTotalTimeoutConstant = ConvertedTime;

-  PortTimeOuts.WriteTotalTimeoutMultiplier = ConvertedTime == 0 ? 1 : ConvertedTime;

-  PortTimeOuts.WriteTotalTimeoutConstant = 0;

-

-  if (!Private->WinNtThunk->SetCommTimeouts (Private->NtHandle, &PortTimeOuts)) {

-    Private->NtError = Private->WinNtThunk->GetLastError ();

-    DEBUG ((EFI_D_ERROR, "SerialSetAttributes: SetCommTimeouts %d\n", Private->NtError));

-    gBS->RestoreTPL (Tpl);

-    return EFI_DEVICE_ERROR;

-  }

-

-  //

-  //  Update mode

-  //

-  Private->SerialIoMode.BaudRate          = BaudRate;

-  Private->SerialIoMode.ReceiveFifoDepth  = ReceiveFifoDepth;

-  Private->SerialIoMode.Timeout           = Timeout;

-  Private->SerialIoMode.Parity            = Parity;

-  Private->SerialIoMode.DataBits          = DataBits;

-  Private->SerialIoMode.StopBits          = StopBits;

-

-  //

-  // See if Device Path Node has actually changed

-  //

-  if (Private->UartDevicePath.BaudRate     == BaudRate &&

-      Private->UartDevicePath.DataBits     == DataBits &&

-      Private->UartDevicePath.Parity       == Parity   &&

-      Private->UartDevicePath.StopBits     == StopBits    ) {

-    gBS->RestoreTPL(Tpl);

-    return EFI_SUCCESS;

-  }

-

-  //

-  // Update the device path

-  //

-  Private->UartDevicePath.BaudRate  = BaudRate;

-  Private->UartDevicePath.DataBits  = DataBits;

-  Private->UartDevicePath.Parity    = (UINT8) Parity;

-  Private->UartDevicePath.StopBits  = (UINT8) StopBits;

-

-  NewDevicePath = AppendDevicePathNode (

-                    Private->ParentDevicePath,

-                    (EFI_DEVICE_PATH_PROTOCOL *) &Private->UartDevicePath

-                    );

-  if (NewDevicePath == NULL) {

-    gBS->RestoreTPL (Tpl);

-    return EFI_DEVICE_ERROR;

-  }

-

-  if (Private->Handle != NULL) {

-    Status = gBS->ReinstallProtocolInterface (

-                    Private->Handle,

-                    &gEfiDevicePathProtocolGuid,

-                    Private->DevicePath,

-                    NewDevicePath

-                    );

-    if (EFI_ERROR (Status)) {

-      gBS->RestoreTPL (Tpl);

-      return Status;

-    }

-  }

-

-  if (Private->DevicePath != NULL) {

-    FreePool (Private->DevicePath);

-  }

-

-  Private->DevicePath = NewDevicePath;

-

-  gBS->RestoreTPL (Tpl);

-

-  return EFI_SUCCESS;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSerialIoSetControl (

-  IN EFI_SERIAL_IO_PROTOCOL *This,

-  IN UINT32                 Control

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This    - TODO: add argument description

-  Control - TODO: add argument description

-

-Returns:

-

-  EFI_DEVICE_ERROR - TODO: Add description for return value

-  EFI_DEVICE_ERROR - TODO: Add description for return value

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  WIN_NT_SERIAL_IO_PRIVATE_DATA *Private;

-  BOOL                          Result;

-  DCB                           Dcb;

-  EFI_TPL                       Tpl;

-

-  Tpl     = gBS->RaiseTPL (TPL_NOTIFY);

-

-  Private = WIN_NT_SERIAL_IO_PRIVATE_DATA_FROM_THIS (This);

-

-  Result  = Private->WinNtThunk->GetCommState (Private->NtHandle, &Dcb);

-

-  if (!Result) {

-    Private->NtError = Private->WinNtThunk->GetLastError ();

-    DEBUG ((EFI_D_ERROR, "SerialSetControl: GetCommState %d\n", Private->NtError));

-    gBS->RestoreTPL (Tpl);

-    return EFI_DEVICE_ERROR;

-  }

-

-  Dcb.fRtsControl                 = RTS_CONTROL_DISABLE;

-  Dcb.fDtrControl                 = DTR_CONTROL_DISABLE;

-  Private->HardwareFlowControl    = FALSE;

-  Private->SoftwareLoopbackEnable = FALSE;

-  Private->HardwareLoopbackEnable = FALSE;

-

-  if (Control & EFI_SERIAL_REQUEST_TO_SEND) {

-    Dcb.fRtsControl = RTS_CONTROL_ENABLE;

-  }

-

-  if (Control & EFI_SERIAL_DATA_TERMINAL_READY) {

-    Dcb.fDtrControl = DTR_CONTROL_ENABLE;

-  }

-

-  if (Control & EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE) {

-    Private->HardwareFlowControl = TRUE;

-  }

-

-  if (Control & EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE) {

-    Private->SoftwareLoopbackEnable = TRUE;

-  }

-

-  if (Control & EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE) {

-    Private->HardwareLoopbackEnable = TRUE;

-  }

-

-  Result = Private->WinNtThunk->SetCommState (

-                                  Private->NtHandle,

-                                  &Dcb

-                                  );

-

-  if (!Result) {

-    Private->NtError = Private->WinNtThunk->GetLastError ();

-    DEBUG ((EFI_D_ERROR, "SerialSetControl: SetCommState %d\n", Private->NtError));

-    gBS->RestoreTPL (Tpl);

-    return EFI_DEVICE_ERROR;

-  }

-

-  gBS->RestoreTPL (Tpl);

-

-  return EFI_SUCCESS;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSerialIoGetControl (

-  IN  EFI_SERIAL_IO_PROTOCOL  *This,

-  OUT UINT32                  *Control

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This    - TODO: add argument description

-  Control - TODO: add argument description

-

-Returns:

-

-  EFI_DEVICE_ERROR - TODO: Add description for return value

-  EFI_DEVICE_ERROR - TODO: Add description for return value

-  EFI_DEVICE_ERROR - TODO: Add description for return value

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  WIN_NT_SERIAL_IO_PRIVATE_DATA *Private;

-  DWORD                         ModemStatus;

-  DWORD                         Errors;

-  UINT32                        Bits;

-  DCB                           Dcb;

-  EFI_TPL                       Tpl;

-

-  Tpl     = gBS->RaiseTPL (TPL_NOTIFY);

-

-  Private = WIN_NT_SERIAL_IO_PRIVATE_DATA_FROM_THIS (This);

-

-  //

-  //  Get modem status

-  //

-  if (!Private->WinNtThunk->GetCommModemStatus (Private->NtHandle, &ModemStatus)) {

-    Private->NtError = Private->WinNtThunk->GetLastError ();

-    gBS->RestoreTPL (Tpl);

-    return EFI_DEVICE_ERROR;

-  }

-

-  Bits = 0;

-  if (ModemStatus & MS_CTS_ON) {

-    Bits |= EFI_SERIAL_CLEAR_TO_SEND;

-  }

-

-  if (ModemStatus & MS_DSR_ON) {

-    Bits |= EFI_SERIAL_DATA_SET_READY;

-  }

-

-  if (ModemStatus & MS_RING_ON) {

-    Bits |= EFI_SERIAL_RING_INDICATE;

-  }

-

-  if (ModemStatus & MS_RLSD_ON) {

-    Bits |= EFI_SERIAL_CARRIER_DETECT;

-  }

-

-  //

-  // Get ctrl status

-  //

-  if (!Private->WinNtThunk->GetCommState (Private->NtHandle, &Dcb)) {

-    Private->NtError = Private->WinNtThunk->GetLastError ();

-    DEBUG ((EFI_D_ERROR, "SerialGetControl: GetCommState %d\n", Private->NtError));

-    gBS->RestoreTPL (Tpl);

-    return EFI_DEVICE_ERROR;

-  }

-

-  if (Dcb.fDtrControl == DTR_CONTROL_ENABLE) {

-    Bits |= EFI_SERIAL_DATA_TERMINAL_READY;

-  }

-

-  if (Dcb.fRtsControl == RTS_CONTROL_ENABLE) {

-    Bits |= EFI_SERIAL_REQUEST_TO_SEND;

-  }

-

-  if (Private->HardwareFlowControl) {

-    Bits |= EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE;

-  }

-

-  if (Private->SoftwareLoopbackEnable) {

-    Bits |= EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE;

-  }

-

-  if (Private->HardwareLoopbackEnable) {

-    Bits |= EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE;

-  }

-

-  //

-  //  Get input buffer status

-  //

-  if (!Private->WinNtThunk->ClearCommError (Private->NtHandle, &Errors, &Private->NtComStatus)) {

-    Private->NtError = Private->WinNtThunk->GetLastError ();

-    DEBUG ((EFI_D_ERROR, "SerialGetControl: ClearCommError %d\n", Private->NtError));

-    gBS->RestoreTPL (Tpl);

-    return EFI_DEVICE_ERROR;

-  }

-

-  if (Private->NtComStatus.cbInQue == 0) {

-    Bits |= EFI_SERIAL_INPUT_BUFFER_EMPTY;

-  }

-

-  *Control = Bits;

-

-  gBS->RestoreTPL (Tpl);

-

-  return EFI_SUCCESS;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSerialIoWrite (

-  IN EFI_SERIAL_IO_PROTOCOL   *This,

-  IN OUT UINTN                *BufferSize,

-  IN VOID                     *Buffer

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This        - TODO: add argument description

-  BufferSize  - TODO: add argument description

-  Buffer      - TODO: add argument description

-

-Returns:

-

-  EFI_DEVICE_ERROR - TODO: Add description for return value

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  WIN_NT_SERIAL_IO_PRIVATE_DATA *Private;

-  UINT8                         *ByteBuffer;

-  UINTN                         TotalBytesWritten;

-  DWORD                         BytesToGo;

-  DWORD                         BytesWritten;

-  BOOL                          Result;

-  UINT32                        Index;

-  UINT32                        Control;

-  EFI_TPL                       Tpl;

-

-  Tpl               = gBS->RaiseTPL (TPL_NOTIFY);

-

-  Private           = WIN_NT_SERIAL_IO_PRIVATE_DATA_FROM_THIS (This);

-

-  ByteBuffer        = (UINT8 *) Buffer;

-  TotalBytesWritten = 0;

-

-  if (Private->SoftwareLoopbackEnable || Private->HardwareLoopbackEnable) {

-    for (Index = 0; Index < *BufferSize; Index++) {

-      if (IsaSerialFifoAdd (&Private->Fifo, ByteBuffer[Index]) == EFI_SUCCESS) {

-        TotalBytesWritten++;

-      } else {

-        break;

-      }

-    }

-  } else {

-    BytesToGo = (DWORD) (*BufferSize);

-

-    do {

-      if (Private->HardwareFlowControl) {

-        //

-        // Send RTS

-        //

-        WinNtSerialIoGetControl (&Private->SerialIo, &Control);

-        Control |= EFI_SERIAL_REQUEST_TO_SEND;

-        WinNtSerialIoSetControl (&Private->SerialIo, Control);

-      }

-

-      //

-      //  Do the write

-      //

-      Result = Private->WinNtThunk->WriteFile (

-                                      Private->NtHandle,

-                                      &ByteBuffer[TotalBytesWritten],

-                                      BytesToGo,

-                                      &BytesWritten,

-                                      NULL

-                                      );

-

-      if (Private->HardwareFlowControl) {

-        //

-        // Assert RTS

-        //

-        WinNtSerialIoGetControl (&Private->SerialIo, &Control);

-        Control &= ~ (UINT32) EFI_SERIAL_REQUEST_TO_SEND;

-        WinNtSerialIoSetControl (&Private->SerialIo, Control);

-      }

-

-      TotalBytesWritten += BytesWritten;

-      BytesToGo -= BytesWritten;

-      if (!Result) {

-        Private->NtError = Private->WinNtThunk->GetLastError ();

-        DEBUG ((EFI_D_ERROR, "SerialWrite: FileWrite %d\n", Private->NtError));

-        *BufferSize = TotalBytesWritten;

-        gBS->RestoreTPL (Tpl);

-        return EFI_DEVICE_ERROR;

-      }

-    } while (BytesToGo > 0);

-  }

-

-  *BufferSize = TotalBytesWritten;

-

-  gBS->RestoreTPL (Tpl);

-

-  return EFI_SUCCESS;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSerialIoRead (

-  IN  EFI_SERIAL_IO_PROTOCOL  *This,

-  IN  OUT UINTN               *BufferSize,

-  OUT VOID                    *Buffer

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This        - TODO: add argument description

-  BufferSize  - TODO: add argument description

-  Buffer      - TODO: add argument description

-

-Returns:

-

-  EFI_DEVICE_ERROR - TODO: Add description for return value

-

---*/

-{

-  WIN_NT_SERIAL_IO_PRIVATE_DATA *Private;

-  BOOL                          Result;

-  DWORD                         BytesRead;

-  EFI_STATUS                    Status;

-  UINT32                        Index;

-  UINT8                         Data;

-  UINT32                        Control;

-  EFI_TPL                       Tpl;

-

-  Tpl     = gBS->RaiseTPL (TPL_NOTIFY);

-

-  Private = WIN_NT_SERIAL_IO_PRIVATE_DATA_FROM_THIS (This);

-

-  //

-  //  Do the read

-  //

-  if (Private->SoftwareLoopbackEnable || Private->HardwareLoopbackEnable) {

-    for (Index = 0, BytesRead = 0; Index < *BufferSize; Index++) {

-      if (IsaSerialFifoRemove (&Private->Fifo, &Data) == EFI_SUCCESS) {

-        ((UINT8 *) Buffer)[Index] = Data;

-        BytesRead++;

-      } else {

-        break;

-      }

-    }

-  } else {

-    if (Private->HardwareFlowControl) {

-      WinNtSerialIoGetControl (&Private->SerialIo, &Control);

-      Control |= EFI_SERIAL_DATA_TERMINAL_READY;

-      WinNtSerialIoSetControl (&Private->SerialIo, Control);

-    }

-

-    Result = Private->WinNtThunk->ReadFile (

-                                    Private->NtHandle,

-                                    Buffer,

-                                    (DWORD) *BufferSize,

-                                    &BytesRead,

-                                    NULL

-                                    );

-

-    if (Private->HardwareFlowControl) {

-      WinNtSerialIoGetControl (&Private->SerialIo, &Control);

-      Control &= ~ (UINT32) EFI_SERIAL_DATA_TERMINAL_READY;

-      WinNtSerialIoSetControl (&Private->SerialIo, Control);

-    }

-

-    if (!Result) {

-      Private->NtError = Private->WinNtThunk->GetLastError ();

-      gBS->RestoreTPL (Tpl);

-      return EFI_DEVICE_ERROR;

-    }

-  }

-

-  if (BytesRead != *BufferSize) {

-    Status = EFI_TIMEOUT;

-  } else {

-    Status = EFI_SUCCESS;

-  }

-

-  *BufferSize = (UINTN) BytesRead;

-

-  gBS->RestoreTPL (Tpl);

-

-  return Status;

-}

-

-BOOLEAN

-IsaSerialFifoFull (

-  IN SERIAL_DEV_FIFO *Fifo

-  )

-/*++

-

-  Routine Description:

-  Detect whether specific FIFO is full or not

-

-  Arguments:

-  Fifo  SERIAL_DEV_FIFO *: A pointer to the Data Structure SERIAL_DEV_FIFO

-

-  Returns:

-  TRUE:  the FIFO is full

-  FALSE: the FIFO is not full

-

---*/

-{

-  if (Fifo->Surplus == 0) {

-    return TRUE;

-  }

-

-  return FALSE;

-}

-

-BOOLEAN

-IsaSerialFifoEmpty (

-  IN SERIAL_DEV_FIFO *Fifo

-  )

-/*++

-

-  Routine Description:

-  Detect whether specific FIFO is empty or not

-

-  Arguments:

-    Fifo  SERIAL_DEV_FIFO *: A pointer to the Data Structure SERIAL_DEV_FIFO

-

-  Returns:

-    TRUE:  the FIFO is empty

-    FALSE: the FIFO is not empty

-

---*/

-{

-  if (Fifo->Surplus == SERIAL_MAX_BUFFER_SIZE) {

-    return TRUE;

-  }

-

-  return FALSE;

-}

-

-EFI_STATUS

-IsaSerialFifoAdd (

-  IN SERIAL_DEV_FIFO *Fifo,

-  IN UINT8           Data

-  )

-/*++

-

-  Routine Description:

-  Add data to specific FIFO

-

-  Arguments:

-    Fifo  SERIAL_DEV_FIFO *: A pointer to the Data Structure SERIAL_DEV_FIFO

-    Data  UINT8: the data added to FIFO

-

-  Returns:

-    EFI_SUCCESS:  Add data to specific FIFO successfully

-    EFI_OUT_RESOURCE: Failed to add data because FIFO is already full

-

---*/

-// TODO:    EFI_OUT_OF_RESOURCES - add return value to function comment

-{

-  //

-  // if FIFO full can not add data

-  //

-  if (IsaSerialFifoFull (Fifo)) {

-    return EFI_OUT_OF_RESOURCES;

-  }

-

-  //

-  // FIFO is not full can add data

-  //

-  Fifo->Data[Fifo->Last] = Data;

-  Fifo->Surplus--;

-  Fifo->Last++;

-  if (Fifo->Last >= SERIAL_MAX_BUFFER_SIZE) {

-    Fifo->Last = 0;

-  }

-

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-IsaSerialFifoRemove (

-  IN  SERIAL_DEV_FIFO *Fifo,

-  OUT UINT8           *Data

-  )

-/*++

-

-  Routine Description:

-  Remove data from specific FIFO

-

-  Arguments:

-    Fifo  SERIAL_DEV_FIFO *: A pointer to the Data Structure SERIAL_DEV_FIFO

-    Data  UINT8*: the data removed from FIFO

-

-  Returns:

-    EFI_SUCCESS:  Remove data from specific FIFO successfully

-    EFI_OUT_RESOURCE: Failed to remove data because FIFO is empty

-

---*/

-// TODO:    EFI_OUT_OF_RESOURCES - add return value to function comment

-{

-  //

-  // if FIFO is empty, no data can remove

-  //

-  if (IsaSerialFifoEmpty (Fifo)) {

-    return EFI_OUT_OF_RESOURCES;

-  }

-

-  //

-  // FIFO is not empty, can remove data

-  //

-  *Data = Fifo->Data[Fifo->First];

-  Fifo->Surplus++;

-  Fifo->First++;

-  if (Fifo->First >= SERIAL_MAX_BUFFER_SIZE) {

-    Fifo->First = 0;

-  }

-

-  return EFI_SUCCESS;

-}

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.h b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.h
deleted file mode 100644
index 79e905c..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.h
+++ /dev/null
@@ -1,513 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  WinNtSerialIo.h

-

-Abstract:

-

-

---*/

-

-#ifndef _WIN_NT_SERIAL_IO_

-#define _WIN_NT_SERIAL_IO_

-

-

-

-#define SERIAL_MAX_BUFFER_SIZE  256

-#define TIMEOUT_STALL_INTERVAL  10

-

-typedef struct {

-  UINT32  First;

-  UINT32  Last;

-  UINT32  Surplus;

-  UINT8   Data[SERIAL_MAX_BUFFER_SIZE];

-} SERIAL_DEV_FIFO;

-

-#define WIN_NT_SERIAL_IO_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('N', 'T', 's', 'i')

-typedef struct {

-  UINT64                    Signature;

-

-  //

-  // Protocol data for the new handle we are going to add

-  //

-  EFI_HANDLE                Handle;

-  EFI_SERIAL_IO_PROTOCOL    SerialIo;

-  EFI_SERIAL_IO_MODE        SerialIoMode;

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;

-

-  //

-  // Private Data

-  //

-  EFI_HANDLE                ControllerHandle;

-  EFI_DEVICE_PATH_PROTOCOL  *ParentDevicePath;

-  UART_DEVICE_PATH          UartDevicePath;

-  EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;

-

-  EFI_UNICODE_STRING_TABLE  *ControllerNameTable;

-

-  //

-  // Private NT type Data;

-  //

-  HANDLE                    NtHandle;

-  DCB                       NtDCB;

-  DWORD                     NtError;

-  COMSTAT                   NtComStatus;

-

-  BOOLEAN                   SoftwareLoopbackEnable;

-  BOOLEAN                   HardwareFlowControl;

-  BOOLEAN                   HardwareLoopbackEnable;

-

-  SERIAL_DEV_FIFO           Fifo;

-

-} WIN_NT_SERIAL_IO_PRIVATE_DATA;

-

-#define WIN_NT_SERIAL_IO_PRIVATE_DATA_FROM_THIS(a) \

-         CR(a, WIN_NT_SERIAL_IO_PRIVATE_DATA, SerialIo, WIN_NT_SERIAL_IO_PRIVATE_DATA_SIGNATURE)

-

-//

-// Global Protocol Variables

-//

-extern EFI_DRIVER_BINDING_PROTOCOL  gWinNtSerialIoDriverBinding;

-extern EFI_COMPONENT_NAME_PROTOCOL  gWinNtSerialIoComponentName;

-

-//

-// Macros to convert EFI serial types to NT serial types.

-//

-

-//

-// one second

-//

-#define SERIAL_TIMEOUT_DEFAULT  (1000 * 1000) 

-#define SERIAL_BAUD_DEFAULT     115200

-#define SERIAL_FIFO_DEFAULT     14

-#define SERIAL_DATABITS_DEFAULT 8

-#define SERIAL_PARITY_DEFAULT   DefaultParity

-#define SERIAL_STOPBITS_DEFAULT DefaultStopBits

-

-#define SERIAL_CONTROL_MASK     (EFI_SERIAL_CLEAR_TO_SEND       | \

-                                 EFI_SERIAL_DATA_SET_READY      | \

-                                 EFI_SERIAL_RING_INDICATE       | \

-                                 EFI_SERIAL_CARRIER_DETECT      | \

-                                 EFI_SERIAL_REQUEST_TO_SEND     | \

-                                 EFI_SERIAL_DATA_TERMINAL_READY | \

-                                 EFI_SERIAL_INPUT_BUFFER_EMPTY)

-

-#define ConvertBaud2Nt(x)       (DWORD) x

-#define ConvertData2Nt(x)       (BYTE) x

-

-#define ConvertParity2Nt(x)              \

-    (BYTE) (                             \

-    x == DefaultParity ? NOPARITY    :   \

-    x == NoParity      ? NOPARITY    :   \

-    x == EvenParity    ? EVENPARITY  :   \

-    x == OddParity     ? ODDPARITY   :   \

-    x == MarkParity    ? MARKPARITY  :   \

-    x == SpaceParity   ? SPACEPARITY : 0 \

-    )

-

-#define ConvertStop2Nt(x)                 \

-    (BYTE) (                                \

-    x == DefaultParity   ? ONESTOPBIT   :   \

-    x == OneFiveStopBits ? ONE5STOPBITS :   \

-    x == TwoStopBits     ? TWOSTOPBITS  : 0 \

-    )

-

-#define ConvertTime2Nt(x) ((x) / 1000)

-

-//

-// 115400 baud with rounding errors

-//

-#define SERIAL_PORT_MAX_BAUD_RATE 115400  

-

-//

-// Function Prototypes

-//

-EFI_STATUS

-EFIAPI

-InitializeWinNtSerialIo (

-  IN EFI_HANDLE           ImageHandle,

-  IN EFI_SYSTEM_TABLE     *SystemTable

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  ImageHandle - TODO: add argument description

-  SystemTable - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSerialIoDriverBindingSupported (

-  IN  EFI_DRIVER_BINDING_PROTOCOL     *This,

-  IN  EFI_HANDLE                      Handle,

-  IN  EFI_DEVICE_PATH_PROTOCOL        *RemainingDevicePath

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This                - TODO: add argument description

-  Handle              - TODO: add argument description

-  RemainingDevicePath - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSerialIoDriverBindingStart (

-  IN  EFI_DRIVER_BINDING_PROTOCOL     *This,

-  IN  EFI_HANDLE                      Handle,

-  IN  EFI_DEVICE_PATH_PROTOCOL        *RemainingDevicePath

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This                - TODO: add argument description

-  Handle              - TODO: add argument description

-  RemainingDevicePath - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSerialIoDriverBindingStop (

-  IN  EFI_DRIVER_BINDING_PROTOCOL   *This,

-  IN  EFI_HANDLE                    Handle,

-  IN  UINTN                         NumberOfChildren,

-  IN  EFI_HANDLE                    *ChildHandleBuffer

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This              - TODO: add argument description

-  Handle            - TODO: add argument description

-  NumberOfChildren  - TODO: add argument description

-  ChildHandleBuffer - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSerialIoReset (

-  IN EFI_SERIAL_IO_PROTOCOL *This

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSerialIoSetAttributes (

-  IN EFI_SERIAL_IO_PROTOCOL *This,

-  IN UINT64                 BaudRate,

-  IN UINT32                 ReceiveFifoDepth,

-  IN UINT32                 Timeout,

-  IN EFI_PARITY_TYPE        Parity,

-  IN UINT8                  DataBits,

-  IN EFI_STOP_BITS_TYPE     StopBits

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This              - TODO: add argument description

-  BaudRate          - TODO: add argument description

-  ReceiveFifoDepth  - TODO: add argument description

-  Timeout           - TODO: add argument description

-  Parity            - TODO: add argument description

-  DataBits          - TODO: add argument description

-  StopBits          - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSerialIoSetControl (

-  IN EFI_SERIAL_IO_PROTOCOL *This,

-  IN UINT32                 Control

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This    - TODO: add argument description

-  Control - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSerialIoGetControl (

-  IN  EFI_SERIAL_IO_PROTOCOL  *This,

-  OUT UINT32                  *Control

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This    - TODO: add argument description

-  Control - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSerialIoWrite (

-  IN EFI_SERIAL_IO_PROTOCOL   *This,

-  IN OUT UINTN                *BufferSize,

-  IN VOID                     *Buffer

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This        - TODO: add argument description

-  BufferSize  - TODO: add argument description

-  Buffer      - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSerialIoRead (

-  IN  EFI_SERIAL_IO_PROTOCOL  *This,

-  IN  OUT UINTN               *BufferSize,

-  OUT VOID                    *Buffer

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This        - TODO: add argument description

-  BufferSize  - TODO: add argument description

-  Buffer      - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-BOOLEAN

-IsaSerialFifoFull (

-  IN SERIAL_DEV_FIFO *Fifo

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Fifo  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-BOOLEAN

-IsaSerialFifoEmpty (

-  IN SERIAL_DEV_FIFO *Fifo

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Fifo  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-IsaSerialFifoAdd (

-  IN SERIAL_DEV_FIFO *Fifo,

-  IN UINT8           Data

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Fifo  - TODO: add argument description

-  Data  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-IsaSerialFifoRemove (

-  IN  SERIAL_DEV_FIFO *Fifo,

-  OUT UINT8           *Data

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Fifo  - TODO: add argument description

-  Data  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-IsaSerialReceiveTransmit (

-  WIN_NT_SERIAL_IO_PRIVATE_DATA     *Private

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-#endif

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.msa
deleted file mode 100644
index b7e5107..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.msa
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>WinNtSerialIo</ModuleName>

-    <ModuleType>UEFI_DRIVER</ModuleType>

-    <GuidValue>6B41B553-A649-11d4-BD02-0080C73C8881</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>Serial I/O driver</Abstract>

-    <Description>Our DriverBinding member functions operate on the handles

-      created by the NT Bus drive</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>WinNtSerialIo</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiDriverModelLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiDriverEntryPoint</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseMemoryLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiBootServicesTableLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DevicePathLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>MemoryAllocationLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>WinNtSerialIo.h</Filename>

-    <Filename>WinNtSerialIo.c</Filename>

-    <Filename>ComponentName.c</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <Protocols>

-    <Protocol Usage="TO_START">

-      <ProtocolCName>gEfiWinNtIoProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="TO_START">

-      <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="BY_START">

-      <ProtocolCName>gEfiSerialIoProtocolGuid</ProtocolCName>

-    </Protocol>

-  </Protocols>

-  <Guids>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiWinNtSerialPortGuid</GuidCName>

-    </GuidCNames>

-  </Guids>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-    <Extern>

-      <DriverBinding>gWinNtSerialIoDriverBinding</DriverBinding>

-      <ComponentName>gWinNtSerialIoComponentName</ComponentName>

-    </Extern>

-  </Externs>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/ComponentName.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/ComponentName.c
deleted file mode 100644
index c6240df..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/ComponentName.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  ComponentName.c

-

-Abstract:

-

---*/

-

-#include "WinNtSimpleFileSystem.h"

-

-//

-// EFI Component Name Functions

-//

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemComponentNameGetDriverName (

-  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,

-  IN  CHAR8                        *Language,

-  OUT CHAR16                       **DriverName

-  );

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemComponentNameGetControllerName (

-  IN  EFI_COMPONENT_NAME_PROTOCOL                                        *This,

-  IN  EFI_HANDLE                                                         ControllerHandle,

-  IN  EFI_HANDLE                                                         ChildHandle        OPTIONAL,

-  IN  CHAR8                                                              *Language,

-  OUT CHAR16                                                             **ControllerName

-  );

-

-//

-// EFI Component Name Protocol

-//

-EFI_COMPONENT_NAME_PROTOCOL     gWinNtSimpleFileSystemComponentName = {

-  WinNtSimpleFileSystemComponentNameGetDriverName,

-  WinNtSimpleFileSystemComponentNameGetControllerName,

-  "eng"

-};

-

-static EFI_UNICODE_STRING_TABLE mWinNtSimpleFileSystemDriverNameTable[] = {

-  {

-    "eng",

-    L"Windows Simple File System Driver"

-  },

-  {

-    NULL,

-    NULL

-  }

-};

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemComponentNameGetDriverName (

-  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,

-  IN  CHAR8                        *Language,

-  OUT CHAR16                       **DriverName

-  )

-/*++

-

-  Routine Description:

-    Retrieves a Unicode string that is the user readable name of the EFI Driver.

-

-  Arguments:

-    This       - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.

-    Language   - A pointer to a three character ISO 639-2 language identifier.

-                 This is the language of the driver name that that the caller 

-                 is requesting, and it must match one of the languages specified

-                 in SupportedLanguages.  The number of languages supported by a 

-                 driver is up to the driver writer.

-    DriverName - A pointer to the Unicode string to return.  This Unicode string

-                 is the name of the driver specified by This in the language 

-                 specified by Language.

-

-  Returns:

-    EFI_SUCCESS           - The Unicode string for the Driver specified by This

-                            and the language specified by Language was returned 

-                            in DriverName.

-    EFI_INVALID_PARAMETER - Language is NULL.

-    EFI_INVALID_PARAMETER - DriverName is NULL.

-    EFI_UNSUPPORTED       - The driver specified by This does not support the 

-                            language specified by Language.

-

---*/

-{

-  return LookupUnicodeString (

-          Language,

-          gWinNtSimpleFileSystemComponentName.SupportedLanguages,

-          mWinNtSimpleFileSystemDriverNameTable,

-          DriverName

-          );

-}

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemComponentNameGetControllerName (

-  IN  EFI_COMPONENT_NAME_PROTOCOL                                        *This,

-  IN  EFI_HANDLE                                                         ControllerHandle,

-  IN  EFI_HANDLE                                                         ChildHandle        OPTIONAL,

-  IN  CHAR8                                                              *Language,

-  OUT CHAR16                                                             **ControllerName

-  )

-/*++

-

-  Routine Description:

-    Retrieves a Unicode string that is the user readable name of the controller

-    that is being managed by an EFI Driver.

-

-  Arguments:

-    This             - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.

-    ControllerHandle - The handle of a controller that the driver specified by 

-                       This is managing.  This handle specifies the controller 

-                       whose name is to be returned.

-    ChildHandle      - The handle of the child controller to retrieve the name 

-                       of.  This is an optional parameter that may be NULL.  It 

-                       will be NULL for device drivers.  It will also be NULL 

-                       for a bus drivers that wish to retrieve the name of the 

-                       bus controller.  It will not be NULL for a bus driver 

-                       that wishes to retrieve the name of a child controller.

-    Language         - A pointer to a three character ISO 639-2 language 

-                       identifier.  This is the language of the controller name 

-                       that that the caller is requesting, and it must match one

-                       of the languages specified in SupportedLanguages.  The 

-                       number of languages supported by a driver is up to the 

-                       driver writer.

-    ControllerName   - A pointer to the Unicode string to return.  This Unicode

-                       string is the name of the controller specified by 

-                       ControllerHandle and ChildHandle in the language specified

-                       by Language from the point of view of the driver specified

-                       by This. 

-

-  Returns:

-    EFI_SUCCESS           - The Unicode string for the user readable name in the 

-                            language specified by Language for the driver 

-                            specified by This was returned in DriverName.

-    EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.

-    EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.

-    EFI_INVALID_PARAMETER - Language is NULL.

-    EFI_INVALID_PARAMETER - ControllerName is NULL.

-    EFI_UNSUPPORTED       - The driver specified by This is not currently managing 

-                            the controller specified by ControllerHandle and 

-                            ChildHandle.

-    EFI_UNSUPPORTED       - The driver specified by This does not support the 

-                            language specified by Language.

-

---*/

-{

-  EFI_STATUS                        Status;

-  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL   *SimpleFileSystem;

-  WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE *Private;

-

-  //

-  // This is a device driver, so ChildHandle must be NULL.

-  //

-  if (ChildHandle != NULL) {

-    return EFI_UNSUPPORTED;

-  }

-

-  //

-  // Make sure this driver is currently managing ControllerHandle

-  //

-  Status = EfiTestManagedDevice (

-             ControllerHandle,

-             gWinNtSimpleFileSystemDriverBinding.DriverBindingHandle,

-             &gEfiWinNtIoProtocolGuid

-             );

-  if (EFI_ERROR (Status)) {

-    return EFI_UNSUPPORTED;

-  }

-  //

-  // Get our context back

-  //

-  Status = gBS->OpenProtocol (

-                  ControllerHandle,

-                  &gEfiSimpleFileSystemProtocolGuid,

-                  &SimpleFileSystem,

-                  gWinNtSimpleFileSystemDriverBinding.DriverBindingHandle,

-                  ControllerHandle,

-                  EFI_OPEN_PROTOCOL_GET_PROTOCOL

-                  );

-  if (EFI_ERROR (Status)) {

-    return EFI_UNSUPPORTED;

-  }

-

-  Private = WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (SimpleFileSystem);

-

-  return LookupUnicodeString (

-          Language,

-          gWinNtSimpleFileSystemComponentName.SupportedLanguages,

-          Private->ControllerNameTable,

-          ControllerName

-          );

-}

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.c
deleted file mode 100644
index 475dff6..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.c
+++ /dev/null
@@ -1,2682 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  WinNtSimpleFileSystem.c

-

-Abstract:

-

-  Produce Simple File System abstractions for directories on your PC using Win32 APIs.

-  The configuration of what devices to mount or emulate comes from NT

-  environment variables. The variables must be visible to the Microsoft*

-  Developer Studio for them to work.

-

-  * Other names and brands may be claimed as the property of others.

-

---*/

-

-#include "WinNtSimpleFileSystem.h"

-

-EFI_DRIVER_BINDING_PROTOCOL gWinNtSimpleFileSystemDriverBinding = {

-  WinNtSimpleFileSystemDriverBindingSupported,

-  WinNtSimpleFileSystemDriverBindingStart,

-  WinNtSimpleFileSystemDriverBindingStop,

-  0xa,

-  NULL,

-  NULL

-};

-

-

-CHAR16 *

-EfiStrChr (

-  IN CHAR16   *Str,

-  IN CHAR16   Chr

-  )

-/*++

-

-Routine Description:

-

-  Locate the first occurance of a character in a string.

-

-Arguments:

-

-  Str - Pointer to NULL terminated unicode string.

-  Chr - Character to locate.

-

-Returns:

-

-  If Str is NULL, then NULL is returned.

-  If Chr is not contained in Str, then NULL is returned.

-  If Chr is contained in Str, then a pointer to the first occurance of Chr in Str is returned.

-

---*/

-{

-  if (Str == NULL) {

-    return Str;

-  }

-

-  while (*Str != '\0' && *Str != Chr) {

-    ++Str;

-  }

-

-  return (*Str == Chr) ? Str : NULL;

-}

-

-BOOLEAN

-IsZero (

-  IN VOID   *Buffer,

-  IN UINTN  Length

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Buffer  - TODO: add argument description

-  Length  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-{

-  if (Buffer == NULL || Length == 0) {

-    return FALSE;

-  }

-

-  if (*(UINT8 *) Buffer != 0) {

-    return FALSE;

-  }

-

-  if (Length > 1) {

-    if (!CompareMem (Buffer, (UINT8 *) Buffer + 1, Length - 1)) {

-      return FALSE;

-    }

-  }

-

-  return TRUE;

-}

-

-VOID

-CutPrefix (

-  IN  CHAR16  *Str,

-  IN  UINTN   Count

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Str   - TODO: add argument description

-  Count - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-{

-  CHAR16  *Pointer;

-

-  if (StrLen (Str) < Count) {

-    ASSERT (0);

-  }

-

-  if (Count != 0) {

-    for (Pointer = Str; *(Pointer + Count); Pointer++) {

-      *Pointer = *(Pointer + Count);

-    }

-    *Pointer = *(Pointer + Count);

-  }

-}

-

-

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemDriverBindingSupported (

-  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

-  IN  EFI_HANDLE                   ControllerHandle,

-  IN  EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath

-  )

-/*++

-

-Routine Description:

-

-  Check to see if the driver supports a given controller.

-

-Arguments:

-

-  This                - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.

-

-  ControllerHandle    - EFI handle of the controller to test.

-

-  RemainingDevicePath - Pointer to remaining portion of a device path.

-

-Returns:

-

-  EFI_SUCCESS         - The device specified by ControllerHandle and RemainingDevicePath is supported by the driver

-                        specified by This.

-

-  EFI_ALREADY_STARTED - The device specified by ControllerHandle and RemainingDevicePath is already being managed by

-                        the driver specified by This.

-

-  EFI_ACCESS_DENIED   - The device specified by ControllerHandle and RemainingDevicePath is already being managed by

-                        a different driver or an application that requires exclusive access.

-

-  EFI_UNSUPPORTED     - The device specified by ControllerHandle and RemainingDevicePath is not supported by the

-                        driver specified by This.

-

---*/

-{

-  EFI_STATUS              Status;

-  EFI_WIN_NT_IO_PROTOCOL  *WinNtIo;

-

-  //

-  // Open the IO Abstraction(s) needed to perform the supported test

-  //

-  Status = gBS->OpenProtocol (

-                  ControllerHandle,

-                  &gEfiWinNtIoProtocolGuid,

-                  &WinNtIo,

-                  This->DriverBindingHandle,

-                  ControllerHandle,

-                  EFI_OPEN_PROTOCOL_BY_DRIVER

-                  );

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  //

-  // Make sure GUID is for a File System handle.

-  //

-  Status = EFI_UNSUPPORTED;

-  if (CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtFileSystemGuid)) {

-    Status = EFI_SUCCESS;

-  }

-

-  //

-  // Close the I/O Abstraction(s) used to perform the supported test

-  //

-  gBS->CloseProtocol (

-        ControllerHandle,

-        &gEfiWinNtIoProtocolGuid,

-        This->DriverBindingHandle,

-        ControllerHandle

-        );

-

-  return Status;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemDriverBindingStart (

-  IN  EFI_DRIVER_BINDING_PROTOCOL   *This,

-  IN  EFI_HANDLE                    ControllerHandle,

-  IN  EFI_DEVICE_PATH_PROTOCOL      *RemainingDevicePath

-  )

-/*++

-

-Routine Description:

-

-  Starts a device controller or a bus controller.

-

-Arguments:

-

-  This                - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.

-

-  ControllerHandle    - EFI handle of the controller to start.

-

-  RemainingDevicePath - Pointer to remaining portion of a device path.

-

-Returns:

-

-  EFI_SUCCESS           - The device or bus controller has been started.

-

-  EFI_DEVICE_ERROR      - The device could not be started due to a device failure.

-

-  EFI_OUT_OF_RESOURCES  - The request could not be completed due to lack of resources.

-

---*/

-{

-  EFI_STATUS                        Status;

-  EFI_WIN_NT_IO_PROTOCOL            *WinNtIo;

-  WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE *Private;

-

-  Private = NULL;

-

-  //

-  // Open the IO Abstraction(s) needed

-  //

-  Status = gBS->OpenProtocol (

-                  ControllerHandle,

-                  &gEfiWinNtIoProtocolGuid,

-                  &WinNtIo,

-                  This->DriverBindingHandle,

-                  ControllerHandle,

-                  EFI_OPEN_PROTOCOL_BY_DRIVER

-                  );

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  //

-  // Validate GUID

-  //

-  if (!CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtFileSystemGuid)) {

-    Status = EFI_UNSUPPORTED;

-    goto Done;

-  }

-

-  Private = AllocatePool (sizeof (WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE));

-  if (Private == NULL) {

-    Status = EFI_OUT_OF_RESOURCES;

-

-    goto Done;

-  }

-

-  Private->Signature  = WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE;

-  Private->WinNtThunk = WinNtIo->WinNtThunk;

-

-  Private->FilePath = WinNtIo->EnvString;

-

-  Private->VolumeLabel = AllocatePool (StrSize (L"EFI_EMULATED"));

-  if (Private->VolumeLabel == NULL) {

-    Status = EFI_OUT_OF_RESOURCES;

-    goto Done;

-  }

-

-  StrCpy (Private->VolumeLabel, L"EFI_EMULATED");

-

-  Private->SimpleFileSystem.Revision    = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION;

-  Private->SimpleFileSystem.OpenVolume  = WinNtSimpleFileSystemOpenVolume;

-

-  Private->WinNtThunk->SetErrorMode (SEM_FAILCRITICALERRORS);

-

-  Private->ControllerNameTable = NULL;

-

-  AddUnicodeString (

-    "eng",

-    gWinNtSimpleFileSystemComponentName.SupportedLanguages,

-    &Private->ControllerNameTable,

-    WinNtIo->EnvString

-    );

-

-  Status = gBS->InstallMultipleProtocolInterfaces (

-                  &ControllerHandle,

-                  &gEfiSimpleFileSystemProtocolGuid,

-                  &Private->SimpleFileSystem,

-                  NULL

-                  );

-

-Done:

-  if (EFI_ERROR (Status)) {

-

-    if (Private != NULL) {

-

-      FreeUnicodeStringTable (Private->ControllerNameTable);

-

-      FreePool (Private);

-    }

-

-    gBS->CloseProtocol (

-          ControllerHandle,

-          &gEfiWinNtIoProtocolGuid,

-          This->DriverBindingHandle,

-          ControllerHandle

-          );

-  }

-

-  return Status;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemDriverBindingStop (

-  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

-  IN  EFI_HANDLE                   ControllerHandle,

-  IN  UINTN                        NumberOfChildren,

-  IN  EFI_HANDLE                   *ChildHandleBuffer

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This              - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.

-

-  ControllerHandle  - A handle to the device to be stopped.

-

-  NumberOfChildren  - The number of child device handles in ChildHandleBuffer.

-

-  ChildHandleBuffer - An array of child device handles to be freed.

-

-Returns:

-

-  EFI_SUCCESS       - The device has been stopped.

-

-  EFI_DEVICE_ERROR  - The device could not be stopped due to a device failure.

-

---*/

-// TODO:    EFI_UNSUPPORTED - add return value to function comment

-{

-  EFI_STATUS                        Status;

-  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL   *SimpleFileSystem;

-  WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE *Private;

-

-  //

-  // Get our context back

-  //

-  Status = gBS->OpenProtocol (

-                  ControllerHandle,

-                  &gEfiSimpleFileSystemProtocolGuid,

-                  &SimpleFileSystem,

-                  This->DriverBindingHandle,

-                  ControllerHandle,

-                  EFI_OPEN_PROTOCOL_GET_PROTOCOL

-                  );

-  if (EFI_ERROR (Status)) {

-    return EFI_UNSUPPORTED;

-  }

-

-  Private = WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (SimpleFileSystem);

-

-  //

-  // Uninstall the Simple File System Protocol from ControllerHandle

-  //

-  Status = gBS->UninstallMultipleProtocolInterfaces (

-                  ControllerHandle,

-                  &gEfiSimpleFileSystemProtocolGuid,

-                  &Private->SimpleFileSystem,

-                  NULL

-                  );

-  if (!EFI_ERROR (Status)) {

-    Status = gBS->CloseProtocol (

-                    ControllerHandle,

-                    &gEfiWinNtIoProtocolGuid,

-                    This->DriverBindingHandle,

-                    ControllerHandle

-                    );

-  }

-

-  if (!EFI_ERROR (Status)) {

-    //

-    // Free our instance data

-    //

-    FreeUnicodeStringTable (Private->ControllerNameTable);

-

-    FreePool (Private);

-  }

-

-  return Status;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemOpenVolume (

-  IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL  *This,

-  OUT EFI_FILE                        **Root

-  )

-/*++

-

-Routine Description:

-

-  Open the root directory on a volume.

-

-Arguments:

-

-  This  - A pointer to the volume to open.

-

-  Root  - A pointer to storage for the returned opened file handle of the root directory.

-

-Returns:

-

-  EFI_SUCCESS           - The volume was opened.

-

-  EFI_UNSUPPORTED       - The volume does not support the requested file system type.

-

-  EFI_NO_MEDIA          - The device has no media.

-

-  EFI_DEVICE_ERROR      - The device reported an error.

-

-  EFI_VOLUME_CORRUPTED  - The file system structures are corrupted.

-

-  EFI_ACCESS_DENIED     - The service denied access to the file.

-

-  EFI_OUT_OF_RESOURCES  - The file volume could not be opened due to lack of resources.

-

-  EFI_MEDIA_CHANGED     - The device has new media or the media is no longer supported.

-

---*/

-// TODO:    EFI_INVALID_PARAMETER - add return value to function comment

-{

-  EFI_STATUS                        Status;

-  WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE *Private;

-  WIN_NT_EFI_FILE_PRIVATE           *PrivateFile;

-  EFI_TPL                           OldTpl;

-

-  if (This == NULL || Root == NULL) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);

-

-  Private     = WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (This);

-

-  PrivateFile = AllocatePool (sizeof (WIN_NT_EFI_FILE_PRIVATE));

-  if (PrivateFile == NULL) {

-    Status = EFI_OUT_OF_RESOURCES;

-    goto Done;

-  }

-

-  PrivateFile->FileName = AllocatePool (StrSize (Private->FilePath));

-  if (PrivateFile->FileName == NULL) {

-    Status = EFI_OUT_OF_RESOURCES;

-    goto Done;

-  }

-

-  PrivateFile->FilePath = AllocatePool (StrSize (Private->FilePath));

-  if (PrivateFile->FilePath == NULL) {

-    Status = EFI_OUT_OF_RESOURCES;

-    goto Done;

-  }

-

-  StrCpy (PrivateFile->FilePath, Private->FilePath);

-  StrCpy (PrivateFile->FileName, PrivateFile->FilePath);

-  PrivateFile->Signature            = WIN_NT_EFI_FILE_PRIVATE_SIGNATURE;

-  PrivateFile->WinNtThunk           = Private->WinNtThunk;

-  PrivateFile->SimpleFileSystem     = This;

-  PrivateFile->IsRootDirectory      = TRUE;

-  PrivateFile->IsDirectoryPath      = TRUE;

-  PrivateFile->IsOpenedByRead       = TRUE;

-  PrivateFile->EfiFile.Revision     = EFI_FILE_HANDLE_REVISION;

-  PrivateFile->EfiFile.Open         = WinNtSimpleFileSystemOpen;

-  PrivateFile->EfiFile.Close        = WinNtSimpleFileSystemClose;

-  PrivateFile->EfiFile.Delete       = WinNtSimpleFileSystemDelete;

-  PrivateFile->EfiFile.Read         = WinNtSimpleFileSystemRead;

-  PrivateFile->EfiFile.Write        = WinNtSimpleFileSystemWrite;

-  PrivateFile->EfiFile.GetPosition  = WinNtSimpleFileSystemGetPosition;

-  PrivateFile->EfiFile.SetPosition  = WinNtSimpleFileSystemSetPosition;

-  PrivateFile->EfiFile.GetInfo      = WinNtSimpleFileSystemGetInfo;

-  PrivateFile->EfiFile.SetInfo      = WinNtSimpleFileSystemSetInfo;

-  PrivateFile->EfiFile.Flush        = WinNtSimpleFileSystemFlush;

-  PrivateFile->LHandle              = INVALID_HANDLE_VALUE;

-  PrivateFile->DirHandle            = INVALID_HANDLE_VALUE;

-  PrivateFile->IsValidFindBuf       = FALSE;

-

-  *Root = &PrivateFile->EfiFile;

-

-  Status = EFI_SUCCESS;

-

-Done:

-  if (EFI_ERROR (Status)) {

-    if (PrivateFile) {

-      if (PrivateFile->FileName) {

-        FreePool (PrivateFile->FileName);

-      }

-

-      if (PrivateFile->FilePath) {

-        FreePool (PrivateFile->FilePath);

-      }

-

-      FreePool (PrivateFile);

-    }

-  }

-

-  gBS->RestoreTPL (OldTpl);

-

-  return Status;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemOpen (

-  IN  EFI_FILE  *This,

-  OUT EFI_FILE  **NewHandle,

-  IN  CHAR16    *FileName,

-  IN  UINT64    OpenMode,

-  IN  UINT64    Attributes

-  )

-/*++

-

-Routine Description:

-

-  Open a file relative to the source file location.

-

-Arguments:

-

-  This        - A pointer to the source file location.

-

-  NewHandle   - Pointer to storage for the new file handle.

-

-  FileName    - Pointer to the file name to be opened.

-

-  OpenMode    - File open mode information.

-

-  Attributes  - File creation attributes.

-

-Returns:

-

-  EFI_SUCCESS           - The file was opened.

-

-  EFI_NOT_FOUND         - The file could not be found in the volume.

-

-  EFI_NO_MEDIA          - The device has no media.

-

-  EFI_MEDIA_CHANGED     - The device has new media or the media is no longer supported.

-

-  EFI_DEVICE_ERROR      - The device reported an error.

-

-  EFI_VOLUME_CORRUPTED  - The file system structures are corrupted.

-

-  EFI_WRITE_PROTECTED   - The volume or file is write protected.

-

-  EFI_ACCESS_DENIED     - The service denied access to the file.

-

-  EFI_OUT_OF_RESOURCES  - Not enough resources were available to open the file.

-

-  EFI_VOLUME_FULL       - There is not enough space left to create the new file.

-

---*/

-// TODO:    EFI_INVALID_PARAMETER - add return value to function comment

-// TODO:    EFI_INVALID_PARAMETER - add return value to function comment

-// TODO:    EFI_INVALID_PARAMETER - add return value to function comment

-// TODO:    EFI_INVALID_PARAMETER - add return value to function comment

-{

-  EFI_FILE                          *Root;

-  WIN_NT_EFI_FILE_PRIVATE           *PrivateFile;

-  WIN_NT_EFI_FILE_PRIVATE           *NewPrivateFile;

-  WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE *PrivateRoot;

-  EFI_STATUS                        Status;

-  CHAR16                            *RealFileName;

-  CHAR16                            *TempFileName;

-  CHAR16                            *ParseFileName;

-  CHAR16                            *GuardPointer;

-  CHAR16                            TempChar;

-  DWORD                             LastError;

-  UINTN                             Count;

-  BOOLEAN                           LoopFinish;

-  UINTN                             InfoSize;

-  EFI_FILE_INFO                     *Info;

-

-  //

-  // Check for obvious invalid parameters.

-  //

-  if (This == NULL || NewHandle == NULL || FileName == NULL) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  switch (OpenMode) {

-  case EFI_FILE_MODE_CREATE | EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE:

-    if (Attributes &~EFI_FILE_VALID_ATTR) {

-      return EFI_INVALID_PARAMETER;

-    }

-

-    if (Attributes & EFI_FILE_READ_ONLY) {

-      return EFI_INVALID_PARAMETER;

-    }

-

-  //

-  // fall through

-  //

-  case EFI_FILE_MODE_READ:

-  case EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE:

-    break;

-

-  default:

-    return EFI_INVALID_PARAMETER;

-  }

-

-  //

-  // Init local variables

-  //

-  PrivateFile     = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);

-  PrivateRoot     = WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (PrivateFile->SimpleFileSystem);

-  NewPrivateFile  = NULL;

-

-  //

-  // Allocate buffer for FileName as the passed in FileName may be read only

-  //

-  TempFileName = AllocatePool (StrSize (FileName));

-  if (TempFileName == NULL) {

-    return EFI_OUT_OF_RESOURCES;

-  }

-  StrCpy (TempFileName, FileName);

-  FileName = TempFileName;

-

-  //

-  // BUGBUG: assume an open of root

-  // if current location, return current data

-  //

-  if (StrCmp (FileName, L"\\") == 0 || (StrCmp (FileName, L".") == 0 && PrivateFile->IsRootDirectory)) {

-    //

-    // BUGBUG: assume an open root

-    //

-OpenRoot:

-    Status          = WinNtSimpleFileSystemOpenVolume (PrivateFile->SimpleFileSystem, &Root);

-    NewPrivateFile  = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (Root);

-    goto Done;

-  }

-

-  if (FileName[StrLen (FileName) - 1] == L'\\') {

-    FileName[StrLen (FileName) - 1]  = 0;

-  }

-

-  //

-  // If file name does not equal to "." or "..",

-  // then we trim the leading/trailing blanks and trailing dots

-  //

-  if (StrCmp (FileName, L".") != 0 && StrCmp (FileName, L"..") != 0) {

-    //

-    // Trim leading blanks

-    //

-    Count = 0;

-    for (TempFileName = FileName;

-      *TempFileName != 0 && *TempFileName == L' ';

-      TempFileName++) {

-      Count++;

-    }

-    CutPrefix (FileName, Count);

-    //

-    // Trim trailing dots and blanks

-    //

-    for (TempFileName = FileName + StrLen (FileName) - 1;

-      TempFileName >= FileName && (*TempFileName == L' ' || *TempFileName == L'.');

-      TempFileName--) {

-      ;

-    }

-    *(TempFileName + 1) = 0;

-  }

-

-  //

-  // Attempt to open the file

-  //

-  NewPrivateFile = AllocatePool (sizeof (WIN_NT_EFI_FILE_PRIVATE));

-  if (NewPrivateFile == NULL) {

-    Status = EFI_OUT_OF_RESOURCES;

-    goto Done;

-  }

-

-  CopyMem (NewPrivateFile, PrivateFile, sizeof (WIN_NT_EFI_FILE_PRIVATE));

-

-  NewPrivateFile->FilePath = AllocatePool (StrSize (PrivateFile->FileName));

-  if (NewPrivateFile->FilePath == NULL) {

-    Status = EFI_OUT_OF_RESOURCES;

-    goto Done;

-  }

-

-  if (PrivateFile->IsDirectoryPath) {

-    StrCpy (NewPrivateFile->FilePath, PrivateFile->FileName);

-  } else {

-    StrCpy (NewPrivateFile->FilePath, PrivateFile->FilePath);

-  }

-

-  NewPrivateFile->FileName = AllocatePool (StrSize (NewPrivateFile->FilePath) + StrSize (L"\\") + StrSize (FileName));

-  if (NewPrivateFile->FileName == NULL) {

-    Status = EFI_OUT_OF_RESOURCES;

-    goto Done;

-  }

-

-  if (*FileName == L'\\') {

-    StrCpy (NewPrivateFile->FileName, PrivateRoot->FilePath);

-    StrCat (NewPrivateFile->FileName, L"\\");

-    StrCat (NewPrivateFile->FileName, FileName + 1);

-  } else {

-    StrCpy (NewPrivateFile->FileName, NewPrivateFile->FilePath);

-    if (StrCmp (FileName, L"") != 0) {

-      //

-      // In case the filename becomes empty, especially after trimming dots and blanks

-      //

-      StrCat (NewPrivateFile->FileName, L"\\");

-      StrCat (NewPrivateFile->FileName, FileName);

-    }

-  }

-

-  //

-  // Get rid of . and .., except leading . or ..

-  //

-

-  //

-  // GuardPointer protect simplefilesystem root path not be destroyed

-  //

-  GuardPointer  = NewPrivateFile->FileName + StrLen (PrivateRoot->FilePath);

-

-  LoopFinish    = FALSE;

-

-  while (!LoopFinish) {

-

-    LoopFinish = TRUE;

-

-    for (ParseFileName = GuardPointer; *ParseFileName; ParseFileName++) {

-      if (*ParseFileName == L'.' &&

-          (*(ParseFileName + 1) == 0 || *(ParseFileName + 1) == L'\\') &&

-          *(ParseFileName - 1) == L'\\'

-          ) {

-

-        //

-        // cut \.

-        //

-        CutPrefix (ParseFileName - 1, 2);

-        LoopFinish = FALSE;

-        break;

-      }

-

-      if (*ParseFileName == L'.' &&

-          *(ParseFileName + 1) == L'.' &&

-          (*(ParseFileName + 2) == 0 || *(ParseFileName + 2) == L'\\') &&

-          *(ParseFileName - 1) == L'\\'

-          ) {

-

-        ParseFileName--;

-        Count = 3;

-

-        while (ParseFileName != GuardPointer) {

-          ParseFileName--;

-          Count++;

-          if (*ParseFileName == L'\\') {

-            break;

-          }

-        }

-

-        //

-        // cut \.. and its left directory

-        //

-        CutPrefix (ParseFileName, Count);

-        LoopFinish = FALSE;

-        break;

-      }

-    }

-  }

-

-  if (StrCmp (NewPrivateFile->FileName, PrivateRoot->FilePath) == 0) {

-    NewPrivateFile->IsRootDirectory = TRUE;

-    FreePool (NewPrivateFile->FilePath);

-    FreePool (NewPrivateFile->FileName);

-    FreePool (NewPrivateFile);

-    goto OpenRoot;

-  }

-

-  RealFileName = NewPrivateFile->FileName;

-  while (EfiStrChr (RealFileName, L'\\') != NULL) {

-    RealFileName = EfiStrChr (RealFileName, L'\\') + 1;

-  }

-

-  TempChar            = *(RealFileName - 1);

-  *(RealFileName - 1) = 0;

-

-  FreePool (NewPrivateFile->FilePath);

-  NewPrivateFile->FilePath = NULL;

-  NewPrivateFile->FilePath = AllocatePool (StrSize (NewPrivateFile->FileName));

-  if (NewPrivateFile->FilePath == NULL) {

-    Status = EFI_OUT_OF_RESOURCES;

-    goto Done;

-  }

-

-  StrCpy (NewPrivateFile->FilePath, NewPrivateFile->FileName);

-

-  *(RealFileName - 1)             = TempChar;

-

-  NewPrivateFile->IsRootDirectory = FALSE;

-

-  //

-  // Test whether file or directory

-  //

-  if (OpenMode & EFI_FILE_MODE_CREATE) {

-    if (Attributes & EFI_FILE_DIRECTORY) {

-      NewPrivateFile->IsDirectoryPath = TRUE;

-    } else {

-      NewPrivateFile->IsDirectoryPath = FALSE;

-    }

-  } else {

-    NewPrivateFile->LHandle = INVALID_HANDLE_VALUE;

-    NewPrivateFile->LHandle = NewPrivateFile->WinNtThunk->CreateFile (

-                                                            NewPrivateFile->FileName,

-                                                            GENERIC_READ,

-                                                            FILE_SHARE_READ | FILE_SHARE_WRITE,

-                                                            NULL,

-                                                            OPEN_EXISTING,

-                                                            0,

-                                                            NULL

-                                                            );

-

-    if (NewPrivateFile->LHandle != INVALID_HANDLE_VALUE) {

-      NewPrivateFile->IsDirectoryPath = FALSE;

-      NewPrivateFile->WinNtThunk->CloseHandle (NewPrivateFile->LHandle);

-    } else {

-      NewPrivateFile->IsDirectoryPath = TRUE;

-    }

-

-    NewPrivateFile->LHandle = INVALID_HANDLE_VALUE;

-  }

-

-  if (OpenMode & EFI_FILE_MODE_WRITE) {

-    NewPrivateFile->IsOpenedByRead = FALSE;

-  } else {

-    NewPrivateFile->IsOpenedByRead = TRUE;

-  }

-

-  Status = EFI_SUCCESS;

-

-  //

-  // deal with directory

-  //

-  if (NewPrivateFile->IsDirectoryPath) {

-

-    TempFileName = AllocatePool (StrSize (NewPrivateFile->FileName) + StrSize (L"\\*"));

-    if (TempFileName == NULL) {

-      Status = EFI_OUT_OF_RESOURCES;

-      goto Done;

-    }

-

-    StrCpy (TempFileName, NewPrivateFile->FileName);

-

-    if ((OpenMode & EFI_FILE_MODE_CREATE)) {

-      //

-      // Create a directory

-      //

-      if (!NewPrivateFile->WinNtThunk->CreateDirectory (TempFileName, NULL)) {

-

-        LastError = PrivateFile->WinNtThunk->GetLastError ();

-        if (LastError != ERROR_ALREADY_EXISTS) {

-          FreePool (TempFileName);

-          Status = EFI_ACCESS_DENIED;

-          goto Done;

-        }

-      }

-    }

-

-    NewPrivateFile->DirHandle = NewPrivateFile->WinNtThunk->CreateFile (

-                                                              TempFileName,

-                                                              NewPrivateFile->IsOpenedByRead ? GENERIC_READ : (GENERIC_READ | GENERIC_WRITE),

-                                                              FILE_SHARE_READ | FILE_SHARE_WRITE,

-                                                              NULL,

-                                                              OPEN_EXISTING,

-                                                              FILE_FLAG_BACKUP_SEMANTICS,

-                                                              NULL

-                                                              );

-

-    if (NewPrivateFile->DirHandle == INVALID_HANDLE_VALUE) {

-

-      NewPrivateFile->DirHandle = NewPrivateFile->WinNtThunk->CreateFile (

-                                                                TempFileName,

-                                                                GENERIC_READ,

-                                                                FILE_SHARE_READ | FILE_SHARE_WRITE,

-                                                                NULL,

-                                                                OPEN_EXISTING,

-                                                                FILE_FLAG_BACKUP_SEMANTICS,

-                                                                NULL

-                                                                );

-

-      if (NewPrivateFile->DirHandle != INVALID_HANDLE_VALUE) {

-        NewPrivateFile->WinNtThunk->CloseHandle (NewPrivateFile->DirHandle);

-        NewPrivateFile->DirHandle = INVALID_HANDLE_VALUE;

-        Status                    = EFI_ACCESS_DENIED;

-      } else {

-        Status = EFI_NOT_FOUND;

-      }

-

-      goto Done;

-    }

-

-    //

-    // Find the first file under it

-    //

-    StrCat (TempFileName, L"\\*");

-    NewPrivateFile->LHandle = NewPrivateFile->WinNtThunk->FindFirstFile (TempFileName, &NewPrivateFile->FindBuf);

-

-    if (NewPrivateFile->LHandle == INVALID_HANDLE_VALUE) {

-      NewPrivateFile->IsValidFindBuf = FALSE;

-    } else {

-      NewPrivateFile->IsValidFindBuf = TRUE;

-    }

-  } else {

-    //

-    // deal with file

-    //

-    if (!NewPrivateFile->IsOpenedByRead) {

-      NewPrivateFile->LHandle = NewPrivateFile->WinNtThunk->CreateFile (

-                                                              NewPrivateFile->FileName,

-                                                              GENERIC_READ | GENERIC_WRITE,

-                                                              FILE_SHARE_READ | FILE_SHARE_WRITE,

-                                                              NULL,

-                                                              (OpenMode & EFI_FILE_MODE_CREATE) ? OPEN_ALWAYS : OPEN_EXISTING,

-                                                              0,

-                                                              NULL

-                                                              );

-

-      if (NewPrivateFile->LHandle == INVALID_HANDLE_VALUE) {

-        NewPrivateFile->LHandle = NewPrivateFile->WinNtThunk->CreateFile (

-                                                                NewPrivateFile->FileName,

-                                                                GENERIC_READ,

-                                                                FILE_SHARE_READ | FILE_SHARE_WRITE,

-                                                                NULL,

-                                                                OPEN_EXISTING,

-                                                                0,

-                                                                NULL

-                                                                );

-

-        if (NewPrivateFile->LHandle == INVALID_HANDLE_VALUE) {

-          Status = EFI_NOT_FOUND;

-        } else {

-          Status = EFI_ACCESS_DENIED;

-          NewPrivateFile->WinNtThunk->CloseHandle (NewPrivateFile->LHandle);

-          NewPrivateFile->LHandle = INVALID_HANDLE_VALUE;

-        }

-      }

-    } else {

-      NewPrivateFile->LHandle = NewPrivateFile->WinNtThunk->CreateFile (

-                                                              NewPrivateFile->FileName,

-                                                              GENERIC_READ,

-                                                              FILE_SHARE_READ | FILE_SHARE_WRITE,

-                                                              NULL,

-                                                              OPEN_EXISTING,

-                                                              0,

-                                                              NULL

-                                                              );

-

-      if (NewPrivateFile->LHandle == INVALID_HANDLE_VALUE) {

-        Status = EFI_NOT_FOUND;

-      }

-    }

-  }

-

-  if ((OpenMode & EFI_FILE_MODE_CREATE) && Status == EFI_SUCCESS) {

-    //

-    // Set the attribute

-    //

-    InfoSize  = 0;

-    Info      = NULL;

-

-    Status    = WinNtSimpleFileSystemGetInfo (&NewPrivateFile->EfiFile, &gEfiFileInfoGuid, &InfoSize, Info);

-

-    if (Status != EFI_BUFFER_TOO_SMALL) {

-      Status = EFI_DEVICE_ERROR;

-      goto Done;

-    }

-

-    Info = AllocatePool (InfoSize);

-    if (Info == NULL) {

-      Status = EFI_OUT_OF_RESOURCES;

-      goto Done;

-    }

-

-    Status = WinNtSimpleFileSystemGetInfo (&NewPrivateFile->EfiFile, &gEfiFileInfoGuid, &InfoSize, Info);

-

-    if (EFI_ERROR (Status)) {

-      goto Done;

-    }

-

-    Info->Attribute = Attributes;

-

-    WinNtSimpleFileSystemSetInfo (&NewPrivateFile->EfiFile, &gEfiFileInfoGuid, InfoSize, Info);

-  }

-

-Done: ;

-  FreePool (FileName);

-

-  if (EFI_ERROR (Status)) {

-    if (NewPrivateFile) {

-      if (NewPrivateFile->FileName) {

-        FreePool (NewPrivateFile->FileName);

-      }

-

-      if (NewPrivateFile->FilePath) {

-        FreePool (NewPrivateFile->FilePath);

-      }

-

-      FreePool (NewPrivateFile);

-    }

-  } else {

-    *NewHandle = &NewPrivateFile->EfiFile;

-  }

-

-  return Status;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemClose (

-  IN EFI_FILE  *This

-  )

-/*++

-

-Routine Description:

-

-  Close the specified file handle.

-

-Arguments:

-

-  This  - Pointer to a returned opened file handle.

-

-Returns:

-

-  EFI_SUCCESS - The file handle has been closed.

-

---*/

-// TODO:    EFI_INVALID_PARAMETER - add return value to function comment

-{

-  WIN_NT_EFI_FILE_PRIVATE *PrivateFile;

-  EFI_TPL                 OldTpl;

-

-  if (This == NULL) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);

-

-  PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);

-

-  if (PrivateFile->LHandle != INVALID_HANDLE_VALUE) {

-    if (PrivateFile->IsDirectoryPath) {

-      PrivateFile->WinNtThunk->FindClose (PrivateFile->LHandle);

-    } else {

-      PrivateFile->WinNtThunk->CloseHandle (PrivateFile->LHandle);

-    }

-

-    PrivateFile->LHandle = INVALID_HANDLE_VALUE;

-  }

-

-  if (PrivateFile->IsDirectoryPath && PrivateFile->DirHandle != INVALID_HANDLE_VALUE) {

-    PrivateFile->WinNtThunk->CloseHandle (PrivateFile->DirHandle);

-    PrivateFile->DirHandle = INVALID_HANDLE_VALUE;

-  }

-

-  if (PrivateFile->FileName) {

-    FreePool (PrivateFile->FileName);

-  }

-

-  FreePool (PrivateFile);

-

-  gBS->RestoreTPL (OldTpl);

-

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemDelete (

-  IN EFI_FILE  *This

-  )

-/*++

-

-Routine Description:

-

-  Close and delete a file.

-

-Arguments:

-

-  This  - Pointer to a returned opened file handle.

-

-Returns:

-

-  EFI_SUCCESS             - The file handle was closed and deleted.

-

-  EFI_WARN_DELETE_FAILURE - The handle was closed but could not be deleted.

-

---*/

-// TODO:    EFI_INVALID_PARAMETER - add return value to function comment

-{

-  EFI_STATUS              Status;

-  WIN_NT_EFI_FILE_PRIVATE *PrivateFile;

-  EFI_TPL                 OldTpl;

-

-  if (This == NULL) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);

-

-  PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);

-

-  Status      = EFI_WARN_DELETE_FAILURE;

-

-  if (PrivateFile->IsDirectoryPath) {

-    if (PrivateFile->LHandle != INVALID_HANDLE_VALUE) {

-      PrivateFile->WinNtThunk->FindClose (PrivateFile->LHandle);

-    }

-

-    if (PrivateFile->DirHandle != INVALID_HANDLE_VALUE) {

-      PrivateFile->WinNtThunk->CloseHandle (PrivateFile->DirHandle);

-      PrivateFile->DirHandle = INVALID_HANDLE_VALUE;

-    }

-

-    if (PrivateFile->WinNtThunk->RemoveDirectory (PrivateFile->FileName)) {

-      Status = EFI_SUCCESS;

-    }

-  } else {

-    PrivateFile->WinNtThunk->CloseHandle (PrivateFile->LHandle);

-    PrivateFile->LHandle = INVALID_HANDLE_VALUE;

-

-    if (!PrivateFile->IsOpenedByRead) {

-      if (PrivateFile->WinNtThunk->DeleteFile (PrivateFile->FileName)) {

-        Status = EFI_SUCCESS;

-      }

-    }

-  }

-

-  FreePool (PrivateFile->FileName);

-  FreePool (PrivateFile);

-

-  gBS->RestoreTPL (OldTpl);

-

-  return Status;

-}

-

-STATIC

-VOID

-WinNtSystemTimeToEfiTime (

-  IN SYSTEMTIME             *SystemTime,

-  IN TIME_ZONE_INFORMATION  *TimeZone,

-  OUT EFI_TIME              *Time

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  SystemTime  - TODO: add argument description

-  TimeZone    - TODO: add argument description

-  Time        - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-{

-  Time->Year        = (UINT16) SystemTime->wYear;

-  Time->Month       = (UINT8) SystemTime->wMonth;

-  Time->Day         = (UINT8) SystemTime->wDay;

-  Time->Hour        = (UINT8) SystemTime->wHour;

-  Time->Minute      = (UINT8) SystemTime->wMinute;

-  Time->Second      = (UINT8) SystemTime->wSecond;

-  Time->Nanosecond  = (UINT32) SystemTime->wMilliseconds * 1000000;

-  Time->TimeZone    = (INT16) TimeZone->Bias;

-

-  if (TimeZone->StandardDate.wMonth) {

-    Time->Daylight = EFI_TIME_ADJUST_DAYLIGHT;

-  }

-}

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemRead (

-  IN     EFI_FILE  *This,

-  IN OUT UINTN     *BufferSize,

-  OUT    VOID      *Buffer

-  )

-/*++

-

-Routine Description:

-

-  Read data from a file.

-

-Arguments:

-

-  This        - Pointer to a returned open file handle.

-

-  BufferSize  - On input, the size of the Buffer.  On output, the number of bytes stored in the Buffer.

-

-  Buffer      - Pointer to the first byte of the read Buffer.

-

-Returns:

-

-  EFI_SUCCESS           - The data was read.

-

-  EFI_NO_MEDIA          - The device has no media.

-

-  EFI_DEVICE_ERROR      - The device reported an error.

-

-  EFI_VOLUME_CORRUPTED  - The file system structures are corrupted.

-

-  EFI_BUFFER_TOO_SMALL  - The supplied buffer size was too small to store the current directory entry.

-                          *BufferSize has been updated with the size needed to complete the request.

-

---*/

-// TODO:    EFI_INVALID_PARAMETER - add return value to function comment

-{

-  WIN_NT_EFI_FILE_PRIVATE *PrivateFile;

-  EFI_STATUS              Status;

-  UINTN                   Size;

-  UINTN                   NameSize;

-  UINTN                   ResultSize;

-  UINTN                   Index;

-  SYSTEMTIME              SystemTime;

-  EFI_FILE_INFO           *Info;

-  WCHAR                   *pw;

-  TIME_ZONE_INFORMATION   TimeZone;

-  EFI_FILE_INFO           *FileInfo;

-  UINT64                  Pos;

-  UINT64                  FileSize;

-  UINTN                   FileInfoSize;

-  EFI_TPL                 OldTpl;

-

-  if (This == NULL || BufferSize == NULL) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);

-

-  PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);

-

-  if (PrivateFile->LHandle == INVALID_HANDLE_VALUE) {

-    Status = EFI_DEVICE_ERROR;

-    goto Done;

-  }

-

-  if (!PrivateFile->IsDirectoryPath) {

-

-    if (This->GetPosition (This, &Pos) != EFI_SUCCESS) {

-      Status = EFI_DEVICE_ERROR;

-      goto Done;

-    }

-

-    FileInfoSize = SIZE_OF_EFI_FILE_SYSTEM_INFO;

-    FileInfo = AllocatePool (FileInfoSize);

-

-    Status = This->GetInfo (

-                    This,

-                    &gEfiFileInfoGuid,

-                    &FileInfoSize,

-                    FileInfo

-                    );

-

-    if (Status == EFI_BUFFER_TOO_SMALL) {

-      FreePool (FileInfo);

-      FileInfo = AllocatePool (FileInfoSize);

-      Status = This->GetInfo (

-                      This,

-                      &gEfiFileInfoGuid,

-                      &FileInfoSize,

-                      FileInfo

-                      );

-    }

-

-    if (EFI_ERROR (Status)) {

-      Status = EFI_DEVICE_ERROR;

-      goto Done;

-    }

-

-    FileSize = FileInfo->FileSize;

-

-    FreePool (FileInfo);

-

-    if (Pos >= FileSize) {

-      *BufferSize = 0;

-      if (Pos == FileSize) {

-        Status = EFI_SUCCESS;

-        goto Done;

-      } else {

-        Status = EFI_DEVICE_ERROR;

-        goto Done;

-      }

-    }

-

-    Status = PrivateFile->WinNtThunk->ReadFile (

-                                      PrivateFile->LHandle,

-                                      Buffer,

-                                      *BufferSize,

-                                      BufferSize,

-                                      NULL

-                                      ) ? EFI_SUCCESS : EFI_DEVICE_ERROR;

-    goto Done;

-  }

-

-  //

-  // Read on a directory.  Perform a find next

-  //

-  if (!PrivateFile->IsValidFindBuf) {

-    *BufferSize = 0;

-    Status = EFI_SUCCESS;

-    goto Done;

-  }

-

-  Size        = SIZE_OF_EFI_FILE_INFO;

-

-  NameSize    = StrSize (PrivateFile->FindBuf.cFileName);

-

-  ResultSize  = Size + NameSize;

-

-  Status      = EFI_BUFFER_TOO_SMALL;

-

-  if (*BufferSize >= ResultSize) {

-    Status  = EFI_SUCCESS;

-

-    Info    = Buffer;

-    ZeroMem (Info, ResultSize);

-

-    Info->Size = ResultSize;

-

-    PrivateFile->WinNtThunk->GetTimeZoneInformation (&TimeZone);

-

-    PrivateFile->WinNtThunk->FileTimeToLocalFileTime (

-                              &PrivateFile->FindBuf.ftCreationTime,

-                              &PrivateFile->FindBuf.ftCreationTime

-                              );

-

-    PrivateFile->WinNtThunk->FileTimeToSystemTime (&PrivateFile->FindBuf.ftCreationTime, &SystemTime);

-

-    WinNtSystemTimeToEfiTime (&SystemTime, &TimeZone, &Info->CreateTime);

-

-    PrivateFile->WinNtThunk->FileTimeToLocalFileTime (

-                              &PrivateFile->FindBuf.ftLastWriteTime,

-                              &PrivateFile->FindBuf.ftLastWriteTime

-                              );

-

-    PrivateFile->WinNtThunk->FileTimeToSystemTime (&PrivateFile->FindBuf.ftLastWriteTime, &SystemTime);

-

-    WinNtSystemTimeToEfiTime (&SystemTime, &TimeZone, &Info->ModificationTime);

-

-    Info->FileSize      = PrivateFile->FindBuf.nFileSizeLow;

-

-    Info->PhysicalSize  = PrivateFile->FindBuf.nFileSizeLow;

-

-    if (PrivateFile->FindBuf.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE) {

-      Info->Attribute |= EFI_FILE_ARCHIVE;

-    }

-

-    if (PrivateFile->FindBuf.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) {

-      Info->Attribute |= EFI_FILE_HIDDEN;

-    }

-

-    if (PrivateFile->FindBuf.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) {

-      Info->Attribute |= EFI_FILE_SYSTEM;

-    }

-

-    if (PrivateFile->FindBuf.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {

-      Info->Attribute |= EFI_FILE_READ_ONLY;

-    }

-

-    if (PrivateFile->FindBuf.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {

-      Info->Attribute |= EFI_FILE_DIRECTORY;

-    }

-

-    NameSize  = NameSize / sizeof (WCHAR);

-

-    pw        = (WCHAR *) (((CHAR8 *) Buffer) + Size);

-

-    for (Index = 0; Index < NameSize; Index++) {

-      pw[Index] = PrivateFile->FindBuf.cFileName[Index];

-    }

-

-    if (PrivateFile->WinNtThunk->FindNextFile (PrivateFile->LHandle, &PrivateFile->FindBuf)) {

-      PrivateFile->IsValidFindBuf = TRUE;

-    } else {

-      PrivateFile->IsValidFindBuf = FALSE;

-    }

-  }

-

-  *BufferSize = ResultSize;

-

-Done:

-  gBS->RestoreTPL (OldTpl);

-  return Status;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemWrite (

-  IN     EFI_FILE  *This,

-  IN OUT UINTN     *BufferSize,

-  IN     VOID      *Buffer

-  )

-/*++

-

-Routine Description:

-

-  Write data to a file.

-

-Arguments:

-

-  This        - Pointer to an opened file handle.

-

-  BufferSize  - On input, the number of bytes in the Buffer to write to the file.  On output, the number of bytes

-                of data written to the file.

-

-  Buffer      - Pointer to the first by of data in the buffer to write to the file.

-

-Returns:

-

-  EFI_SUCCESS           - The data was written to the file.

-

-  EFI_UNSUPPORTED       - Writes to an open directory are not supported.

-

-  EFI_NO_MEDIA          - The device has no media.

-

-  EFI_DEVICE_ERROR      - The device reported an error.

-

-  EFI_VOLUME_CORRUPTED  - The file system structures are corrupt.

-

-  EFI_WRITE_PROTECTED   - The file, directory, volume, or device is write protected.

-

-  EFI_ACCESS_DENIED     - The file was opened read-only.

-

-  EFI_VOLUME_FULL       - The volume is full.

-

---*/

-// TODO:    EFI_INVALID_PARAMETER - add return value to function comment

-{

-  WIN_NT_EFI_FILE_PRIVATE *PrivateFile;

-  EFI_STATUS              Status;

-  EFI_TPL                 OldTpl;

-

-  if (This == NULL || BufferSize == NULL || Buffer == NULL) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);

-

-  PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);

-

-  if (PrivateFile->LHandle == INVALID_HANDLE_VALUE) {

-    Status = EFI_DEVICE_ERROR;

-    goto Done;

-  }

-

-  if (PrivateFile->IsDirectoryPath) {

-    Status = EFI_UNSUPPORTED;

-    goto Done;

-  }

-

-  if (PrivateFile->IsOpenedByRead) {

-    Status = EFI_ACCESS_DENIED;

-    goto Done;

-  }

-

-  Status = PrivateFile->WinNtThunk->WriteFile (

-                                    PrivateFile->LHandle,

-                                    Buffer,

-                                    *BufferSize,

-                                    BufferSize,

-                                    NULL

-                                    ) ? EFI_SUCCESS : EFI_DEVICE_ERROR;

-

-Done:

-  gBS->RestoreTPL (OldTpl);

-  return Status;

-

-  //

-  // bugbug: need to access windows error reporting

-  //

-}

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemSetPosition (

-  IN EFI_FILE  *This,

-  IN UINT64    Position

-  )

-/*++

-

-Routine Description:

-

-  Set a file's current position.

-

-Arguments:

-

-  This      - Pointer to an opened file handle.

-

-  Position  - The byte position from the start of the file to set.

-

-Returns:

-

-  EFI_SUCCESS     - The file position has been changed.

-

-  EFI_UNSUPPORTED - The seek request for non-zero is not supported for directories.

-

---*/

-// TODO:    EFI_INVALID_PARAMETER - add return value to function comment

-{

-  EFI_STATUS              Status;

-  WIN_NT_EFI_FILE_PRIVATE *PrivateFile;

-  UINT32                  PosLow;

-  UINT32                  PosHigh;

-  CHAR16                  *FileName;

-  EFI_TPL                 OldTpl;

-

-  if (This == NULL) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);

-

-  PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);

-

-  if (PrivateFile->IsDirectoryPath) {

-    if (Position != 0) {

-      Status = EFI_UNSUPPORTED;

-      goto Done;

-    }

-

-    FileName = AllocatePool (StrSize (PrivateFile->FileName) + StrSize (L"\\*"));

-    if (FileName == NULL) {

-      Status = EFI_OUT_OF_RESOURCES;

-      goto Done;

-    }

-

-    StrCpy (FileName, PrivateFile->FileName);

-    StrCat (FileName, L"\\*");

-

-    if (PrivateFile->LHandle != INVALID_HANDLE_VALUE) {

-      PrivateFile->WinNtThunk->FindClose (PrivateFile->LHandle);

-    }

-

-    PrivateFile->LHandle = PrivateFile->WinNtThunk->FindFirstFile (FileName, &PrivateFile->FindBuf);

-

-    if (PrivateFile->LHandle == INVALID_HANDLE_VALUE) {

-      PrivateFile->IsValidFindBuf = FALSE;

-    } else {

-      PrivateFile->IsValidFindBuf = TRUE;

-    }

-

-    FreePool (FileName);

-

-    Status = (PrivateFile->LHandle == INVALID_HANDLE_VALUE) ? EFI_DEVICE_ERROR : EFI_SUCCESS;

-  } else {

-    if (Position == (UINT64) -1) {

-      PosLow = PrivateFile->WinNtThunk->SetFilePointer (PrivateFile->LHandle, (ULONG) 0, NULL, FILE_END);

-    } else {

-      PosHigh = (UINT32) RShiftU64 (Position, 32);

-

-      PosLow  = PrivateFile->WinNtThunk->SetFilePointer (PrivateFile->LHandle, (ULONG) Position, &PosHigh, FILE_BEGIN);

-    }

-

-    Status = (PosLow == 0xFFFFFFFF) ? EFI_DEVICE_ERROR : EFI_SUCCESS;

-  }

-

-Done:

-  gBS->RestoreTPL (OldTpl);

-  return Status;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemGetPosition (

-  IN  EFI_FILE  *This,

-  OUT UINT64    *Position

-  )

-/*++

-

-Routine Description:

-

-  Get a file's current position.

-

-Arguments:

-

-  This      - Pointer to an opened file handle.

-

-  Position  - Pointer to storage for the current position.

-

-Returns:

-

-  EFI_SUCCESS     - The file position has been reported.

-

-  EFI_UNSUPPORTED - Not valid for directories.

-

---*/

-// TODO:    EFI_INVALID_PARAMETER - add return value to function comment

-{

-  EFI_STATUS              Status;

-  WIN_NT_EFI_FILE_PRIVATE *PrivateFile;

-  INT32                   PositionHigh;

-  UINT64                  PosHigh64;

-  EFI_TPL                 OldTpl;

-

-  if (This == NULL || Position == NULL) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);

-  PrivateFile   = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);

-

-  PositionHigh  = 0;

-  PosHigh64     = 0;

-

-  if (PrivateFile->IsDirectoryPath) {

-

-    Status = EFI_UNSUPPORTED;

-    goto Done;

-

-  } else {

-

-    PositionHigh = 0;

-    *Position = PrivateFile->WinNtThunk->SetFilePointer (

-                                          PrivateFile->LHandle,

-                                          0,

-                                          &PositionHigh,

-                                          FILE_CURRENT

-                                          );

-

-    Status = *Position == 0xffffffff ? EFI_DEVICE_ERROR : EFI_SUCCESS;

-    if (EFI_ERROR (Status)) {

-      goto Done;

-    }

-

-    PosHigh64 = PositionHigh;

-    *Position += LShiftU64 (PosHigh64, 32);

-  }

-

-Done:

-  gBS->RestoreTPL (OldTpl);

-  return Status;

-}

-

-STATIC

-EFI_STATUS

-WinNtSimpleFileSystemFileInfo (

-  IN     WIN_NT_EFI_FILE_PRIVATE  *PrivateFile,

-  IN OUT UINTN                    *BufferSize,

-  OUT    VOID                     *Buffer

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  PrivateFile - TODO: add argument description

-  BufferSize  - TODO: add argument description

-  Buffer      - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-{

-  EFI_STATUS                  Status;

-  UINTN                       Size;

-  UINTN                       NameSize;

-  UINTN                       ResultSize;

-  EFI_FILE_INFO               *Info;

-  BY_HANDLE_FILE_INFORMATION  FileInfo;

-  SYSTEMTIME                  SystemTime;

-  CHAR16                      *RealFileName;

-  CHAR16                      *TempPointer;

-  EFI_FILE_INFO               *DirInfo;

-  UINTN                       ReadSize;

-  UINT64                      Location;

-  EFI_STATUS                  DirStatus;

-

-

-  Size        = SIZE_OF_EFI_FILE_INFO;

-  NameSize    = StrSize (PrivateFile->FileName);

-  ResultSize  = Size + NameSize;

-

-  Status      = EFI_BUFFER_TOO_SMALL;

-  if (*BufferSize >= ResultSize) {

-    Status  = EFI_SUCCESS;

-

-    Info    = Buffer;

-    ZeroMem (Info, ResultSize);

-

-    Info->Size = ResultSize;

-    PrivateFile->WinNtThunk->GetFileInformationByHandle (

-                              PrivateFile->IsDirectoryPath ? PrivateFile->DirHandle : PrivateFile->LHandle,

-                              &FileInfo

-                              );

-    Info->FileSize      = FileInfo.nFileSizeLow;

-    Info->PhysicalSize  = Info->FileSize;

-

-    PrivateFile->WinNtThunk->FileTimeToSystemTime (&FileInfo.ftCreationTime, &SystemTime);

-    Info->CreateTime.Year   = SystemTime.wYear;

-    Info->CreateTime.Month  = (UINT8) SystemTime.wMonth;

-    Info->CreateTime.Day    = (UINT8) SystemTime.wDay;

-    Info->CreateTime.Hour   = (UINT8) SystemTime.wHour;

-    Info->CreateTime.Minute = (UINT8) SystemTime.wMinute;

-    Info->CreateTime.Second = (UINT8) SystemTime.wSecond;

-

-    PrivateFile->WinNtThunk->FileTimeToSystemTime (&FileInfo.ftLastAccessTime, &SystemTime);

-    Info->LastAccessTime.Year   = SystemTime.wYear;

-    Info->LastAccessTime.Month  = (UINT8) SystemTime.wMonth;

-    Info->LastAccessTime.Day    = (UINT8) SystemTime.wDay;

-    Info->LastAccessTime.Hour   = (UINT8) SystemTime.wHour;

-    Info->LastAccessTime.Minute = (UINT8) SystemTime.wMinute;

-    Info->LastAccessTime.Second = (UINT8) SystemTime.wSecond;

-

-    PrivateFile->WinNtThunk->FileTimeToSystemTime (&FileInfo.ftLastWriteTime, &SystemTime);

-    Info->ModificationTime.Year   = SystemTime.wYear;

-    Info->ModificationTime.Month  = (UINT8) SystemTime.wMonth;

-    Info->ModificationTime.Day    = (UINT8) SystemTime.wDay;

-    Info->ModificationTime.Hour   = (UINT8) SystemTime.wHour;

-    Info->ModificationTime.Minute = (UINT8) SystemTime.wMinute;

-    Info->ModificationTime.Second = (UINT8) SystemTime.wSecond;

-

-    if (FileInfo.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE) {

-      Info->Attribute |= EFI_FILE_ARCHIVE;

-    }

-

-    if (FileInfo.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) {

-      Info->Attribute |= EFI_FILE_HIDDEN;

-    }

-

-    if (FileInfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {

-      Info->Attribute |= EFI_FILE_READ_ONLY;

-    }

-

-    if (FileInfo.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) {

-      Info->Attribute |= EFI_FILE_SYSTEM;

-    }

-

-    if (FileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {

-      Info->Attribute |= EFI_FILE_DIRECTORY;

-    }

-

-    if (PrivateFile->IsDirectoryPath) {

-      Info->Attribute |= EFI_FILE_DIRECTORY;

-    }

-

-    RealFileName  = PrivateFile->FileName;

-    TempPointer   = RealFileName;

-

-    while (*TempPointer) {

-      if (*TempPointer == '\\') {

-        RealFileName = TempPointer + 1;

-      }

-

-      TempPointer++;

-    }

-

-    if (PrivateFile->IsRootDirectory) {

-      *((CHAR8 *) Buffer + Size) = 0;

-    } else {

-      CopyMem ((CHAR8 *) Buffer + Size, RealFileName, NameSize);

-    }

-

-    if (Info->Attribute & EFI_FILE_DIRECTORY) {

-      //

-      // The GetFileInformationByHandle.nFileSizeLow is bogus for dir so we 

-      // need to do the same thing the caller would do to get the right value

-      //

-      ASSERT (PrivateFile->EfiFile.Read != NULL);

-      DirStatus = PrivateFile->EfiFile.GetPosition (&PrivateFile->EfiFile, &Location);

-      if (EFI_ERROR (DirStatus)) {

-        Location = 0;

-      }

-

-      PrivateFile->EfiFile.SetPosition (&PrivateFile->EfiFile, 0);

-      Info->FileSize = 0; 

-      do {

-        ReadSize = 0;

-        DirInfo = NULL;

-        DirStatus = PrivateFile->EfiFile.Read (&PrivateFile->EfiFile, &ReadSize, DirInfo);

-        if (DirStatus == EFI_BUFFER_TOO_SMALL) {

-          DirInfo = AllocatePool (ReadSize);

-          if (DirInfo != NULL) {

-            //

-            // Read each dir entry to figure out how big the directory is

-            //

-            DirStatus = PrivateFile->EfiFile.Read (&PrivateFile->EfiFile, &ReadSize, DirInfo);

-            if (!EFI_ERROR (DirStatus) && (ReadSize != 0)) {

-              Info->FileSize += ReadSize;

-            }

-            FreePool (DirInfo);

-          }

-        }

-        

-      } while (!EFI_ERROR (DirStatus) && (ReadSize != 0));

-

-      //

-      // reset the file possition back to the previous location

-      //

-      PrivateFile->EfiFile.SetPosition (&PrivateFile->EfiFile, Location);

-    }

-  }

-

-  *BufferSize = ResultSize;

-  return Status;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemGetInfo (

-  IN     EFI_FILE  *This,

-  IN     EFI_GUID  *InformationType,

-  IN OUT UINTN     *BufferSize,

-  OUT    VOID      *Buffer

-  )

-/*++

-

-Routine Description:

-

-  Return information about a file or volume.

-

-Arguments:

-

-  This            - Pointer to an opened file handle.

-

-  InformationType - GUID describing the type of information to be returned.

-

-  BufferSize      - On input, the size of the information buffer.  On output, the number of bytes written to the

-                    information buffer.

-

-  Buffer          - Pointer to the first byte of the information buffer.

-

-Returns:

-

-  EFI_SUCCESS           - The requested information has been written into the buffer.

-

-  EFI_UNSUPPORTED       - The InformationType is not known.

-

-  EFI_NO_MEDIA          - The device has no media.

-

-  EFI_DEVICE_ERROR      - The device reported an error.

-

-  EFI_VOLUME_CORRUPTED  - The file system structures are corrupt.

-

-  EFI_BUFFER_TOO_SMALL  - The buffer size was too small to contain the requested information.  The buffer size has

-                          been updated with the size needed to complete the requested operation.

-

---*/

-// TODO:    EFI_INVALID_PARAMETER - add return value to function comment

-{

-  EFI_STATUS                        Status;

-  WIN_NT_EFI_FILE_PRIVATE           *PrivateFile;

-  EFI_FILE_SYSTEM_INFO              *FileSystemInfoBuffer;

-  UINT32                            SectorsPerCluster;

-  UINT32                            BytesPerSector;

-  UINT32                            FreeClusters;

-  UINT32                            TotalClusters;

-  UINT32                            BytesPerCluster;

-  CHAR16                            *DriveName;

-  BOOLEAN                           DriveNameFound;

-  BOOL                              NtStatus;

-  UINTN                             Index;

-  WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE *PrivateRoot;

-  EFI_TPL                           OldTpl;

-

-  if (This == NULL || InformationType == NULL || BufferSize == NULL) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);

-

-  PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);

-  PrivateRoot = WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (PrivateFile->SimpleFileSystem);

-

-  Status      = EFI_UNSUPPORTED;

-

-  if (CompareGuid (InformationType, &gEfiFileInfoGuid)) {

-    Status = WinNtSimpleFileSystemFileInfo (PrivateFile, BufferSize, Buffer);

-  }

-

-  if (CompareGuid (InformationType, &gEfiFileSystemInfoGuid)) {

-    if (*BufferSize < SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel)) {

-      *BufferSize = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel);

-      Status = EFI_BUFFER_TOO_SMALL;

-      goto Done;

-    }

-

-    FileSystemInfoBuffer            = (EFI_FILE_SYSTEM_INFO *) Buffer;

-    FileSystemInfoBuffer->Size      = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel);

-    FileSystemInfoBuffer->ReadOnly  = FALSE;

-

-    //

-    // Try to get the drive name

-    //

-    DriveNameFound  = FALSE;

-    DriveName = AllocatePool (StrSize (PrivateFile->FilePath) + 1);

-    if (DriveName == NULL) {

-      Status = EFI_OUT_OF_RESOURCES;

-      goto Done;

-    }

-

-    StrCpy (DriveName, PrivateFile->FilePath);

-    for (Index = 0; DriveName[Index] != 0 && DriveName[Index] != ':'; Index++) {

-      ;

-    }

-

-    if (DriveName[Index] == ':') {

-      DriveName[Index + 1]  = '\\';

-      DriveName[Index + 2]  = 0;

-      DriveNameFound        = TRUE;

-    } else if (DriveName[0] == '\\' && DriveName[1] == '\\') {

-      for (Index = 2; DriveName[Index] != 0 && DriveName[Index] != '\\'; Index++) {

-        ;

-      }

-

-      if (DriveName[Index] == '\\') {

-        DriveNameFound = TRUE;

-        for (Index++; DriveName[Index] != 0 && DriveName[Index] != '\\'; Index++) {

-          ;

-        }

-

-        DriveName[Index]      = '\\';

-        DriveName[Index + 1]  = 0;

-      }

-    }

-

-    //

-    // Try GetDiskFreeSpace first

-    //

-    NtStatus = PrivateFile->WinNtThunk->GetDiskFreeSpace (

-                                          DriveNameFound ? DriveName : NULL,

-                                          &SectorsPerCluster,

-                                          &BytesPerSector,

-                                          &FreeClusters,

-                                          &TotalClusters

-                                          );

-    if (DriveName) {

-      FreePool (DriveName);

-    }

-

-    if (NtStatus) {

-      //

-      // Succeeded

-      //

-      BytesPerCluster                   = BytesPerSector * SectorsPerCluster;

-      FileSystemInfoBuffer->VolumeSize  = MultU64x32 (TotalClusters, BytesPerCluster);

-      FileSystemInfoBuffer->FreeSpace   = MultU64x32 (FreeClusters, BytesPerCluster);

-      FileSystemInfoBuffer->BlockSize   = BytesPerCluster;

-

-    } else {

-      //

-      // try GetDiskFreeSpaceEx then

-      //

-      FileSystemInfoBuffer->BlockSize = 0;

-      NtStatus = PrivateFile->WinNtThunk->GetDiskFreeSpaceEx (

-                                            PrivateFile->FilePath,

-                                            (PULARGE_INTEGER) (&FileSystemInfoBuffer->FreeSpace),

-                                            (PULARGE_INTEGER) (&FileSystemInfoBuffer->VolumeSize),

-                                            NULL

-                                            );

-      if (!NtStatus) {

-        Status = EFI_DEVICE_ERROR;

-        goto Done;

-      }

-    }

-

-    StrCpy ((CHAR16 *) FileSystemInfoBuffer->VolumeLabel, PrivateRoot->VolumeLabel);

-    *BufferSize = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel);

-    Status      = EFI_SUCCESS;

-  }

-

-  if (CompareGuid (InformationType, &gEfiFileSystemVolumeLabelInfoIdGuid)) {

-    if (*BufferSize < StrSize (PrivateRoot->VolumeLabel)) {

-      *BufferSize = StrSize (PrivateRoot->VolumeLabel);

-      Status = EFI_BUFFER_TOO_SMALL;

-      goto Done;

-    }

-

-    StrCpy ((CHAR16 *) Buffer, PrivateRoot->VolumeLabel);

-    *BufferSize = StrSize (PrivateRoot->VolumeLabel);

-    Status      = EFI_SUCCESS;

-  }

-

-Done:

-  gBS->RestoreTPL (OldTpl);

-  return Status;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemSetInfo (

-  IN EFI_FILE         *This,

-  IN EFI_GUID         *InformationType,

-  IN UINTN            BufferSize,

-  IN VOID             *Buffer

-  )

-/*++

-

-Routine Description:

-

-  Set information about a file or volume.

-

-Arguments:

-

-  This            - Pointer to an opened file handle.

-

-  InformationType - GUID identifying the type of information to set.

-

-  BufferSize      - Number of bytes of data in the information buffer.

-

-  Buffer          - Pointer to the first byte of data in the information buffer.

-

-Returns:

-

-  EFI_SUCCESS           - The file or volume information has been updated.

-

-  EFI_UNSUPPORTED       - The information identifier is not recognised.

-

-  EFI_NO_MEDIA          - The device has no media.

-

-  EFI_DEVICE_ERROR      - The device reported an error.

-

-  EFI_VOLUME_CORRUPTED  - The file system structures are corrupt.

-

-  EFI_WRITE_PROTECTED   - The file, directory, volume, or device is write protected.

-

-  EFI_ACCESS_DENIED     - The file was opened read-only.

-

-  EFI_VOLUME_FULL       - The volume is full.

-

-  EFI_BAD_BUFFER_SIZE   - The buffer size is smaller than the type indicated by InformationType.

-

---*/

-// TODO:    EFI_INVALID_PARAMETER - add return value to function comment

-// TODO:    EFI_INVALID_PARAMETER - add return value to function comment

-{

-  WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE *PrivateRoot;

-  WIN_NT_EFI_FILE_PRIVATE           *PrivateFile;

-  EFI_FILE_INFO                     *OldFileInfo;

-  EFI_FILE_INFO                     *NewFileInfo;

-  EFI_STATUS                        Status;

-  UINTN                             OldInfoSize;

-  INTN                              NtStatus;

-  UINT32                            NewAttr;

-  UINT32                            OldAttr;

-  CHAR16                            *OldFileName;

-  CHAR16                            *NewFileName;

-  CHAR16                            *TempFileName;

-  CHAR16                            *CharPointer;

-  BOOLEAN                           AttrChangeFlag;

-  BOOLEAN                           NameChangeFlag;

-  BOOLEAN                           SizeChangeFlag;

-  BOOLEAN                           TimeChangeFlag;

-  UINT64                            CurPos;

-  SYSTEMTIME                        NewCreationSystemTime;

-  SYSTEMTIME                        NewLastAccessSystemTime;

-  SYSTEMTIME                        NewLastWriteSystemTime;

-  FILETIME                          NewCreationFileTime;

-  FILETIME                          NewLastAccessFileTime;

-  FILETIME                          NewLastWriteFileTime;

-  WIN32_FIND_DATA                   FindBuf;

-  EFI_FILE_SYSTEM_INFO              *NewFileSystemInfo;

-  EFI_TPL                           OldTpl;

-

-  //

-  // Check for invalid parameters.

-  //

-  if (This == NULL || InformationType == NULL || BufferSize == 0 || Buffer == NULL) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);

-

-  //

-  // Initialise locals.

-  //

-  PrivateFile               = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);

-  PrivateRoot               = WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (PrivateFile->SimpleFileSystem);

-

-  Status                    = EFI_UNSUPPORTED;

-  OldFileInfo               = NewFileInfo = NULL;

-  OldFileName               = NewFileName = NULL;

-  AttrChangeFlag = NameChangeFlag = SizeChangeFlag = TimeChangeFlag = FALSE;

-

-  //

-  // Set file system information.

-  //

-  if (CompareGuid (InformationType, &gEfiFileSystemInfoGuid)) {

-    if (BufferSize < SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel)) {

-      Status = EFI_BAD_BUFFER_SIZE;

-      goto Done;

-    }

-

-    NewFileSystemInfo = (EFI_FILE_SYSTEM_INFO *) Buffer;

-

-    FreePool (PrivateRoot->VolumeLabel);

-    PrivateRoot->VolumeLabel = AllocatePool (StrSize (NewFileSystemInfo->VolumeLabel));

-    if (PrivateRoot->VolumeLabel == NULL) {

-      Status = EFI_OUT_OF_RESOURCES;

-      goto Done;

-    }

-

-    StrCpy (PrivateRoot->VolumeLabel, NewFileSystemInfo->VolumeLabel);

-

-    Status = EFI_SUCCESS;

-    goto Done;

-  }

-

-  //

-  // Set volume label information.

-  //

-  if (CompareGuid (InformationType, &gEfiFileSystemVolumeLabelInfoIdGuid)) {

-    if (BufferSize < StrSize (PrivateRoot->VolumeLabel)) {

-      Status = EFI_BAD_BUFFER_SIZE;

-      goto Done;

-    }

-

-    StrCpy (PrivateRoot->VolumeLabel, (CHAR16 *) Buffer);

-

-    Status = EFI_SUCCESS;

-    goto Done;

-  }

-

-  if (!CompareGuid (InformationType, &gEfiFileInfoGuid)) {

-    Status = EFI_UNSUPPORTED;

-    goto Done;

-  }

-

-  if (BufferSize < SIZE_OF_EFI_FILE_INFO) {

-    Status = EFI_BAD_BUFFER_SIZE;

-    goto Done;

-  }

-

-  //

-  // Set file/directory information.

-  //

-

-  //

-  // Check for invalid set file information parameters.

-  //

-  NewFileInfo = (EFI_FILE_INFO *) Buffer;

-

-  if (NewFileInfo->Size <= sizeof (EFI_FILE_INFO) ||

-      (NewFileInfo->Attribute &~(EFI_FILE_VALID_ATTR)) ||

-      (sizeof (UINTN) == 4 && NewFileInfo->Size > 0xFFFFFFFF)

-      ) {

-    Status = EFI_INVALID_PARAMETER;

-    goto Done;

-  }

-

-  //

-  // bugbug: - This is not safe.  We need something like EfiStrMaxSize()

-  // that would have an additional parameter that would be the size

-  // of the string array just in case there are no NULL characters in

-  // the string array.

-  //

-  //

-  // Get current file information so we can determine what kind

-  // of change request this is.

-  //

-  OldInfoSize = 0;

-  Status      = WinNtSimpleFileSystemFileInfo (PrivateFile, &OldInfoSize, NULL);

-

-  if (Status != EFI_BUFFER_TOO_SMALL) {

-    Status = EFI_DEVICE_ERROR;

-    goto Done;

-  }

-

-  OldFileInfo = AllocatePool (OldInfoSize);

-  if (OldFileInfo == NULL) {

-    Status = EFI_OUT_OF_RESOURCES;

-    goto Done;

-  }

-

-  Status = WinNtSimpleFileSystemFileInfo (PrivateFile, &OldInfoSize, OldFileInfo);

-

-  if (EFI_ERROR (Status)) {

-    goto Done;

-  }

-

-  OldFileName = AllocatePool (StrSize (PrivateFile->FileName));

-  if (OldFileName == NULL) {

-    Status = EFI_OUT_OF_RESOURCES;

-    goto Done;

-  }

-

-  StrCpy (OldFileName, PrivateFile->FileName);

-

-  //

-  // Make full pathname from new filename and rootpath.

-  //

-  if (NewFileInfo->FileName[0] == '\\') {

-    NewFileName = AllocatePool (StrSize (PrivateRoot->FilePath) + StrSize (L"\\") + StrSize (NewFileInfo->FileName));

-    if (NewFileName == NULL) {

-      Status = EFI_OUT_OF_RESOURCES;

-      goto Done;

-    }

-

-    StrCpy (NewFileName, PrivateRoot->FilePath);

-    StrCat (NewFileName, L"\\");

-    StrCat (NewFileName, NewFileInfo->FileName + 1);

-  } else {

-    NewFileName = AllocatePool (StrSize (PrivateFile->FilePath) + StrSize (L"\\") + StrSize (NewFileInfo->FileName));

-    if (NewFileName == NULL) {

-      Status = EFI_OUT_OF_RESOURCES;

-      goto Done;

-    }

-

-    StrCpy (NewFileName, PrivateFile->FilePath);

-    StrCat (NewFileName, L"\\");

-    StrCat (NewFileName, NewFileInfo->FileName);

-  }

-

-  //

-  // Is there an attribute change request?

-  //

-  if (NewFileInfo->Attribute != OldFileInfo->Attribute) {

-    if ((NewFileInfo->Attribute & EFI_FILE_DIRECTORY) != (OldFileInfo->Attribute & EFI_FILE_DIRECTORY)) {

-      Status = EFI_INVALID_PARAMETER;

-      goto Done;

-    }

-

-    AttrChangeFlag = TRUE;

-  }

-

-  //

-  // Is there a name change request?

-  // bugbug: - Need EfiStrCaseCmp()

-  //

-  if (StrCmp (NewFileInfo->FileName, OldFileInfo->FileName)) {

-    NameChangeFlag = TRUE;

-  }

-

-  //

-  // Is there a size change request?

-  //

-  if (NewFileInfo->FileSize != OldFileInfo->FileSize) {

-    SizeChangeFlag = TRUE;

-  }

-

-  //

-  // Is there a time stamp change request?

-  //

-  if (!IsZero (&NewFileInfo->CreateTime, sizeof (EFI_TIME)) &&

-      CompareMem (&NewFileInfo->CreateTime, &OldFileInfo->CreateTime, sizeof (EFI_TIME))

-        ) {

-    TimeChangeFlag = TRUE;

-  } else if (!IsZero (&NewFileInfo->LastAccessTime, sizeof (EFI_TIME)) &&

-           CompareMem (&NewFileInfo->LastAccessTime, &OldFileInfo->LastAccessTime, sizeof (EFI_TIME))

-            ) {

-    TimeChangeFlag = TRUE;

-  } else if (!IsZero (&NewFileInfo->ModificationTime, sizeof (EFI_TIME)) &&

-           CompareMem (&NewFileInfo->ModificationTime, &OldFileInfo->ModificationTime, sizeof (EFI_TIME))

-            ) {

-    TimeChangeFlag = TRUE;

-  }

-

-  //

-  // All done if there are no change requests being made.

-  //

-  if (!(AttrChangeFlag || NameChangeFlag || SizeChangeFlag || TimeChangeFlag)) {

-    Status = EFI_SUCCESS;

-    goto Done;

-  }

-

-  //

-  // Set file or directory information.

-  //

-  OldAttr = PrivateFile->WinNtThunk->GetFileAttributes (OldFileName);

-

-  //

-  // Name change.

-  //

-  if (NameChangeFlag) {

-    //

-    // Close the handles first

-    //

-    if (PrivateFile->IsOpenedByRead) {

-      Status = EFI_ACCESS_DENIED;

-      goto Done;

-    }

-

-    for (CharPointer = NewFileName; *CharPointer != 0 && *CharPointer != L'/'; CharPointer++) {

-    }

-

-    if (*CharPointer != 0) {

-      Status = EFI_ACCESS_DENIED;

-      goto Done;

-    }

-

-    if (PrivateFile->LHandle != INVALID_HANDLE_VALUE) {

-      if (PrivateFile->IsDirectoryPath) {

-        PrivateFile->WinNtThunk->FindClose (PrivateFile->LHandle);

-      } else {

-        PrivateFile->WinNtThunk->CloseHandle (PrivateFile->LHandle);

-        PrivateFile->LHandle = INVALID_HANDLE_VALUE;

-      }

-    }

-

-    if (PrivateFile->IsDirectoryPath && PrivateFile->DirHandle != INVALID_HANDLE_VALUE) {

-      PrivateFile->WinNtThunk->CloseHandle (PrivateFile->DirHandle);

-      PrivateFile->DirHandle = INVALID_HANDLE_VALUE;

-    }

-

-    NtStatus = PrivateFile->WinNtThunk->MoveFile (OldFileName, NewFileName);

-

-    if (NtStatus) {

-      //

-      // modify file name

-      //

-      FreePool (PrivateFile->FileName);

-

-      PrivateFile->FileName = AllocatePool (StrSize (NewFileName));

-      if (PrivateFile->FileName == NULL) {

-        Status = EFI_OUT_OF_RESOURCES;

-        goto Done;

-      }

-

-      StrCpy (PrivateFile->FileName, NewFileName);

-

-      TempFileName = AllocatePool (StrSize (NewFileName) + StrSize (L"\\*"));

-

-      StrCpy (TempFileName, NewFileName);

-

-      if (!PrivateFile->IsDirectoryPath) {

-       PrivateFile->LHandle = PrivateFile->WinNtThunk->CreateFile (

-                                                          TempFileName,

-                                                          PrivateFile->IsOpenedByRead ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE,

-                                                          FILE_SHARE_READ | FILE_SHARE_WRITE,

-                                                          NULL,

-                                                          OPEN_EXISTING,

-                                                          0,

-                                                          NULL

-                                                          );

-

-        FreePool (TempFileName);

-

-        //

-        //  Flush buffers just in case

-        //

-        if (PrivateFile->WinNtThunk->FlushFileBuffers (PrivateFile->LHandle) == 0) {

-          Status = EFI_DEVICE_ERROR;

-          goto Done;

-        }

-      } else {

-        PrivateFile->DirHandle = PrivateFile->WinNtThunk->CreateFile (

-                                                            TempFileName,

-                                                            PrivateFile->IsOpenedByRead ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE,

-                                                            FILE_SHARE_READ | FILE_SHARE_WRITE,

-                                                            NULL,

-                                                            OPEN_EXISTING,

-                                                            FILE_FLAG_BACKUP_SEMANTICS,

-                                                            NULL

-                                                            );

-

-        StrCat (TempFileName, L"\\*");

-        PrivateFile->LHandle = PrivateFile->WinNtThunk->FindFirstFile (TempFileName, &FindBuf);

-

-        FreePool (TempFileName);

-      }

-    } else {

-Reopen: ;

-      Status    = EFI_DEVICE_ERROR;

-

-      NtStatus  = PrivateFile->WinNtThunk->SetFileAttributes (OldFileName, OldAttr);

-

-      if (!NtStatus) {

-        goto Done;

-      }

-

-      TempFileName = AllocatePool (StrSize (OldFileName) + StrSize (L"\\*"));

-

-      StrCpy (TempFileName, OldFileName);

-

-      if (!PrivateFile->IsDirectoryPath) {

-        PrivateFile->LHandle = PrivateFile->WinNtThunk->CreateFile (

-                                                          TempFileName,

-                                                          PrivateFile->IsOpenedByRead ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE,

-                                                          FILE_SHARE_READ | FILE_SHARE_WRITE,

-                                                          NULL,

-                                                          OPEN_EXISTING,

-                                                          0,

-                                                          NULL

-                                                          );

-      } else {

-        PrivateFile->DirHandle = PrivateFile->WinNtThunk->CreateFile (

-                                                            TempFileName,

-                                                            PrivateFile->IsOpenedByRead ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE,

-                                                            FILE_SHARE_READ | FILE_SHARE_WRITE,

-                                                            NULL,

-                                                            OPEN_EXISTING,

-                                                            FILE_FLAG_BACKUP_SEMANTICS,

-                                                            NULL

-                                                            );

-

-        StrCat (TempFileName, L"\\*");

-        PrivateFile->LHandle = PrivateFile->WinNtThunk->FindFirstFile (TempFileName, &FindBuf);

-      }

-

-      FreePool (TempFileName);

-

-      goto Done;

-

-    }

-  }

-

-  //

-  //  Size change

-  //

-  if (SizeChangeFlag) {

-    if (PrivateFile->IsDirectoryPath) {

-      Status = EFI_UNSUPPORTED;

-      goto Done;

-    }

-

-    if (PrivateFile->IsOpenedByRead || OldFileInfo->Attribute & EFI_FILE_READ_ONLY) {

-      Status = EFI_ACCESS_DENIED;

-      goto Done;

-    }

-

-    Status = This->GetPosition (This, &CurPos);

-    if (EFI_ERROR (Status)) {

-      goto Done;

-    }

-

-    Status = This->SetPosition (This, NewFileInfo->FileSize);

-    if (EFI_ERROR (Status)) {

-      goto Done;

-    }

-

-    if (PrivateFile->WinNtThunk->SetEndOfFile (PrivateFile->LHandle) == 0) {

-      Status = EFI_DEVICE_ERROR;

-      goto Done;

-    }

-

-    Status = This->SetPosition (This, CurPos);

-    if (EFI_ERROR (Status)) {

-      goto Done;

-    }

-  }

-

-  //

-  // Time change

-  //

-  if (TimeChangeFlag) {

-

-    NewCreationSystemTime.wYear         = NewFileInfo->CreateTime.Year;

-    NewCreationSystemTime.wMonth        = NewFileInfo->CreateTime.Month;

-    NewCreationSystemTime.wDay          = NewFileInfo->CreateTime.Day;

-    NewCreationSystemTime.wHour         = NewFileInfo->CreateTime.Hour;

-    NewCreationSystemTime.wMinute       = NewFileInfo->CreateTime.Minute;

-    NewCreationSystemTime.wSecond       = NewFileInfo->CreateTime.Second;

-    NewCreationSystemTime.wMilliseconds = 0;

-

-    if (!PrivateFile->WinNtThunk->SystemTimeToFileTime (

-                                    &NewCreationSystemTime,

-                                    &NewCreationFileTime

-                                    )) {

-      goto Done;

-    }

-

-    NewLastAccessSystemTime.wYear         = NewFileInfo->LastAccessTime.Year;

-    NewLastAccessSystemTime.wMonth        = NewFileInfo->LastAccessTime.Month;

-    NewLastAccessSystemTime.wDay          = NewFileInfo->LastAccessTime.Day;

-    NewLastAccessSystemTime.wHour         = NewFileInfo->LastAccessTime.Hour;

-    NewLastAccessSystemTime.wMinute       = NewFileInfo->LastAccessTime.Minute;

-    NewLastAccessSystemTime.wSecond       = NewFileInfo->LastAccessTime.Second;

-    NewLastAccessSystemTime.wMilliseconds = 0;

-

-    if (!PrivateFile->WinNtThunk->SystemTimeToFileTime (

-                                    &NewLastAccessSystemTime,

-                                    &NewLastAccessFileTime

-                                    )) {

-      goto Done;

-    }

-

-    NewLastWriteSystemTime.wYear          = NewFileInfo->ModificationTime.Year;

-    NewLastWriteSystemTime.wMonth         = NewFileInfo->ModificationTime.Month;

-    NewLastWriteSystemTime.wDay           = NewFileInfo->ModificationTime.Day;

-    NewLastWriteSystemTime.wHour          = NewFileInfo->ModificationTime.Hour;

-    NewLastWriteSystemTime.wMinute        = NewFileInfo->ModificationTime.Minute;

-    NewLastWriteSystemTime.wSecond        = NewFileInfo->ModificationTime.Second;

-    NewLastWriteSystemTime.wMilliseconds  = 0;

-

-    if (!PrivateFile->WinNtThunk->SystemTimeToFileTime (

-                                    &NewLastWriteSystemTime,

-                                    &NewLastWriteFileTime

-                                    )) {

-      goto Done;

-    }

-

-    if (!PrivateFile->WinNtThunk->SetFileTime (

-                                    PrivateFile->IsDirectoryPath ? PrivateFile->DirHandle : PrivateFile->LHandle,

-                                    &NewCreationFileTime,

-                                    &NewLastAccessFileTime,

-                                    &NewLastWriteFileTime

-                                    )) {

-      Status = EFI_DEVICE_ERROR;

-      goto Done;

-    }

-

-  }

-

-  //

-  // No matter about AttrChangeFlag, Attribute must be set.

-  // Because operation before may cause attribute change.

-  //

-  NewAttr = OldAttr;

-

-  if (NewFileInfo->Attribute & EFI_FILE_ARCHIVE) {

-    NewAttr |= FILE_ATTRIBUTE_ARCHIVE;

-  } else {

-    NewAttr &= ~FILE_ATTRIBUTE_ARCHIVE;

-  }

-

-  if (NewFileInfo->Attribute & EFI_FILE_HIDDEN) {

-    NewAttr |= FILE_ATTRIBUTE_HIDDEN;

-  } else {

-    NewAttr &= ~FILE_ATTRIBUTE_HIDDEN;

-  }

-

-  if (NewFileInfo->Attribute & EFI_FILE_SYSTEM) {

-    NewAttr |= FILE_ATTRIBUTE_SYSTEM;

-  } else {

-    NewAttr &= ~FILE_ATTRIBUTE_SYSTEM;

-  }

-

-  if (NewFileInfo->Attribute & EFI_FILE_READ_ONLY) {

-    NewAttr |= FILE_ATTRIBUTE_READONLY;

-  } else {

-    NewAttr &= ~FILE_ATTRIBUTE_READONLY;

-  }

-

-  NtStatus = PrivateFile->WinNtThunk->SetFileAttributes (NewFileName, NewAttr);

-

-  if (!NtStatus) {

-    goto Reopen;

-  }

-

-Done:

-  if (OldFileInfo != NULL) {

-    FreePool (OldFileInfo);

-  }

-

-  if (OldFileName != NULL) {

-    FreePool (OldFileName);

-  }

-

-  if (NewFileName != NULL) {

-    FreePool (NewFileName);

-  }

-

-  gBS->RestoreTPL (OldTpl);

-  return Status;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemFlush (

-  IN EFI_FILE  *This

-  )

-/*++

-

-Routine Description:

-

-  Flush all modified data to the media.

-

-Arguments:

-

-  This  - Pointer to an opened file handle.

-

-Returns:

-

-  EFI_SUCCESS           - The data has been flushed.

-

-  EFI_NO_MEDIA          - The device has no media.

-

-  EFI_DEVICE_ERROR      - The device reported an error.

-

-  EFI_VOLUME_CORRUPTED  - The file system structures have been corrupted.

-

-  EFI_WRITE_PROTECTED   - The file, directory, volume, or device is write protected.

-

-  EFI_ACCESS_DENIED     - The file was opened read-only.

-

-  EFI_VOLUME_FULL       - The volume is full.

-

---*/

-// TODO:    EFI_INVALID_PARAMETER - add return value to function comment

-{

-  BY_HANDLE_FILE_INFORMATION  FileInfo;

-  WIN_NT_EFI_FILE_PRIVATE     *PrivateFile;

-  EFI_STATUS                  Status;

-  EFI_TPL                     OldTpl;

-

-  if (This == NULL) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);

-

-  PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);

-

-  if (PrivateFile->LHandle == INVALID_HANDLE_VALUE) {

-    Status = EFI_DEVICE_ERROR;

-    goto Done;

-  }

-

-  if (PrivateFile->IsDirectoryPath) {

-    Status = EFI_SUCCESS;

-    goto Done;

-  }

-

-  if (PrivateFile->IsOpenedByRead) {

-    Status = EFI_ACCESS_DENIED;

-    goto Done;

-  }

-

-  PrivateFile->WinNtThunk->GetFileInformationByHandle (PrivateFile->LHandle, &FileInfo);

-

-  if (FileInfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {

-    Status = EFI_ACCESS_DENIED;

-    goto Done;

-  }

-

-  Status = PrivateFile->WinNtThunk->FlushFileBuffers (PrivateFile->LHandle) ? EFI_SUCCESS : EFI_DEVICE_ERROR;

-

-Done:

-  gBS->RestoreTPL (OldTpl);

-  return Status;

-  //

-  // bugbug: - Use Windows error reporting.

-  //

-}

-

-

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.h b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.h
deleted file mode 100644
index eeb373d..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.h
+++ /dev/null
@@ -1,587 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  WinNtSimpleFileSystem.h

-

-Abstract:

-

-  Produce Simple File System abstractions for a directory on your PC using Win32 APIs.

-  The configuration of what devices to mount or emulate comes from NT 

-  environment variables. The variables must be visible to the Microsoft* 

-  Developer Studio for them to work.

-

-  * Other names and brands may be claimed as the property of others.

-

---*/

-

-#ifndef _WIN_NT_SIMPLE_FILE_SYSTEM_H_

-#define _WIN_NT_SIMPLE_FILE_SYSTEM_H_

-

-

-

-#define WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE EFI_SIGNATURE_32 ('N', 'T', 'f', 's')

-

-typedef struct {

-  UINTN                           Signature;

-  EFI_WIN_NT_THUNK_PROTOCOL       *WinNtThunk;

-  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL SimpleFileSystem;

-  CHAR16                          *FilePath;

-  CHAR16                          *VolumeLabel;

-  EFI_UNICODE_STRING_TABLE        *ControllerNameTable;

-} WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE;

-

-#define WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS(a) \

-  CR (a, \

-      WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE, \

-      SimpleFileSystem, \

-      WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE \

-      )

-

-#define WIN_NT_EFI_FILE_PRIVATE_SIGNATURE EFI_SIGNATURE_32 ('l', 'o', 'f', 's')

-

-typedef struct {

-  UINTN                           Signature;

-  EFI_WIN_NT_THUNK_PROTOCOL       *WinNtThunk;

-  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;

-  EFI_FILE                        EfiFile;

-  HANDLE                          LHandle;

-  HANDLE                          DirHandle;

-  BOOLEAN                         IsRootDirectory;

-  BOOLEAN                         IsDirectoryPath;

-  BOOLEAN                         IsOpenedByRead;

-  CHAR16                          *FilePath;

-  WCHAR                           *FileName;

-  BOOLEAN                         IsValidFindBuf;

-  WIN32_FIND_DATA                 FindBuf;

-} WIN_NT_EFI_FILE_PRIVATE;

-

-#define WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS(a) \

-  CR (a, \

-      WIN_NT_EFI_FILE_PRIVATE, \

-      EfiFile, \

-      WIN_NT_EFI_FILE_PRIVATE_SIGNATURE \

-      )

-

-//

-// Global Protocol Variables

-//

-extern EFI_DRIVER_BINDING_PROTOCOL  gWinNtSimpleFileSystemDriverBinding;

-extern EFI_COMPONENT_NAME_PROTOCOL  gWinNtSimpleFileSystemComponentName;

-

-//

-// Driver Binding protocol member functions

-//

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemDriverBindingSupported (

-  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

-  IN  EFI_HANDLE                   ControllerHandle,

-  IN  EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath  OPTIONAL

-  )

-/*++

-

-Routine Description:

-

-  Check to see if the driver supports a given controller.

-

-Arguments:

-

-  This                - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.

-

-  ControllerHandle    - EFI handle of the controller to test.

-

-  RemainingDevicePath - Pointer to remaining portion of a device path.

-

-Returns:

-

-  EFI_SUCCESS         - The device specified by ControllerHandle and RemainingDevicePath is supported by the driver

-                        specified by This.

-

-  EFI_ALREADY_STARTED - The device specified by ControllerHandle and RemainingDevicePath is already being managed by

-                        the driver specified by This.

-

-  EFI_ACCESS_DENIED   - The device specified by ControllerHandle and RemainingDevicePath is already being managed by

-                        a different driver or an application that requires exclusive access.

-

-  EFI_UNSUPPORTED     - The device specified by ControllerHandle and RemainingDevicePath is not supported by the

-                        driver specified by This.

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemDriverBindingStart (

-  IN  EFI_DRIVER_BINDING_PROTOCOL   *This,

-  IN  EFI_HANDLE                    ControllerHandle,

-  IN  EFI_DEVICE_PATH_PROTOCOL      *RemainingDevicePath  OPTIONAL

-  )

-/*++

-

-Routine Description:

-

-  Starts a device controller or a bus controller.

-

-Arguments:

-

-  This                - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.

-

-  ControllerHandle    - EFI handle of the controller to start.

-

-  RemainingDevicePath - Pointer to remaining portion of a device path.

-

-Returns:

-

-  EFI_SUCCESS           - The device or bus controller has been started.

-

-  EFI_DEVICE_ERROR      - The device could not be started due to a device failure.

-

-  EFI_OUT_OF_RESOURCES  - The request could not be completed due to lack of resources.

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemDriverBindingStop (

-  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

-  IN  EFI_HANDLE                   ControllerHandle,

-  IN  UINTN                        NumberOfChildren,

-  IN  EFI_HANDLE                   *ChildHandleBuffer  OPTIONAL

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This              - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.

-

-  ControllerHandle  - A handle to the device to be stopped.

-

-  NumberOfChildren  - The number of child device handles in ChildHandleBuffer.

-

-  ChildHandleBuffer - An array of child device handles to be freed.

-

-Returns:

-

-  EFI_SUCCESS       - The device has been stopped.

-

-  EFI_DEVICE_ERROR  - The device could not be stopped due to a device failure.

-

---*/

-;

-

-//

-// Simple File System protocol member functions

-//

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemOpenVolume (

-  IN  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,

-  OUT EFI_FILE                        **Root

-  )

-/*++

-

-Routine Description:

-

-  Open the root directory on a volume.

-

-Arguments:

-

-  This  - A pointer to the volume to open.

-

-  Root  - A pointer to storage for the returned opened file handle of the root directory.

-

-Returns:

-

-  EFI_SUCCESS           - The volume was opened.

-

-  EFI_UNSUPPORTED       - The volume does not support the requested file system type.

-

-  EFI_NO_MEDIA          - The device has no media.

-

-  EFI_DEVICE_ERROR      - The device reported an error.

-

-  EFI_VOLUME_CORRUPTED  - The file system structures are corrupted.

-

-  EFI_ACCESS_DENIED     - The service denied access to the file.

-

-  EFI_OUT_OF_RESOURCES  - The file volume could not be opened due to lack of resources.

-

-  EFI_MEDIA_CHANGED     - The device has new media or the media is no longer supported.

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemOpen (

-  IN  EFI_FILE  *This,

-  OUT EFI_FILE  **NewHandle,

-  IN  CHAR16    *FileName,

-  IN  UINT64    OpenMode,

-  IN  UINT64    Attributes

-  )

-/*++

-

-Routine Description:

-

-  Open a file relative to the source file location.

-

-Arguments:

-

-  This        - A pointer to the source file location.

-

-  NewHandle   - Pointer to storage for the new file handle.

-

-  FileName    - Pointer to the file name to be opened.

-

-  OpenMode    - File open mode information.

-

-  Attributes  - File creation attributes.

-

-Returns:

-

-  EFI_SUCCESS           - The file was opened.

-

-  EFI_NOT_FOUND         - The file could not be found in the volume.

-

-  EFI_NO_MEDIA          - The device has no media.

-

-  EFI_MEDIA_CHANGED     - The device has new media or the media is no longer supported.

-

-  EFI_DEVICE_ERROR      - The device reported an error.

-

-  EFI_VOLUME_CORRUPTED  - The file system structures are corrupted.

-

-  EFI_WRITE_PROTECTED   - The volume or file is write protected.

-

-  EFI_ACCESS_DENIED     - The service denied access to the file.

-

-  EFI_OUT_OF_RESOURCES  - Not enough resources were available to open the file.

-

-  EFI_VOLUME_FULL       - There is not enough space left to create the new file.

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemClose (

-  IN EFI_FILE  *This

-  )

-/*++

-

-Routine Description:

-

-  Close the specified file handle.

-

-Arguments:

-

-  This  - Pointer to a returned opened file handle.

-

-Returns:

-

-  EFI_SUCCESS - The file handle has been closed.

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemDelete (

-  IN EFI_FILE  *This

-  )

-/*++

-

-Routine Description:

-

-  Close and delete a file.

-

-Arguments:

-

-  This  - Pointer to a returned opened file handle.

-

-Returns:

-

-  EFI_SUCCESS             - The file handle was closed and deleted.

-

-  EFI_WARN_DELETE_FAILURE - The handle was closed but could not be deleted.

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemRead (

-  IN     EFI_FILE  *This,

-  IN OUT UINTN     *BufferSize,

-  OUT    VOID      *Buffer

-  )

-/*++

-

-Routine Description:

-

-  Read data from a file.

-

-Arguments:

-

-  This        - Pointer to a returned open file handle.

-

-  BufferSize  - On input, the size of the Buffer.  On output, the number of bytes stored in the Buffer.

-

-  Buffer      - Pointer to the first byte of the read Buffer.

-

-Returns:

-

-  EFI_SUCCESS           - The data was read.

-

-  EFI_NO_MEDIA          - The device has no media.

-

-  EFI_DEVICE_ERROR      - The device reported an error.

-

-  EFI_VOLUME_CORRUPTED  - The file system structures are corrupted.

-

-  EFI_BUFFER_TOO_SMALL  - The supplied buffer size was too small to store the current directory entry.

-                          *BufferSize has been updated with the size needed to complete the request.

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemWrite (

-  IN     EFI_FILE  *This,

-  IN OUT UINTN     *BufferSize,

-  IN     VOID      *Buffer

-  )

-/*++

-

-Routine Description:

-

-  Write data to a file.

-

-Arguments:

-

-  This        - Pointer to an opened file handle.

-

-  BufferSize  - On input, the number of bytes in the Buffer to write to the file.  On output, the number of bytes

-                of data written to the file.

-

-  Buffer      - Pointer to the first by of data in the buffer to write to the file.

-

-Returns:

-

-  EFI_SUCCESS           - The data was written to the file.

-

-  EFI_UNSUPPORTED       - Writes to an open directory are not supported.

-

-  EFI_NO_MEDIA          - The device has no media.

-

-  EFI_DEVICE_ERROR      - The device reported an error.

-

-  EFI_VOLUME_CORRUPTED  - The file system structures are corrupt.

-

-  EFI_WRITE_PROTECTED   - The file, directory, volume, or device is write protected.

-

-  EFI_ACCESS_DENIED     - The file was opened read-only.

-

-  EFI_VOLUME_FULL       - The volume is full.

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemSetPosition (

-  IN EFI_FILE  *This,

-  IN UINT64    Position

-  )

-/*++

-

-Routine Description:

-

-  Set a file's current position.

-

-Arguments:

-

-  This      - Pointer to an opened file handle.

-

-  Position  - The byte position from the start of the file to set.

-

-Returns:

-

-  EFI_SUCCESS     - The file position has been changed.

-

-  EFI_UNSUPPORTED - The seek request for non-zero is not supported for directories.

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemGetPosition (

-  IN  EFI_FILE  *This,

-  OUT UINT64    *Position

-  )

-/*++

-

-Routine Description:

-

-  Get a file's current position.

-

-Arguments:

-

-  This      - Pointer to an opened file handle.

-

-  Position  - Pointer to storage for the current position.

-

-Returns:

-

-  EFI_SUCCESS     - The file position has been reported.

-

-  EFI_UNSUPPORTED - Not valid for directories.

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemGetInfo (

-  IN     EFI_FILE  *This,

-  IN     EFI_GUID  *InformationType,

-  IN OUT UINTN     *BufferSize,

-  OUT    VOID      *Buffer

-  )

-/*++

-

-Routine Description:

-

-  Return information about a file or volume.

-

-Arguments:

-

-  This            - Pointer to an opened file handle.

-

-  InformationType - GUID describing the type of information to be returned.

-

-  BufferSize      - On input, the size of the information buffer.  On output, the number of bytes written to the

-                    information buffer.

-

-  Buffer          - Pointer to the first byte of the information buffer.

-

-Returns:

-

-  EFI_SUCCESS           - The requested information has been written into the buffer.

-

-  EFI_UNSUPPORTED       - The InformationType is not known.

-

-  EFI_NO_MEDIA          - The device has no media.

-

-  EFI_DEVICE_ERROR      - The device reported an error.

-

-  EFI_VOLUME_CORRUPTED  - The file system structures are corrupt.

-

-  EFI_BUFFER_TOO_SMALL  - The buffer size was too small to contain the requested information.  The buffer size has

-                          been updated with the size needed to complete the requested operation.

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemSetInfo (

-  IN EFI_FILE  *This,

-  IN EFI_GUID  *InformationType,

-  IN UINTN     BufferSize,

-  IN VOID      *Buffer

-  )

-/*++

-

-Routine Description:

-

-  Set information about a file or volume.

-

-Arguments:

-

-  This            - Pointer to an opened file handle.

-

-  InformationType - GUID identifying the type of information to set.

-

-  BufferSize      - Number of bytes of data in the information buffer.

-

-  Buffer          - Pointer to the first byte of data in the information buffer.

-

-Returns:

-

-  EFI_SUCCESS           - The file or volume information has been updated.

-

-  EFI_UNSUPPORTED       - The information identifier is not recognised.

-

-  EFI_NO_MEDIA          - The device has no media.

-

-  EFI_DEVICE_ERROR      - The device reported an error.

-

-  EFI_VOLUME_CORRUPTED  - The file system structures are corrupt.

-

-  EFI_WRITE_PROTECTED   - The file, directory, volume, or device is write protected.

-

-  EFI_ACCESS_DENIED     - The file was opened read-only.

-

-  EFI_VOLUME_FULL       - The volume is full.

-

-  EFI_BAD_BUFFER_SIZE   - The buffer size is smaller than the type indicated by InformationType.

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-WinNtSimpleFileSystemFlush (

-  IN EFI_FILE  *This

-  )

-/*++

-

-Routine Description:

-

-  Flush all modified data to the media.

-

-Arguments:

-

-  This  - Pointer to an opened file handle.

-

-Returns:

-

-  EFI_SUCCESS           - The data has been flushed.

-

-  EFI_NO_MEDIA          - The device has no media.

-

-  EFI_DEVICE_ERROR      - The device reported an error.

-

-  EFI_VOLUME_CORRUPTED  - The file system structures have been corrupted.

-

-  EFI_WRITE_PROTECTED   - The file, directory, volume, or device is write protected.

-

-  EFI_ACCESS_DENIED     - The file was opened read-only.

-

-  EFI_VOLUME_FULL       - The volume is full.

-

---*/

-;

-

-#endif /* _WIN_NT_SIMPLE_FILE_SYSTEM_H_ */

-

-/* eof - WinNtSimpleFileSystem.h */

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.msa
deleted file mode 100644
index c60e293..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.msa
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>WinNtSimpleFileSystem</ModuleName>

-    <ModuleType>UEFI_DRIVER</ModuleType>

-    <GuidValue>9C25E18B-76BA-43da-A132-DBB0997CEFEF</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>Simple filesystem driver</Abstract>

-    <Description>Produce Simple File System abstractions for directories on your PC using Win32 APIs.

-      The configuration of what devices to mount or emulate comes from NT

-      environment variables. The variables must be visible to the Microsoft*

-      Developer Studio for them to work.</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>WinNtSimpleFileSystem</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiDriverModelLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiDriverEntryPoint</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseMemoryLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiBootServicesTableLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>MemoryAllocationLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>WinNtSimpleFileSystem.h</Filename>

-    <Filename>WinNtSimpleFileSystem.c</Filename>

-    <Filename>ComponentName.c</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <Protocols>

-    <Protocol Usage="TO_START">

-      <ProtocolCName>gEfiWinNtIoProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="BY_START">

-      <ProtocolCName>gEfiSimpleFileSystemProtocolGuid</ProtocolCName>

-    </Protocol>

-  </Protocols>

-  <Guids>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiWinNtFileSystemGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="SOMETIMES_CONSUMED">

-      <GuidCName>gEfiFileSystemInfoGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="SOMETIMES_CONSUMED">

-      <GuidCName>gEfiFileInfoGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="SOMETIMES_CONSUMED">

-      <GuidCName>gEfiFileSystemVolumeLabelInfoIdGuid</GuidCName>

-    </GuidCNames>

-  </Guids>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-    <Extern>

-      <DriverBinding>gWinNtSimpleFileSystemDriverBinding</DriverBinding>

-      <ComponentName>gWinNtSimpleFileSystemComponentName</ComponentName>

-    </Extern>

-  </Externs>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/ComponentName.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/ComponentName.c
deleted file mode 100644
index 9107719..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/ComponentName.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  ComponentName.c

-

-Abstract:

-

---*/

-

-#include "WinNtUga.h"

-

-//

-// EFI Component Name Functions

-//

-EFI_STATUS

-EFIAPI

-WinNtUgaComponentNameGetDriverName (

-  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,

-  IN  CHAR8                        *Language,

-  OUT CHAR16                       **DriverName

-  );

-

-EFI_STATUS

-EFIAPI

-WinNtUgaComponentNameGetControllerName (

-  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,

-  IN  EFI_HANDLE                                      ControllerHandle,

-  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,

-  IN  CHAR8                                           *Language,

-  OUT CHAR16                                          **ControllerName

-  );

-

-//

-// EFI Component Name Protocol

-//

-EFI_COMPONENT_NAME_PROTOCOL     gWinNtUgaComponentName = {

-  WinNtUgaComponentNameGetDriverName,

-  WinNtUgaComponentNameGetControllerName,

-  "eng"

-};

-

-static EFI_UNICODE_STRING_TABLE mWinNtUgaDriverNameTable[] = {

-  { "eng", L"Windows Universal Graphics Adapter Driver" },

-  { NULL , NULL }

-};

-

-EFI_STATUS

-EFIAPI

-WinNtUgaComponentNameGetDriverName (

-  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,

-  IN  CHAR8                        *Language,

-  OUT CHAR16                       **DriverName

-  )

-/*++

-

-  Routine Description:

-    Retrieves a Unicode string that is the user readable name of the EFI Driver.

-

-  Arguments:

-    This       - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.

-    Language   - A pointer to a three character ISO 639-2 language identifier.

-                 This is the language of the driver name that that the caller 

-                 is requesting, and it must match one of the languages specified

-                 in SupportedLanguages.  The number of languages supported by a 

-                 driver is up to the driver writer.

-    DriverName - A pointer to the Unicode string to return.  This Unicode string

-                 is the name of the driver specified by This in the language 

-                 specified by Language.

-

-  Returns:

-    EFI_SUCCESS           - The Unicode string for the Driver specified by This

-                            and the language specified by Language was returned 

-                            in DriverName.

-    EFI_INVALID_PARAMETER - Language is NULL.

-    EFI_INVALID_PARAMETER - DriverName is NULL.

-    EFI_UNSUPPORTED       - The driver specified by This does not support the 

-                            language specified by Language.

-

---*/

-{

-  return LookupUnicodeString (

-          Language,

-          gWinNtUgaComponentName.SupportedLanguages,

-          mWinNtUgaDriverNameTable,

-          DriverName

-          );

-}

-

-EFI_STATUS

-EFIAPI

-WinNtUgaComponentNameGetControllerName (

-  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,

-  IN  EFI_HANDLE                                      ControllerHandle,

-  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,

-  IN  CHAR8                                           *Language,

-  OUT CHAR16                                          **ControllerName

-  )

-/*++

-

-  Routine Description:

-    Retrieves a Unicode string that is the user readable name of the controller

-    that is being managed by an EFI Driver.

-

-  Arguments:

-    This             - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.

-    ControllerHandle - The handle of a controller that the driver specified by 

-                       This is managing.  This handle specifies the controller 

-                       whose name is to be returned.

-    ChildHandle      - The handle of the child controller to retrieve the name 

-                       of.  This is an optional parameter that may be NULL.  It 

-                       will be NULL for device drivers.  It will also be NULL 

-                       for a bus drivers that wish to retrieve the name of the 

-                       bus controller.  It will not be NULL for a bus driver 

-                       that wishes to retrieve the name of a child controller.

-    Language         - A pointer to a three character ISO 639-2 language 

-                       identifier.  This is the language of the controller name 

-                       that that the caller is requesting, and it must match one

-                       of the languages specified in SupportedLanguages.  The 

-                       number of languages supported by a driver is up to the 

-                       driver writer.

-    ControllerName   - A pointer to the Unicode string to return.  This Unicode

-                       string is the name of the controller specified by 

-                       ControllerHandle and ChildHandle in the language specified

-                       by Language from the point of view of the driver specified

-                       by This. 

-

-  Returns:

-    EFI_SUCCESS           - The Unicode string for the user readable name in the 

-                            language specified by Language for the driver 

-                            specified by This was returned in DriverName.

-    EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.

-    EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.

-    EFI_INVALID_PARAMETER - Language is NULL.

-    EFI_INVALID_PARAMETER - ControllerName is NULL.

-    EFI_UNSUPPORTED       - The driver specified by This is not currently managing 

-                            the controller specified by ControllerHandle and 

-                            ChildHandle.

-    EFI_UNSUPPORTED       - The driver specified by This does not support the 

-                            language specified by Language.

-

---*/

-{

-  EFI_STATUS            Status;

-  EFI_UGA_DRAW_PROTOCOL *UgaDraw;

-  UGA_PRIVATE_DATA      *Private;

-

-  //

-  // This is a device driver, so ChildHandle must be NULL.

-  //

-  if (ChildHandle != NULL) {

-    return EFI_UNSUPPORTED;

-  }

-

-  //

-  // Make sure this driver is currently managing ControllerHandle

-  //

-  Status = EfiTestManagedDevice (

-             ControllerHandle,

-             gWinNtUgaDriverBinding.DriverBindingHandle,

-             &gEfiWinNtIoProtocolGuid

-             );

-  if (EFI_ERROR (Status)) {

-    return EFI_UNSUPPORTED;

-  }

-  //

-  // Get our context back

-  //

-  Status = gBS->OpenProtocol (

-                  ControllerHandle,

-                  &gEfiUgaDrawProtocolGuid,

-                  &UgaDraw,

-                  gWinNtUgaDriverBinding.DriverBindingHandle,

-                  ControllerHandle,

-                  EFI_OPEN_PROTOCOL_GET_PROTOCOL

-                  );

-  if (EFI_ERROR (Status)) {

-    return EFI_UNSUPPORTED;

-  }

-

-  Private = UGA_DRAW_PRIVATE_DATA_FROM_THIS (UgaDraw);

-

-  return LookupUnicodeString (

-          Language,

-          gWinNtUgaComponentName.SupportedLanguages,

-          Private->ControllerNameTable,

-          ControllerName

-          );

-}

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUga.h b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUga.h
deleted file mode 100644
index defe391..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUga.h
+++ /dev/null
@@ -1,363 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  WinNtUga.h

-

-Abstract:

-

-  Private data for the Uga driver that is bound to the WinNt Thunk protocol 

-

---*/

-

-#ifndef _WIN_NT_UGA_H_

-#define _WIN_NT_UGA_H_

-

-

-

-#define MAX_Q 256

-

-typedef struct {

-  UINTN         Front;

-  UINTN         Rear;

-  UINTN         Count;

-  EFI_INPUT_KEY Q[MAX_Q];

-} UGA_QUEUE_FIXED;

-

-#define WIN_NT_UGA_CLASS_NAME       L"WinNtUgaWindow"

-

-#define UGA_PRIVATE_DATA_SIGNATURE  EFI_SIGNATURE_32 ('S', 'g', 'o', 'N')

-typedef struct {

-  UINT64                      Signature;

-

-  EFI_HANDLE                  Handle;

-  EFI_UGA_DRAW_PROTOCOL       UgaDraw;

-  EFI_SIMPLE_TEXT_IN_PROTOCOL SimpleTextIn;

-

-  EFI_WIN_NT_THUNK_PROTOCOL   *WinNtThunk;

-

-  EFI_UNICODE_STRING_TABLE    *ControllerNameTable;

-

-  //

-  // UGA Private Data for GetMode ()

-  //

-  UINT32                      HorizontalResolution;

-  UINT32                      VerticalResolution;

-  UINT32                      ColorDepth;

-  UINT32                      RefreshRate;

-

-  //

-  // UGA Private Data knowing when to start hardware

-  //

-  BOOLEAN                     HardwareNeedsStarting;

-

-  CHAR16                      *WindowName;

-  CHAR16                      Buffer[160];

-

-  HANDLE                      ThreadInited; // Semaphore

-  HANDLE                      ThreadHandle; // Thread

-  DWORD                       ThreadId;

-

-  HWND                        WindowHandle;

-  WNDCLASSEX                  WindowsClass;

-

-  //

-  // This screen is used to redraw the scree when windows events happen. It's

-  // updated in the main thread and displayed in the windows thread.

-  //

-  BITMAPV4HEADER              *VirtualScreenInfo;

-  RGBQUAD                     *VirtualScreen;

-

-  EFI_UGA_PIXEL               *FillLine;

-

-  //

-  // Keyboard Queue used by Simple Text In. WinProc thread adds, and main

-  // thread removes.

-  //

-  CRITICAL_SECTION            QCriticalSection;

-  UGA_QUEUE_FIXED             Queue;

-

-} UGA_PRIVATE_DATA;

-

-#define UGA_DRAW_PRIVATE_DATA_FROM_THIS(a)  \

-         CR(a, UGA_PRIVATE_DATA, UgaDraw, UGA_PRIVATE_DATA_SIGNATURE)

-

-#define UGA_PRIVATE_DATA_FROM_TEXT_IN_THIS(a)  \

-         CR(a, UGA_PRIVATE_DATA, SimpleTextIn, UGA_PRIVATE_DATA_SIGNATURE)

-

-//

-// Global Protocol Variables

-//

-extern EFI_DRIVER_BINDING_PROTOCOL  gWinNtUgaDriverBinding;

-extern EFI_COMPONENT_NAME_PROTOCOL  gWinNtUgaComponentName;

-

-//

-// Uga Hardware abstraction internal worker functions

-//

-EFI_STATUS

-WinNtUgaSupported (

-  IN  EFI_WIN_NT_IO_PROTOCOL  *WinNtIo

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  WinNtIo - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-WinNtUgaConstructor (

-  IN  UGA_PRIVATE_DATA    *Private

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-WinNtUgaDestructor (

-  IN  UGA_PRIVATE_DATA    *Private

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-//

-// EFI 1.1 driver model prototypes for Win NT UGA

-//

-

-EFI_STATUS

-EFIAPI

-WinNtUgaInitialize (

-  IN EFI_HANDLE            ImageHandle,

-  IN EFI_SYSTEM_TABLE      *SystemTable

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  ImageHandle - TODO: add argument description

-  SystemTable - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-WinNtUgaDriverBindingSupported (

-  IN  EFI_DRIVER_BINDING_PROTOCOL     *This,

-  IN  EFI_HANDLE                      Handle,

-  IN  EFI_DEVICE_PATH_PROTOCOL        *RemainingDevicePath

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This                - TODO: add argument description

-  Handle              - TODO: add argument description

-  RemainingDevicePath - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-WinNtUgaDriverBindingStart (

-  IN  EFI_DRIVER_BINDING_PROTOCOL     *This,

-  IN  EFI_HANDLE                      Handle,

-  IN  EFI_DEVICE_PATH_PROTOCOL        *RemainingDevicePath

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This                - TODO: add argument description

-  Handle              - TODO: add argument description

-  RemainingDevicePath - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-WinNtUgaDriverBindingStop (

-  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

-  IN  EFI_HANDLE                   Handle,

-  IN  UINTN                        NumberOfChildren,

-  IN  EFI_HANDLE                   *ChildHandleBuffer

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This              - TODO: add argument description

-  Handle            - TODO: add argument description

-  NumberOfChildren  - TODO: add argument description

-  ChildHandleBuffer - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-UgaPrivateAddQ (

-  IN  UGA_PRIVATE_DATA    *Private,

-  IN  EFI_INPUT_KEY       Key

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private - TODO: add argument description

-  Key     - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-WinNtUgaInitializeSimpleTextInForWindow (

-  IN  UGA_PRIVATE_DATA    *Private

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-WinNtUgaDestroySimpleTextInForWindow (

-  IN  UGA_PRIVATE_DATA    *Private

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-UINTN

-Atoi (

-  IN  CHAR16  *String

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  String  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-#endif

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUga.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUga.msa
deleted file mode 100644
index 0024262..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUga.msa
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>WinNtUga</ModuleName>

-    <ModuleType>UEFI_DRIVER</ModuleType>

-    <GuidValue>AB248E8D-ABE1-11d4-BD0D-0080C73C8881</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>Uga driver</Abstract>

-    <Description>UGA is short hand for Universal Graphics Abstraction protocol.

-      This file is a verision of UgaIo the uses WinNtThunk system calls as an IO

-      abstraction. For a PCI device WinNtIo would be replaced with

-      a PCI IO abstraction that abstracted a specific PCI device.</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>WinNtUga</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiDriverModelLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiDriverEntryPoint</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseMemoryLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiBootServicesTableLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>MemoryAllocationLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>WinNtUga.h</Filename>

-    <Filename>WinNtUgaInput.c</Filename>

-    <Filename>WinNtUgaDriver.c</Filename>

-    <Filename>WinNtUgaScreen.c</Filename>

-    <Filename>ComponentName.c</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <Protocols>

-    <Protocol Usage="TO_START">

-      <ProtocolCName>gEfiWinNtIoProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="BY_START">

-      <ProtocolCName>gEfiUgaDrawProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="BY_START">

-      <ProtocolCName>gEfiSimpleTextInProtocolGuid</ProtocolCName>

-    </Protocol>

-  </Protocols>

-  <Events>

-    <CreateEvents>

-      <EventTypes EventGuidCName="gEfiEventExitBootServicesGuid" Usage="SOMETIMES_CONSUMED">

-        <EventType>EVENT_GROUP_GUID</EventType>

-      </EventTypes>

-    </CreateEvents>

-  </Events>

-  <Guids>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiWinNtUgaGuid</GuidCName>

-    </GuidCNames>

-  </Guids>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-    <Extern>

-      <DriverBinding>gWinNtUgaDriverBinding</DriverBinding>

-      <ComponentName>gWinNtUgaComponentName</ComponentName>

-    </Extern>

-  </Externs>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaDriver.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaDriver.c
deleted file mode 100644
index 5208560..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaDriver.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  WinNtUgaDriver.c

-

-Abstract:

-

-  This file implements the EFI 1.1 Device Driver model requirements for UGA

-

-  UGA is short hand for Universal Graphics Abstraction protocol.

-

-  This file is a verision of UgaIo the uses WinNtThunk system calls as an IO

-  abstraction. For a PCI device WinNtIo would be replaced with

-  a PCI IO abstraction that abstracted a specific PCI device.

-

---*/

-

-#include "WinNtUga.h"

-

-EFI_DRIVER_BINDING_PROTOCOL gWinNtUgaDriverBinding = {

-  WinNtUgaDriverBindingSupported,

-  WinNtUgaDriverBindingStart,

-  WinNtUgaDriverBindingStop,

-  0xa,

-  NULL,

-  NULL

-};

-

-

-EFI_STATUS

-EFIAPI

-WinNtUgaDriverBindingSupported (

-  IN  EFI_DRIVER_BINDING_PROTOCOL     *This,

-  IN  EFI_HANDLE                      Handle,

-  IN  EFI_DEVICE_PATH_PROTOCOL        *RemainingDevicePath

-  )

-/*++

-

-Routine Description:

-

-Arguments:

-

-Returns:

-

-  None

-

---*/

-// TODO:    This - add argument and description to function comment

-// TODO:    Handle - add argument and description to function comment

-// TODO:    RemainingDevicePath - add argument and description to function comment

-{

-  EFI_STATUS              Status;

-  EFI_WIN_NT_IO_PROTOCOL  *WinNtIo;

-

-  //

-  // Open the IO Abstraction(s) needed to perform the supported test

-  //

-  Status = gBS->OpenProtocol (

-                  Handle,

-                  &gEfiWinNtIoProtocolGuid,

-                  &WinNtIo,

-                  This->DriverBindingHandle,

-                  Handle,

-                  EFI_OPEN_PROTOCOL_BY_DRIVER

-                  );

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  Status = WinNtUgaSupported (WinNtIo);

-

-  //

-  // Close the I/O Abstraction(s) used to perform the supported test

-  //

-  gBS->CloseProtocol (

-        Handle,

-        &gEfiWinNtIoProtocolGuid,

-        This->DriverBindingHandle,

-        Handle

-        );

-

-  return Status;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtUgaDriverBindingStart (

-  IN  EFI_DRIVER_BINDING_PROTOCOL     *This,

-  IN  EFI_HANDLE                      Handle,

-  IN  EFI_DEVICE_PATH_PROTOCOL        *RemainingDevicePath

-  )

-/*++

-

-Routine Description:

-

-Arguments:

-

-Returns:

-

-  None

-

---*/

-// TODO:    This - add argument and description to function comment

-// TODO:    Handle - add argument and description to function comment

-// TODO:    RemainingDevicePath - add argument and description to function comment

-// TODO:    EFI_UNSUPPORTED - add return value to function comment

-{

-  EFI_WIN_NT_IO_PROTOCOL  *WinNtIo;

-  EFI_STATUS              Status;

-  UGA_PRIVATE_DATA        *Private;

-

-  //

-  // Grab the protocols we need

-  //

-  Status = gBS->OpenProtocol (

-                  Handle,

-                  &gEfiWinNtIoProtocolGuid,

-                  &WinNtIo,

-                  This->DriverBindingHandle,

-                  Handle,

-                  EFI_OPEN_PROTOCOL_BY_DRIVER

-                  );

-  if (EFI_ERROR (Status)) {

-    return EFI_UNSUPPORTED;

-  }

-

-  //

-  // Allocate Private context data for SGO inteface.

-  //

-  Private = AllocatePool (sizeof (UGA_PRIVATE_DATA));

-  if (Private == NULL) {

-    goto Done;

-  }

-  //

-  // Set up context record

-  //

-  Private->Signature            = UGA_PRIVATE_DATA_SIGNATURE;

-  Private->Handle               = Handle;

-  Private->WinNtThunk           = WinNtIo->WinNtThunk;

-

-  Private->ControllerNameTable  = NULL;

-

-  AddUnicodeString (

-    "eng",

-    gWinNtUgaComponentName.SupportedLanguages,

-    &Private->ControllerNameTable,

-    WinNtIo->EnvString

-    );

-

-  Private->WindowName = WinNtIo->EnvString;

-

-  Status              = WinNtUgaConstructor (Private);

-  if (EFI_ERROR (Status)) {

-    goto Done;

-  }

-  //

-  // Publish the Uga interface to the world

-  //

-  Status = gBS->InstallMultipleProtocolInterfaces (

-                  &Private->Handle,

-                  &gEfiUgaDrawProtocolGuid,

-                  &Private->UgaDraw,

-                  &gEfiSimpleTextInProtocolGuid,

-                  &Private->SimpleTextIn,

-                  NULL

-                  );

-

-Done:

-  if (EFI_ERROR (Status)) {

-

-    gBS->CloseProtocol (

-          Handle,

-          &gEfiWinNtIoProtocolGuid,

-          This->DriverBindingHandle,

-          Handle

-          );

-

-    if (Private != NULL) {

-      //

-      // On Error Free back private data

-      //

-      if (Private->ControllerNameTable != NULL) {

-        FreeUnicodeStringTable (Private->ControllerNameTable);

-      }

-

-      FreePool (Private);

-    }

-  }

-

-  return Status;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtUgaDriverBindingStop (

-  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

-  IN  EFI_HANDLE                   Handle,

-  IN  UINTN                        NumberOfChildren,

-  IN  EFI_HANDLE                   *ChildHandleBuffer

-  )

-/*++

-

-Routine Description:

-

-Arguments:

-

-Returns:

-

-  None

-

---*/

-// TODO:    This - add argument and description to function comment

-// TODO:    Handle - add argument and description to function comment

-// TODO:    NumberOfChildren - add argument and description to function comment

-// TODO:    ChildHandleBuffer - add argument and description to function comment

-// TODO:    EFI_NOT_STARTED - add return value to function comment

-// TODO:    EFI_DEVICE_ERROR - add return value to function comment

-{

-  EFI_UGA_DRAW_PROTOCOL *UgaDraw;

-  EFI_STATUS            Status;

-  UGA_PRIVATE_DATA      *Private;

-

-  Status = gBS->OpenProtocol (

-                  Handle,

-                  &gEfiUgaDrawProtocolGuid,

-                  &UgaDraw,

-                  This->DriverBindingHandle,

-                  Handle,

-                  EFI_OPEN_PROTOCOL_GET_PROTOCOL

-                  );

-  if (EFI_ERROR (Status)) {

-    //

-    // If the UGA interface does not exist the driver is not started

-    //

-    return EFI_NOT_STARTED;

-  }

-

-  //

-  // Get our private context information

-  //

-  Private = UGA_DRAW_PRIVATE_DATA_FROM_THIS (UgaDraw);

-

-  //

-  // Remove the SGO interface from the system

-  //

-  Status = gBS->UninstallMultipleProtocolInterfaces (

-                  Private->Handle,

-                  &gEfiUgaDrawProtocolGuid,

-                  &Private->UgaDraw,

-                  &gEfiSimpleTextInProtocolGuid,

-                  &Private->SimpleTextIn,

-                  NULL

-                  );

-  if (!EFI_ERROR (Status)) {

-    //

-    // Shutdown the hardware

-    //

-    Status = WinNtUgaDestructor (Private);

-    if (EFI_ERROR (Status)) {

-      return EFI_DEVICE_ERROR;

-    }

-

-    gBS->CloseProtocol (

-          Handle,

-          &gEfiWinNtIoProtocolGuid,

-          This->DriverBindingHandle,

-          Handle

-          );

-

-    //

-    // Free our instance data

-    //

-    FreeUnicodeStringTable (Private->ControllerNameTable);

-

-    FreePool (Private);

-

-  }

-

-  return Status;

-}

-

-UINTN

-Atoi (

-  CHAR16  *String

-  )

-/*++

-

-Routine Description:

-

-  Convert a unicode string to a UINTN

-

-Arguments:

-

-  String - Unicode string.

-

-Returns:

-

-  UINTN of the number represented by String.

-

---*/

-{

-  UINTN   Number;

-  CHAR16  *Str;

-

-  //

-  // skip preceeding white space

-  //

-  Str = String;

-  while ((*Str) && (*Str == ' ' || *Str == '"')) {

-    Str++;

-  }

-

-  //

-  // Convert ot a Number

-  //

-  Number = 0;

-  while (*Str != '\0') {

-    if ((*Str >= '0') && (*Str <= '9')) {

-      Number = (Number * 10) +*Str - '0';

-    } else {

-      break;

-    }

-

-    Str++;

-  }

-

-  return Number;

-}

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaInput.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaInput.c
deleted file mode 100644
index 2c715c6..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaInput.c
+++ /dev/null
@@ -1,411 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  WinNtUgaInput.c

-

-Abstract:

-

-  This file produces the Simple Text In for an Uga window.

-

-  This stuff is linked at the hip to the Window, since the window

-  processing is done in a thread kicked off in WinNtUgaImplementation.c

-

-  Since the window information is processed in an other thread we need

-  a keyboard Queue to pass data about. The Simple Text In code just

-  takes data off the Queue. The WinProc message loop takes keyboard input

-  and places it in the Queue.

-

---*/

-

-#include "WinNtUga.h"

-

-EFI_STATUS

-UgaPrivateCreateQ (

-  IN  UGA_PRIVATE_DATA    *Private

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private - TODO: add argument description

-

-Returns:

-

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  Private->WinNtThunk->InitializeCriticalSection (&Private->QCriticalSection);

-

-  Private->Queue.Front  = 0;

-  Private->Queue.Rear   = MAX_Q - 1;

-  Private->Queue.Count  = 0;

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-UgaPrivateDestroyQ (

-  IN  UGA_PRIVATE_DATA    *Private

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private - TODO: add argument description

-

-Returns:

-

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  Private->Queue.Count = 0;

-  Private->WinNtThunk->DeleteCriticalSection (&Private->QCriticalSection);

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-UgaPrivateAddQ (

-  IN  UGA_PRIVATE_DATA    *Private,

-  IN  EFI_INPUT_KEY       Key

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private - TODO: add argument description

-  Key     - TODO: add argument description

-

-Returns:

-

-  EFI_NOT_READY - TODO: Add description for return value

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  Private->WinNtThunk->EnterCriticalSection (&Private->QCriticalSection);

-

-  if (Private->Queue.Count == MAX_Q) {

-    Private->WinNtThunk->LeaveCriticalSection (&Private->QCriticalSection);

-    return EFI_NOT_READY;

-  }

-

-  Private->Queue.Rear                   = (Private->Queue.Rear + 1) % MAX_Q;

-  Private->Queue.Q[Private->Queue.Rear] = Key;

-  Private->Queue.Count++;

-

-  Private->WinNtThunk->LeaveCriticalSection (&Private->QCriticalSection);

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-UgaPrivateDeleteQ (

-  IN  UGA_PRIVATE_DATA    *Private,

-  OUT EFI_INPUT_KEY       *Key

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private - TODO: add argument description

-  Key     - TODO: add argument description

-

-Returns:

-

-  EFI_NOT_READY - TODO: Add description for return value

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  Private->WinNtThunk->EnterCriticalSection (&Private->QCriticalSection);

-

-  if (Private->Queue.Count == 0) {

-    Private->WinNtThunk->LeaveCriticalSection (&Private->QCriticalSection);

-    return EFI_NOT_READY;

-  }

-

-  *Key                  = Private->Queue.Q[Private->Queue.Front];

-  Private->Queue.Front  = (Private->Queue.Front + 1) % MAX_Q;

-  Private->Queue.Count--;

-

-  Private->WinNtThunk->LeaveCriticalSection (&Private->QCriticalSection);

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-UgaPrivateCheckQ (

-  IN  UGA_PRIVATE_DATA    *Private

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private - TODO: add argument description

-

-Returns:

-

-  EFI_NOT_READY - TODO: Add description for return value

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  if (Private->Queue.Count == 0) {

-    return EFI_NOT_READY;

-  }

-

-  return EFI_SUCCESS;

-}

-

-//

-// Simple Text In implementation.

-//

-

-EFI_STATUS

-EFIAPI

-WinNtUgaSimpleTextInReset (

-  IN EFI_SIMPLE_TEXT_IN_PROTOCOL          *This,

-  IN BOOLEAN                              ExtendedVerification

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This                  - TODO: add argument description

-  ExtendedVerification  - TODO: add argument description

-

-Returns:

-

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  UGA_PRIVATE_DATA  *Private;

-  EFI_INPUT_KEY     Key;

-  EFI_TPL           OldTpl;

-

-  Private = UGA_PRIVATE_DATA_FROM_TEXT_IN_THIS (This);

-

-  //

-  // Enter critical section

-  //

-  OldTpl = gBS->RaiseTPL (TPL_NOTIFY);

-

-  //

-  // A reset is draining the Queue

-  //

-  while (UgaPrivateDeleteQ (Private, &Key) == EFI_SUCCESS)

-    ;

-

-  //

-  // Leave critical section and return

-  //

-  gBS->RestoreTPL (OldTpl);

-  return EFI_SUCCESS;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtUgaSimpleTextInReadKeyStroke (

-  IN EFI_SIMPLE_TEXT_IN_PROTOCOL          *This,

-  OUT EFI_INPUT_KEY                       *Key

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This  - TODO: add argument description

-  Key   - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-{

-  UGA_PRIVATE_DATA  *Private;

-  EFI_STATUS        Status;

-  EFI_TPL           OldTpl;

-

-  Private = UGA_PRIVATE_DATA_FROM_TEXT_IN_THIS (This);

-

-  //

-  // Enter critical section

-  //

-  OldTpl  = gBS->RaiseTPL (TPL_NOTIFY);

-

-  Status  = UgaPrivateCheckQ (Private);

-  if (!EFI_ERROR (Status)) {

-    //

-    // If a Key press exists try and read it.

-    //

-    Status = UgaPrivateDeleteQ (Private, Key);

-  }

-

-  //

-  // Leave critical section and return

-  //

-  gBS->RestoreTPL (OldTpl);

-

-  return Status;

-}

-

-STATIC

-VOID

-EFIAPI

-WinNtUgaSimpleTextInWaitForKey (

-  IN EFI_EVENT          Event,

-  IN VOID               *Context

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Event   - TODO: add argument description

-  Context - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-{

-  UGA_PRIVATE_DATA  *Private;

-  EFI_STATUS        Status;

-  EFI_TPL           OldTpl;

-

-  Private = (UGA_PRIVATE_DATA *) Context;

-

-  //

-  // Enter critical section

-  //

-  OldTpl  = gBS->RaiseTPL (TPL_NOTIFY);

-

-  Status  = UgaPrivateCheckQ (Private);

-  if (!EFI_ERROR (Status)) {

-    //

-    // If a there is a key in the queue signal our event.

-    //

-    gBS->SignalEvent (Event);

-  } else {

-    //

-    // We need to sleep or NT will schedule this thread with such high

-    // priority that WinProc thread will never run and we will not see

-    // keyboard input. This Sleep makes the syste run 10x faster, so don't

-    // remove it.

-    //

-    Private->WinNtThunk->Sleep (1);

-  }

-

-  //

-  // Leave critical section and return

-  //

-  gBS->RestoreTPL (OldTpl);

-}

-

-EFI_STATUS

-WinNtUgaInitializeSimpleTextInForWindow (

-  IN  UGA_PRIVATE_DATA    *Private

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-{

-  EFI_STATUS  Status;

-

-  UgaPrivateCreateQ (Private);

-

-  //

-  // Initialize Simple Text In protoocol

-  //

-  Private->SimpleTextIn.Reset         = WinNtUgaSimpleTextInReset;

-  Private->SimpleTextIn.ReadKeyStroke = WinNtUgaSimpleTextInReadKeyStroke;

-

-  Status = gBS->CreateEvent (

-                  EVT_NOTIFY_WAIT,

-                  TPL_NOTIFY,

-                  WinNtUgaSimpleTextInWaitForKey,

-                  Private,

-                  &Private->SimpleTextIn.WaitForKey

-                  );

-

-  return Status;

-}

-

-EFI_STATUS

-WinNtUgaDestroySimpleTextInForWindow (

-  IN  UGA_PRIVATE_DATA    *Private

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private - TODO: add argument description

-

-Returns:

-

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  UgaPrivateDestroyQ (Private);

-  return EFI_SUCCESS;

-}

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaScreen.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaScreen.c
deleted file mode 100644
index ebaf0b3..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaScreen.c
+++ /dev/null
@@ -1,990 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-    WinNtUgaScreen.c

-

-Abstract:

-

-  This file produces the graphics abstration of UGA. It is called by

-  WinNtUgaDriver.c file which deals with the EFI 1.1 driver model.

-  This file just does graphics.

-

---*/

-

-#include "WinNtUga.h"

-

-EFI_WIN_NT_THUNK_PROTOCOL *mWinNt;

-DWORD                     mTlsIndex         = TLS_OUT_OF_INDEXES;

-DWORD                     mTlsIndexUseCount = 0;  // lets us know when we can free mTlsIndex.

-static EFI_EVENT          mUgaScreenExitBootServicesEvent;

-

-EFI_STATUS

-WinNtUgaStartWindow (

-  IN  UGA_PRIVATE_DATA    *Private,

-  IN  UINT32              HorizontalResolution,

-  IN  UINT32              VerticalResolution,

-  IN  UINT32              ColorDepth,

-  IN  UINT32              RefreshRate

-  );

-

-STATIC

-VOID

-EFIAPI

-KillNtUgaThread (

-  IN EFI_EVENT  Event,

-  IN VOID       *Context

-  );

-

-//

-// UGA Protocol Member Functions

-//

-

-EFI_STATUS

-EFIAPI

-WinNtUgaGetMode (

-  EFI_UGA_DRAW_PROTOCOL *This,

-  UINT32                *HorizontalResolution,

-  UINT32                *VerticalResolution,

-  UINT32                *ColorDepth,

-  UINT32                *RefreshRate

-  )

-/*++

-

-  Routine Description:

-    Return the current video mode information.

-

-  Arguments:

-    This                  - Protocol instance pointer.

-    HorizontalResolution  - Current video horizontal resolution in pixels

-    VerticalResolution    - Current video Vertical resolution in pixels

-    ColorDepth            - Current video color depth in bits per pixel

-    RefreshRate           - Current video refresh rate in Hz.

-

-  Returns:

-    EFI_SUCCESS     - Mode information returned.

-    EFI_NOT_STARTED - Video display is not initialized. Call SetMode ()

-    EFI_INVALID_PARAMETER - One of the input args was NULL.

-

---*/

-// TODO:    ADD IN/OUT description here

-{

-  UGA_PRIVATE_DATA  *Private;

-

-  Private = UGA_DRAW_PRIVATE_DATA_FROM_THIS (This);

-

-  if (Private->HardwareNeedsStarting) {

-    return EFI_NOT_STARTED;

-  }

-

-  if ((HorizontalResolution == NULL) ||

-      (VerticalResolution   == NULL) ||

-      (ColorDepth           == NULL) ||

-      (RefreshRate          == NULL)) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  *HorizontalResolution = Private->HorizontalResolution;

-  *VerticalResolution   = Private->VerticalResolution;

-  *ColorDepth           = Private->ColorDepth;

-  *RefreshRate          = Private->RefreshRate;

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtUgaSetMode (

-  EFI_UGA_DRAW_PROTOCOL *This,

-  UINT32                HorizontalResolution,

-  UINT32                VerticalResolution,

-  UINT32                ColorDepth,

-  UINT32                RefreshRate

-  )

-/*++

-

-  Routine Description:

-    Return the current video mode information.

-

-  Arguments:

-    This                  - Protocol instance pointer.

-    HorizontalResolution  - Current video horizontal resolution in pixels

-    VerticalResolution    - Current video Vertical resolution in pixels

-    ColorDepth            - Current video color depth in bits per pixel

-    RefreshRate           - Current video refresh rate in Hz.

-

-  Returns:

-    EFI_SUCCESS     - Mode information returned.

-    EFI_NOT_STARTED - Video display is not initialized. Call SetMode ()

-    EFI_INVALID_PARAMETER - One of the input args was NULL.

-

---*/

-// TODO:    EFI_DEVICE_ERROR - add return value to function comment

-// TODO:    EFI_DEVICE_ERROR - add return value to function comment

-// TODO:    ADD IN/OUT description here

-{

-  EFI_STATUS        Status;

-  UGA_PRIVATE_DATA  *Private;

-  EFI_UGA_PIXEL     Fill;

-  EFI_UGA_PIXEL     *NewFillLine;

-  RECT              Rect;

-  UINTN             Size;

-  UINTN             Width;

-  UINTN             Height;

-

-  Private = UGA_DRAW_PRIVATE_DATA_FROM_THIS (This);

-

-  if (Private->HardwareNeedsStarting) {

-    Status = WinNtUgaStartWindow (

-              Private,

-              HorizontalResolution,

-              VerticalResolution,

-              ColorDepth,

-              RefreshRate

-              );

-    if (EFI_ERROR (Status)) {

-      return EFI_DEVICE_ERROR;

-    }

-

-    Private->HardwareNeedsStarting = FALSE;

-  } else {

-    //

-    // Change the resolution and resize of the window

-    //

-

-    //

-    // Free the old buffer. We do not save the content of the old buffer since the

-    // screen is to be cleared anyway. Clearing the screen is required by the EFI spec.

-    // See EFI spec chepter 10.5-EFI_UGA_DRAW_PROTOCOL.SetMode()

-    //

-    Private->WinNtThunk->HeapFree (Private->WinNtThunk->GetProcessHeap (), 0, Private->VirtualScreenInfo);

-

-    //

-    // Allocate DIB frame buffer directly from NT for performance enhancement

-    // This buffer is the virtual screen/frame buffer. This buffer is not the

-    // same a a frame buffer. The first row of this buffer will be the bottom

-    // line of the image. This is an artifact of the way we draw to the screen.

-    //

-    Size = HorizontalResolution * VerticalResolution * sizeof (RGBQUAD) + sizeof (BITMAPV4HEADER);

-    Private->VirtualScreenInfo = Private->WinNtThunk->HeapAlloc (

-                                                        Private->WinNtThunk->GetProcessHeap (),

-                                                        HEAP_ZERO_MEMORY,

-                                                        Size

-                                                        );

-

-    //

-    // Update the virtual screen info data structure

-    //

-    Private->VirtualScreenInfo->bV4Size           = sizeof (BITMAPV4HEADER);

-    Private->VirtualScreenInfo->bV4Width          = HorizontalResolution;

-    Private->VirtualScreenInfo->bV4Height         = VerticalResolution;

-    Private->VirtualScreenInfo->bV4Planes         = 1;

-    Private->VirtualScreenInfo->bV4BitCount       = 32;

-    //

-    // uncompressed

-    //

-    Private->VirtualScreenInfo->bV4V4Compression  = BI_RGB;

-

-    //

-    // The rest of the allocated memory block is the virtual screen buffer

-    //

-    Private->VirtualScreen = (RGBQUAD *) (Private->VirtualScreenInfo + 1);

-

-    //

-    // Use the AdjuctWindowRect fuction to calculate the real width and height

-    // of the new window including the border and caption

-    //

-    Rect.left   = 0;

-    Rect.top    = 0;

-    Rect.right  = HorizontalResolution;

-    Rect.bottom = VerticalResolution;

-

-    Private->WinNtThunk->AdjustWindowRect (&Rect, WS_OVERLAPPEDWINDOW, 0);

-

-    Width   = Rect.right - Rect.left;

-    Height  = Rect.bottom - Rect.top;

-

-    //

-    // Retrieve the original window position information

-    //

-    Private->WinNtThunk->GetWindowRect (Private->WindowHandle, &Rect);

-

-    //

-    // Adjust the window size

-    //

-    Private->WinNtThunk->MoveWindow (Private->WindowHandle, Rect.left, Rect.top, Width, Height, TRUE);

-

-  }

-

-  NewFillLine = AllocatePool (sizeof (EFI_UGA_PIXEL) * HorizontalResolution);

-  if (NewFillLine == NULL) {

-    return EFI_DEVICE_ERROR;

-  }

-

-  if (Private->FillLine != NULL) {

-    FreePool (Private->FillLine);

-  }

-

-  Private->FillLine             = NewFillLine;

-

-  Private->HorizontalResolution = HorizontalResolution;

-  Private->VerticalResolution   = VerticalResolution;

-  Private->ColorDepth           = ColorDepth;

-  Private->RefreshRate          = RefreshRate;

-

-  Fill.Red                      = 0x00;

-  Fill.Green                    = 0x00;

-  Fill.Blue                     = 0x00;

-  This->Blt (

-          This,

-          &Fill,

-          EfiUgaVideoFill,

-          0,

-          0,

-          0,

-          0,

-          HorizontalResolution,

-          VerticalResolution,

-          HorizontalResolution * sizeof (EFI_UGA_PIXEL)

-          );

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtUgaBlt (

-  IN  EFI_UGA_DRAW_PROTOCOL                   *This,

-  IN  EFI_UGA_PIXEL                           *BltBuffer, OPTIONAL

-  IN  EFI_UGA_BLT_OPERATION                   BltOperation,

-  IN  UINTN                                   SourceX,

-  IN  UINTN                                   SourceY,

-  IN  UINTN                                   DestinationX,

-  IN  UINTN                                   DestinationY,

-  IN  UINTN                                   Width,

-  IN  UINTN                                   Height,

-  IN  UINTN                                   Delta         OPTIONAL

-  )

-/*++

-

-  Routine Description:

-    Blt pixels from the rectangle (Width X Height) formed by the BltBuffer

-    onto the graphics screen starting a location (X, Y). (0, 0) is defined as

-    the upper left hand side of the screen. (X, Y) can be outside of the

-    current screen geometry and the BltBuffer will be cliped when it is

-    displayed. X and Y can be negative or positive. If Width or Height is

-    bigger than the current video screen the image will be clipped.

-

-  Arguments:

-    This          - Protocol instance pointer.

-    X             - X location on graphics screen.

-    Y             - Y location on the graphics screen.

-    Width         - Width of BltBuffer.

-    Height        - Hight of BltBuffer

-    BltOperation  - Operation to perform on BltBuffer and video memory

-    BltBuffer     - Buffer containing data to blt into video buffer. This

-                    buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL)

-    SourceX       - If the BltOperation is a EfiCopyBlt this is the source

-                    of the copy. For other BLT operations this argument is not

-                    used.

-    SourceX       - If the BltOperation is a EfiCopyBlt this is the source

-                    of the copy. For other BLT operations this argument is not

-                    used.

-

-  Returns:

-    EFI_SUCCESS           - The palette is updated with PaletteArray.

-    EFI_INVALID_PARAMETER - BltOperation is not valid.

-    EFI_DEVICE_ERROR      - A hardware error occured writting to the video

-                             buffer.

-

---*/

-// TODO:    SourceY - add argument and description to function comment

-// TODO:    DestinationX - add argument and description to function comment

-// TODO:    DestinationY - add argument and description to function comment

-// TODO:    Delta - add argument and description to function comment

-{

-  UGA_PRIVATE_DATA  *Private;

-  EFI_TPL           OriginalTPL;

-  UINTN             DstY;

-  UINTN             SrcY;

-  RGBQUAD           *VScreen;

-  RGBQUAD           *VScreenSrc;

-  EFI_UGA_PIXEL     *Blt;

-  UINTN             Index;

-  RECT              Rect;

-  EFI_UGA_PIXEL     *FillPixel;

-

-  Private = UGA_DRAW_PRIVATE_DATA_FROM_THIS (This);

-

-  if ((BltOperation < 0) || (BltOperation >= EfiUgaBltMax)) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  if (Width == 0 || Height == 0) {

-    return EFI_INVALID_PARAMETER;

-  }

-  //

-  // If Delta is zero, then the entire BltBuffer is being used, so Delta

-  // is the number of bytes in each row of BltBuffer.  Since BltBuffer is Width pixels size,

-  // the number of bytes in each row can be computed.

-  //

-  if (Delta == 0) {

-    Delta = Width * sizeof (EFI_UGA_PIXEL);

-  }

-

-  //

-  // We need to fill the Virtual Screen buffer with the blt data.

-  // The virtual screen is upside down, as the first row is the bootom row of

-  // the image.

-  //

-

-  if (BltOperation == EfiUgaVideoToBltBuffer) {

-

-    //

-    // Video to BltBuffer: Source is Video, destination is BltBuffer

-    //

-    if (SourceY + Height > Private->VerticalResolution) {

-      return EFI_INVALID_PARAMETER;

-    }

-

-    if (SourceX + Width > Private->HorizontalResolution) {

-      return EFI_INVALID_PARAMETER;

-    }

-    //

-    // We have to raise to TPL Notify, so we make an atomic write the frame buffer.

-    // We would not want a timer based event (Cursor, ...) to come in while we are

-    // doing this operation.

-    //

-    OriginalTPL = gBS->RaiseTPL (TPL_NOTIFY);

-

-    for (SrcY = SourceY, DstY = DestinationY; DstY < (Height + DestinationY); SrcY++, DstY++) {

-      Blt = (EFI_UGA_PIXEL *) ((UINT8 *) BltBuffer + (DstY * Delta) + DestinationX * sizeof (EFI_UGA_PIXEL));

-      VScreen = &Private->VirtualScreen[(Private->VerticalResolution - SrcY - 1) * Private->HorizontalResolution + SourceX];

-      CopyMem (Blt, VScreen, sizeof (EFI_UGA_PIXEL) * Width);

-    }

-  } else {

-    //

-    // BltBuffer to Video: Source is BltBuffer, destination is Video

-    //

-    if (DestinationY + Height > Private->VerticalResolution) {

-      return EFI_INVALID_PARAMETER;

-    }

-

-    if (DestinationX + Width > Private->HorizontalResolution) {

-      return EFI_INVALID_PARAMETER;

-    }

-

-    //

-    // We have to raise to TPL Notify, so we make an atomic write the frame buffer.

-    // We would not want a timer based event (Cursor, ...) to come in while we are

-    // doing this operation.

-    //

-    OriginalTPL = gBS->RaiseTPL (TPL_NOTIFY);

-

-    if (BltOperation == EfiUgaVideoFill) {

-      FillPixel = BltBuffer;

-      for (Index = 0; Index < Width; Index++) {

-        Private->FillLine[Index] = *FillPixel;

-      }

-    }

-

-    for (Index = 0; Index < Height; Index++) {

-      if (DestinationY <= SourceY) {

-        SrcY  = SourceY + Index;

-        DstY  = DestinationY + Index;

-      } else {

-        SrcY  = SourceY + Height - Index - 1;

-        DstY  = DestinationY + Height - Index - 1;

-      }

-

-      VScreen = &Private->VirtualScreen[(Private->VerticalResolution - DstY - 1) * Private->HorizontalResolution + DestinationX];

-      switch (BltOperation) {

-      case EfiUgaBltBufferToVideo:

-        Blt = (EFI_UGA_PIXEL *) ((UINT8 *) BltBuffer + (SrcY * Delta) + SourceX * sizeof (EFI_UGA_PIXEL));

-        CopyMem (VScreen, Blt, Width * sizeof (EFI_UGA_PIXEL));

-        break;

-

-      case EfiUgaVideoToVideo:

-        VScreenSrc = &Private->VirtualScreen[(Private->VerticalResolution - SrcY - 1) * Private->HorizontalResolution + SourceX];

-        CopyMem (VScreen, VScreenSrc, Width * sizeof (EFI_UGA_PIXEL));

-        break;

-

-      case EfiUgaVideoFill:

-        CopyMem (VScreen, Private->FillLine, Width * sizeof (EFI_UGA_PIXEL));

-        break;

-      }

-    }

-  }

-

-  if (BltOperation != EfiUgaVideoToBltBuffer) {

-    //

-    // Mark the area we just blted as Invalid so WM_PAINT will update.

-    //

-    Rect.left   = DestinationX;

-    Rect.top    = DestinationY;

-    Rect.right  = DestinationX + Width;

-    Rect.bottom = DestinationY + Height;

-    Private->WinNtThunk->InvalidateRect (Private->WindowHandle, &Rect, FALSE);

-

-    //

-    // Send the WM_PAINT message to the thread that is drawing the window. We

-    // are in the main thread and the window drawing is in a child thread.

-    // There is a child thread per window. We have no CriticalSection or Mutex

-    // since we write the data and the other thread displays the data. While

-    // we may miss some data for a short period of time this is no different than

-    // a write combining on writes to a frame buffer.

-    //

-

-    Private->WinNtThunk->UpdateWindow (Private->WindowHandle);

-  }

-

-  gBS->RestoreTPL (OriginalTPL);

-

-  return EFI_SUCCESS;

-}

-

-

-//

-// Construction and Destruction functions

-//

-

-EFI_STATUS

-WinNtUgaSupported (

-  IN  EFI_WIN_NT_IO_PROTOCOL  *WinNtIo

-  )

-/*++

-

-Routine Description:

-

-Arguments:

-

-Returns:

-

-  None

-

---*/

-// TODO:    WinNtIo - add argument and description to function comment

-// TODO:    EFI_UNSUPPORTED - add return value to function comment

-// TODO:    EFI_SUCCESS - add return value to function comment

-{

-  //

-  // Check to see if the IO abstraction represents a device type we support.

-  //

-  // This would be replaced a check of PCI subsystem ID, etc.

-  //

-  if (!CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtUgaGuid)) {

-    return EFI_UNSUPPORTED;

-  }

-

-  return EFI_SUCCESS;

-}

-

-LRESULT

-CALLBACK

-WinNtUgaThreadWindowProc (

-  IN  HWND    hwnd,

-  IN  UINT    iMsg,

-  IN  WPARAM  wParam,

-  IN  LPARAM  lParam

-  )

-/*++

-

-Routine Description:

-  Win32 Windows event handler.

-

-Arguments:

-  See Win32 Book

-

-Returns:

-  See Win32 Book

-

---*/

-// TODO:    hwnd - add argument and description to function comment

-// TODO:    iMsg - add argument and description to function comment

-// TODO:    wParam - add argument and description to function comment

-// TODO:    lParam - add argument and description to function comment

-{

-  UGA_PRIVATE_DATA  *Private;

-  UINTN             Size;

-  HDC               Handle;

-  PAINTSTRUCT       PaintStruct;

-  LPARAM            Index;

-  EFI_INPUT_KEY     Key;

-

-  //

-  // BugBug - if there are two instances of this DLL in memory (such as is

-  // the case for ERM), the correct instance of this function may not be called.

-  // This also means that the address of the mTlsIndex value will be wrong, and

-  // the value may be wrong too.

-  //

-

-

-  //

-  // Use mTlsIndex global to get a Thread Local Storage version of Private.

-  // This works since each Uga protocol has a unique Private data instance and

-  // a unique thread.

-  //

-  Private = mWinNt->TlsGetValue (mTlsIndex);

-  ASSERT (NULL != Private);

-

-  switch (iMsg) {

-  case WM_CREATE:

-    Size = Private->HorizontalResolution * Private->VerticalResolution * sizeof (RGBQUAD);

-

-    //

-    // Allocate DIB frame buffer directly from NT for performance enhancement

-    // This buffer is the virtual screen/frame buffer. This buffer is not the

-    // same a a frame buffer. The first fow of this buffer will be the bottom

-    // line of the image. This is an artifact of the way we draw to the screen.

-    //

-    Private->VirtualScreenInfo = Private->WinNtThunk->HeapAlloc (

-                                                        Private->WinNtThunk->GetProcessHeap (),

-                                                        HEAP_ZERO_MEMORY,

-                                                        Size

-                                                        );

-

-    Private->VirtualScreenInfo->bV4Size           = sizeof (BITMAPV4HEADER);

-    Private->VirtualScreenInfo->bV4Width          = Private->HorizontalResolution;

-    Private->VirtualScreenInfo->bV4Height         = Private->VerticalResolution;

-    Private->VirtualScreenInfo->bV4Planes         = 1;

-    Private->VirtualScreenInfo->bV4BitCount       = 32;

-    //

-    // uncompressed

-    //

-    Private->VirtualScreenInfo->bV4V4Compression  = BI_RGB;

-    Private->VirtualScreen = (RGBQUAD *) (Private->VirtualScreenInfo + 1);

-    return 0;

-

-  case WM_PAINT:

-    //

-    // I have not found a way to convert hwnd into a Private context. So for

-    // now we use this API to convert hwnd to Private data.

-    //

-

-    Handle = mWinNt->BeginPaint (hwnd, &PaintStruct);

-

-    mWinNt->SetDIBitsToDevice (

-              Handle,                                     // Destination Device Context

-              0,                                          // Destination X - 0

-              0,                                          // Destination Y - 0

-              Private->HorizontalResolution,              // Width

-              Private->VerticalResolution,                // Height

-              0,                                          // Source X

-              0,                                          // Source Y

-              0,                                          // DIB Start Scan Line

-              Private->VerticalResolution,                // Number of scan lines

-              Private->VirtualScreen,                     // Address of array of DIB bits

-              (BITMAPINFO *) Private->VirtualScreenInfo,  // Address of structure with bitmap info

-              DIB_RGB_COLORS                              // RGB or palette indexes

-              );

-

-    mWinNt->EndPaint (hwnd, &PaintStruct);

-    return 0;

-

-  //

-  // F10 and the ALT key do not create a WM_KEYDOWN message, thus this special case

-  //

-  case WM_SYSKEYDOWN:

-    Key.ScanCode = 0;

-    switch (wParam) {

-    case VK_F10:

-      Key.ScanCode    = SCAN_F10;

-      Key.UnicodeChar = 0;

-      UgaPrivateAddQ (Private, Key);

-      return 0;

-    }

-    break;

-

-  case WM_KEYDOWN:

-    Key.ScanCode = 0;

-    switch (wParam) {

-    case VK_HOME:       Key.ScanCode = SCAN_HOME;       break;

-    case VK_END:        Key.ScanCode = SCAN_END;        break;

-    case VK_LEFT:       Key.ScanCode = SCAN_LEFT;       break;

-    case VK_RIGHT:      Key.ScanCode = SCAN_RIGHT;      break;

-    case VK_UP:         Key.ScanCode = SCAN_UP;         break;

-    case VK_DOWN:       Key.ScanCode = SCAN_DOWN;       break;

-    case VK_DELETE:     Key.ScanCode = SCAN_DELETE;     break;

-    case VK_INSERT:     Key.ScanCode = SCAN_INSERT;     break;

-    case VK_PRIOR:      Key.ScanCode = SCAN_PAGE_UP;    break;

-    case VK_NEXT:       Key.ScanCode = SCAN_PAGE_DOWN;  break;

-    case VK_ESCAPE:     Key.ScanCode = SCAN_ESC;        break;

-

-    case VK_F1:   Key.ScanCode = SCAN_F1;   break;

-    case VK_F2:   Key.ScanCode = SCAN_F2;   break;

-    case VK_F3:   Key.ScanCode = SCAN_F3;   break;

-    case VK_F4:   Key.ScanCode = SCAN_F4;   break;

-    case VK_F5:   Key.ScanCode = SCAN_F5;   break;

-    case VK_F6:   Key.ScanCode = SCAN_F6;   break;

-    case VK_F7:   Key.ScanCode = SCAN_F7;   break;

-    case VK_F8:   Key.ScanCode = SCAN_F8;   break;

-    case VK_F9:   Key.ScanCode = SCAN_F9;   break;

-    case VK_F11:  Key.ScanCode = SCAN_F11;  break;

-    case VK_F12:  Key.ScanCode = SCAN_F12;  break;

-    }

-

-    if (Key.ScanCode != 0) {

-      Key.UnicodeChar = 0;

-      UgaPrivateAddQ (Private, Key);

-    }

-

-    return 0;

-

-  case WM_CHAR:

-    //

-    // The ESC key also generate WM_CHAR.

-    //

-    if (wParam == 0x1B) {

-      return 0;

-    }

-

-    for (Index = 0; Index < (lParam & 0xffff); Index++) {

-      if (wParam != 0) {

-        Key.UnicodeChar = (CHAR16) wParam;

-        Key.ScanCode    = 0;

-        UgaPrivateAddQ (Private, Key);

-      }

-    }

-

-    return 0;

-

-  case WM_CLOSE:

-    //

-    // This close message is issued by user, core is not aware of this,

-    // so don't release the window display resource, just hide the window.

-    //

-    Private->WinNtThunk->ShowWindow (Private->WindowHandle, SW_HIDE);

-    return 0;

-

-  case WM_DESTROY:

-    mWinNt->DestroyWindow (hwnd);

-    mWinNt->PostQuitMessage (0);

-

-    mWinNt->HeapFree (Private->WinNtThunk->GetProcessHeap (), 0, Private->VirtualScreenInfo);

-

-    mWinNt->ExitThread (0);

-    return 0;

-

-  default:

-    break;

-  };

-

-  return mWinNt->DefWindowProc (hwnd, iMsg, wParam, lParam);

-}

-

-DWORD

-WINAPI

-WinNtUgaThreadWinMain (

-  LPVOID    lpParameter

-  )

-/*++

-

-Routine Description:

-

-  This thread simulates the end of WinMain () aplication. Each Winow nededs

-  to process it's events. The messages are dispatched to

-  WinNtUgaThreadWindowProc ().

-

-  Be very careful sine WinNtUgaThreadWinMain () and WinNtUgaThreadWindowProc ()

-  are running in a seperate thread. We have to do this to process the events.

-

-Arguments:

-

-  lpParameter - Handle of window to manage.

-

-Returns:

-

-  if a WM_QUIT message is returned exit.

-

---*/

-{

-  MSG               Message;

-  UGA_PRIVATE_DATA  *Private;

-  ATOM              Atom;

-  RECT              Rect;

-

-  Private = (UGA_PRIVATE_DATA *) lpParameter;

-  ASSERT (NULL != Private);

-

-  //

-  // Since each thread has unique private data, save the private data in Thread

-  // Local Storage slot. Then the shared global mTlsIndex can be used to get

-  // thread specific context.

-  //

-  Private->WinNtThunk->TlsSetValue (mTlsIndex, Private);

-

-  Private->ThreadId                   = Private->WinNtThunk->GetCurrentThreadId ();

-

-  Private->WindowsClass.cbSize        = sizeof (WNDCLASSEX);

-  Private->WindowsClass.style         = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;

-  Private->WindowsClass.lpfnWndProc   = WinNtUgaThreadWindowProc;

-  Private->WindowsClass.cbClsExtra    = 0;

-  Private->WindowsClass.cbWndExtra    = 0;

-  Private->WindowsClass.hInstance     = NULL;

-  Private->WindowsClass.hIcon         = Private->WinNtThunk->LoadIcon (NULL, IDI_APPLICATION);

-  Private->WindowsClass.hCursor       = Private->WinNtThunk->LoadCursor (NULL, IDC_ARROW);

-  Private->WindowsClass.hbrBackground = (HBRUSH) COLOR_WINDOW;

-  Private->WindowsClass.lpszMenuName  = NULL;

-  Private->WindowsClass.lpszClassName = WIN_NT_UGA_CLASS_NAME;

-  Private->WindowsClass.hIconSm       = Private->WinNtThunk->LoadIcon (NULL, IDI_APPLICATION);

-

-  //

-  // This call will fail after the first time, but thats O.K. since we only need

-  // WIN_NT_UGA_CLASS_NAME to exist to create the window.

-  //

-  // Note: Multiple instances of this DLL will use the same instance of this

-  // Class, including the callback function, unless the Class is unregistered and

-  // successfully registered again.

-  //

-  Atom = Private->WinNtThunk->RegisterClassEx (&Private->WindowsClass);

-

-  //

-  // Setting Rect values to allow for the AdjustWindowRect to provide

-  // us the correct sizes for the client area when doing the CreateWindowEx

-  //

-  Rect.top    = 0;

-  Rect.bottom = Private->VerticalResolution;

-  Rect.left   = 0;

-  Rect.right  = Private->HorizontalResolution;

-

-  Private->WinNtThunk->AdjustWindowRect (&Rect, WS_OVERLAPPEDWINDOW, 0);

-

-  Private->WindowHandle = Private->WinNtThunk->CreateWindowEx (

-                                                0,

-                                                WIN_NT_UGA_CLASS_NAME,

-                                                Private->WindowName,

-                                                WS_OVERLAPPEDWINDOW,

-                                                CW_USEDEFAULT,

-                                                CW_USEDEFAULT,

-                                                Rect.right - Rect.left,

-                                                Rect.bottom - Rect.top,

-                                                NULL,

-                                                NULL,

-                                                NULL,

-                                                &Private

-                                                );

-

-  //

-  // The reset of this thread is the standard winows program. We need a sperate

-  // thread since we must process the message loop to make windows act like

-  // windows.

-  //

-

-  Private->WinNtThunk->ShowWindow (Private->WindowHandle, SW_SHOW);

-  Private->WinNtThunk->UpdateWindow (Private->WindowHandle);

-

-  //

-  // Let the main thread get some work done

-  //

-  Private->WinNtThunk->ReleaseSemaphore (Private->ThreadInited, 1, NULL);

-

-  //

-  // This is the message loop that all Windows programs need.

-  //

-  while (Private->WinNtThunk->GetMessage (&Message, Private->WindowHandle, 0, 0)) {

-    Private->WinNtThunk->TranslateMessage (&Message);

-    Private->WinNtThunk->DispatchMessage (&Message);

-  }

-

-  return Message.wParam;

-}

-

-EFI_STATUS

-WinNtUgaStartWindow (

-  IN  UGA_PRIVATE_DATA    *Private,

-  IN  UINT32              HorizontalResolution,

-  IN  UINT32              VerticalResolution,

-  IN  UINT32              ColorDepth,

-  IN  UINT32              RefreshRate

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Private               - TODO: add argument description

-  HorizontalResolution  - TODO: add argument description

-  VerticalResolution    - TODO: add argument description

-  ColorDepth            - TODO: add argument description

-  RefreshRate           - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-{

-  EFI_STATUS          Status;

-  DWORD               NewThreadId;

-

-

-  mWinNt  = Private->WinNtThunk;

-

-  //

-  // Initialize a Thread Local Storge variable slot. We use TLS to get the

-  // correct Private data instance into the windows thread.

-  //

-  if (mTlsIndex == TLS_OUT_OF_INDEXES) {

-    ASSERT (0 == mTlsIndexUseCount);

-    mTlsIndex = Private->WinNtThunk->TlsAlloc ();

-  }

-

-  //

-  // always increase the use count!

-  //

-  mTlsIndexUseCount++;

-

-  Private->HorizontalResolution = HorizontalResolution;

-  Private->VerticalResolution   = VerticalResolution;

-

-  //

-  // Register to be notified on exit boot services so we can destroy the window.

-  //

-  Status = gBS->CreateEvent (

-                  EVT_SIGNAL_EXIT_BOOT_SERVICES,

-                  TPL_CALLBACK,

-                  KillNtUgaThread,

-                  Private,

-                  &mUgaScreenExitBootServicesEvent

-                  );

-

-  Private->ThreadInited = Private->WinNtThunk->CreateSemaphore (NULL, 0, 1, NULL);

-  Private->ThreadHandle = Private->WinNtThunk->CreateThread (

-                                                NULL,

-                                                0,

-                                                WinNtUgaThreadWinMain,

-                                                (VOID *) Private,

-                                                0,

-                                                &NewThreadId

-                                                );

-

-  //

-  // The other thread has entered the windows message loop so we can

-  // continue our initialization.

-  //

-  Private->WinNtThunk->WaitForSingleObject (Private->ThreadInited, INFINITE);

-  Private->WinNtThunk->CloseHandle (Private->ThreadInited);

-

-  return Status;

-}

-

-EFI_STATUS

-WinNtUgaConstructor (

-  UGA_PRIVATE_DATA    *Private

-  )

-/*++

-

-Routine Description:

-

-Arguments:

-

-Returns:

-

-  None

-

---*/

-// TODO:    Private - add argument and description to function comment

-// TODO:    EFI_SUCCESS - add return value to function comment

-{

-

-  Private->UgaDraw.GetMode        = WinNtUgaGetMode;

-  Private->UgaDraw.SetMode        = WinNtUgaSetMode;

-  Private->UgaDraw.Blt            = WinNtUgaBlt;

-

-  Private->HardwareNeedsStarting  = TRUE;

-  Private->FillLine               = NULL;

-

-  WinNtUgaInitializeSimpleTextInForWindow (Private);

-

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-WinNtUgaDestructor (

-  UGA_PRIVATE_DATA     *Private

-  )

-/*++

-

-Routine Description:

-

-Arguments:

-

-Returns:

-

-  None

-

---*/

-// TODO:    Private - add argument and description to function comment

-// TODO:    EFI_SUCCESS - add return value to function comment

-{

-  UINT32  UnregisterReturn;

-

-  if (!Private->HardwareNeedsStarting) {

-    //

-    // BugBug: Shutdown Uga Hardware and any child devices.

-    //

-    Private->WinNtThunk->SendMessage (Private->WindowHandle, WM_DESTROY, 0, 0);

-    Private->WinNtThunk->CloseHandle (Private->ThreadHandle);

-

-    mTlsIndexUseCount--;

-

-    //

-    // The callback function for another window could still be called,

-    // so we need to make sure there are no more users of mTlsIndex.

-    //

-    if (0 == mTlsIndexUseCount) {

-      ASSERT (TLS_OUT_OF_INDEXES != mTlsIndex);

-

-      Private->WinNtThunk->TlsFree (mTlsIndex);

-      mTlsIndex = TLS_OUT_OF_INDEXES;

-

-      UnregisterReturn = Private->WinNtThunk->UnregisterClass (

-                                                Private->WindowsClass.lpszClassName,

-                                                Private->WindowsClass.hInstance

-                                                );

-    }

-

-    WinNtUgaDestroySimpleTextInForWindow (Private);

-  }

-

-  return EFI_SUCCESS;

-}

-

-STATIC

-VOID

-EFIAPI

-KillNtUgaThread (

-  IN EFI_EVENT  Event,

-  IN VOID       *Context

-  )

-/*++

-

-Routine Description:

-

-  This is the UGA screen's callback notification function for exit-boot-services.

-  All we do here is call WinNtUgaDestructor().

-

-Arguments:

-

-  Event   - not used

-  Context - pointer to the Private structure.

-

-Returns:

-

-  None.

-

---*/

-{

-  EFI_STATUS  Status;

-  Status = WinNtUgaDestructor (Context);

-}

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/ComponentName.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/ComponentName.c
deleted file mode 100644
index b03fc8b..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/ComponentName.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  ComponentName.c

-

-Abstract:

-

---*/

-

-#include "WinNtBusDriver.h"

-

-//

-// EFI Component Name Functions

-//

-EFI_STATUS

-EFIAPI

-WinNtBusDriverComponentNameGetDriverName (

-  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,

-  IN  CHAR8                        *Language,

-  OUT CHAR16                       **DriverName

-  );

-

-EFI_STATUS

-EFIAPI

-WinNtBusDriverComponentNameGetControllerName (

-  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,

-  IN  EFI_HANDLE                                      ControllerHandle,

-  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,

-  IN  CHAR8                                           *Language,

-  OUT CHAR16                                          **ControllerName

-  );

-

-//

-// EFI Component Name Protocol

-//

-EFI_COMPONENT_NAME_PROTOCOL     gWinNtBusDriverComponentName = {

-  WinNtBusDriverComponentNameGetDriverName,

-  WinNtBusDriverComponentNameGetControllerName,

-  "eng"

-};

-

-static EFI_UNICODE_STRING_TABLE mWinNtBusDriverNameTable[] = {

-  { "eng", L"Windows Bus Driver" },

-  { NULL , NULL }

-};

-

-EFI_STATUS

-EFIAPI

-WinNtBusDriverComponentNameGetDriverName (

-  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,

-  IN  CHAR8                        *Language,

-  OUT CHAR16                       **DriverName

-  )

-/*++

-

-  Routine Description:

-    Retrieves a Unicode string that is the user readable name of the EFI Driver.

-

-  Arguments:

-    This       - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.

-    Language   - A pointer to a three character ISO 639-2 language identifier.

-                 This is the language of the driver name that that the caller 

-                 is requesting, and it must match one of the languages specified

-                 in SupportedLanguages.  The number of languages supported by a 

-                 driver is up to the driver writer.

-    DriverName - A pointer to the Unicode string to return.  This Unicode string

-                 is the name of the driver specified by This in the language 

-                 specified by Language.

-

-  Returns:

-    EFI_SUCCESS           - The Unicode string for the Driver specified by This

-                            and the language specified by Language was returned 

-                            in DriverName.

-    EFI_INVALID_PARAMETER - Language is NULL.

-    EFI_INVALID_PARAMETER - DriverName is NULL.

-    EFI_UNSUPPORTED       - The driver specified by This does not support the 

-                            language specified by Language.

-

---*/

-{

-  return LookupUnicodeString (

-          Language,

-          gWinNtBusDriverComponentName.SupportedLanguages,

-          mWinNtBusDriverNameTable,

-          DriverName

-          );

-}

-

-EFI_STATUS

-EFIAPI

-WinNtBusDriverComponentNameGetControllerName (

-  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,

-  IN  EFI_HANDLE                                      ControllerHandle,

-  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,

-  IN  CHAR8                                           *Language,

-  OUT CHAR16                                          **ControllerName

-  )

-/*++

-

-  Routine Description:

-    Retrieves a Unicode string that is the user readable name of the controller

-    that is being managed by an EFI Driver.

-

-  Arguments:

-    This             - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.

-    ControllerHandle - The handle of a controller that the driver specified by 

-                       This is managing.  This handle specifies the controller 

-                       whose name is to be returned.

-    ChildHandle      - The handle of the child controller to retrieve the name 

-                       of.  This is an optional parameter that may be NULL.  It 

-                       will be NULL for device drivers.  It will also be NULL 

-                       for a bus drivers that wish to retrieve the name of the 

-                       bus controller.  It will not be NULL for a bus driver 

-                       that wishes to retrieve the name of a child controller.

-    Language         - A pointer to a three character ISO 639-2 language 

-                       identifier.  This is the language of the controller name 

-                       that that the caller is requesting, and it must match one

-                       of the languages specified in SupportedLanguages.  The 

-                       number of languages supported by a driver is up to the 

-                       driver writer.

-    ControllerName   - A pointer to the Unicode string to return.  This Unicode

-                       string is the name of the controller specified by 

-                       ControllerHandle and ChildHandle in the language specified

-                       by Language from the point of view of the driver specified

-                       by This. 

-

-  Returns:

-    EFI_SUCCESS           - The Unicode string for the user readable name in the 

-                            language specified by Language for the driver 

-                            specified by This was returned in DriverName.

-    EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.

-    EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.

-    EFI_INVALID_PARAMETER - Language is NULL.

-    EFI_INVALID_PARAMETER - ControllerName is NULL.

-    EFI_UNSUPPORTED       - The driver specified by This is not currently managing 

-                            the controller specified by ControllerHandle and 

-                            ChildHandle.

-    EFI_UNSUPPORTED       - The driver specified by This does not support the 

-                            language specified by Language.

-

---*/

-{

-  EFI_STATUS              Status;

-  EFI_WIN_NT_IO_PROTOCOL  *WinNtIo;

-  WIN_NT_IO_DEVICE        *Private;

-

-  //

-  // Make sure this driver is currently managing ControllHandle

-  //

-  Status = EfiTestManagedDevice (

-             ControllerHandle,

-             gWinNtBusDriverBinding.DriverBindingHandle,

-             &gEfiWinNtThunkProtocolGuid

-             );

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  //

-  // This is a bus driver, so ChildHandle can not be NULL.

-  //

-  if (ChildHandle == NULL) {

-    return EFI_UNSUPPORTED;

-  }

-

-  Status = EfiTestChildHandle (

-             ControllerHandle,

-             ChildHandle,

-             &gEfiWinNtThunkProtocolGuid

-             );

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  //

-  // Get our context back

-  //

-  Status = gBS->OpenProtocol (

-                  ChildHandle,

-                  &gEfiWinNtIoProtocolGuid,

-                  &WinNtIo,

-                  gWinNtBusDriverBinding.DriverBindingHandle,

-                  ChildHandle,

-                  EFI_OPEN_PROTOCOL_GET_PROTOCOL

-                  );

-  if (EFI_ERROR (Status)) {

-    return EFI_UNSUPPORTED;

-  }

-

-  Private = WIN_NT_IO_DEVICE_FROM_THIS (WinNtIo);

-

-  return LookupUnicodeString (

-          Language,

-          gWinNtBusDriverComponentName.SupportedLanguages,

-          Private->ControllerNameTable,

-          ControllerName

-          );

-}

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.c
deleted file mode 100644
index b0e1c2b..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.c
+++ /dev/null
@@ -1,707 +0,0 @@
-/*+++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  WinNtBusDriver.c

-

-Abstract:

-

-This following section documents the envirnoment variables for the Win NT

-build.  These variables are used to define the (virtual) hardware

-configuration of the NT environment

-

-A ! can be used to seperate multiple instances in a variable. Each

-instance represents a seperate hardware device.

-

-EFI_WIN_NT_PHYSICAL_DISKS - maps to drives on your system

-EFI_WIN_NT_VIRTUAL_DISKS  - maps to a device emulated by a file

-EFI_WIN_NT_FILE_SYSTEM    - mouts a directory as a file system

-EFI_WIN_NT_CONSOLE        - make a logical comand line window (only one!)

-EFI_WIN_NT_UGA            - Builds UGA Windows of Width and Height

-EFI_WIN_NT_SERIAL_PORT    - maps physical serial ports

-

- <F>ixed       - Fixed disk like a hard drive.

- <R>emovable   - Removable media like a floppy or CD-ROM.

- Read <O>nly   - Write protected device.

- Read <W>rite  - Read write device.

- <block count> - Decimal number of blocks a device supports.

- <block size>  - Decimal number of bytes per block.

-

- NT envirnonment variable contents. '<' and '>' are not part of the variable,

- they are just used to make this help more readable. There should be no

- spaces between the ';'. Extra spaces will break the variable. A '!' is

- used to seperate multiple devices in a variable.

-

- EFI_WIN_NT_VIRTUAL_DISKS =

-   <F | R><O | W>;<block count>;<block size>[!...]

-

- EFI_WIN_NT_PHYSICAL_DISKS =

-   <drive letter>:<F | R><O | W>;<block count>;<block size>[!...]

-

- Virtual Disks: These devices use a file to emulate a hard disk or removable

-                media device.

-

-   Thus a 20 MB emulated hard drive would look like:

-   EFI_WIN_NT_VIRTUAL_DISKS=FW;40960;512

-

-   A 1.44MB emulated floppy with a block size of 1024 would look like:

-   EFI_WIN_NT_VIRTUAL_DISKS=RW;1440;1024

-

- Physical Disks: These devices use NT to open a real device in your system

-

-   Thus a 120 MB floppy would look like:

-   EFI_WIN_NT_PHYSICAL_DISKS=B:RW;245760;512

-

-   Thus a standard CD-ROM floppy would look like:

-   EFI_WIN_NT_PHYSICAL_DISKS=Z:RO;307200;2048

-

- EFI_WIN_NT_FILE_SYSTEM =

-   <directory path>[!...]

-

-   Mounting the two directories C:\FOO and C:\BAR would look like:

-   EFI_WIN_NT_FILE_SYSTEM=c:\foo!c:\bar

-

- EFI_WIN_NT_CONSOLE =

-   <window title>

-

-   Declaring a text console window with the title "My EFI Console" woild look like:

-   EFI_WIN_NT_CONSOLE=My EFI Console

-

- EFI_WIN_NT_UGA =

-   <width> <height>[!...]

-

-   Declaring a two UGA windows with resolutions of 800x600 and 1024x768 would look like:

-   Example : EFI_WIN_NT_UGA=800 600!1024 768

-

- EFI_WIN_NT_SERIAL_PORT =

-   <port name>[!...]

-

-   Declaring two serial ports on COM1 and COM2 would look like:

-   Example : EFI_WIN_NT_SERIAL_PORT=COM1!COM2

-

- EFI_WIN_NT_PASS_THROUGH =

-   <BaseAddress>;<Bus#>;<Device#>;<Function#>

-

-   Declaring a base address of 0xE0000000 (used for PCI Express devices)

-   and having NT32 talk to a device located at bus 0, device 1, function 0:

-   Example : EFI_WIN_NT_PASS_THROUGH=E000000;0;1;0

-

----*/

-

-#include "WinNtBusDriver.h"

-

-extern EFI_GUID gWinNtBusDriverGuid;

-//

-// DriverBinding protocol global

-//

-EFI_DRIVER_BINDING_PROTOCOL           gWinNtBusDriverBinding = {

-  WinNtBusDriverBindingSupported,

-  WinNtBusDriverBindingStart,

-  WinNtBusDriverBindingStop,

-  0xa,

-  NULL,

-  NULL

-};

-

-#define NT_PCD_ARRAY_SIZE (sizeof(mPcdEnvironment)/sizeof(NT_PCD_ENTRY))

-

-//

-// Table to map NT Environment variable to the GUID that should be in

-// device path.

-//

-static NT_PCD_ENTRY  mPcdEnvironment[] = {

-  PcdToken(PcdWinNtConsole),       &gEfiWinNtConsoleGuid,

-  PcdToken(PcdWinNtUga),           &gEfiWinNtUgaGuid,

-  PcdToken(PcdWinNtGop),           &gEfiWinNtGopGuid,

-  PcdToken(PcdWinNtSerialPort),    &gEfiWinNtSerialPortGuid,

-  PcdToken(PcdWinNtFileSystem),    &gEfiWinNtFileSystemGuid,

-  PcdToken(PcdWinNtVirtualDisk),   &gEfiWinNtVirtualDisksGuid,

-  PcdToken(PcdWinNtPhysicalDisk),  &gEfiWinNtPhysicalDisksGuid,

-  PcdToken(PcdWinNtCpuModel),      &gEfiWinNtCPUModelGuid,

-  PcdToken(PcdWinNtCpuSpeed),      &gEfiWinNtCPUSpeedGuid,

-  PcdToken(PcdWinNtMemorySize),    &gEfiWinNtMemoryGuid

-};

-

-VOID *

-AllocateMemory (

-  IN  UINTN   Size

-  )

-{

-  VOID        *Buffer;

-

-  Buffer = AllocatePool (Size);

-  ASSERT (Buffer != NULL);

-

-  return Buffer;

-}

-

-

-EFI_STATUS

-EFIAPI

-WinNtBusDriverBindingSupported (

-  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

-  IN  EFI_HANDLE                   ControllerHandle,

-  IN  EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath

-  )

-/*++

-

-Routine Description:

-

-Arguments:

-

-Returns:

-

-  None

-

---*/

-// TODO:    This - add argument and description to function comment

-// TODO:    ControllerHandle - add argument and description to function comment

-// TODO:    RemainingDevicePath - add argument and description to function comment

-// TODO:    EFI_UNSUPPORTED - add return value to function comment

-// TODO:    EFI_UNSUPPORTED - add return value to function comment

-// TODO:    EFI_SUCCESS - add return value to function comment

-// TODO:    EFI_SUCCESS - add return value to function comment

-{

-  EFI_STATUS                Status;

-  EFI_DEVICE_PATH_PROTOCOL  *ParentDevicePath;

-  EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;

-  UINTN                     Index;

-

-  //

-  // Check the contents of the first Device Path Node of RemainingDevicePath to make sure

-  // it is a legal Device Path Node for this bus driver's children.

-  //

-  if (RemainingDevicePath != NULL) {

-    if (RemainingDevicePath->Type != HARDWARE_DEVICE_PATH ||

-        RemainingDevicePath->SubType != HW_VENDOR_DP ||

-        DevicePathNodeLength(RemainingDevicePath) != sizeof(WIN_NT_VENDOR_DEVICE_PATH_NODE)) {

-      return EFI_UNSUPPORTED;

-    }

-

-    for (Index = 0; Index < NT_PCD_ARRAY_SIZE; Index++) {

-      if (CompareGuid (&((VENDOR_DEVICE_PATH *) RemainingDevicePath)->Guid, mPcdEnvironment[Index].DevicePathGuid)) {

-        break;

-      }

-    }

-

-    if (Index >= NT_PCD_ARRAY_SIZE) {

-      return EFI_UNSUPPORTED;

-    }

-  }

-

-  //

-  // Open the IO Abstraction(s) needed to perform the supported test

-  //

-  Status = gBS->OpenProtocol (

-                  ControllerHandle,

-                  &gEfiDevicePathProtocolGuid,

-                  &ParentDevicePath,

-                  This->DriverBindingHandle,

-                  ControllerHandle,

-                  EFI_OPEN_PROTOCOL_BY_DRIVER

-                  );

-  if (Status == EFI_ALREADY_STARTED) {

-    return EFI_SUCCESS;

-  }

-

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  gBS->CloseProtocol (

-        ControllerHandle,

-        &gEfiDevicePathProtocolGuid,

-        This->DriverBindingHandle,

-        ControllerHandle

-        );

-

-  Status = gBS->OpenProtocol (

-                  ControllerHandle,

-                  &gEfiWinNtThunkProtocolGuid,

-                  &WinNtThunk,

-                  This->DriverBindingHandle,

-                  ControllerHandle,

-                  EFI_OPEN_PROTOCOL_BY_DRIVER

-                  );

-  if (Status == EFI_ALREADY_STARTED) {

-    return EFI_SUCCESS;

-  }

-

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  //

-  // Since we call through WinNtThunk we need to make sure it's valid

-  //

-  Status = EFI_SUCCESS;

-  if (WinNtThunk->Signature != EFI_WIN_NT_THUNK_PROTOCOL_SIGNATURE) {

-    Status = EFI_UNSUPPORTED;

-  }

-

-  //

-  // Close the I/O Abstraction(s) used to perform the supported test

-  //

-  gBS->CloseProtocol (

-        ControllerHandle,

-        &gEfiWinNtThunkProtocolGuid,

-        This->DriverBindingHandle,

-        ControllerHandle

-        );

-

-  return Status;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtBusDriverBindingStart (

-  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

-  IN  EFI_HANDLE                   ControllerHandle,

-  IN  EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath

-  )

-/*++

-

-Routine Description:

-

-Arguments:

-

-Returns:

-

-  None

-

---*/

-// TODO:    This - add argument and description to function comment

-// TODO:    ControllerHandle - add argument and description to function comment

-// TODO:    RemainingDevicePath - add argument and description to function comment

-// TODO:    EFI_OUT_OF_RESOURCES - add return value to function comment

-// TODO:    EFI_OUT_OF_RESOURCES - add return value to function comment

-// TODO:    EFI_SUCCESS - add return value to function comment

-{

-  EFI_STATUS                      Status;

-  EFI_STATUS                      InstallStatus;

-  EFI_WIN_NT_THUNK_PROTOCOL       *WinNtThunk;

-  EFI_DEVICE_PATH_PROTOCOL        *ParentDevicePath;

-  WIN_NT_BUS_DEVICE               *WinNtBusDevice;

-  WIN_NT_IO_DEVICE                *WinNtDevice;

-  UINTN                           Index;

-  CHAR16                          *StartString;

-  CHAR16                          *SubString;

-  UINT16                          Count;

-  UINTN                           StringSize;

-  UINT16                          ComponentName[MAX_NT_ENVIRNMENT_VARIABLE_LENGTH];

-  WIN_NT_VENDOR_DEVICE_PATH_NODE  *Node;

-  BOOLEAN                         CreateDevice;

-  CHAR16                          *TempStr;

-  CHAR16                          *PcdTempStr;

-  UINTN                           TempStrSize;

-

-  Status = EFI_UNSUPPORTED;

-

-  //

-  // Grab the protocols we need

-  //

-  Status = gBS->OpenProtocol (

-                  ControllerHandle,

-                  &gEfiDevicePathProtocolGuid,

-                  &ParentDevicePath,

-                  This->DriverBindingHandle,

-                  ControllerHandle,

-                  EFI_OPEN_PROTOCOL_BY_DRIVER

-                  );

-  if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {

-    return Status;

-  }

-

-  Status = gBS->OpenProtocol (

-                  ControllerHandle,

-                  &gEfiWinNtThunkProtocolGuid,

-                  &WinNtThunk,

-                  This->DriverBindingHandle,

-                  ControllerHandle,

-                  EFI_OPEN_PROTOCOL_BY_DRIVER

-                  );

-  if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {

-    return Status;

-  }

-

-  if (Status != EFI_ALREADY_STARTED) {

-    WinNtBusDevice = AllocatePool (sizeof (WIN_NT_BUS_DEVICE));

-    if (WinNtBusDevice == NULL) {

-      return EFI_OUT_OF_RESOURCES;

-    }

-

-    WinNtBusDevice->Signature           = WIN_NT_BUS_DEVICE_SIGNATURE;

-    WinNtBusDevice->ControllerNameTable = NULL;

-

-    AddUnicodeString (

-      "eng",

-      gWinNtBusDriverComponentName.SupportedLanguages,

-      &WinNtBusDevice->ControllerNameTable,

-      L"Windows Bus Controller"

-      );

-

-    Status = gBS->InstallMultipleProtocolInterfaces (

-                    &ControllerHandle,

-                    &gWinNtBusDriverGuid,

-                    WinNtBusDevice,

-                    NULL

-                    );

-    if (EFI_ERROR (Status)) {

-      FreeUnicodeStringTable (WinNtBusDevice->ControllerNameTable);

-      FreePool (WinNtBusDevice);

-      return Status;

-    }

-  }

-

-  //

-  // Loop on the Variable list. Parse each variable to produce a set of handles that

-  // represent virtual hardware devices.

-  //

-  InstallStatus   = EFI_NOT_FOUND;

-  for (Index = 0; Index < NT_PCD_ARRAY_SIZE; Index++) {

-    PcdTempStr = (VOID *)LibPcdGetPtr (mPcdEnvironment[Index].Token);

-    ASSERT (PcdTempStr != NULL);

-

-    TempStrSize = StrLen (PcdTempStr);

-    TempStr = AllocateMemory ((TempStrSize * sizeof (CHAR16)) + 1);

-    StrCpy (TempStr, PcdTempStr);

-

-    StartString = TempStr;

-

-    //

-    // Parse the envirnment variable into sub strings using '!' as a delimator.

-    // Each substring needs it's own handle to be added to the system. This code

-    // does not understand the sub string. Thats the device drivers job.

-    //

-    Count = 0;

-    while (*StartString != '\0') {

-

-      //

-      // Find the end of the sub string

-      //

-      SubString = StartString;

-      while (*SubString != '\0' && *SubString != '!') {

-        SubString++;

-      }

-

-      if (*SubString == '!') {

-        //

-        // Replace token with '\0' to make sub strings. If this is the end

-        //  of the string SubString will already point to NULL.

-        //

-        *SubString = '\0';

-        SubString++;

-      }

-

-      CreateDevice = TRUE;

-      if (RemainingDevicePath != NULL) {

-        CreateDevice  = FALSE;

-        Node          = (WIN_NT_VENDOR_DEVICE_PATH_NODE *) RemainingDevicePath;

-        if (Node->VendorDevicePath.Header.Type == HARDWARE_DEVICE_PATH &&

-            Node->VendorDevicePath.Header.SubType == HW_VENDOR_DP &&

-            DevicePathNodeLength (&Node->VendorDevicePath.Header) == sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)

-            ) {

-          if (CompareGuid (&Node->VendorDevicePath.Guid, mPcdEnvironment[Index].DevicePathGuid) &&

-              Node->Instance == Count

-              ) {

-            CreateDevice = TRUE;

-          }

-        }

-      }

-

-      if (CreateDevice) {

-

-        //

-        // Allocate instance structure, and fill in parent information.

-        //

-        WinNtDevice = AllocateMemory (sizeof (WIN_NT_IO_DEVICE));

-        if (WinNtDevice == NULL) {

-          return EFI_OUT_OF_RESOURCES;

-        }

-

-        WinNtDevice->Handle             = NULL;

-        WinNtDevice->ControllerHandle   = ControllerHandle;

-        WinNtDevice->ParentDevicePath   = ParentDevicePath;

-

-        WinNtDevice->WinNtIo.WinNtThunk = WinNtThunk;

-

-        //

-        // Plus 2 to account for the NULL at the end of the Unicode string

-        //

-        StringSize = (UINTN) ((UINT8 *) SubString - (UINT8 *) StartString) + sizeof (CHAR16);

-        WinNtDevice->WinNtIo.EnvString = AllocateMemory (StringSize);

-        if (WinNtDevice->WinNtIo.EnvString != NULL) {

-          CopyMem (WinNtDevice->WinNtIo.EnvString, StartString, StringSize);

-        }

-

-        WinNtDevice->ControllerNameTable = NULL;

-

-        WinNtThunk->SPrintf (ComponentName, sizeof (ComponentName), L"%s", WinNtDevice->WinNtIo.EnvString);

-

-        WinNtDevice->DevicePath = WinNtBusCreateDevicePath (

-                                    ParentDevicePath,

-                                    mPcdEnvironment[Index].DevicePathGuid,

-                                    Count

-                                    );

-        if (WinNtDevice->DevicePath == NULL) {

-          FreePool (WinNtDevice);

-          return EFI_OUT_OF_RESOURCES;

-        }

-

-        AddUnicodeString (

-          "eng",

-          gWinNtBusDriverComponentName.SupportedLanguages,

-          &WinNtDevice->ControllerNameTable,

-          ComponentName

-          );

-

-        WinNtDevice->WinNtIo.TypeGuid       = mPcdEnvironment[Index].DevicePathGuid;

-        WinNtDevice->WinNtIo.InstanceNumber = Count;

-

-        WinNtDevice->Signature              = WIN_NT_IO_DEVICE_SIGNATURE;

-

-        Status = gBS->InstallMultipleProtocolInterfaces (

-                        &WinNtDevice->Handle,

-                        &gEfiDevicePathProtocolGuid,

-                        WinNtDevice->DevicePath,

-                        &gEfiWinNtIoProtocolGuid,

-                        &WinNtDevice->WinNtIo,

-                        NULL

-                        );

-        if (EFI_ERROR (Status)) {

-          FreeUnicodeStringTable (WinNtDevice->ControllerNameTable);

-          FreePool (WinNtDevice);

-        } else {

-          //

-          // Open For Child Device

-          //

-          Status = gBS->OpenProtocol (

-                          ControllerHandle,

-                          &gEfiWinNtThunkProtocolGuid,

-                          &WinNtThunk,

-                          This->DriverBindingHandle,

-                          WinNtDevice->Handle,

-                          EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER

-                          );

-          if (!EFI_ERROR (Status)) {

-            InstallStatus = EFI_SUCCESS;

-          }

-        }

-      }

-

-      //

-      // Parse Next sub string. This will point to '\0' if we are at the end.

-      //

-      Count++;

-      StartString = SubString;

-    }

-

-    FreePool (TempStr);

-  }

-

-  return EFI_SUCCESS;

-}

-

-

-EFI_STATUS

-EFIAPI

-WinNtBusDriverBindingStop (

-  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

-  IN  EFI_HANDLE                   ControllerHandle,

-  IN  UINTN                        NumberOfChildren,

-  IN  EFI_HANDLE                   *ChildHandleBuffer

-  )

-/*++

-

-Routine Description:

-

-Arguments:

-

-Returns:

-

-    None

-

---*/

-// TODO:    This - add argument and description to function comment

-// TODO:    ControllerHandle - add argument and description to function comment

-// TODO:    NumberOfChildren - add argument and description to function comment

-// TODO:    ChildHandleBuffer - add argument and description to function comment

-// TODO:    EFI_SUCCESS - add return value to function comment

-// TODO:    EFI_DEVICE_ERROR - add return value to function comment

-// TODO:    EFI_SUCCESS - add return value to function comment

-{

-  EFI_STATUS                Status;

-  UINTN                     Index;

-  BOOLEAN                   AllChildrenStopped;

-  EFI_WIN_NT_IO_PROTOCOL    *WinNtIo;

-  WIN_NT_BUS_DEVICE         *WinNtBusDevice;

-  WIN_NT_IO_DEVICE          *WinNtDevice;

-  EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;

-

-  //

-  // Complete all outstanding transactions to Controller.

-  // Don't allow any new transaction to Controller to be started.

-  //

-

-  if (NumberOfChildren == 0) {

-    //

-    // Close the bus driver

-    //

-    Status = gBS->OpenProtocol (

-                    ControllerHandle,

-                    &gWinNtBusDriverGuid,

-                    &WinNtBusDevice,

-                    This->DriverBindingHandle,

-                    ControllerHandle,

-                    EFI_OPEN_PROTOCOL_GET_PROTOCOL

-                    );

-    if (EFI_ERROR (Status)) {

-      return Status;

-    }

-

-    gBS->UninstallMultipleProtocolInterfaces (

-          ControllerHandle,

-          &gWinNtBusDriverGuid,

-          WinNtBusDevice,

-          NULL

-          );

-

-    FreeUnicodeStringTable (WinNtBusDevice->ControllerNameTable);

-

-    FreePool (WinNtBusDevice);

-

-    gBS->CloseProtocol (

-          ControllerHandle,

-          &gEfiWinNtThunkProtocolGuid,

-          This->DriverBindingHandle,

-          ControllerHandle

-          );

-

-    gBS->CloseProtocol (

-          ControllerHandle,

-          &gEfiDevicePathProtocolGuid,

-          This->DriverBindingHandle,

-          ControllerHandle

-          );

-    return EFI_SUCCESS;

-  }

-

-  AllChildrenStopped = TRUE;

-

-  for (Index = 0; Index < NumberOfChildren; Index++) {

-

-    Status = gBS->OpenProtocol (

-                    ChildHandleBuffer[Index],

-                    &gEfiWinNtIoProtocolGuid,

-                    &WinNtIo,

-                    This->DriverBindingHandle,

-                    ControllerHandle,

-                    EFI_OPEN_PROTOCOL_GET_PROTOCOL

-                    );

-    if (!EFI_ERROR (Status)) {

-

-      WinNtDevice = WIN_NT_IO_DEVICE_FROM_THIS (WinNtIo);

-

-      Status = gBS->CloseProtocol (

-                      ControllerHandle,

-                      &gEfiWinNtThunkProtocolGuid,

-                      This->DriverBindingHandle,

-                      WinNtDevice->Handle

-                      );

-

-      Status = gBS->UninstallMultipleProtocolInterfaces (

-                      WinNtDevice->Handle,

-                      &gEfiDevicePathProtocolGuid,

-                      WinNtDevice->DevicePath,

-                      &gEfiWinNtIoProtocolGuid,

-                      &WinNtDevice->WinNtIo,

-                      NULL

-                      );

-

-      if (EFI_ERROR (Status)) {

-        gBS->OpenProtocol (

-              ControllerHandle,

-              &gEfiWinNtThunkProtocolGuid,

-              (VOID **) &WinNtThunk,

-              This->DriverBindingHandle,

-              WinNtDevice->Handle,

-              EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER

-              );

-      } else {

-        //

-        // Close the child handle

-        //

-        FreeUnicodeStringTable (WinNtDevice->ControllerNameTable);

-        FreePool (WinNtDevice);

-      }

-    }

-

-    if (EFI_ERROR (Status)) {

-      AllChildrenStopped = FALSE;

-    }

-  }

-

-  if (!AllChildrenStopped) {

-    return EFI_DEVICE_ERROR;

-  }

-

-  return EFI_SUCCESS;

-}

-

-EFI_DEVICE_PATH_PROTOCOL *

-WinNtBusCreateDevicePath (

-  IN  EFI_DEVICE_PATH_PROTOCOL  *RootDevicePath,

-  IN  EFI_GUID                  *Guid,

-  IN  UINT16                    InstanceNumber

-  )

-/*++

-

-Routine Description:

-  Create a device path node using Guid and InstanceNumber and append it to

-  the passed in RootDevicePath

-

-Arguments:

-  RootDevicePath - Root of the device path to return.

-

-  Guid           - GUID to use in vendor device path node.

-

-  InstanceNumber - Instance number to use in the vendor device path. This

-                    argument is needed to make sure each device path is unique.

-

-Returns:

-

-  EFI_DEVICE_PATH_PROTOCOL

-

---*/

-{

-  WIN_NT_VENDOR_DEVICE_PATH_NODE  DevicePath;

-

-  DevicePath.VendorDevicePath.Header.Type     = HARDWARE_DEVICE_PATH;

-  DevicePath.VendorDevicePath.Header.SubType  = HW_VENDOR_DP;

-  SetDevicePathNodeLength (&DevicePath.VendorDevicePath.Header, sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE));

-

-  //

-  // The GUID defines the Class

-  //

-  CopyMem (&DevicePath.VendorDevicePath.Guid, Guid, sizeof (EFI_GUID));

-

-  //

-  // Add an instance number so we can make sure there are no Device Path

-  // duplication.

-  //

-  DevicePath.Instance = InstanceNumber;

-

-  return AppendDevicePathNode (

-          RootDevicePath,

-          (EFI_DEVICE_PATH_PROTOCOL *) &DevicePath

-          );

-}

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.h b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.h
deleted file mode 100644
index 414465b..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.h
+++ /dev/null
@@ -1,297 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  WinNtBusDriver.h

-

-Abstract:

-

-This following section documents the envirnoment variables for the Win NT 

-build.  These variables are used to define the (virtual) hardware 

-configuration of the NT environment

-

-A ! can be used to seperate multiple instances in a variable. Each 

-instance represents a seperate hardware device. 

-

-EFI_WIN_NT_PHYSICAL_DISKS - maps to drives on your system

-EFI_WIN_NT_VIRTUAL_DISKS  - maps to a device emulated by a file

-EFI_WIN_NT_FILE_SYSTEM    - mouts a directory as a file system

-EFI_WIN_NT_CONSOLE        - make a logical comand line window (only one!)

-EFI_WIN_NT_UGA            - Builds UGA Windows of Width and Height

-EFI_WIN_NT_SERIAL_PORT    - maps physical serial ports

-EFI_WIN_NT_PASS_THRU      - associates a device with our PCI support

-

- <F>ixed       - Fixed disk like a hard drive.

- <R>emovable   - Removable media like a floppy or CD-ROM.

- Read <O>nly   - Write protected device.

- Read <W>rite  - Read write device.

- <block count> - Decimal number of blocks a device supports.

- <block size>  - Decimal number of bytes per block.

-

- NT envirnonment variable contents. '<' and '>' are not part of the variable, 

- they are just used to make this help more readable. There should be no 

- spaces between the ';'. Extra spaces will break the variable. A '!' is  

- used to seperate multiple devices in a variable.

-

- EFI_WIN_NT_VIRTUAL_DISKS = 

-   <F | R><O | W>;<block count>;<block size>[!...]

-

- EFI_WIN_NT_PHYSICAL_DISKS =

-   <drive letter>:<F | R><O | W>;<block count>;<block size>[!...]

-

- Virtual Disks: These devices use a file to emulate a hard disk or removable

-                media device. 

-                

-   Thus a 20 MB emulated hard drive would look like:

-   EFI_WIN_NT_VIRTUAL_DISKS=FW;40960;512

-

-   A 1.44MB emulated floppy with a block size of 1024 would look like:

-   EFI_WIN_NT_VIRTUAL_DISKS=RW;1440;1024

-

- Physical Disks: These devices use NT to open a real device in your system

-

-   Thus a 120 MB floppy would look like:

-   EFI_WIN_NT_PHYSICAL_DISKS=B:RW;245760;512

-

-   Thus a standard CD-ROM floppy would look like:

-   EFI_WIN_NT_PHYSICAL_DISKS=Z:RO;307200;2048

-

- EFI_WIN_NT_FILE_SYSTEM = 

-   <directory path>[!...]

-

-   Mounting the two directories C:\FOO and C:\BAR would look like:

-   EFI_WIN_NT_FILE_SYSTEM=c:\foo!c:\bar

-

- EFI_WIN_NT_CONSOLE = 

-   <window title>

-

-   Declaring a text console window with the title "My EFI Console" woild look like:

-   EFI_WIN_NT_CONSOLE=My EFI Console

-

- EFI_WIN_NT_UGA = 

-   <width> <height>[!...]

-

-   Declaring a two UGA windows with resolutions of 800x600 and 1024x768 would look like:

-   Example : EFI_WIN_NT_UGA=800 600!1024 768

-

- EFI_WIN_NT_SERIAL_PORT = 

-   <port name>[!...]

-

-   Declaring two serial ports on COM1 and COM2 would look like:

-   Example : EFI_WIN_NT_SERIAL_PORT=COM1!COM2

-

- EFI_WIN_NT_PASS_THROUGH =

-   <BaseAddress>;<Bus#>;<Device#>;<Function#>

-

-   Declaring a base address of 0xE0000000 (used for PCI Express devices)

-   and having NT32 talk to a device located at bus 0, device 1, function 0:

-   Example : EFI_WIN_NT_PASS_THROUGH=E000000;0;1;0

-

----*/

-

-#ifndef __NT_BUS_DRIVER_H__

-#define __NT_BUS_DRIVER_H__

-

-

-

-//

-// WinNt Bus Driver Global Variables

-//

-extern EFI_DRIVER_BINDING_PROTOCOL  gWinNtBusDriverBinding;

-extern EFI_COMPONENT_NAME_PROTOCOL  gWinNtBusDriverComponentName;

-

-//

-// WinNt Bus Controller Structure

-//

-#define WIN_NT_BUS_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('N', 'T', 'B', 'D')

-

-typedef struct {

-  UINT64                    Signature;

-  EFI_UNICODE_STRING_TABLE  *ControllerNameTable;

-} WIN_NT_BUS_DEVICE;

-

-//

-// WinNt Child Device Controller Structure

-//

-#define WIN_NT_IO_DEVICE_SIGNATURE  EFI_SIGNATURE_32 ('N', 'T', 'V', 'D')

-

-typedef struct {

-  UINT64                    Signature;

-  EFI_HANDLE                Handle;

-  EFI_WIN_NT_IO_PROTOCOL    WinNtIo;

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;

-

-  //

-  // Private data about the parent

-  //

-  EFI_HANDLE                ControllerHandle;

-  EFI_DEVICE_PATH_PROTOCOL  *ParentDevicePath;

-

-  EFI_UNICODE_STRING_TABLE  *ControllerNameTable;

-

-} WIN_NT_IO_DEVICE;

-

-#define WIN_NT_IO_DEVICE_FROM_THIS(a) \

-  CR(a, WIN_NT_IO_DEVICE, WinNtIo, WIN_NT_IO_DEVICE_SIGNATURE)

-

-//

-// This is the largest env variable we can parse

-//

-#define MAX_NT_ENVIRNMENT_VARIABLE_LENGTH 512

-

-typedef struct {

-  UINTN               Token;

-  EFI_GUID            *DevicePathGuid;

-} NT_PCD_ENTRY;

-

-typedef struct {

-  VENDOR_DEVICE_PATH  VendorDevicePath;

-  UINT32              Instance;

-} WIN_NT_VENDOR_DEVICE_PATH_NODE;

-

-EFI_STATUS

-EFIAPI

-CpuIoInitialize (

-  IN EFI_HANDLE                            ImageHandle,

-  IN EFI_SYSTEM_TABLE                      *SystemTable

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  ImageHandle - TODO: add argument description

-  SystemTable - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-//

-// Driver Binding Protocol function prototypes

-//

-EFI_STATUS

-EFIAPI

-WinNtBusDriverBindingSupported (

-  IN EFI_DRIVER_BINDING_PROTOCOL    *This,

-  IN EFI_HANDLE                     Handle,

-  IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This                - TODO: add argument description

-  Handle              - TODO: add argument description

-  RemainingDevicePath - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-WinNtBusDriverBindingStart (

-  IN EFI_DRIVER_BINDING_PROTOCOL    *This,

-  IN EFI_HANDLE                     ParentHandle,

-  IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This                - TODO: add argument description

-  ParentHandle        - TODO: add argument description

-  RemainingDevicePath - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-WinNtBusDriverBindingStop (

-  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,

-  IN  EFI_HANDLE                   Handle,

-  IN  UINTN                        NumberOfChildren,

-  IN  EFI_HANDLE                   *ChildHandleBuffer

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This              - TODO: add argument description

-  Handle            - TODO: add argument description

-  NumberOfChildren  - TODO: add argument description

-  ChildHandleBuffer - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-//

-// WinNt Bus Driver private worker functions

-//

-EFI_DEVICE_PATH_PROTOCOL  *

-WinNtBusCreateDevicePath (

-  IN  EFI_DEVICE_PATH_PROTOCOL  *RootDevicePath,

-  IN  EFI_GUID                  *Guid,

-  IN  UINT16                    InstanceNumber

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  RootDevicePath  - TODO: add argument description

-  Guid            - TODO: add argument description

-  InstanceNumber  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-

-#endif

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.msa
deleted file mode 100644
index 2fb7d61..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.msa
+++ /dev/null
@@ -1,186 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>WinNtBusDriver</ModuleName>

-    <ModuleType>UEFI_DRIVER</ModuleType>

-    <GuidValue>BD7E9A27-D6C5-416a-B245-5F507D95B2BD</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>Win NT Bus driver</Abstract>

-    <Description>This following section documents the envirnoment variables for the Win NT

-      build.  These variables are used to define the (virtual) hardware

-      configuration of the NT environment</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>WinNtBusDriver</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiDriverModelLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiDriverEntryPoint</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>PcdLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseMemoryLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiBootServicesTableLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DevicePathLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>MemoryAllocationLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>WinNtBusDriver.h</Filename>

-    <Filename>WinNtBusDriver.c</Filename>

-    <Filename>ComponentName.c</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <Protocols>

-    <Protocol Usage="BY_START">

-      <ProtocolCName>gEfiWinNtIoProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="TO_START">

-      <ProtocolCName>gEfiWinNtThunkProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="BY_START">

-      <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="BY_START">

-      <ProtocolCName>gWinNtBusDriverGuid</ProtocolCName>

-    </Protocol>

-  </Protocols>

-  <Guids>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiWinNtVirtualDisksGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiWinNtPhysicalDisksGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiWinNtFileSystemGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiWinNtSerialPortGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiWinNtUgaGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiWinNtGopGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiWinNtConsoleGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiWinNtMemoryGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiWinNtCPUModelGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiWinNtCPUSpeedGuid</GuidCName>

-    </GuidCNames>

-  </Guids>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-    <Extern>

-      <DriverBinding>gWinNtBusDriverBinding</DriverBinding>

-      <ComponentName>gWinNtBusDriverComponentName</ComponentName>

-    </Extern>

-  </Externs>

-  <PcdCoded>

-    <PcdEntry PcdItemType="DYNAMIC">

-      <C_Name>PcdWinNtConsole</C_Name>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <HelpText>This PCD declares the title string of the text console window.

-        such as "My EFI Console".

-        The item type of this PCD can only be "DYNAMIC".</HelpText>

-    </PcdEntry>

-    <PcdEntry PcdItemType="DYNAMIC">

-      <C_Name>PcdWinNtUga</C_Name>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <HelpText>This PCD declares the resolutions for the UGA windows.

-        The item type of this PCD can only be "DYNAMIC".</HelpText>

-    </PcdEntry>

-    <PcdEntry PcdItemType="DYNAMIC">

-      <C_Name>PcdWinNtGop</C_Name>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <HelpText>This PCD declares the resolutions for the GOP windows.

-        The item type of this PCD can only be "DYNAMIC".</HelpText>

-    </PcdEntry>

-    <PcdEntry PcdItemType="DYNAMIC">

-      <C_Name>PcdWinNtSerialPort</C_Name>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <HelpText>This Pcd declares two serial port for simulated environment.

-        The item type of this PCD can only be "DYNAMIC".</HelpText>

-    </PcdEntry>

-    <PcdEntry PcdItemType="DYNAMIC">

-      <C_Name>PcdWinNtFileSystem</C_Name>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <HelpText>This PCD defines the windows directory who will be mounted as

-        harddisk in simulator.

-        The item type of this PCD can only be "DYNAMIC".</HelpText>

-    </PcdEntry>

-    <PcdEntry PcdItemType="DYNAMIC">

-      <C_Name>PcdWinNtVirtualDisk</C_Name>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <HelpText>This PCD defines the devices which use a file to emulate a hard disk or

-        removable media device

-        The item type if this PCD can only be "DYNAMIC".</HelpText>

-    </PcdEntry>

-    <PcdEntry PcdItemType="DYNAMIC">

-      <C_Name>PcdWinNtPhysicalDisk</C_Name>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <HelpText>This PCD defines physical disk which will be simualted as a

-        harddisk in simulator.

-        The item type of this PCD can only be "DYNAMIC".</HelpText>

-    </PcdEntry>

-    <PcdEntry PcdItemType="DYNAMIC">

-      <C_Name>PcdWinNtCpuModel</C_Name>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <HelpText>This PCD defines simulated CPU model string.

-        The item type of this PCD can only be "DYNAMIC".</HelpText>

-    </PcdEntry>

-    <PcdEntry PcdItemType="DYNAMIC">

-      <C_Name>PcdWinNtCpuSpeed</C_Name>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <HelpText>This PCD defines simulated CPU speed string.</HelpText>

-    </PcdEntry>

-    <PcdEntry PcdItemType="DYNAMIC">

-      <C_Name>PcdWinNtMemorySize</C_Name>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <HelpText>This PCD defines the size of simulated memory size.

-        The item type of this PCD can only be "DYNAMIC".</HelpText>

-    </PcdEntry>

-  </PcdCoded>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Metronome/Metronome.c b/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Metronome/Metronome.c
deleted file mode 100644
index 394ca6e..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Metronome/Metronome.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  Metronome.c

-

-Abstract:

-

-  NT Emulation Metronome Architectural Protocol Driver as defined in DXE CIS

-

---*/

-

-#include "Metronome.h"

-

-//

-// Global Variables

-//

-EFI_METRONOME_ARCH_PROTOCOL mMetronome = {

-  WinNtMetronomeDriverWaitForTick,

-  TICK_PERIOD

-};

-

-//

-// Worker Functions

-//

-

-EFI_STATUS

-EFIAPI

-WinNtMetronomeDriverWaitForTick (

-  IN EFI_METRONOME_ARCH_PROTOCOL  *This,

-  IN UINT32                       TickNumber

-  )

-/*++

-

-Routine Description:

-

-  The WaitForTick() function waits for the number of ticks specified by

-  TickNumber from a known time source in the platform.  If TickNumber of

-  ticks are detected, then EFI_SUCCESS is returned.  The actual time passed

-  between entry of this function and the first tick is between 0 and

-  TickPeriod 100 nS units.  If you want to guarantee that at least TickPeriod

-  time has elapsed, wait for two ticks.  This function waits for a hardware

-  event to determine when a tick occurs.  It is possible for interrupt

-  processing, or exception processing to interrupt the execution of the

-  WaitForTick() function.  Depending on the hardware source for the ticks, it

-  is possible for a tick to be missed.  This function cannot guarantee that

-  ticks will not be missed.  If a timeout occurs waiting for the specified

-  number of ticks, then EFI_TIMEOUT is returned.

-

-Arguments:

-

-  This       - The EFI_METRONOME_ARCH_PROTOCOL instance.

-  TickNumber - Number of ticks to wait.

-

-Returns:

-

-  EFI_SUCCESS - The wait for the number of ticks specified by TickNumber

-                succeeded.

-

---*/

-{

-  UINT64  SleepTime;

-

-  //

-  // Calculate the time to sleep.  Win API smallest unit to sleep is 1 millisec

-  // Tick Period is in 100ns units, divide by 10000 to convert to ms

-  //

-  SleepTime = DivU64x32 (MultU64x32 ((UINT64) TickNumber, TICK_PERIOD) + 9999, 10000);

-  gWinNt->Sleep ((UINT32) SleepTime);

-

-  return EFI_SUCCESS;

-}

-

-

-EFI_STATUS

-EFIAPI

-WinNtMetronomeDriverInitialize (

-  IN EFI_HANDLE        ImageHandle,

-  IN EFI_SYSTEM_TABLE  *SystemTable

-  )

-/*++

-

-Routine Description:

-

-  Initialize the Metronome Architectural Protocol driver

-

-Arguments:

-

-  ImageHandle - ImageHandle of the loaded driver

-

-

-  SystemTable - Pointer to the System Table

-

-Returns:

-

-  EFI_SUCCESS           - Metronome Architectural Protocol created

-

-  EFI_OUT_OF_RESOURCES  - Not enough resources available to initialize driver.

-

-  EFI_DEVICE_ERROR      - A device error occured attempting to initialize the driver.

-

---*/

-{

-  EFI_STATUS  Status;

-  EFI_HANDLE  Handle;

-

-

-  //

-  // Install the Metronome Architectural Protocol onto a new handle

-  //

-  Handle = NULL;

-  Status = gBS->InstallProtocolInterface (

-                  &Handle,

-                  &gEfiMetronomeArchProtocolGuid,

-                  EFI_NATIVE_INTERFACE,

-                  &mMetronome

-                  );

-

-  return Status;

-}

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Metronome/Metronome.dxs b/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Metronome/Metronome.dxs
deleted file mode 100644
index 406b52c..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Metronome/Metronome.dxs
+++ /dev/null
@@ -1,26 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  Metronome.dxs

-

-Abstract:

-

-  Dependency expression source file.

-  

---*/  

-

-#include <DxeDepex.h>

-

-DEPENDENCY_START

-  TRUE

-DEPENDENCY_END

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Metronome/Metronome.h b/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Metronome/Metronome.h
deleted file mode 100644
index d89a149..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Metronome/Metronome.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  Metronome.h

-

-Abstract:

-

-  NT Emulation Metronome Architectural Protocol Driver as defined in DXE CIS

-

---*/

-

-#ifndef _NT_THUNK_METRONOME_H_

-#define _NT_THUNK_METRONOME_H_

-

-

-

-//

-// Period of on tick in 100 nanosecond units

-//

-#define TICK_PERIOD 2000

-

-//

-// Function Prototypes

-//

-

-EFI_STATUS

-EFIAPI

-WinNtMetronomeDriverInitialize (

-  IN EFI_HANDLE        ImageHandle,

-  IN EFI_SYSTEM_TABLE  *SystemTable

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  ImageHandle - TODO: add argument description

-  SystemTable - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-WinNtMetronomeDriverWaitForTick (

-  IN EFI_METRONOME_ARCH_PROTOCOL  *This,

-  IN UINT32                       TickNumber

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This        - TODO: add argument description

-  TickNumber  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-#endif

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Metronome/Metronome.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Metronome/Metronome.msa
deleted file mode 100644
index e4dc0b1..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Metronome/Metronome.msa
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>Metronome</ModuleName>

-    <ModuleType>DXE_DRIVER</ModuleType>

-    <GuidValue>154CAB4A-52B5-46CD-99C3-4368ABBACFFD</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>NT Emulation Metronome Architectural Protocol Driver as defined in DXE CIS</Abstract>

-    <Description>This metronome module simulates metronome by Sleep WinAPI.</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials
-      are licensed and made available under the terms and conditions of the BSD License
-      which accompanies this distribution.  The full text of the license may be found at
-      http://opensource.org/licenses/bsd-license.php
-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>Metronome</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiDriverEntryPoint</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>WinNtLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiBootServicesTableLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>Metronome.c</Filename>

-    <Filename>Metronome.h</Filename>

-    <Filename>Metronome.dxs</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <Protocols>

-    <Protocol Usage="ALWAYS_PRODUCED">

-      <ProtocolCName>gEfiMetronomeArchProtocolGuid</ProtocolCName>

-    </Protocol>

-  </Protocols>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-    <Extern>

-      <ModuleEntryPoint>WinNtMetronomeDriverInitialize</ModuleEntryPoint>

-    </Extern>

-  </Externs>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/RealTimeClock/RealTimeClock.c b/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/RealTimeClock/RealTimeClock.c
deleted file mode 100644
index b705ee6..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/RealTimeClock/RealTimeClock.c
+++ /dev/null
@@ -1,391 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  RealTimeClock.c

-

-Abstract:

-

-  NT Emulation Architectural Protocol Driver as defined in Tiano

-

---*/

-

-

-

-BOOLEAN

-DayValid (

-  IN  EFI_TIME  *Time

-  );

-

-BOOLEAN

-IsLeapYear (

-  IN EFI_TIME   *Time

-  );

-

-EFI_STATUS

-RtcTimeFieldsValid (

-  IN EFI_TIME *Time

-  );

-

-EFI_STATUS

-EFIAPI

-InitializeRealTimeClock (

-  IN EFI_HANDLE                          ImageHandle,

-  IN EFI_SYSTEM_TABLE                    *SystemTable

-  );

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtGetTime (

-  OUT EFI_TIME                                 *Time,

-  OUT EFI_TIME_CAPABILITIES                    *Capabilities OPTIONAL

-  )

-/*++

-

-Routine Description:

-  Service routine for RealTimeClockInstance->GetTime 

-

-Arguments:

-

-  Time          - A pointer to storage that will receive a snapshot of the current time.

-

-  Capabilities  - A pointer to storage that will receive the capabilities of the real time clock

-                  in the platform. This includes the real time clock's resolution and accuracy.  

-                  All reported device capabilities are rounded up.  This is an OPTIONAL argument.

-

-Returns:

-

-  EFI_SUCEESS   - The underlying GetSystemTime call occurred and returned

-                  Note that in the NT32 emulation, the GetSystemTime call has no return value

-                  thus you will always receive a EFI_SUCCESS on this.

-

---*/

-// TODO:    EFI_INVALID_PARAMETER - add return value to function comment

-{

-  SYSTEMTIME            SystemTime;

-  TIME_ZONE_INFORMATION TimeZone;

-

-  //

-  // Check parameter for null pointer

-  //

-  if (Time == NULL) {

-    return EFI_INVALID_PARAMETER;

-

-  }

-

-  gWinNt->GetLocalTime (&SystemTime);

-  gWinNt->GetTimeZoneInformation (&TimeZone);

-

-  Time->Year        = (UINT16) SystemTime.wYear;

-  Time->Month       = (UINT8) SystemTime.wMonth;

-  Time->Day         = (UINT8) SystemTime.wDay;

-  Time->Hour        = (UINT8) SystemTime.wHour;

-  Time->Minute      = (UINT8) SystemTime.wMinute;

-  Time->Second      = (UINT8) SystemTime.wSecond;

-  Time->Nanosecond  = (UINT32) (SystemTime.wMilliseconds * 1000000);

-  Time->TimeZone    = (INT16) TimeZone.Bias;

-

-  if (Capabilities != NULL) {

-    Capabilities->Resolution  = 1;

-    Capabilities->Accuracy    = 50000000;

-    Capabilities->SetsToZero  = FALSE;

-  }

-

-  Time->Daylight = 0;

-  if (TimeZone.StandardDate.wMonth) {

-    Time->Daylight = EFI_TIME_ADJUST_DAYLIGHT;

-  }

-

-  return EFI_SUCCESS;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSetTime (

-  IN EFI_TIME   *Time

-  )

-/*++

-

-Routine Description:

-  Service routine for RealTimeClockInstance->SetTime 

-

-Arguments:

-

-  Time          - A pointer to storage containing the time and date information to

-                  program into the real time clock.

-

-Returns:

-

-  EFI_SUCEESS           - The operation completed successfully.

-                  

-  EFI_INVALID_PARAMETER - One of the fields in Time is out of range.

-

-  EFI_DEVICE_ERROR      - The operation could not be complete due to a device error.

-

---*/

-// TODO:    EFI_SUCCESS - add return value to function comment

-{

-  TIME_ZONE_INFORMATION TimeZone;

-  EFI_STATUS            Status;

-  SYSTEMTIME            SystemTime;

-  BOOL                  Flag;

-

-  if (Time == NULL) {

-    return EFI_INVALID_PARAMETER;

-  }

-  //

-  // Make sure that the time fields are valid

-  //

-  Status = RtcTimeFieldsValid (Time);

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-  //

-  // Set Daylight savings time information and Time Zone

-  //

-  gWinNt->GetTimeZoneInformation (&TimeZone);

-  TimeZone.StandardDate.wMonth  = Time->Daylight;

-  TimeZone.Bias                 = Time->TimeZone;

-  gWinNt->SetTimeZoneInformation (&TimeZone);

-

-  SystemTime.wYear          = Time->Year;

-  SystemTime.wMonth         = Time->Month;

-  SystemTime.wDay           = Time->Day;

-  SystemTime.wHour          = Time->Hour;

-  SystemTime.wMinute        = Time->Minute;

-  SystemTime.wSecond        = Time->Second;

-  SystemTime.wMilliseconds  = (INT16) (Time->Nanosecond / 1000000);

-

-  Flag                      = gWinNt->SetLocalTime (&SystemTime);

-

-  if (!Flag) {

-    return EFI_DEVICE_ERROR;

-  } else {

-    return EFI_SUCCESS;

-  }

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtGetWakeupTime (

-  OUT BOOLEAN        *Enabled,

-  OUT BOOLEAN        *Pending,

-  OUT EFI_TIME       *Time

-  )

-/*++

-

-Routine Description:

-  Service routine for RealTimeClockInstance->GetWakeupTime

-

-Arguments:

-  This          - Indicates the protocol instance structure.

-

-  Enabled       - Indicates if the alarm is currently enabled or disabled.

-

-  Pending       - Indicates if the alarm signal is pending and requires

-                  acknowledgement.

-

-  Time          - The current alarm setting.

-

-Returns:

-

-  EFI_SUCEESS           - The operation completed successfully.

-                  

-  EFI_DEVICE_ERROR      - The operation could not be complete due to a device error.

-

-  EFI_UNSUPPORTED       - The operation is not supported on this platform.

-

---*/

-{

-  return EFI_UNSUPPORTED;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSetWakeupTime (

-  IN BOOLEAN      Enable,

-  OUT EFI_TIME    *Time

-  )

-/*++

-

-Routine Description:

-  Service routine for RealTimeClockInstance->SetWakeupTime

-

-Arguments:

-

-  Enabled       - Enable or disable the wakeup alarm.

-

-  Time          - If enable is TRUE, the time to set the wakup alarm for.

-                  If enable is FALSE, then this parameter is optional, and

-                  may be NULL.

-

-Returns:

-

-  EFI_SUCEESS           - The operation completed successfully.

-                  

-  EFI_DEVICE_ERROR      - The operation could not be complete due to a device error.

-

-  EFI_INVALID_PARAMETER - A field in Time is out of range.

-

-  EFI_UNSUPPORTED       - The operation is not supported on this platform.

-

---*/

-{

-  return EFI_UNSUPPORTED;

-}

-

-EFI_STATUS

-EFIAPI

-InitializeRealTimeClock (

-  IN EFI_HANDLE                            ImageHandle,

-  IN EFI_SYSTEM_TABLE                      *SystemTable

-  )

-/*++

-

-Routine Description:

-  Install Real Time Clock Protocol 

-

-Arguments:

-  (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)

-

-Returns:

-

-  EFI_SUCEESS - Real Time Clock Services are installed into the Runtime Services Table

-

---*/

-// TODO:    ImageHandle - add argument and description to function comment

-// TODO:    SystemTable - add argument and description to function comment

-{

-  EFI_STATUS  Status;

-  EFI_HANDLE  Handle;

-

-

-  SystemTable->RuntimeServices->GetTime       = WinNtGetTime;

-  SystemTable->RuntimeServices->SetTime       = WinNtSetTime;

-  SystemTable->RuntimeServices->GetWakeupTime = WinNtGetWakeupTime;

-  SystemTable->RuntimeServices->SetWakeupTime = WinNtSetWakeupTime;

-

-  Handle = NULL;

-  Status = gBS->InstallMultipleProtocolInterfaces (

-                  &Handle,

-                  &gEfiRealTimeClockArchProtocolGuid,

-                  NULL,

-                  NULL

-                  );

-  return Status;

-}

-

-EFI_STATUS

-RtcTimeFieldsValid (

-  IN EFI_TIME *Time

-  )

-/*++

-

-Routine Description:

-

-  Arguments:

- 

-  Returns: 

---*/

-// TODO:    Time - add argument and description to function comment

-// TODO:    EFI_INVALID_PARAMETER - add return value to function comment

-// TODO:    EFI_SUCCESS - add return value to function comment

-{

-  if (Time->Year < 1998 ||

-      Time->Year > 2099 ||

-      Time->Month < 1 ||

-      Time->Month > 12 ||

-      (!DayValid (Time)) ||

-      Time->Hour > 23 ||

-      Time->Minute > 59 ||

-      Time->Second > 59 ||

-      Time->Nanosecond > 999999999 ||

-      (!(Time->TimeZone == EFI_UNSPECIFIED_TIMEZONE || (Time->TimeZone >= -1440 && Time->TimeZone <= 1440))) ||

-      (Time->Daylight & (~(EFI_TIME_ADJUST_DAYLIGHT | EFI_TIME_IN_DAYLIGHT)))

-      ) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  return EFI_SUCCESS;

-}

-

-BOOLEAN

-DayValid (

-  IN  EFI_TIME  *Time

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Time  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-{

-

-  INTN  DayOfMonth[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

-

-  if (Time->Day < 1 ||

-      Time->Day > DayOfMonth[Time->Month - 1] ||

-      (Time->Month == 2 && (!IsLeapYear (Time) && Time->Day > 28))

-      ) {

-    return FALSE;

-  }

-

-  return TRUE;

-}

-

-BOOLEAN

-IsLeapYear (

-  IN EFI_TIME   *Time

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Time  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-{

-  if (Time->Year % 4 == 0) {

-    if (Time->Year % 100 == 0) {

-      if (Time->Year % 400 == 0) {

-        return TRUE;

-      } else {

-        return FALSE;

-      }

-    } else {

-      return TRUE;

-    }

-  } else {

-    return FALSE;

-  }

-}

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/RealTimeClock/RealTimeClock.dxs b/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/RealTimeClock/RealTimeClock.dxs
deleted file mode 100644
index c3c61d3..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/RealTimeClock/RealTimeClock.dxs
+++ /dev/null
@@ -1,26 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  RealTimeClock.dxs

-

-Abstract:

-

-  Dependency expression source file.

-  

---*/  

-

-#include <DxeDepex.h>

-

-DEPENDENCY_START

-  TRUE

-DEPENDENCY_END

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/RealTimeClock/RealTimeClock.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/RealTimeClock/RealTimeClock.msa
deleted file mode 100644
index 0fe3cd0..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/RealTimeClock/RealTimeClock.msa
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>RealTimeClock</ModuleName>

-    <ModuleType>DXE_DRIVER</ModuleType>

-    <GuidValue>27F05AF5-1644-4EF4-8944-48C4F75675A0</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>NT Emulation Real time clock Architectural Protocol Driver as defined in TIANO</Abstract>

-    <Description>This real time clock module simulates virtual device by time WinAPI.</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>RealTimeClock</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiDriverEntryPoint</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>WinNtLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiBootServicesTableLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>RealTimeClock.c</Filename>

-    <Filename>RealTimeClock.dxs</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <Protocols>

-    <Protocol Usage="ALWAYS_PRODUCED">

-      <ProtocolCName>gEfiRealTimeClockArchProtocolGuid</ProtocolCName>

-    </Protocol>

-  </Protocols>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-    <Extern>

-      <ModuleEntryPoint>InitializeRealTimeClock</ModuleEntryPoint>

-    </Extern>

-  </Externs>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Reset/Reset.dxs b/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Reset/Reset.dxs
deleted file mode 100644
index ffafd53..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Reset/Reset.dxs
+++ /dev/null
@@ -1,26 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  Reset.dxs

-

-Abstract:

-

-  Dependency expression source file.

-  

---*/  

-

-#include <DxeDepex.h>

-

-DEPENDENCY_START

-  TRUE

-DEPENDENCY_END

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Reset/Reset.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Reset/Reset.msa
deleted file mode 100644
index 404da8d..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Reset/Reset.msa
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>Reset</ModuleName>

-    <ModuleType>DXE_DRIVER</ModuleType>

-    <GuidValue>BA929954-35B0-4dd3-90CD-9634BD7E1CF1</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>NT Emulation Reset Architectural Protocol Driver as defined in TIANO</Abstract>

-    <Description>This Reset module simulates system reset by process exit on NT.</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>Reset</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiDriverEntryPoint</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>WinNtLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiBootServicesTableLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>reset.c</Filename>

-    <Filename>Reset.dxs</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <Protocols>

-    <Protocol Usage="ALWAYS_PRODUCED">

-      <ProtocolCName>gEfiResetArchProtocolGuid</ProtocolCName>

-    </Protocol>

-  </Protocols>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-    <Extern>

-      <ModuleEntryPoint>InitializeNtReset</ModuleEntryPoint>

-    </Extern>

-  </Externs>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Reset/reset.c b/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Reset/reset.c
deleted file mode 100644
index d1b841d..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Reset/reset.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

- Reset.c

-

-Abstract:

-

-  Reset Architectural Protocol as defined in Tiano under NT Emulation

-

---*/

-

-

-

-EFI_STATUS

-EFIAPI

-InitializeNtReset (

-  IN EFI_HANDLE        ImageHandle,

-  IN EFI_SYSTEM_TABLE  *SystemTable

-  );

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtResetSystem (

-  IN EFI_RESET_TYPE   ResetType,

-  IN EFI_STATUS       ResetStatus,

-  IN UINTN            DataSize,

-  IN CHAR16           *ResetData OPTIONAL

-  );

-

-

-EFI_STATUS

-EFIAPI

-InitializeNtReset (

-  IN EFI_HANDLE        ImageHandle,

-  IN EFI_SYSTEM_TABLE  *SystemTable

-  )

-/*++

-

-Routine Description:

-

-

-Arguments:

-

-  ImageHandle of the loaded driver

-  Pointer to the System Table

-

-Returns:

-

-  Status

---*/

-// TODO:    SystemTable - add argument and description to function comment

-{

-  EFI_STATUS  Status;

-  EFI_HANDLE  Handle;

-

-  SystemTable->RuntimeServices->ResetSystem = WinNtResetSystem;

-

-  Handle = NULL;

-  Status = gBS->InstallMultipleProtocolInterfaces (

-                  &Handle,

-                  &gEfiResetArchProtocolGuid,

-                  NULL,

-                  NULL

-                  );

-  ASSERT_EFI_ERROR (Status);

-

-  return Status;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtResetSystem (

-  IN EFI_RESET_TYPE   ResetType,

-  IN EFI_STATUS       ResetStatus,

-  IN UINTN            DataSize,

-  IN CHAR16           *ResetData OPTIONAL

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  ResetType   - TODO: add argument description

-  ResetStatus - TODO: add argument description

-  DataSize    - TODO: add argument description

-  ResetData   - TODO: add argument description

-

-Returns:

-

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  //

-  // BUGBUG Need to kill all console windows later

-  //

-  //

-  // Discard ResetType, always return 0 as exit code

-  //

-  gWinNt->ExitProcess (0);

-

-  //

-  // Should never go here

-  //

-  return EFI_SUCCESS;

-}

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Timer/Timer.c b/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Timer/Timer.c
deleted file mode 100644
index 3997c5f..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Timer/Timer.c
+++ /dev/null
@@ -1,597 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  Timer.c

-

-Abstract:

-

-  NT Emulation Timer Architectural Protocol Driver as defined in DXE CIS

-

-  This Timer module uses an NT Thread to simulate the timer-tick driven

-  timer service.  In the future, the Thread creation should possibly be 

-  abstracted by the CPU architectural protocol

-

---*/

-

-#include "Timer.h"

-

-//

-// Pointer to the CPU Architectural Protocol instance

-//

-EFI_CPU_ARCH_PROTOCOL   *mCpu;

-

-//

-// The Timer Architectural Protocol that this driver produces

-//

-EFI_TIMER_ARCH_PROTOCOL mTimer = {

-  WinNtTimerDriverRegisterHandler,

-  WinNtTimerDriverSetTimerPeriod,

-  WinNtTimerDriverGetTimerPeriod,

-  WinNtTimerDriverGenerateSoftInterrupt

-};

-

-//

-// Define a global that we can use to shut down the NT timer thread when

-// the timer is canceled.

-//

-BOOLEAN                 mCancelTimerThread = FALSE;

-

-//

-// The notification function to call on every timer interrupt

-//

-EFI_TIMER_NOTIFY        mTimerNotifyFunction = NULL;

-

-//

-// The current period of the timer interrupt

-//

-UINT64                  mTimerPeriod;

-

-//

-// The thread handle for this driver

-//

-HANDLE                  mNtMainThreadHandle;

-

-//

-// The timer value from the last timer interrupt

-//

-UINT32                  mNtLastTick;

-

-//

-// Critical section used to update varibles shared between the main thread and

-// the timer interrupt thread.

-//

-CRITICAL_SECTION        mNtCriticalSection;

-

-//

-// Worker Functions

-//

-UINT                    mMMTimerThreadID = 0;

-

-VOID

-CALLBACK

-MMTimerThread (

-  UINT  wTimerID,

-  UINT  msg,

-  DWORD dwUser,

-  DWORD dw1,

-  DWORD dw2

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  wTimerID  - TODO: add argument description

-  msg       - TODO: add argument description

-  dwUser    - TODO: add argument description

-  dw1       - TODO: add argument description

-  dw2       - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-{

-  EFI_TPL           OriginalTPL;

-  UINT32            CurrentTick;

-  UINT32            Delta;

-  EFI_TIMER_NOTIFY  CallbackFunction;

-  BOOLEAN           InterruptState;

-

-  if (!mCancelTimerThread) {

-  

-    //

-    //  Suspend the main thread until we are done

-    //

-

-    gWinNt->SuspendThread (mNtMainThreadHandle);

-

-    //

-    // If the timer thread is being canceled, then bail immediately.

-    // We check again here because there's a small window of time from when

-    // this thread was kicked off and when we suspended the main thread above.

-    //

-    if (mCancelTimerThread) {

-      gWinNt->ResumeThread (mNtMainThreadHandle);

-      gWinNt->timeKillEvent (wTimerID);

-      mMMTimerThreadID = 0;

-      return ;

-    }

-

-    mCpu->GetInterruptState (mCpu, &InterruptState);

-    while (!InterruptState) {

-      //

-      //  Resume the main thread

-      //

-      gWinNt->ResumeThread (mNtMainThreadHandle);

-

-      //

-      //  Wait for interrupts to be enabled.

-      //

-      mCpu->GetInterruptState (mCpu, &InterruptState);

-      while (!InterruptState) {

-        gWinNt->Sleep (0);

-        mCpu->GetInterruptState (mCpu, &InterruptState);

-      }

-       

-      //

-      //  Suspend the main thread until we are done

-      //

-      gWinNt->SuspendThread (mNtMainThreadHandle);

-      mCpu->GetInterruptState (mCpu, &InterruptState);

-    }

-

-    //

-    //  Get the current system tick

-    //

-    CurrentTick = gWinNt->GetTickCount ();

-    Delta       = CurrentTick - mNtLastTick;

-    mNtLastTick = CurrentTick;

-

-    //

-    //  If delay was more then 1 second, ignore it (probably debugging case)

-    //

-    if (Delta < 1000) {

-

-      OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);

-

-      //

-      //  Inform the firmware of an "timer interrupt".  The time

-      //  expired since the last call is 10,000 times the number

-      //  of ms.  (or 100ns units)

-      //

-      gWinNt->EnterCriticalSection (&mNtCriticalSection);

-      CallbackFunction = mTimerNotifyFunction;

-      gWinNt->LeaveCriticalSection (&mNtCriticalSection);

-

-      //

-      // Only invoke the callback function if a Non-NULL handler has been

-      // registered. Assume all other handlers are legal.

-      //

-      if (CallbackFunction != NULL) {

-        CallbackFunction ((UINT64) (Delta * 10000));

-      }

-

-      gBS->RestoreTPL (OriginalTPL);

-

-    }

-

-    //

-    //  Resume the main thread

-    //

-    gWinNt->ResumeThread (mNtMainThreadHandle);

-  } else {

-    gWinNt->timeKillEvent (wTimerID);

-    mMMTimerThreadID = 0;

-  }

-

-}

-

-UINT

-CreateNtTimer (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-   It is used to emulate a platform 

-  timer-driver interrupt handler.  

-

-Returns:

-

-  Timer ID

-

---*/

-// TODO: function comment is missing 'Arguments:'

-{

-  UINT32  SleepCount;

-

-  //

-  //  Set our thread priority higher than the "main" thread.

-  //

-  gWinNt->SetThreadPriority (

-            gWinNt->GetCurrentThread (),

-            THREAD_PRIORITY_HIGHEST

-            );

-

-  //

-  //  Calc the appropriate interval

-  //

-  gWinNt->EnterCriticalSection (&mNtCriticalSection);

-  SleepCount = (UINT32) (mTimerPeriod + 5000) / 10000;

-  gWinNt->LeaveCriticalSection (&mNtCriticalSection);

-

-  return gWinNt->timeSetEvent (

-                  SleepCount,

-                  0,

-                  MMTimerThread,

-                  (DWORD_PTR) NULL,

-                  TIME_PERIODIC | TIME_KILL_SYNCHRONOUS | TIME_CALLBACK_FUNCTION

-                  );

-

-}

-

-EFI_STATUS

-EFIAPI

-WinNtTimerDriverRegisterHandler (

-  IN EFI_TIMER_ARCH_PROTOCOL           *This,

-  IN EFI_TIMER_NOTIFY                  NotifyFunction

-  )

-/*++

-

-Routine Description:

-

-  This function registers the handler NotifyFunction so it is called every time 

-  the timer interrupt fires.  It also passes the amount of time since the last 

-  handler call to the NotifyFunction.  If NotifyFunction is NULL, then the 

-  handler is unregistered.  If the handler is registered, then EFI_SUCCESS is 

-  returned.  If the CPU does not support registering a timer interrupt handler, 

-  then EFI_UNSUPPORTED is returned.  If an attempt is made to register a handler 

-  when a handler is already registered, then EFI_ALREADY_STARTED is returned.  

-  If an attempt is made to unregister a handler when a handler is not registered, 

-  then EFI_INVALID_PARAMETER is returned.  If an error occurs attempting to 

-  register the NotifyFunction with the timer interrupt, then EFI_DEVICE_ERROR 

-  is returned.

-

-Arguments:

-

-  This           - The EFI_TIMER_ARCH_PROTOCOL instance.

-

-  NotifyFunction - The function to call when a timer interrupt fires.  This 

-                   function executes at TPL_HIGH_LEVEL.  The DXE Core will 

-                   register a handler for the timer interrupt, so it can know 

-                   how much time has passed.  This information is used to 

-                   signal timer based events.  NULL will unregister the handler.

-

-Returns: 

-

-  EFI_SUCCESS           - The timer handler was registered.

-

-  EFI_UNSUPPORTED       - The platform does not support timer interrupts.

-

-  EFI_ALREADY_STARTED   - NotifyFunction is not NULL, and a handler is already 

-                          registered.

-

-  EFI_INVALID_PARAMETER - NotifyFunction is NULL, and a handler was not 

-                          previously registered.

-

-  EFI_DEVICE_ERROR      - The timer handler could not be registered.

-

---*/

-{

-  //

-  // Check for invalid parameters

-  //

-  if (NotifyFunction == NULL && mTimerNotifyFunction == NULL) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  if (NotifyFunction != NULL && mTimerNotifyFunction != NULL) {

-    return EFI_ALREADY_STARTED;

-  }

-

-  //

-  // Use Critical Section to update the notification function that is

-  // used from the timer interrupt thread.

-  //

-  gWinNt->EnterCriticalSection (&mNtCriticalSection);

-

-  mTimerNotifyFunction = NotifyFunction;

-

-  gWinNt->LeaveCriticalSection (&mNtCriticalSection);

-

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtTimerDriverSetTimerPeriod (

-  IN EFI_TIMER_ARCH_PROTOCOL  *This,

-  IN UINT64                   TimerPeriod

-  )

-/*++

-

-Routine Description:

-

-  This function adjusts the period of timer interrupts to the value specified 

-  by TimerPeriod.  If the timer period is updated, then the selected timer 

-  period is stored in EFI_TIMER.TimerPeriod, and EFI_SUCCESS is returned.  If 

-  the timer hardware is not programmable, then EFI_UNSUPPORTED is returned.  

-  If an error occurs while attempting to update the timer period, then the 

-  timer hardware will be put back in its state prior to this call, and 

-  EFI_DEVICE_ERROR is returned.  If TimerPeriod is 0, then the timer interrupt 

-  is disabled.  This is not the same as disabling the CPU's interrupts.  

-  Instead, it must either turn off the timer hardware, or it must adjust the 

-  interrupt controller so that a CPU interrupt is not generated when the timer 

-  interrupt fires. 

-

-Arguments:

-

-  This        - The EFI_TIMER_ARCH_PROTOCOL instance.

-

-  TimerPeriod - The rate to program the timer interrupt in 100 nS units.  If 

-                the timer hardware is not programmable, then EFI_UNSUPPORTED is 

-                returned.  If the timer is programmable, then the timer period 

-                will be rounded up to the nearest timer period that is supported 

-                by the timer hardware.  If TimerPeriod is set to 0, then the 

-                timer interrupts will be disabled.

-

-Returns: 

-

-  EFI_SUCCESS      - The timer period was changed.

-

-  EFI_UNSUPPORTED  - The platform cannot change the period of the timer interrupt.

-

-  EFI_DEVICE_ERROR - The timer period could not be changed due to a device error.

-

---*/

-{

-

-  //

-  // If TimerPeriod is 0, then the timer thread should be canceled

-  //

-  if (TimerPeriod == 0) {

-    //

-    // Cancel the timer thread

-    //

-    gWinNt->EnterCriticalSection (&mNtCriticalSection);

-

-    mCancelTimerThread = TRUE;

-

-    gWinNt->LeaveCriticalSection (&mNtCriticalSection);

-

-    //

-    // Wait for the timer thread to exit

-    //

-

-    if (mMMTimerThreadID) {

-      gWinNt->timeKillEvent (mMMTimerThreadID);

-    }

-

-    mMMTimerThreadID = 0;

-

-    //

-    // Update the timer period

-    //

-    gWinNt->EnterCriticalSection (&mNtCriticalSection);

-

-    mTimerPeriod = TimerPeriod;

-

-    gWinNt->LeaveCriticalSection (&mNtCriticalSection);

-

-    //

-    // NULL out the thread handle so it will be re-created if the timer is enabled again

-    //

-

-  } else if ((TimerPeriod > TIMER_MINIMUM_VALUE) && (TimerPeriod < TIMER_MAXIMUM_VALUE)) {

-    //

-    // If the TimerPeriod is valid, then create and/or adjust the period of the timer thread

-    //

-    gWinNt->EnterCriticalSection (&mNtCriticalSection);

-

-    mTimerPeriod        = TimerPeriod;

-

-    mCancelTimerThread  = FALSE;

-

-    gWinNt->LeaveCriticalSection (&mNtCriticalSection);

-

-    //

-    //  Get the starting tick location if we are just starting the timer thread

-    //

-    mNtLastTick = gWinNt->GetTickCount ();

-

-    if (mMMTimerThreadID) {

-      gWinNt->timeKillEvent (mMMTimerThreadID);

-    }

-

-    mMMTimerThreadID  = 0;

-

-    mMMTimerThreadID  = CreateNtTimer ();

-

-  }

-

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtTimerDriverGetTimerPeriod (

-  IN EFI_TIMER_ARCH_PROTOCOL            *This,

-  OUT UINT64                            *TimerPeriod

-  )

-/*++

-

-Routine Description:

-

-  This function retrieves the period of timer interrupts in 100 ns units, 

-  returns that value in TimerPeriod, and returns EFI_SUCCESS.  If TimerPeriod 

-  is NULL, then EFI_INVALID_PARAMETER is returned.  If a TimerPeriod of 0 is 

-  returned, then the timer is currently disabled.

-

-Arguments:

-

-  This        - The EFI_TIMER_ARCH_PROTOCOL instance.

-

-  TimerPeriod - A pointer to the timer period to retrieve in 100 ns units.  If 

-                0 is returned, then the timer is currently disabled.

-

-Returns: 

-

-  EFI_SUCCESS           - The timer period was returned in TimerPeriod.

-

-  EFI_INVALID_PARAMETER - TimerPeriod is NULL.

-

---*/

-{

-  if (TimerPeriod == NULL) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  *TimerPeriod = mTimerPeriod;

-

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-EFIAPI

-WinNtTimerDriverGenerateSoftInterrupt (

-  IN EFI_TIMER_ARCH_PROTOCOL  *This

-  )

-/*++

-

-Routine Description:

-

-  This function generates a soft timer interrupt. If the platform does not support soft 

-  timer interrupts, then EFI_UNSUPPORTED is returned. Otherwise, EFI_SUCCESS is returned. 

-  If a handler has been registered through the EFI_TIMER_ARCH_PROTOCOL.RegisterHandler() 

-  service, then a soft timer interrupt will be generated. If the timer interrupt is 

-  enabled when this service is called, then the registered handler will be invoked. The 

-  registered handler should not be able to distinguish a hardware-generated timer 

-  interrupt from a software-generated timer interrupt.

-

-Arguments:

-

-  This  -  The EFI_TIMER_ARCH_PROTOCOL instance.

-

-Returns: 

-

-  EFI_SUCCESS       - The soft timer interrupt was generated.

-

-  EFI_UNSUPPORTEDT  - The platform does not support the generation of soft timer interrupts.

-

---*/

-{

-  return EFI_UNSUPPORTED;

-}

-

-

-EFI_STATUS

-EFIAPI

-WinNtTimerDriverInitialize (

-  IN EFI_HANDLE        ImageHandle,

-  IN EFI_SYSTEM_TABLE  *SystemTable

-  )

-/*++

-

-Routine Description:

-

-  Initialize the Timer Architectural Protocol driver

-

-Arguments:

-

-  ImageHandle - ImageHandle of the loaded driver

-

-  SystemTable - Pointer to the System Table

-

-Returns:

-

-  EFI_SUCCESS           - Timer Architectural Protocol created

-

-  EFI_OUT_OF_RESOURCES  - Not enough resources available to initialize driver.

-  

-  EFI_DEVICE_ERROR      - A device error occured attempting to initialize the driver.

-

---*/

-{

-  EFI_STATUS  Status;

-  UINTN       Result;

-  EFI_HANDLE  Handle;

-

-  //

-  // Make sure the Timer Architectural Protocol is not already installed in the system

-  //

-  ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiTimerArchProtocolGuid);

-

-  //

-  // Get the CPU Architectural Protocol instance

-  //

-  Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, &mCpu);

-  ASSERT_EFI_ERROR (Status);

-

-  //

-  //  Get our handle so the timer tick thread can suspend

-  //

-  Result = gWinNt->DuplicateHandle (

-                    gWinNt->GetCurrentProcess (),

-                    gWinNt->GetCurrentThread (),

-                    gWinNt->GetCurrentProcess (),

-                    &mNtMainThreadHandle,

-                    0,

-                    FALSE,

-                    DUPLICATE_SAME_ACCESS

-                    );

-  if (Result == 0) {

-    return EFI_DEVICE_ERROR;

-  }

-

-  //

-  // Initialize Critical Section used to update variables shared between the main

-  // thread and the timer interrupt thread.

-  //

-  gWinNt->InitializeCriticalSection (&mNtCriticalSection);

-

-  //

-  // Start the timer thread at the default timer period

-  //

-  Status = mTimer.SetTimerPeriod (&mTimer, DEFAULT_TIMER_TICK_DURATION);

-  if (EFI_ERROR (Status)) {

-    gWinNt->DeleteCriticalSection (&mNtCriticalSection);

-    return Status;

-  }

-

-  //

-  // Install the Timer Architectural Protocol onto a new handle

-  //

-  Handle = NULL;

-  Status = gBS->InstallProtocolInterface (

-                  &Handle,

-                  &gEfiTimerArchProtocolGuid,

-                  EFI_NATIVE_INTERFACE,

-                  &mTimer

-                  );

-  if (EFI_ERROR (Status)) {

-    //

-    // Cancel the timer

-    //

-    mTimer.SetTimerPeriod (&mTimer, 0);

-    gWinNt->DeleteCriticalSection (&mNtCriticalSection);

-    return Status;

-  }

-

-  return EFI_SUCCESS;

-}

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Timer/Timer.dxs b/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Timer/Timer.dxs
deleted file mode 100644
index cdef2de..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Timer/Timer.dxs
+++ /dev/null
@@ -1,27 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  Timer.dxs

-

-Abstract:

-

-  Dependency expression source file.

-  

---*/ 

-

-

-#include <DxeDepex.h>

-

-DEPENDENCY_START

-  EFI_CPU_ARCH_PROTOCOL_GUID

-DEPENDENCY_END

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Timer/Timer.h b/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Timer/Timer.h
deleted file mode 100644
index 218ece6..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Timer/Timer.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  Timer.h

-

-Abstract:

-

-  NT Emulation Architectural Protocol Driver as defined in Tiano.

-  This Timer module uses an NT Thread to simulate the timer-tick driven

-  timer service.

-

---*/

-

-#ifndef _TIMER_H_

-#define _TIMER_H_

-

-

-

-

-//

-// Legal timer value range in 100 ns units

-//

-#define TIMER_MINIMUM_VALUE 0

-#define TIMER_MAXIMUM_VALUE (0x100000000 - 1)

-

-//

-// Default timer value in 100 ns units (10 ms)

-//

-#define DEFAULT_TIMER_TICK_DURATION 100000

-

-//

-// Function Prototypes

-//

-EFI_STATUS

-EFIAPI

-WinNtTimerDriverInitialize (

-  IN EFI_HANDLE        ImageHandle,

-  IN EFI_SYSTEM_TABLE  *SystemTable

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  ImageHandle - TODO: add argument description

-  SystemTable - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-WinNtTimerDriverRegisterHandler (

-  IN EFI_TIMER_ARCH_PROTOCOL  *This,

-  IN EFI_TIMER_NOTIFY         NotifyFunction

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This            - TODO: add argument description

-  NotifyFunction  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-WinNtTimerDriverSetTimerPeriod (

-  IN EFI_TIMER_ARCH_PROTOCOL  *This,

-  IN UINT64                   TimerPeriod

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This        - TODO: add argument description

-  TimerPeriod - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-WinNtTimerDriverGetTimerPeriod (

-  IN EFI_TIMER_ARCH_PROTOCOL   *This,

-  OUT UINT64                   *TimerPeriod

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This        - TODO: add argument description

-  TimerPeriod - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-WinNtTimerDriverGenerateSoftInterrupt (

-  IN EFI_TIMER_ARCH_PROTOCOL  *This

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  This  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-#endif

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Timer/Timer.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Timer/Timer.msa
deleted file mode 100644
index b022741..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Chipset/Timer/Timer.msa
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>Timer</ModuleName>

-    <ModuleType>DXE_DRIVER</ModuleType>

-    <GuidValue>C3811036-710B-4E39-8CF1-0AF9BE3A8198</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>NT Emulation Timer Architectural Protocol Driver as defined in DXE CIS</Abstract>

-    <Description>This Timer module uses an NT Thread to simulate the timer-tick driven

-      timer service.  In the future, the Thread creation should possibly be

-      abstracted by the CPU architectural protocol</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>Timer</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiDriverEntryPoint</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>WinNtLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiBootServicesTableLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>Timer.h</Filename>

-    <Filename>Timer.c</Filename>

-    <Filename>Timer.dxs</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <Protocols>

-    <Protocol Usage="ALWAYS_PRODUCED">

-      <ProtocolCName>gEfiTimerArchProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="ALWAYS_CONSUMED">

-      <ProtocolCName>gEfiCpuArchProtocolGuid</ProtocolCName>

-    </Protocol>

-  </Protocols>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-    <Extern>

-      <ModuleEntryPoint>WinNtTimerDriverInitialize</ModuleEntryPoint>

-    </Extern>

-  </Externs>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Cpu/Cpu.c b/EdkNt32Pkg/Dxe/WinNtThunk/Cpu/Cpu.c
deleted file mode 100644
index d732a5c..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Cpu/Cpu.c
+++ /dev/null
@@ -1,726 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  Cpu.c

-

-Abstract:

-

-  NT Emulation Architectural Protocol Driver as defined in Tiano.

-  This CPU module abstracts the interrupt subsystem of a platform and

-  the CPU-specific setjump/long pair.  Other services are not implemented

-  in this driver.

-

---*/

-

-#include "CpuDriver.h"

-

-#define EFI_CPU_DATA_MAXIMUM_LENGTH 0x100

-

-EFI_STATUS

-EFIAPI

-InitializeCpu (

-  IN EFI_HANDLE        ImageHandle,

-  IN EFI_SYSTEM_TABLE  *SystemTable

-  );

-

-VOID

-EFIAPI

-WinNtIoProtocolNotifyFunction (

-  IN EFI_EVENT                Event,

-  IN VOID                     *Context

-  );

-

-typedef union {

-  EFI_CPU_DATA_RECORD *DataRecord;

-  UINT8               *Raw;

-} EFI_CPU_DATA_RECORD_BUFFER;

-

-EFI_SUBCLASS_TYPE1_HEADER mCpuDataRecordHeader = {

-  EFI_PROCESSOR_SUBCLASS_VERSION,       // Version

-  sizeof (EFI_SUBCLASS_TYPE1_HEADER),   // Header Size

-  0,                                    // Instance, Initialize later

-  EFI_SUBCLASS_INSTANCE_NON_APPLICABLE, // SubInstance

-  0                                     // RecordType, Initialize later

-};

-

-//

-// Service routines for the driver

-//

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtFlushCpuDataCache (

-  IN EFI_CPU_ARCH_PROTOCOL  *This,

-  IN EFI_PHYSICAL_ADDRESS   Start,

-  IN UINT64                 Length,

-  IN EFI_CPU_FLUSH_TYPE     FlushType

-  )

-/*++

-

-Routine Description:

-

-  This routine would provide support for flushing the CPU data cache.

-  In the case of NT emulation environment, this flushing is not necessary and

-  is thus not implemented.

-

-Arguments:

-

-  Pointer to CPU Architectural Protocol interface

-  Start adddress in memory to flush

-  Length of memory to flush

-  Flush type

-

-Returns:

-

-  Status

-    EFI_SUCCESS

-

---*/

-// TODO:    This - add argument and description to function comment

-// TODO:    FlushType - add argument and description to function comment

-// TODO:    EFI_UNSUPPORTED - add return value to function comment

-{

-  if (FlushType == EfiCpuFlushTypeWriteBackInvalidate) {

-    //

-    // Only WB flush is supported. We actually need do nothing on NT emulator

-    // environment. Classify this to follow EFI spec

-    //

-    return EFI_SUCCESS;

-  }

-  //

-  // Other flush types are not supported by NT emulator

-  //

-  return EFI_UNSUPPORTED;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtEnableInterrupt (

-  IN EFI_CPU_ARCH_PROTOCOL  *This

-  )

-/*++

-

-Routine Description:

-

-  This routine provides support for emulation of the interrupt enable of the

-  the system.  For our purposes, CPU enable is just a BOOLEAN that the Timer

-  Architectural Protocol observes in order to defer behaviour while in its

-  emulated interrupt, or timer tick.

-

-Arguments:

-

-  Pointer to CPU Architectural Protocol interface

-

-Returns:

-

-  Status

-    EFI_SUCCESS

-

---*/

-// TODO:    This - add argument and description to function comment

-{

-  CPU_ARCH_PROTOCOL_PRIVATE *Private;

-

-  Private                 = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);

-  Private->InterruptState = TRUE;

-  return EFI_SUCCESS;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtDisableInterrupt (

-  IN EFI_CPU_ARCH_PROTOCOL  *This

-  )

-/*++

-

-Routine Description:

-

-  This routine provides support for emulation of the interrupt disable of the

-  the system.  For our purposes, CPU enable is just a BOOLEAN that the Timer

-  Architectural Protocol observes in order to defer behaviour while in its

-  emulated interrupt, or timer tick.

-

-Arguments:

-

-  Pointer to CPU Architectural Protocol interface

-

-Returns:

-

-  Status

-    EFI_SUCCESS

-

---*/

-// TODO:    This - add argument and description to function comment

-{

-  CPU_ARCH_PROTOCOL_PRIVATE *Private;

-

-  Private                 = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);

-  Private->InterruptState = FALSE;

-  return EFI_SUCCESS;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtGetInterruptState (

-  IN EFI_CPU_ARCH_PROTOCOL  *This,

-  OUT BOOLEAN               *State

-  )

-/*++

-

-Routine Description:

-

-  This routine provides support for emulation of the interrupt disable of the

-  the system.  For our purposes, CPU enable is just a BOOLEAN that the Timer

-  Architectural Protocol observes in order to defer behaviour while in its

-  emulated interrupt, or timer tick.

-

-Arguments:

-

-  Pointer to CPU Architectural Protocol interface

-

-Returns:

-

-  Status

-    EFI_SUCCESS

-

---*/

-// TODO:    This - add argument and description to function comment

-// TODO:    State - add argument and description to function comment

-// TODO:    EFI_INVALID_PARAMETER - add return value to function comment

-{

-  CPU_ARCH_PROTOCOL_PRIVATE *Private;

-

-  if (State == NULL) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);

-  *State  = Private->InterruptState;

-  return EFI_SUCCESS;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtInit (

-  IN EFI_CPU_ARCH_PROTOCOL  *This,

-  IN EFI_CPU_INIT_TYPE      InitType

-  )

-/*++

-

-Routine Description:

-

-  This routine would support generation of a CPU INIT.  At

-  present, this code does not provide emulation.

-

-Arguments:

-

-  Pointer to CPU Architectural Protocol interface

-  INIT Type

-

-Returns:

-

-  Status

-    EFI_UNSUPPORTED - not yet implemented

-

---*/

-// TODO:    This - add argument and description to function comment

-// TODO:    InitType - add argument and description to function comment

-{

-  CPU_ARCH_PROTOCOL_PRIVATE *Private;

-

-  Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);

-  return EFI_UNSUPPORTED;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtRegisterInterruptHandler (

-  IN EFI_CPU_ARCH_PROTOCOL      *This,

-  IN EFI_EXCEPTION_TYPE         InterruptType,

-  IN EFI_CPU_INTERRUPT_HANDLER  InterruptHandler

-  )

-/*++

-

-Routine Description:

-

-  This routine would support registration of an interrupt handler.  At

-  present, this code does not provide emulation.

-

-Arguments:

-

-  Pointer to CPU Architectural Protocol interface

-  Pointer to interrupt handlers

-  Interrupt type

-

-Returns:

-

-  Status

-    EFI_UNSUPPORTED - not yet implemented

-

---*/

-// TODO:    This - add argument and description to function comment

-// TODO:    InterruptType - add argument and description to function comment

-// TODO:    InterruptHandler - add argument and description to function comment

-{

-  CPU_ARCH_PROTOCOL_PRIVATE *Private;

-

-  //

-  // Do parameter checking for EFI spec conformance

-  //

-  if (InterruptType < 0 || InterruptType > 0xff) {

-    return EFI_UNSUPPORTED;

-  }

-  //

-  // Do nothing for Nt32 emulation

-  //

-  Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);

-  return EFI_UNSUPPORTED;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtGetTimerValue (

-  IN  EFI_CPU_ARCH_PROTOCOL *This,

-  IN  UINT32                TimerIndex,

-  OUT UINT64                *TimerValue,

-  OUT UINT64                *TimerPeriod OPTIONAL

-  )

-/*++

-

-Routine Description:

-

-  This routine would support querying of an on-CPU timer.  At present,

-  this code does not provide timer emulation.

-

-Arguments:

-

-  This        - Pointer to CPU Architectural Protocol interface

-  TimerIndex  - Index of given CPU timer

-  TimerValue  - Output of the timer

-  TimerPeriod - Output of the timer period

-

-Returns:

-

-  EFI_UNSUPPORTED       - not yet implemented

-  EFI_INVALID_PARAMETER - TimeValue is NULL

-

---*/

-{

-  if (TimerValue == NULL) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  //

-  // No timer supported

-  //

-  return EFI_UNSUPPORTED;

-}

-

-STATIC

-EFI_STATUS

-EFIAPI

-WinNtSetMemoryAttributes (

-  IN EFI_CPU_ARCH_PROTOCOL  *This,

-  IN EFI_PHYSICAL_ADDRESS   BaseAddress,

-  IN UINT64                 Length,

-  IN UINT64                 Attributes

-  )

-/*++

-

-Routine Description:

-

-  This routine would support querying of an on-CPU timer.  At present,

-  this code does not provide timer emulation.

-

-Arguments:

-

-  Pointer to CPU Architectural Protocol interface

-  Start address of memory region

-  The size in bytes of the memory region

-  The bit mask of attributes to set for the memory region

-

-Returns:

-

-  Status

-    EFI_UNSUPPORTED - not yet implemented

-

---*/

-// TODO:    This - add argument and description to function comment

-// TODO:    BaseAddress - add argument and description to function comment

-// TODO:    Length - add argument and description to function comment

-// TODO:    Attributes - add argument and description to function comment

-// TODO:    EFI_INVALID_PARAMETER - add return value to function comment

-{

-  CPU_ARCH_PROTOCOL_PRIVATE *Private;

-

-  //

-  // Check for invalid parameter for Spec conformance

-  //

-  if (Length == 0) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  //

-  // Do nothing for Nt32 emulation

-  //

-  Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);

-  return EFI_UNSUPPORTED;

-}

-

-

-EFI_STATUS

-EFIAPI

-InitializeCpu (

-  IN EFI_HANDLE        ImageHandle,

-  IN EFI_SYSTEM_TABLE  *SystemTable

-  )

-/*++

-

-Routine Description:

-

-  Initialize the state information for the CPU Architectural Protocol

-

-Arguments:

-

-  ImageHandle of the loaded driver

-  Pointer to the System Table

-

-Returns:

-

-  Status

-

-  EFI_SUCCESS           - protocol instance can be published

-  EFI_OUT_OF_RESOURCES  - cannot allocate protocol data structure

-  EFI_DEVICE_ERROR      - cannot create the thread

-

---*/

-// TODO:    SystemTable - add argument and description to function comment

-{

-  EFI_STATUS                Status;

-  EFI_EVENT                 Event;

-  CPU_ARCH_PROTOCOL_PRIVATE *Private;

-  VOID                      *Registration;

-

-  Private = AllocatePool (sizeof (CPU_ARCH_PROTOCOL_PRIVATE));

-  ASSERT (Private != NULL);

-

-  Private->Signature                    = CPU_ARCH_PROT_PRIVATE_SIGNATURE;

-  Private->Cpu.FlushDataCache           = WinNtFlushCpuDataCache;

-  Private->Cpu.EnableInterrupt          = WinNtEnableInterrupt;

-  Private->Cpu.DisableInterrupt         = WinNtDisableInterrupt;

-  Private->Cpu.GetInterruptState        = WinNtGetInterruptState;

-  Private->Cpu.Init                     = WinNtInit;

-  Private->Cpu.RegisterInterruptHandler = WinNtRegisterInterruptHandler;

-  Private->Cpu.GetTimerValue            = WinNtGetTimerValue;

-  Private->Cpu.SetMemoryAttributes      = WinNtSetMemoryAttributes;

-

-  Private->Cpu.NumberOfTimers           = 0;

-  Private->Cpu.DmaBufferAlignment       = 4;

-

-  Private->InterruptState               = TRUE;

-

-  Private->CpuIo.Mem.Read   = CpuMemoryServiceRead;

-  Private->CpuIo.Mem.Write  = CpuMemoryServiceWrite;

-  Private->CpuIo.Io.Read    = CpuIoServiceRead;

-  Private->CpuIo.Io.Write   = CpuIoServiceWrite;

-

-

-  Private->Handle                       = NULL;

-  Status = gBS->InstallMultipleProtocolInterfaces (

-                  &Private->Handle,

-                  &gEfiCpuArchProtocolGuid,   &Private->Cpu,

-                  &gEfiCpuIoProtocolGuid,     &Private->CpuIo,

-                  NULL

-                  );

-  ASSERT_EFI_ERROR (Status);

-

-  //

-  // Install notify function to store processor data to HII database and data hub.

-  //

-  Status = gBS->CreateEvent (

-                  EVT_NOTIFY_SIGNAL,

-                  TPL_CALLBACK,

-                  WinNtIoProtocolNotifyFunction,

-                  ImageHandle,

-                  &Event

-                  );

-  ASSERT (!EFI_ERROR (Status));

-

-  Status = gBS->RegisterProtocolNotify (

-                  &gEfiWinNtIoProtocolGuid,

-                  Event,

-                  &Registration

-                  );

-  ASSERT (!EFI_ERROR (Status));

-

-  //

-  // Should be at EFI_D_INFO, but lets us now things are running

-  //

-  DEBUG ((EFI_D_ERROR, "CPU Architectural Protocol Loaded\n"));

-

-

-

-  return Status;

-}

-

-UINTN

-Atoi (

-  CHAR16  *String

-  )

-/*++

-

-Routine Description:

-  Convert a unicode string to a UINTN

-

-Arguments:

-  String - Unicode string.

-

-Returns:

-  UINTN of the number represented by String.

-

---*/

-{

-  UINTN   Number;

-  CHAR16  *Str;

-

-  //

-  // skip preceeding white space

-  //

-  Str = String;

-  while ((*Str) && (*Str == ' ' || *Str == '"')) {

-    Str++;

-  }

-  //

-  // Convert ot a Number

-  //

-  Number = 0;

-  while (*Str != '\0') {

-    if ((*Str >= '0') && (*Str <= '9')) {

-      Number = (Number * 10) +*Str - '0';

-    } else {

-      break;

-    }

-

-    Str++;

-  }

-

-  return Number;

-}

-

-VOID

-EFIAPI

-WinNtIoProtocolNotifyFunction (

-  IN EFI_EVENT                Event,

-  IN VOID                     *Context

-  )

-/*++

-

-Routine Description:

-  This function will log processor version and frequency data to data hub.

-

-Arguments:

-  Event        - Event whose notification function is being invoked.

-  Context      - Pointer to the notification function's context.

-

-Returns:

-  None.

-

---*/

-{

-  EFI_STATUS                  Status;

-  EFI_CPU_DATA_RECORD_BUFFER  RecordBuffer;

-  EFI_DATA_RECORD_HEADER      *Record;

-  EFI_SUBCLASS_TYPE1_HEADER   *DataHeader;

-  UINT32                      HeaderSize;

-  UINT32                      TotalSize;

-  UINTN                       HandleCount;

-  UINTN                       HandleIndex;

-  UINT64                      MonotonicCount;

-  BOOLEAN                     RecordFound;

-  EFI_HANDLE                  *HandleBuffer;

-  EFI_WIN_NT_IO_PROTOCOL      *WinNtIo;

-  EFI_DATA_HUB_PROTOCOL       *DataHub;

-  EFI_HII_PROTOCOL            *Hii;

-  EFI_HII_HANDLE              StringHandle;

-  EFI_HII_PACKAGES            *PackageList;

-  STRING_REF                  Token;

-

-  DataHub         = NULL;

-  Token           = 0;

-  MonotonicCount  = 0;

-  RecordFound     = FALSE;

-

-  //

-  // Retrieve the list of all handles from the handle database

-  //

-  Status = gBS->LocateHandleBuffer (

-                  AllHandles,

-                  &gEfiWinNtIoProtocolGuid,

-                  NULL,

-                  &HandleCount,

-                  &HandleBuffer

-                  );

-  if (EFI_ERROR (Status)) {

-    return ;

-  }

-  //

-  // Locate HII protocol

-  //

-  Status = gBS->LocateProtocol (&gEfiHiiProtocolGuid, NULL, &Hii);

-  if (EFI_ERROR (Status)) {

-    return ;

-  }

-  //

-  // Locate DataHub protocol.

-  //

-  Status = gBS->LocateProtocol (&gEfiDataHubProtocolGuid, NULL, &DataHub);

-  if (EFI_ERROR (Status)) {

-    return ;

-  }

-  //

-  // Initialize data record header

-  //

-  mCpuDataRecordHeader.Instance = 1;

-  HeaderSize                    = sizeof (EFI_SUBCLASS_TYPE1_HEADER);

-

-  RecordBuffer.Raw              = AllocatePool (HeaderSize + EFI_CPU_DATA_MAXIMUM_LENGTH);

-  if (RecordBuffer.Raw == NULL) {

-    return ;

-  }

-

-  CopyMem (RecordBuffer.Raw, &mCpuDataRecordHeader, HeaderSize);

-

-  //

-  // Search the Handle array to find the CPU model and speed information

-  //

-  for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {

-    Status = gBS->OpenProtocol (

-                    HandleBuffer[HandleIndex],

-                    &gEfiWinNtIoProtocolGuid,

-                    &WinNtIo,

-                    Context,

-                    NULL,

-                    EFI_OPEN_PROTOCOL_GET_PROTOCOL

-                    );

-    if (EFI_ERROR (Status)) {

-      continue;

-    }

-

-    if ((WinNtIo->WinNtThunk->Signature == EFI_WIN_NT_THUNK_PROTOCOL_SIGNATURE) &&

-        CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtCPUModelGuid)

-          ) {

-      //

-      // Check if this record has been stored in data hub

-      //

-      do {

-        Status = DataHub->GetNextRecord (DataHub, &MonotonicCount, NULL, &Record);

-        if (Record->DataRecordClass == EFI_DATA_RECORD_CLASS_DATA) {

-          DataHeader = (EFI_SUBCLASS_TYPE1_HEADER *) (Record + 1);

-          if (CompareGuid (&Record->DataRecordGuid, &gEfiProcessorSubClassGuid) &&

-              (DataHeader->RecordType == ProcessorVersionRecordType)

-              ) {

-            RecordFound = TRUE;

-          }

-        }

-      } while (MonotonicCount != 0);

-

-      if (RecordFound) {

-        RecordFound = FALSE;

-        continue;

-      }

-      //

-      // Initialize strings to HII database

-      //

-      PackageList = PreparePackages (1, &gEfiProcessorProducerGuid, CpuStrings);

-

-      Status      = Hii->NewPack (Hii, PackageList, &StringHandle);

-      ASSERT (!EFI_ERROR (Status));

-

-      FreePool (PackageList);

-

-      //

-      // Store processor version data record to data hub

-      //

-      Status = Hii->NewString (Hii, NULL, StringHandle, &Token, WinNtIo->EnvString);

-      ASSERT (!EFI_ERROR (Status));

-

-      RecordBuffer.DataRecord->DataRecordHeader.RecordType      = ProcessorVersionRecordType;

-      RecordBuffer.DataRecord->VariableRecord.ProcessorVersion  = Token;

-      TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_VERSION_DATA);

-

-      Status = DataHub->LogData (

-                          DataHub,

-                          &gEfiProcessorSubClassGuid,

-                          &gEfiProcessorProducerGuid,

-                          EFI_DATA_RECORD_CLASS_DATA,

-                          RecordBuffer.Raw,

-                          TotalSize

-                          );

-    }

-

-    if ((WinNtIo->WinNtThunk->Signature == EFI_WIN_NT_THUNK_PROTOCOL_SIGNATURE) &&

-        CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtCPUSpeedGuid)

-          ) {

-      //

-      // Check if this record has been stored in data hub

-      //

-      do {

-        Status = DataHub->GetNextRecord (DataHub, &MonotonicCount, NULL, &Record);

-        if (Record->DataRecordClass == EFI_DATA_RECORD_CLASS_DATA) {

-          DataHeader = (EFI_SUBCLASS_TYPE1_HEADER *) (Record + 1);

-          if (CompareGuid (&Record->DataRecordGuid, &gEfiProcessorSubClassGuid) &&

-              (DataHeader->RecordType == ProcessorCoreFrequencyRecordType)

-              ) {

-            RecordFound = TRUE;

-          }

-        }

-      } while (MonotonicCount != 0);

-

-      if (RecordFound) {

-        RecordFound = FALSE;

-        continue;

-      }

-      //

-      // Store CPU frequency data record to data hub

-      //

-      RecordBuffer.DataRecord->DataRecordHeader.RecordType                    = ProcessorCoreFrequencyRecordType;

-      RecordBuffer.DataRecord->VariableRecord.ProcessorCoreFrequency.Value    = (UINT16) Atoi (WinNtIo->EnvString);

-      RecordBuffer.DataRecord->VariableRecord.ProcessorCoreFrequency.Exponent = 6;

-      TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_CORE_FREQUENCY_DATA);

-

-      Status = DataHub->LogData (

-                          DataHub,

-                          &gEfiProcessorSubClassGuid,

-                          &gEfiProcessorProducerGuid,

-                          EFI_DATA_RECORD_CLASS_DATA,

-                          RecordBuffer.Raw,

-                          TotalSize

-                          );

-

-      FreePool (RecordBuffer.Raw);

-    }

-

-    gBS->CloseProtocol (

-          HandleBuffer[HandleIndex],

-          &gEfiWinNtIoProtocolGuid,

-          Context,

-          NULL

-          );

-  }

-}

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Cpu/Cpu.dxs b/EdkNt32Pkg/Dxe/WinNtThunk/Cpu/Cpu.dxs
deleted file mode 100644
index 73d23fd..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Cpu/Cpu.dxs
+++ /dev/null
@@ -1,26 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  Cpu.dxs

-

-Abstract:

-

-  Dependency expression source file.

-  

---*/ 

-#include <DxeDepex.h>

-

-DEPENDENCY_START

-  EFI_DATA_HUB_PROTOCOL_GUID  AND

-  EFI_HII_PROTOCOL_GUID

-DEPENDENCY_END

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Cpu/Cpu.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Cpu/Cpu.msa
deleted file mode 100644
index f0f22f9..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Cpu/Cpu.msa
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>Cpu</ModuleName>

-    <ModuleType>DXE_DRIVER</ModuleType>

-    <GuidValue>ee993080-5197-4d4e-b63c-f1f7413e33ce</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>Component description file for Cpu module.</Abstract>

-    <Description>This CPU module abstracts the interrupt subsystem of a platform and the CPU-specific setjump-long pair.</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>Cpu</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>HiiLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiDriverEntryPoint</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseMemoryLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>MemoryAllocationLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiBootServicesTableLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>Strings.uni</Filename>

-    <Filename>CpuDriver.h</Filename>

-    <Filename>Cpu.c</Filename>

-    <Filename>CpuIo.c</Filename>

-    <Filename>Cpu.dxs</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <Protocols>

-    <Protocol Usage="ALWAYS_PRODUCED">

-      <ProtocolCName>gEfiCpuArchProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="ALWAYS_PRODUCED">

-      <ProtocolCName>gEfiCpuIoProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="ALWAYS_CONSUMED">

-      <ProtocolCName>gEfiWinNtIoProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="SOMETIMES_CONSUMED">

-      <ProtocolCName>gEfiHiiProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="SOMETIMES_CONSUMED">

-      <ProtocolCName>gEfiDataHubProtocolGuid</ProtocolCName>

-    </Protocol>

-    <ProtocolNotify Usage="SOMETIMES_CONSUMED">

-      <ProtocolNotifyCName>gEfiWinNtIoProtocolGuid</ProtocolNotifyCName>

-    </ProtocolNotify>

-  </Protocols>

-  <DataHubs>

-    <DataHubRecord Usage="SOMETIMES_PRODUCED">

-      <DataHubCName>ProcessorVersion</DataHubCName>

-    </DataHubRecord>

-    <DataHubRecord Usage="SOMETIMES_PRODUCED">

-      <DataHubCName>ProcessorCoreFrequency</DataHubCName>

-    </DataHubRecord>

-  </DataHubs>

-  <Guids>

-    <GuidCNames Usage="SOMETIMES_CONSUMED">

-      <GuidCName>gEfiProcessorProducerGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="SOMETIMES_CONSUMED">

-      <GuidCName>gEfiProcessorSubClassGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="SOMETIMES_CONSUMED">

-      <GuidCName>gEfiWinNtCPUModelGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="SOMETIMES_CONSUMED">

-      <GuidCName>gEfiWinNtCPUSpeedGuid</GuidCName>

-    </GuidCNames>

-  </Guids>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-    <Extern>

-      <ModuleEntryPoint>InitializeCpu</ModuleEntryPoint>

-    </Extern>

-  </Externs>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Cpu/CpuDriver.h b/EdkNt32Pkg/Dxe/WinNtThunk/Cpu/CpuDriver.h
deleted file mode 100644
index c9f04e1..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Cpu/CpuDriver.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  CpuDriver.h

-

-Abstract:

-

-  NT Emulation Architectural Protocol Driver as defined in Tiano.

-

---*/

-

-#ifndef _CPU_ARCHITECTURAL_PROTOCOL_DRIVER_H_

-#define _CPU_ARCHITECTURAL_PROTOCOL_DRIVER_H_

-

-

-

-extern UINT8  CpuStrings[];

-

-//

-// Internal Data Structures

-//

-#define CPU_ARCH_PROT_PRIVATE_SIGNATURE EFI_SIGNATURE_32 ('c', 'a', 'p', 'd')

-

-typedef struct {

-  UINTN                 Signature;

-  EFI_HANDLE            Handle;

-

-  EFI_CPU_ARCH_PROTOCOL Cpu;

-  EFI_CPU_IO_PROTOCOL   CpuIo;

-

-  //

-  // Local Data for CPU interface goes here

-  //

-  CRITICAL_SECTION      NtCriticalSection;

-  BOOLEAN               InterruptState;

-

-} CPU_ARCH_PROTOCOL_PRIVATE;

-

-#define CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS(a) \

-  CR (a, \

-      CPU_ARCH_PROTOCOL_PRIVATE, \

-      Cpu, \

-      CPU_ARCH_PROT_PRIVATE_SIGNATURE \

-      )

-

-EFI_STATUS

-EFIAPI

-CpuMemoryServiceRead (

-  IN  EFI_CPU_IO_PROTOCOL               *This,

-  IN  EFI_CPU_IO_PROTOCOL_WIDTH         Width,

-  IN  UINT64                            Address,

-  IN  UINTN                             Count,

-  IN  OUT VOID                          *Buffer

-  );

-

-EFI_STATUS

-EFIAPI

-CpuMemoryServiceWrite (

-  IN EFI_CPU_IO_PROTOCOL                *This,

-  IN  EFI_CPU_IO_PROTOCOL_WIDTH         Width,

-  IN  UINT64                            Address,

-  IN  UINTN                             Count,

-  IN  OUT VOID                          *Buffer

-  );

-

-EFI_STATUS

-EFIAPI

-CpuIoServiceRead (

-  IN EFI_CPU_IO_PROTOCOL                *This,

-  IN  EFI_CPU_IO_PROTOCOL_WIDTH         Width,

-  IN  UINT64                            UserAddress,

-  IN  UINTN                             Count,

-  IN  OUT VOID                          *UserBuffer

-  );

-

-EFI_STATUS

-EFIAPI

-CpuIoServiceWrite (

-  IN EFI_CPU_IO_PROTOCOL                *This,

-  IN  EFI_CPU_IO_PROTOCOL_WIDTH         Width,

-  IN  UINT64                            UserAddress,

-  IN  UINTN                             Count,

-  IN  OUT VOID                          *UserBuffer

-  );

-

-

-#endif

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Cpu/CpuIo.c b/EdkNt32Pkg/Dxe/WinNtThunk/Cpu/CpuIo.c
deleted file mode 100644
index 4aaa431..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Cpu/CpuIo.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  CpuIo.c

-

-Abstract:

-

-  This is the code that publishes the CPU I/O Protocol.

-  The intent herein is to have a single I/O service that can load

-  as early as possible, extend into runtime, and be layered upon by 

-  the implementations of architectural protocols and the PCI Root

-  Bridge I/O Protocol.

-

---*/

-

-#include <CpuDriver.h>

-

-#define IA32_MAX_IO_ADDRESS   0xFFFF

-#define IA32_MAX_MEM_ADDRESS  0xFFFFFFFF

-

-EFI_CPU_IO_PROTOCOL mCpuIoProtocol;

-

-EFI_STATUS

-CpuIoCheckAddressRange (

-  IN  EFI_CPU_IO_PROTOCOL_WIDTH         Width,

-  IN  UINT64                            Address,

-  IN  UINTN                             Count,

-  IN  VOID                              *Buffer,

-  IN  UINT64                            Limit

-  );

-

-EFI_STATUS

-EFIAPI

-CpuMemoryServiceRead (

-  IN  EFI_CPU_IO_PROTOCOL               *This,

-  IN  EFI_CPU_IO_PROTOCOL_WIDTH         Width,

-  IN  UINT64                            Address,

-  IN  UINTN                             Count,

-  IN  OUT VOID                          *Buffer

-  )

-/*++

-

-Routine Description:

-

-  Perform the Memory Access Read service for the CPU I/O Protocol

-

-Arguments:

-

-  Pointer to an instance of the CPU I/O Protocol

-  Width of the Memory Access

-  Address of the Memory access

-  Count of the number of accesses to perform

-  Pointer to the buffer to read or write from memory

-

-Returns:

-

-  Status

-

-  EFI_SUCCESS             - The data was read from or written to the EFI 

-                            System.

-  EFI_INVALID_PARAMETER   - Width is invalid for this EFI System.

-  EFI_INVALID_PARAMETER   - Buffer is NULL.

-  EFI_UNSUPPORTED         - The Buffer is not aligned for the given Width.

-  EFI_UNSUPPORTED         - The address range specified by Address, Width, 

-                            and Count is not valid for this EFI System.

-

---*/

-// TODO:    This - add argument and description to function comment

-{

-  EFI_STATUS  Status;

-

-  if (!Buffer) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  Status = CpuIoCheckAddressRange (Width, Address, Count, Buffer, IA32_MAX_MEM_ADDRESS);

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  //

-  // Do nothing for Nt32 version

-  //

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-EFIAPI

-CpuMemoryServiceWrite (

-  IN EFI_CPU_IO_PROTOCOL                *This,

-  IN  EFI_CPU_IO_PROTOCOL_WIDTH         Width,

-  IN  UINT64                            Address,

-  IN  UINTN                             Count,

-  IN  OUT VOID                          *Buffer

-  )

-/*++

-

-Routine Description:

-

-  Perform the Memory Access Read service for the CPU I/O Protocol

-

-Arguments:

-

-  Pointer to an instance of the CPU I/O Protocol

-  Width of the Memory Access

-  Address of the Memory access

-  Count of the number of accesses to perform

-  Pointer to the buffer to read or write from memory

-

-Returns:

-

-  Status

-

-  EFI_SUCCESS             - The data was read from or written to the EFI System.

-  EFI_INVALID_PARAMETER   - Width is invalid for this EFI System.

-  EFI_INVALID_PARAMETER   - Buffer is NULL.

-  EFI_UNSUPPORTED         - The Buffer is not aligned for the given Width.

-  EFI_UNSUPPORTED         - The address range specified by Address, Width, and 

-                            Count is not valid for this EFI System.

-

---*/

-// TODO:    This - add argument and description to function comment

-{

-  EFI_STATUS  Status;

-

-  if (!Buffer) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  Status = CpuIoCheckAddressRange (Width, Address, Count, Buffer, IA32_MAX_MEM_ADDRESS);

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  //

-  // Do nothing for Nt32 version

-  //

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-EFIAPI

-CpuIoServiceRead (

-  IN EFI_CPU_IO_PROTOCOL                *This,

-  IN  EFI_CPU_IO_PROTOCOL_WIDTH         Width,

-  IN  UINT64                            UserAddress,

-  IN  UINTN                             Count,

-  IN  OUT VOID                          *UserBuffer

-  )

-/*++

-

-Routine Description:

-  

-  This is the service that implements the I/O read

-

-Arguments:

-

-  Pointer to an instance of the CPU I/O Protocol

-  Width of the Memory Access

-  Address of the I/O access

-  Count of the number of accesses to perform

-  Pointer to the buffer to read or write from I/O space

-

-Returns:

-

-  Status

-  EFI_SUCCESS             - The data was read from or written to the EFI System.

-  EFI_INVALID_PARAMETER   - Width is invalid for this EFI System.

-  EFI_INVALID_PARAMETER   - Buffer is NULL.

-  EFI_UNSUPPORTED         - The Buffer is not aligned for the given Width.

-  EFI_UNSUPPORTED         - The address range specified by Address, Width, and 

-                            Count is not valid for this EFI System.

---*/

-// TODO:    This - add argument and description to function comment

-// TODO:    UserAddress - add argument and description to function comment

-// TODO:    UserBuffer - add argument and description to function comment

-{

-  UINTN       Address;

-  EFI_STATUS  Status;

-

-  if (!UserBuffer) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  Address = (UINTN) UserAddress;

-

-  if (Width >= EfiCpuIoWidthMaximum) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  Status = CpuIoCheckAddressRange (Width, Address, Count, UserBuffer, IA32_MAX_IO_ADDRESS);

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  //

-  // Do nothing for Nt32 version

-  //

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-EFIAPI

-CpuIoServiceWrite (

-  IN EFI_CPU_IO_PROTOCOL                *This,

-  IN  EFI_CPU_IO_PROTOCOL_WIDTH         Width,

-  IN  UINT64                            UserAddress,

-  IN  UINTN                             Count,

-  IN  OUT VOID                          *UserBuffer

-  )

-/*++

-

-Routine Description:

-

-  

-  This is the service that implements the I/O Write

-

-Arguments:

-

-  Pointer to an instance of the CPU I/O Protocol

-  Width of the Memory Access

-  Address of the I/O access

-  Count of the number of accesses to perform

-  Pointer to the buffer to read or write from I/O space

-

-Returns:

-

-  Status

-

-  Status

-  EFI_SUCCESS             - The data was read from or written to the EFI System.

-  EFI_INVALID_PARAMETER   - Width is invalid for this EFI System.

-  EFI_INVALID_PARAMETER   - Buffer is NULL.

-  EFI_UNSUPPORTED         - The Buffer is not aligned for the given Width.

-  EFI_UNSUPPORTED         - The address range specified by Address, Width, and 

-                            Count is not valid for this EFI System.

-

---*/

-// TODO:    This - add argument and description to function comment

-// TODO:    UserAddress - add argument and description to function comment

-// TODO:    UserBuffer - add argument and description to function comment

-{

-  UINTN       Address;

-  EFI_STATUS  Status;

-

-  if (!UserBuffer) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  Address = (UINTN) UserAddress;

-

-  if (Width >= EfiCpuIoWidthMaximum) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  Status = CpuIoCheckAddressRange (Width, Address, Count, UserBuffer, IA32_MAX_IO_ADDRESS);

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  //

-  // Do nothing for Nt32 version

-  //

-  return EFI_SUCCESS;

-}

-

-

-EFI_STATUS

-CpuIoCheckAddressRange (

-  IN  EFI_CPU_IO_PROTOCOL_WIDTH         Width,

-  IN  UINT64                            Address,

-  IN  UINTN                             Count,

-  IN  VOID                              *Buffer,

-  IN  UINT64                            Limit

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Width   - TODO: add argument description

-  Address - TODO: add argument description

-  Count   - TODO: add argument description

-  Buffer  - TODO: add argument description

-  Limit   - TODO: add argument description

-

-Returns:

-

-  EFI_UNSUPPORTED - TODO: Add description for return value

-  EFI_UNSUPPORTED - TODO: Add description for return value

-  EFI_UNSUPPORTED - TODO: Add description for return value

-  EFI_SUCCESS - TODO: Add description for return value

-

---*/

-{

-  UINTN AlignMask;

-

-  if (Address > Limit) {

-    return EFI_UNSUPPORTED;

-  }

-

-  //

-  // For FiFo type, the target address won't increase during the access, so treat count as 1

-  //

-  if (Width >= EfiCpuIoWidthFifoUint8 && Width <= EfiCpuIoWidthFifoUint64) {

-    Count = 1;

-  }

-

-  Width = Width & 0x03;

-  if (Address - 1 + (1 << Width) * Count > Limit) {

-    return EFI_UNSUPPORTED;

-  }

-

-  AlignMask = (1 << Width) - 1;

-  if ((UINTN) Buffer & AlignMask) {

-    return EFI_UNSUPPORTED;

-  }

-

-  return EFI_SUCCESS;

-}

-

-

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Cpu/Strings.uni b/EdkNt32Pkg/Dxe/WinNtThunk/Cpu/Strings.uni
deleted file mode 100644
index fd70fb9..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Cpu/Strings.uni
+++ /dev/null
Binary files differ
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/WinNtThunk/WinNtThunk.c b/EdkNt32Pkg/Dxe/WinNtThunk/WinNtThunk/WinNtThunk.c
deleted file mode 100644
index b1f139f..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/WinNtThunk/WinNtThunk.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  WinNtThunk.c

-

-Abstract:

-

-  Produce WinNtThunk protocol and it's associated device path and controller 

-  state protocols. WinNtThunk is to the NT emulation environment as 

-  PCI_ROOT_BRIGE is to real hardware. The WinNtBusDriver is the child of this

-  driver.

-

-  Since we are a root hardware abstraction we do not install a Driver Binding

-  protocol on this handle. This driver can only support one one WinNtThunk protocol

-  in the system, since the device path is hard coded.

-

---*/

-

-#include "WinNtThunk.h"

-

-//

-// WinNtThunk Device Path Protocol Instance

-//

-static WIN_NT_THUNK_DEVICE_PATH mWinNtThunkDevicePath = {

-  {

-    HARDWARE_DEVICE_PATH,

-    HW_VENDOR_DP,

-    (UINT8) (sizeof (VENDOR_DEVICE_PATH)),

-    (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),

-    EFI_WIN_NT_THUNK_PROTOCOL_GUID,

-  },

-  {

-    END_DEVICE_PATH_TYPE,

-    END_ENTIRE_DEVICE_PATH_SUBTYPE,

-    END_DEVICE_PATH_LENGTH,

-    0

-  }

-};

-

-

-EFI_STATUS

-EFIAPI

-InitializeWinNtThunk (

-  IN EFI_HANDLE                            ImageHandle,

-  IN EFI_SYSTEM_TABLE                      *SystemTable

-  )

-/*++

-

-Routine Description:

-  Install WinNtThunk Protocol and it's associated Device Path protocol

-

-Arguments:

-  (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)

-

-Returns:

-  EFI_SUCEESS - WinNtThunk protocol is added or error status from 

-                gBS->InstallMultiProtocolInterfaces().

-

---*/

-// TODO:    ImageHandle - add argument and description to function comment

-// TODO:    SystemTable - add argument and description to function comment

-{

-  EFI_STATUS  Status;

-  EFI_HANDLE  ControllerHandle;

-

-  ControllerHandle = NULL;

-  Status = gBS->InstallMultipleProtocolInterfaces (

-                  &ControllerHandle,

-                  &gEfiWinNtThunkProtocolGuid,

-                  gWinNt,

-                  &gEfiDevicePathProtocolGuid,

-                  &mWinNtThunkDevicePath,

-                  NULL

-                  );

-

-  return Status;

-}

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/WinNtThunk/WinNtThunk.dxs b/EdkNt32Pkg/Dxe/WinNtThunk/WinNtThunk/WinNtThunk.dxs
deleted file mode 100644
index a6bab01..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/WinNtThunk/WinNtThunk.dxs
+++ /dev/null
@@ -1,26 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  WinNtThunk.dxs

-

-Abstract:

-

-  Dependency expression source file.

-  

---*/  

-

-#include <DxeDepex.h>

-

-DEPENDENCY_START

-  TRUE

-DEPENDENCY_END

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/WinNtThunk/WinNtThunk.h b/EdkNt32Pkg/Dxe/WinNtThunk/WinNtThunk/WinNtThunk.h
deleted file mode 100644
index 6f474b3..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/WinNtThunk/WinNtThunk.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  WinNtThunk.h

-

-Abstract:

-

---*/

-

-// TODO: add protective #ifndef

-

-

-//

-// WinNtThunk Device Path Protocol Instance Type

-//

-typedef struct {

-  VENDOR_DEVICE_PATH        Vendor;

-  EFI_DEVICE_PATH_PROTOCOL  EndDevicePath;

-} WIN_NT_THUNK_DEVICE_PATH;

-

diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/WinNtThunk/WinNtThunk.msa b/EdkNt32Pkg/Dxe/WinNtThunk/WinNtThunk/WinNtThunk.msa
deleted file mode 100644
index 223f4e6..0000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/WinNtThunk/WinNtThunk.msa
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>WinNtThunk</ModuleName>

-    <ModuleType>DXE_DRIVER</ModuleType>

-    <GuidValue>0C95A916-A006-11d4-BCFA-0080C73C8881</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>A DXE driver to produce EFI_WIN_NT_THUNK_PROTOCOL</Abstract>

-    <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>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>WinNtThunk</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiDriverEntryPoint</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>WinNtLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiBootServicesTableLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>WinNtThunk.h</Filename>

-    <Filename>WinNtThunk.c</Filename>

-    <Filename>WinNtThunk.dxs</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <Protocols>

-    <Protocol Usage="ALWAYS_PRODUCED">

-      <ProtocolCName>gEfiWinNtThunkProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="ALWAYS_PRODUCED">

-      <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>

-    </Protocol>

-  </Protocols>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-    <Extern>

-      <ModuleEntryPoint>InitializeWinNtThunk</ModuleEntryPoint>

-    </Extern>

-  </Externs>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/EdkNt32Pkg.spd b/EdkNt32Pkg/EdkNt32Pkg.spd
deleted file mode 100644
index 18bd8f4..0000000
--- a/EdkNt32Pkg/EdkNt32Pkg.spd
+++ /dev/null
@@ -1,368 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<PackageSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <SpdHeader>

-    <PackageName>EdkNt32Pkg</PackageName>

-    <GuidValue>0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3</GuidValue>

-    <Version>0.3</Version>

-    <Abstract>This is the NT32 Emulation Environment Platform</Abstract>

-    <Description>Reference platform implementation using an emulator.</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>

-    <License>All rights reserved.
-      This program and the accompanying materials are licensed and made available
-      under the terms and conditions of the BSD License which accompanies this distribution.
-      The full text of the license may be found at http://opensource.org/licenses/bsd-license.php
-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES
-      OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </SpdHeader>

-  <PackageDefinitions>

-    <ReadOnly>true</ReadOnly>

-    <RePackage>false</RePackage>

-  </PackageDefinitions>

-  <LibraryClassDeclarations>

-    <LibraryClass Name="EdkGenericBdsLib">

-      <IncludeHeader>Include/Library/EdkGenericBdsLib.h</IncludeHeader>

-      <HelpText/>

-    </LibraryClass>

-    <LibraryClass Name="WinNtLib">

-      <IncludeHeader>Include/Library/WinNtLib.h</IncludeHeader>

-      <HelpText/>

-    </LibraryClass>

-  </LibraryClassDeclarations>

-  <IndustryStdIncludes>

-    <IndustryStdHeader Name="WinNTInclude">

-      <IncludeHeader>Include/Common/WinNTInclude.h</IncludeHeader>

-      <HelpText/>

-    </IndustryStdHeader>

-    <IndustryStdHeader Name="EdkGenericBdsLib">

-      <IncludeHeader>Include/Library/EdkGenericBdsLib.h</IncludeHeader>

-      <HelpText/>

-    </IndustryStdHeader>

-    <IndustryStdHeader Name="WinNtLib">

-      <IncludeHeader>Include/Library/WinNtLib.h</IncludeHeader>

-      <HelpText/>

-    </IndustryStdHeader>

-    <IndustryStdHeader Name="NtAutoscan">

-      <IncludeHeader>Include/Ppi/NtAutoscan.h</IncludeHeader>

-      <HelpText/>

-    </IndustryStdHeader>

-    <IndustryStdHeader Name="NtFwh">

-      <IncludeHeader>Include/Ppi/NtFwh.h</IncludeHeader>

-      <HelpText/>

-    </IndustryStdHeader>

-    <IndustryStdHeader Name="NtPeiLoadFile">

-      <IncludeHeader>Include/Ppi/NtPeiLoadFile.h</IncludeHeader>

-      <HelpText/>

-    </IndustryStdHeader>

-    <IndustryStdHeader Name="NtThunk">

-      <IncludeHeader>Include/Ppi/NtThunk.h</IncludeHeader>

-      <HelpText/>

-    </IndustryStdHeader>

-    <IndustryStdHeader Name="WinNtIo">

-      <IncludeHeader>Include/Protocol/WinNtIo.h</IncludeHeader>

-      <HelpText/>

-    </IndustryStdHeader>

-    <IndustryStdHeader Name="WinNtThunk">

-      <IncludeHeader>Include/Protocol/WinNtThunk.h</IncludeHeader>

-      <HelpText/>

-    </IndustryStdHeader>

-    <IndustryStdHeader Name="FlashLayout">

-      <IncludeHeader>Include/FlashLayout.h</IncludeHeader>

-      <HelpText/>

-    </IndustryStdHeader>

-    <IndustryStdHeader Name="WinNtDxe">

-      <IncludeHeader>Include/WinNtDxe.h</IncludeHeader>

-      <HelpText/>

-    </IndustryStdHeader>

-    <IndustryStdHeader Name="WinNtPeim">

-      <IncludeHeader>Include/WinNtPeim.h</IncludeHeader>

-      <HelpText/>

-    </IndustryStdHeader>

-  </IndustryStdIncludes>

-  <MsaFiles>

-    <Filename>Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriver.msa</Filename>

-    <Filename>Dxe/PlatformBds/PlatformBds.msa</Filename>

-    <Filename>Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.msa</Filename>

-    <Filename>Dxe/WinNtThunk/Bus/Console/WinNtConsole.msa</Filename>

-    <Filename>Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.msa</Filename>

-    <Filename>Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.msa</Filename>

-    <Filename>Dxe/WinNtThunk/Bus/Uga/WinNtUga.msa</Filename>

-    <Filename>Dxe/WinNtThunk/Bus/Gop/WinNtGop.msa</Filename>

-    <Filename>Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.msa</Filename>

-    <Filename>Dxe/WinNtThunk/Chipset/Metronome/Metronome.msa</Filename>

-    <Filename>Dxe/WinNtThunk/Chipset/RealTimeClock/RealTimeClock.msa</Filename>

-    <Filename>Dxe/WinNtThunk/Chipset/Reset/Reset.msa</Filename>

-    <Filename>Dxe/WinNtThunk/Chipset/Timer/Timer.msa</Filename>

-    <Filename>Dxe/WinNtThunk/Cpu/Cpu.msa</Filename>

-    <Filename>Dxe/WinNtThunk/WinNtThunk/WinNtThunk.msa</Filename>

-    <Filename>Library/DxeWinNtLib/DxeWinNtLib.msa</Filename>

-    <Filename>Library/EdkGenericBdsLib/EdkGenericBdsLib.msa</Filename>

-    <Filename>Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.msa</Filename>

-    <Filename>Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoaderLib.msa</Filename>

-    <Filename>Library/PeiNt32OemHookStatusCodeLib/PeiNt32OemHookStatusCodeLib.msa</Filename>

-    <Filename>Library/DxeNt32OemHookStatusCodeLib/DxeNt32OemHookStatusCodeLib.msa</Filename>

-    <Filename>Logo/Logo.msa</Filename>

-    <Filename>Pei/Autoscan/WinNtAutoScan.msa</Filename>

-    <Filename>Pei/BootMode/BootMode.msa</Filename>

-    <Filename>Pei/FirmwareVolume/WinNtFwh.msa</Filename>

-    <Filename>Pei/FlashMap/FlashMap.msa</Filename>

-    <Filename>Pei/WinNtStuff/WinNtStuff.msa</Filename>

-    <Filename>RuntimeDxe/FvbServices/Nt32Fwh.msa</Filename>

-    <Filename>Sec/SecMain.msa</Filename>

-  </MsaFiles>

-  <PackageHeaders>

-    <IncludePkgHeader ModuleType="SEC">Include/WinNtPeim.h</IncludePkgHeader>

-    <IncludePkgHeader ModuleType="PEIM">Include/WinNtPeim.h</IncludePkgHeader>

-    <IncludePkgHeader ModuleType="DXE_DRIVER">Include/WinNtDxe.h</IncludePkgHeader>

-    <IncludePkgHeader ModuleType="DXE_RUNTIME_DRIVER">Include/WinNtDxe.h</IncludePkgHeader>

-    <IncludePkgHeader ModuleType="DXE_SMM_DRIVER">Include/WinNtDxe.h</IncludePkgHeader>

-    <IncludePkgHeader ModuleType="DXE_SAL_DRIVER">Include/WinNtDxe.h</IncludePkgHeader>

-    <IncludePkgHeader ModuleType="UEFI_DRIVER">Include/WinNtDxe.h</IncludePkgHeader>

-  </PackageHeaders>

-  <GuidDeclarations>

-    <Entry Name="EdkNt32PkgTokenSpace" GuidTypeList="TOKEN_SPACE_GUID">

-      <C_Name>gEfiEdkNt32PkgTokenSpaceGuid</C_Name>

-      <GuidValue>0D79A645-1D91-40a6-A81F-61E6982B32B4</GuidValue>

-      <HelpText>All PCD define in EdkNt32Pkg is in this token space scope</HelpText>

-    </Entry>

-    <Entry Name="WinNtVirtualDisks" GuidTypeList="GUID">

-      <C_Name>gEfiWinNtVirtualDisksGuid</C_Name>

-      <GuidValue>0C95A928-A006-11D4-BCFA-0080C73C8881</GuidValue>

-      <HelpText>This variable defines virtual disk the emulator/WinNtBusDriver will produce.</HelpText>

-    </Entry>

-    <Entry Name="WinNtPhysicalDisks" GuidTypeList="GUID">

-      <C_Name>gEfiWinNtPhysicalDisksGuid</C_Name>

-      <GuidValue>0C95A92F-A006-11D4-BCFA-0080C73C8881</GuidValue>

-      <HelpText>This variable defines phisical disk emulator/WinNtBusDriver will produce.</HelpText>

-    </Entry>

-    <Entry Name="WinNtFileSystem" GuidTypeList="GUID">

-      <C_Name>gEfiWinNtFileSystemGuid</C_Name>

-      <GuidValue>0C95A935-A006-11D4-BCFA-0080C73C8881</GuidValue>

-      <HelpText>This variable defines file system the emulator/WinNtBusDriver will produce.</HelpText>

-    </Entry>

-    <Entry Name="WinNtSerialPort" GuidTypeList="GUID">

-      <C_Name>gEfiWinNtSerialPortGuid</C_Name>

-      <GuidValue>0C95A93D-A006-11D4-BCFA-0080C73C8881</GuidValue>

-      <HelpText>This variable defines virtual serial device the emulator/WinNtBusDriver will produce.</HelpText>

-    </Entry>

-    <Entry Name="WinNtGop" GuidTypeList="GUID">

-      <C_Name>gEfiWinNtGopGuid</C_Name>

-      <GuidValue>4e11e955-ccca-11d4-bd0d-0080c73c8881</GuidValue>

-      <HelpText>This variable defines virtual GOP device the emulator/WinNtBusDriver will produce.</HelpText>

-    </Entry>

-    <Entry Name="WinNtUga" GuidTypeList="GUID">

-      <C_Name>gEfiWinNtUgaGuid</C_Name>

-      <GuidValue>AB248E99-ABE1-11D4-BD0D-0080C73C8881</GuidValue>

-      <HelpText>This variable defines virtual VGA device the emulator/WinNtBusDriver will produce.</HelpText>

-    </Entry>

-    <Entry Name="WinNtConsole" GuidTypeList="GUID">

-      <C_Name>gEfiWinNtConsoleGuid</C_Name>

-      <GuidValue>BA73672C-A5D3-11D4-BD00-0080C73C8881</GuidValue>

-      <HelpText>This variable defines virtual Console the emulator/WinNtBusDriver will produce.</HelpText>

-    </Entry>

-    <Entry Name="WinNtMemory" GuidTypeList="GUID">

-      <C_Name>gEfiWinNtMemoryGuid</C_Name>

-      <GuidValue>99042912-122A-11D4-BD0D-0080C73C8881</GuidValue>

-      <HelpText>This variable defines virtual Memory the emulator/WinNtBusDriver will produce.</HelpText>

-    </Entry>

-    <Entry Name="WinNtCPUModel" GuidTypeList="GUID">

-      <C_Name>gEfiWinNtCPUModelGuid</C_Name>

-      <GuidValue>BEE9B6CE-2F8A-11D4-BD0D-0080C73C8881</GuidValue>

-      <HelpText>This variable defines model of the CPU the emulator/WinNtBusDriver will produce.</HelpText>

-    </Entry>

-    <Entry Name="WinNtCPUSpeed" GuidTypeList="GUID">

-      <C_Name>gEfiWinNtCPUSpeedGuid</C_Name>

-      <GuidValue>D4F29055-E1FB-11D4-BD0D-0080C73C8881</GuidValue>

-      <HelpText>This variable defines speed of the CPU the emulator/WinNtBusDriver will produce.</HelpText>

-    </Entry>

-    <Entry Name="WinNPassThrough" GuidTypeList="GUID">

-      <C_Name>gEfiWinNtPassThroughGuid</C_Name>

-      <GuidValue>CC664EB8-3C24-4086-B6F6-34E856BCE36E</GuidValue>

-      <HelpText>This variable defines virtual Pass Thru devicehardware the emulator/WinNtBusDriver will produce.</HelpText>

-    </Entry>

-  </GuidDeclarations>

-  <ProtocolDeclarations>

-    <Entry Name="WinNtIo">

-      <C_Name>gEfiWinNtIoProtocolGuid</C_Name>

-      <GuidValue>96EB4AD6-A32A-11D4-BCFD-0080C73C8881</GuidValue>

-      <HelpText/>

-    </Entry>

-    <Entry Name="WinNtThunk">

-      <C_Name>gEfiWinNtThunkProtocolGuid</C_Name>

-      <GuidValue>58C518B1-76F3-11D4-BCEA-0080C73C8881</GuidValue>

-      <HelpText/>

-    </Entry>

-    <Entry Name="WinNtBusDriver">

-      <C_Name>gWinNtBusDriverGuid</C_Name>

-      <GuidValue>0419f582-0625-4531-8a33-85a9965c95bc</GuidValue>

-      <HelpText/>

-    </Entry>

-  </ProtocolDeclarations>

-  <PpiDeclarations>

-    <Entry Name="NtAutoScan">

-      <C_Name>gPeiNtAutoScanPpiGuid</C_Name>

-      <GuidValue>0DCE384D-007C-4BA5-94BD-0F6EB64D2AA9</GuidValue>

-      <HelpText/>

-    </Entry>

-    <Entry Name="NtFwh">

-      <C_Name>gNtFwhPpiGuid</C_Name>

-      <GuidValue>4E76928F-50AD-4334-B06B-A84213108A57</GuidValue>

-      <HelpText/>

-    </Entry>

-    <Entry Name="NtPeiLoadFile">

-      <C_Name>gNtPeiLoadFilePpiGuid</C_Name>

-      <GuidValue>FD0C65EB-0405-4CD2-8AEE-F400EF13BAC2</GuidValue>

-      <HelpText/>

-    </Entry>

-    <Entry Name="NtThunk">

-      <C_Name>gPeiNtThunkPpiGuid</C_Name>

-      <GuidValue>98C281E5-F906-43DD-A92B-B003BF2765DA</GuidValue>

-      <HelpText/>

-    </Entry>

-  </PpiDeclarations>

-  <PcdDeclarations>

-    <PcdEntry>

-      <C_Name>PcdWinNtPhysicalDisk</C_Name>

-      <Token>0x00001000</Token>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>VOID*</DatumType>

-      <ValidUsage>DYNAMIC</ValidUsage>

-      <DefaultValue>L"E:RW;245760;512"</DefaultValue>

-      <HelpText>This PCD defines physical disk which will be simualted as a
-        harddisk in simulator. The item type of this PCD can only be "DYNAMIC".</HelpText>

-    </PcdEntry>

-    <PcdEntry>

-      <C_Name>PcdWinNtVirtualDisk</C_Name>

-      <Token>0x00001001</Token>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>VOID*</DatumType>

-      <ValidUsage>DYNAMIC</ValidUsage>

-      <DefaultValue>L"FW;40960;512"</DefaultValue>

-      <HelpText>This PCD defines the devices which use a file to emulate a hard disk or
-        removable media device.The item type of this PCD can only be "DYNAMIC".</HelpText>

-    </PcdEntry>

-    <PcdEntry>

-      <C_Name>PcdWinNtSerialPort</C_Name>

-      <Token>0x00001002</Token>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>VOID*</DatumType>

-      <ValidUsage>DYNAMIC</ValidUsage>

-      <DefaultValue>L"COM1!COM2"</DefaultValue>

-      <HelpText>This Pcd declares two serial port for simulated environment.
-        The item type of this PCD can only be "DYNAMIC".</HelpText>

-    </PcdEntry>

-    <PcdEntry>

-      <C_Name>PcdWinNtUga</C_Name>

-      <Token>0x00001003</Token>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>VOID*</DatumType>

-      <ValidUsage>DYNAMIC</ValidUsage>

-      <DefaultValue>L"UGA Window 1!UGA Window 2"</DefaultValue>

-      <HelpText>This PCD declares the resolutions for the UGA windows.
-        The item type of this PCD can only be "DYNAMIC".</HelpText>

-    </PcdEntry>

-    <PcdEntry>

-      <C_Name>PcdWinNtFileSystem</C_Name>

-      <Token>0x00001004</Token>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>VOID*</DatumType>

-      <ValidUsage>DYNAMIC</ValidUsage>

-      <DefaultValue>L".!..\\..\\..\\..\\EdkShellBinPkg\\bin\\ia32\\Apps"</DefaultValue>

-      <HelpText>This PCD defines the windows directory who will be mounted as
-        harddisk in simulator.
-        The item type of this PCD can only be "DYNAMIC".</HelpText>

-    </PcdEntry>

-    <PcdEntry>

-      <C_Name>PcdWinNtMemorySize</C_Name>

-      <Token>0x00001005</Token>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>VOID*</DatumType>

-      <ValidUsage>DYNAMIC</ValidUsage>

-      <DefaultValue>L"64!64"</DefaultValue>

-      <HelpText>This PCD defines the memory size of simulated machine. Simulator will allocate
-        the size of PcdWinNtMemorySize in windows platform.
-        The item type of this PCD can only be "DYNAMIC".</HelpText>

-    </PcdEntry>

-    <PcdEntry>

-      <C_Name>PcdWinNtBootMode</C_Name>

-      <Token>0x00001006</Token>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>UINT32</DatumType>

-      <ValidUsage>FIXED_AT_BUILD PATCHABLE_IN_MODULE</ValidUsage>

-      <DefaultValue>1</DefaultValue>

-      <HelpText>This PCD defines the boot mode for simualtor.
-        The boot mode can be set as following value:
-          0x0:  Boot with full configuration.
-          0x1:  Boot with minimal configuration.
-          0x2:  Boot assume no configuration changes.
-          0x3:  Boot with full configuration plus diagnostics.
-          0x4:  Boot with default settings.
-          0x5:  Boot on S4 resume.
-          0x6:  Boot on S5 resume.
-          0x10: Boot on S2 resume.
-          0x11: Boot on S3 resume.
-          0x12: Boot on flash update.
-          0x20: Boot in reovery mode.</HelpText>

-    </PcdEntry>

-    <PcdEntry>

-      <C_Name>PcdWinNtCpuModel</C_Name>

-      <Token>0x00001007</Token>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>VOID*</DatumType>

-      <ValidUsage>DYNAMIC</ValidUsage>

-      <DefaultValue>L"Intel(R) Processor Model"</DefaultValue>

-      <HelpText>This PCD defines simulated CPU model string.
-        The item type of this PCD can only be "DYNAMIC".</HelpText>

-    </PcdEntry>

-    <PcdEntry>

-      <C_Name>PcdWinNtCpuSpeed</C_Name>

-      <Token>0x00001008</Token>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>VOID*</DatumType>

-      <ValidUsage>DYNAMIC</ValidUsage>

-      <DefaultValue>L"3000"</DefaultValue>

-      <HelpText>This PCD defines simulated CPU speed string.
-        The item type of this PCD can only be "DYNAMIC".</HelpText>

-    </PcdEntry>

-    <PcdEntry>

-      <C_Name>PcdWinNtFirmwareVolume</C_Name>

-      <Token>0x00001009</Token>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>VOID*</DatumType>

-      <ValidUsage>FIXED_AT_BUILD PATCHABLE_IN_MODULE</ValidUsage>

-      <DefaultValue>L"..\\Fv\\Fv_Recovery.fd"</DefaultValue>

-      <HelpText>This PCD defines the FD file windows path string. Simulator will load the FD file and execute.</HelpText>

-    </PcdEntry>

-    <PcdEntry>

-      <C_Name>PcdWinNtConsole</C_Name>

-      <Token>0x0000100a</Token>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>VOID*</DatumType>

-      <ValidUsage>DYNAMIC</ValidUsage>

-      <DefaultValue>L"Bus Driver Console Window"</DefaultValue>

-      <HelpText>This PCD declares the title string of the text console window.
-        such as "My EFI Console".
-        The item type of this PCD can only be "DYNAMIC".</HelpText>

-    </PcdEntry>

-    <PcdEntry>

-      <C_Name>PcdWinNtMemorySizeForSecMain</C_Name>

-      <Token>0x0000100c</Token>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>VOID*</DatumType>

-      <ValidUsage>FIXED_AT_BUILD PATCHABLE_IN_MODULE</ValidUsage>

-      <DefaultValue>L"64!64"</DefaultValue>

-      <HelpText>This PCD defines the memory size of simulated machine. Simulator will allocate
-        the size of PcdWinNtMemorySizeForSecMain in windows platform.</HelpText>

-    </PcdEntry>

-    <PcdEntry>

-      <C_Name>PcdWinNtGop</C_Name>

-      <Token>0x0000100d</Token>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>VOID*</DatumType>

-      <ValidUsage>DYNAMIC</ValidUsage>

-      <DefaultValue>L"UGA Window 1!UGA Window 2"</DefaultValue>

-      <HelpText>This PCD declares the resolutions for the GOP windows.
-        The item type of this PCD can only be "DYNAMIC".</HelpText>

-    </PcdEntry>

-  </PcdDeclarations>

-</PackageSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Include/Common/WinNTInclude.h b/EdkNt32Pkg/Include/Common/WinNTInclude.h
deleted file mode 100644
index a8d31c3..0000000
--- a/EdkNt32Pkg/Include/Common/WinNTInclude.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-  WinNtLib.h

-

-Abstract:

-  Public include file for the WinNt Library

-

---*/

-

-#ifndef __WIN_NT_INCLUDE_H__

-#define __WIN_NT_INCLUDE_H__

-

-//

-// Win32 include files do not compile clean with /W4, so we use the warning

-// pragma to suppress the warnings for Win32 only. This way our code can stil

-// compile at /W4 (highest warning level) with /WX (warnings cause build

-// errors).

-//

-#pragma warning(disable : 4115)

-#pragma warning(disable : 4201)

-#pragma warning(disable : 4214)

-#pragma warning(disable : 4028)

-#pragma warning(disable : 4133)

-

-#define GUID  _WINNT_DUP_GUID_____

-#define _LIST_ENTRY  _WINNT_DUP_LIST_ENTRY_FORWARD

-#define LIST_ENTRY   _WINNT_DUP_LIST_ENTRY

-#define InterlockedIncrement _WINNT_DUP_InterlockedIncrement

-#define InterlockedDecrement _WINNT_DUP_InterlockedDecrement

-#define InterlockedCompareExchange64 _WINNT_DUP_InterlockedCompareExchange64

-#undef UNALIGNED

-#undef CONST

-#undef VOID

-

-#include "windows.h"

-

-#undef GUID

-#undef _LIST_ENTRY

-#undef LIST_ENTRY

-#undef InterlockedIncrement

-#undef InterlockedDecrement

-#undef InterlockedCompareExchange64

-#undef InterlockedCompareExchangePointer

-

-#define VOID void

-

-//

-// Prevent collisions with Windows API name macros that deal with Unicode/Not issues

-//

-#undef LoadImage

-#undef CreateEvent

-

-//

-// Set the warnings back on as the EFI code must be /W4.

-//

-#pragma warning(default : 4115)

-#pragma warning(default : 4201)

-#pragma warning(default : 4214)

-

-

-#endif

diff --git a/EdkNt32Pkg/Include/FlashLayout.h b/EdkNt32Pkg/Include/FlashLayout.h
deleted file mode 100644
index 1a13f16..0000000
--- a/EdkNt32Pkg/Include/FlashLayout.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  FlashLayout.h

-   

-Abstract:

-

-  Platform specific flash layout

-

-  BugBug: We need a better way

-

---*/

-

-#ifndef __EFI_FLASH_LAYOUT__

-#define __EFI_FLASH_LAYOUT__

-

-//

-// Firmware Volume Information for Nt32

-// adding one working block before FFS FV,

-// and another one for spare block behind FFS FV

-//

-//

-// Note: When block number is changed in .dsc file,

-//       this value should be changed accordingly!!!

-//

-#define FIRMWARE_BLOCK_NUMBER                         0x28

-

-#define EFI_WINNT_FIRMWARE_OFFSET                     0x0

-#define EFI_WINNT_FIRMWARE_LENGTH                     (0x10000 * FIRMWARE_BLOCK_NUMBER)

-

-#define EFI_WINNT_RUNTIME_UPDATABLE_OFFSET            (EFI_WINNT_FIRMWARE_OFFSET + EFI_WINNT_FIRMWARE_LENGTH)

-

-#define EFI_WINNT_RUNTIME_UPDATABLE_LENGTH            0x10000

-

-#define EFI_WINNT_FTW_SPARE_BLOCK_OFFSET              (EFI_WINNT_RUNTIME_UPDATABLE_OFFSET + EFI_WINNT_RUNTIME_UPDATABLE_LENGTH)

-

-#define EFI_WINNT_FTW_SPARE_BLOCK_LENGTH              0x10000

-

-#define EFI_WINNT_RUNTIME_UPDATABLE_FV_HEADER_LENGTH  0x48

-

-#define EFI_VARIABLE_STORE_OFFSET                     EFI_WINNT_RUNTIME_UPDATABLE_OFFSET

-

-#define EFI_VARIABLE_STORE_LENGTH                     0x00C000

-

-#define EFI_EVENT_LOG_OFFSET                          (EFI_VARIABLE_STORE_OFFSET + EFI_VARIABLE_STORE_LENGTH)

-

-#define EFI_EVENT_LOG_LENGTH                          0x002000

-

-#define EFI_FTW_WORKING_OFFSET                        (EFI_EVENT_LOG_OFFSET + EFI_EVENT_LOG_LENGTH)

-

-#define EFI_FTW_WORKING_LENGTH                        0x002000

-

-#endif

-

diff --git a/EdkNt32Pkg/Include/Library/EdkGenericBdsLib.h b/EdkNt32Pkg/Include/Library/EdkGenericBdsLib.h
deleted file mode 100644
index 5ef1838..0000000
--- a/EdkNt32Pkg/Include/Library/EdkGenericBdsLib.h
+++ /dev/null
@@ -1,395 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  BdsLib.h

-

-Abstract:

-

-  BDS library definition, include the file and data structure

-

---*/

-

-#ifndef _BDS_LIB_H_

-#define _BDS_LIB_H_

-

-extern EFI_HANDLE mBdsImageHandle;

-

-//

-// Constants which are variable names used to access variables

-//

-#define VarLegacyDevOrder L"LegacyDevOrder"

-

-//

-// Data structures and defines

-//

-#define FRONT_PAGE_QUESTION_ID  0x0000

-#define FRONT_PAGE_DATA_WIDTH   0x01

-

-//

-// ConnectType

-//

-#define CONSOLE_OUT 0x00000001

-#define STD_ERROR   0x00000002

-#define CONSOLE_IN  0x00000004

-#define CONSOLE_ALL (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)

-

-//

-// Load Option Attributes defined in EFI Specification

-//

-#define LOAD_OPTION_ACTIVE              0x00000001

-#define LOAD_OPTION_FORCE_RECONNECT     0x00000002

-#define IS_LOAD_OPTION_TYPE(_c, _Mask)  (BOOLEAN) (((_c) & (_Mask)) != 0)

-

-//

-// Define Maxmim characters that will be accepted

-//

-#define MAX_CHAR            480

-#define MAX_CHAR_SIZE       (MAX_CHAR * 2)

-

-#define MIN_ALIGNMENT_SIZE  4

-#define ALIGN_SIZE(a)       ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0)

-

-//

-// Define maximum characters for boot option variable "BootXXXX"

-//

-#define BOOT_OPTION_MAX_CHAR 10

-

-//

-// This data structure is the part of BDS_CONNECT_ENTRY that we can hard code.

-//

-#define BDS_LOAD_OPTION_SIGNATURE EFI_SIGNATURE_32 ('B', 'd', 'C', 'O')

-

-typedef struct {

-

-  UINTN                     Signature;

-  LIST_ENTRY                Link;

-

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;

-

-  CHAR16                    *OptionName;

-  UINTN                     OptionNumber;

-  UINT16                    BootCurrent;

-  UINT32                    Attribute;

-  CHAR16                    *Description;

-  VOID                      *LoadOptions;

-  UINT32                    LoadOptionsSize;

-

-} BDS_COMMON_OPTION;

-

-typedef struct {

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;

-  UINTN                     ConnectType;

-} BDS_CONSOLE_CONNECT_ENTRY;

-

-//

-// Lib Functions

-//

-

-//

-// Bds boot relate lib functions

-//

-EFI_STATUS

-BdsLibUpdateBootOrderList (

-  IN  LIST_ENTRY                 *BdsOptionList,

-  IN  CHAR16                     *VariableName

-  );

-

-VOID

-BdsLibBootNext (

-  VOID

-  );

-

-EFI_STATUS

-BdsLibBootViaBootOption (

-  IN  BDS_COMMON_OPTION             * Option,

-  IN  EFI_DEVICE_PATH_PROTOCOL      * DevicePath,

-  OUT UINTN                         *ExitDataSize,

-  OUT CHAR16                        **ExitData OPTIONAL

-  );

-

-EFI_STATUS

-BdsLibEnumerateAllBootOption (

-  IN OUT LIST_ENTRY    *BdsBootOptionList

-  );

-

-VOID

-BdsLibBuildOptionFromHandle (

-  IN  EFI_HANDLE      Handle,

-  IN  LIST_ENTRY      *BdsBootOptionList

-  );

-

-VOID

-BdsLibBuildOptionFromShell (

-  IN  EFI_HANDLE                 Handle,

-  IN  LIST_ENTRY                 *BdsBootOptionList

-  );

-

-//

-// Bds misc lib functions

-//

-UINT16

-BdsLibGetTimeout (

-  VOID

-  );

-

-VOID

-BdsLibLoadDrivers (

-  IN  LIST_ENTRY          *BdsDriverLists

-  );

-

-EFI_STATUS

-BdsLibBuildOptionFromVar (

-  IN  LIST_ENTRY          *BdsCommonOptionList,

-  IN  CHAR16              *VariableName

-  );

-

-VOID                      *

-BdsLibGetVariableAndSize (

-  IN  CHAR16              *Name,

-  IN  EFI_GUID            *VendorGuid,

-  OUT UINTN               *VariableSize

-  );

-

-EFI_STATUS

-BdsLibOutputStrings (

-  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL   *ConOut,

-  ...

-  );

-

-BDS_COMMON_OPTION         *

-BdsLibVariableToOption (

-  IN OUT LIST_ENTRY               *BdsCommonOptionList,

-  IN CHAR16                       *VariableName

-  );

-

-EFI_STATUS

-BdsLibRegisterNewOption (

-  IN  LIST_ENTRY                     *BdsOptionList,

-  IN  EFI_DEVICE_PATH_PROTOCOL       *DevicePath,

-  IN  CHAR16                         *String,

-  IN  CHAR16                         *VariableName

-  );

-

-//

-// Bds connect or disconnect driver lib funcion

-//

-VOID

-BdsLibConnectAllDriversToAllControllers (

-  VOID

-  );

-

-VOID

-BdsLibConnectAll (

-  VOID

-  );

-

-EFI_STATUS

-BdsLibConnectDevicePath (

-  IN EFI_DEVICE_PATH_PROTOCOL  *DevicePathToConnect

-  );

-

-EFI_STATUS

-BdsLibConnectAllEfi (

-  VOID

-  );

-

-EFI_STATUS

-BdsLibDisconnectAllEfi (

-  VOID

-  );

-

-//

-// Bds console relate lib functions

-//

-VOID

-BdsLibConnectAllConsoles (

-  VOID

-  );

-

-EFI_STATUS

-BdsLibConnectAllDefaultConsoles (

-  VOID

-  );

-

-EFI_STATUS

-BdsLibUpdateConsoleVariable (

-  IN  CHAR16                    *ConVarName,

-  IN  EFI_DEVICE_PATH_PROTOCOL  *CustomizedConDevicePath,

-  IN  EFI_DEVICE_PATH_PROTOCOL  *ExclusiveDevicePath

-  );

-

-EFI_STATUS

-BdsLibConnectConsoleVariable (

-  IN  CHAR16                 *ConVarName

-  );

-

-//

-// Bds device path relate lib functions

-//

-EFI_DEVICE_PATH_PROTOCOL  *

-BdsLibUnpackDevicePath (

-  IN EFI_DEVICE_PATH_PROTOCOL  *DevPath

-  );

-

-VOID

-BdsLibSafeFreePool (

-  IN  VOID             *Buffer

-  );

-

-EFI_DEVICE_PATH_PROTOCOL *

-BdsLibDelPartMatchInstance (

-  IN     EFI_DEVICE_PATH_PROTOCOL  *Multi,

-  IN     EFI_DEVICE_PATH_PROTOCOL  *Single

-  );

-

-BOOLEAN

-BdsLibMatchDevicePaths (

-  IN  EFI_DEVICE_PATH_PROTOCOL  *Multi,

-  IN  EFI_DEVICE_PATH_PROTOCOL  *Single

-  );

-

-CHAR16                    *

-DevicePathToStr (

-  EFI_DEVICE_PATH_PROTOCOL     *DevPath

-  );

-

-VOID                      *

-EfiLibGetVariable (

-  IN CHAR16               *Name,

-  IN EFI_GUID             *VendorGuid

-  );

-

-//

-// Internal definitions

-//

-typedef struct {

-  CHAR16  *str;

-  UINTN   len;

-  UINTN   maxlen;

-} POOL_PRINT;

-

-typedef struct {

-  UINT8 Type;

-  UINT8 SubType;

-  VOID (*Function) (POOL_PRINT *, VOID *);

-} DEVICE_PATH_STRING_TABLE;

-

-//

-// Internal functions

-//

-EFI_STATUS

-BdsBootByDiskSignatureAndPartition (

-  IN  BDS_COMMON_OPTION          * Option,

-  IN  HARDDRIVE_DEVICE_PATH      * HardDriveDevicePath,

-  IN  UINT32                     LoadOptionsSize,

-  IN  VOID                       *LoadOptions,

-  OUT UINTN                      *ExitDataSize,

-  OUT CHAR16                     **ExitData OPTIONAL

-  );

-

-//

-// Notes: EFI 64 shadow all option rom

-//

-#if   defined (MDE_CPU_IPF)

-#define EFI64_SHADOW_ALL_LEGACY_ROM() ShadowAllOptionRom ();

-VOID

-ShadowAllOptionRom();

-#else

-#define EFI64_SHADOW_ALL_LEGACY_ROM()

-#endif

-

-//

-// BBS support macros and functions

-//

-#if   defined (MDE_CPU_IA32)

-#define REFRESH_LEGACY_BOOT_OPTIONS \

-        BdsDeleteAllInvalidLegacyBootOptions ();\

-        BdsAddNonExistingLegacyBootOptions (); \

-        BdsUpdateLegacyDevOrder ()

-#else

-#define REFRESH_LEGACY_BOOT_OPTIONS

-#endif

-

-EFI_STATUS

-BdsDeleteAllInvalidLegacyBootOptions (

-  VOID

-  );

-

-EFI_STATUS

-BdsAddNonExistingLegacyBootOptions (

-  VOID

-  );

-

-EFI_STATUS

-BdsUpdateLegacyDevOrder (

-  VOID

-  );

-

-EFI_STATUS

-BdsRefreshBbsTableForBoot (

-  IN BDS_COMMON_OPTION        *Entry

-  );

-

-EFI_STATUS

-BdsDeleteBootOption (

-  IN UINTN                       OptionNumber,

-  IN OUT UINT16                  *BootOrder,

-  IN OUT UINTN                   *BootOrderSize

-  );

-

-//

-//The interface functions relate with Setup Browser Reset Reminder feature

-//

-VOID

-EnableResetReminderFeature (

-  VOID

-  );

-

-VOID

-DisableResetReminderFeature (

-  VOID

-  );

-

-VOID

-EnableResetRequired (

-  VOID

-  );

-

-VOID

-DisableResetRequired (

-  VOID

-  );

-

-BOOLEAN

-IsResetReminderFeatureEnable (

-  VOID

-  );

-

-BOOLEAN

-IsResetRequired (

-  VOID

-  );

-

-VOID

-SetupResetReminder (

-  VOID

-  );

-  

-EFI_STATUS

-BdsLibGetHiiHandles (

-  IN     EFI_HII_PROTOCOL *Hii,

-  IN OUT UINT16           *HandleBufferLength,

-  OUT    EFI_HII_HANDLE   **HiiHandles

-  );

-

-#endif // _BDS_LIB_H_

diff --git a/EdkNt32Pkg/Include/Library/WinNtLib.h b/EdkNt32Pkg/Include/Library/WinNtLib.h
deleted file mode 100644
index b9bccfc..0000000
--- a/EdkNt32Pkg/Include/Library/WinNtLib.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  WinNtLib.h

-

-Abstract:

-

-  Public include file for the WinNt Library

-

---*/

-

-#ifndef __WIN_NT_LIB_H__

-#define __WIN_NT_LIB_H__

-

-extern EFI_WIN_NT_THUNK_PROTOCOL  *gWinNt;

-

-#endif
\ No newline at end of file
diff --git a/EdkNt32Pkg/Include/Ppi/NtAutoscan.h b/EdkNt32Pkg/Include/Ppi/NtAutoscan.h
deleted file mode 100644
index 6098819..0000000
--- a/EdkNt32Pkg/Include/Ppi/NtAutoscan.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  NtAutoscan.h

-

-Abstract:

-

-Nt Autoscan PPI

-

---*/

-

-#ifndef __NT_PEI_AUTOSCAN_H__

-#define __NT_PEI_AUTOSCAN_H__

-

-#include <WinNtDxe.h>

-

-#define PEI_NT_AUTOSCAN_PPI_GUID \

-  { \

-    0xdce384d, 0x7c, 0x4ba5, {0x94, 0xbd, 0xf, 0x6e, 0xb6, 0x4d, 0x2a, 0xa9 } \

-  }

-

-typedef

-EFI_STATUS

-(EFIAPI *PEI_NT_AUTOSCAN) (

-  IN  UINTN                 Index,

-  OUT EFI_PHYSICAL_ADDRESS  * MemoryBase,

-  OUT UINT64                *MemorySize

-  );

-

-/*++

-

-Routine Description:

-  This service is called from Index == 0 until it returns EFI_UNSUPPORTED.

-  It allows discontiguous memory regions to be supported by the emulator.

-  It uses gSystemMemory[] and gSystemMemoryCount that were created by

-  parsing the Windows environment variable EFI_MEMORY_SIZE.

-  The size comes from the varaible and the address comes from the call to

-  WinNtOpenFile. 

-

-Arguments:

-  Index      - Which memory region to use

-  MemoryBase - Return Base address of memory region

-  MemorySize - Return size in bytes of the memory region

-

-Returns:

-  EFI_SUCCESS - If memory region was mapped

-  EFI_UNSUPPORTED - If Index is not supported

-

---*/

-typedef struct {

-  PEI_NT_AUTOSCAN NtAutoScan;

-} PEI_NT_AUTOSCAN_PPI;

-

-extern EFI_GUID gPeiNtAutoScanPpiGuid;

-

-#endif

diff --git a/EdkNt32Pkg/Include/Ppi/NtFwh.h b/EdkNt32Pkg/Include/Ppi/NtFwh.h
deleted file mode 100644
index 90b4109..0000000
--- a/EdkNt32Pkg/Include/Ppi/NtFwh.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  NtFwh.h

-

-Abstract:

-

-  WinNt FWH PPI as defined in Tiano

-

---*/

-

-#ifndef __NT_PEI_FWH_H__

-#define __NT_PEI_FWH_H__

-

-#include <WinNtDxe.h>

-

-#define NT_FWH_PPI_GUID \

-  { \

-    0x4e76928f, 0x50ad, 0x4334, {0xb0, 0x6b, 0xa8, 0x42, 0x13, 0x10, 0x8a, 0x57 } \

-  }

-

-typedef

-EFI_STATUS

-(EFIAPI *NT_FWH_INFORMATION) (

-  IN     UINTN                  Index,

-  IN OUT EFI_PHYSICAL_ADDRESS   * FdBase,

-  IN OUT UINT64                 *FdSize

-  );

-

-/*++

-

-Routine Description:

-  Return the FD Size and base address. Since the FD is loaded from a 

-  file into Windows memory only the SEC will know it's address.

-

-Arguments:

-  Index  - Which FD, starts at zero.

-  FdSize - Size of the FD in bytes

-  FdBase - Start address of the FD. Assume it points to an FV Header

-

-Returns:

-  EFI_SUCCESS     - Return the Base address and size of the FV

-  EFI_UNSUPPORTED - Index does nto map to an FD in the system

-

---*/

-typedef struct {

-  NT_FWH_INFORMATION  NtFwh;

-} NT_FWH_PPI;

-

-extern EFI_GUID gNtFwhPpiGuid;

-

-#endif

diff --git a/EdkNt32Pkg/Include/Ppi/NtPeiLoadFile.h b/EdkNt32Pkg/Include/Ppi/NtPeiLoadFile.h
deleted file mode 100644
index 622e01a..0000000
--- a/EdkNt32Pkg/Include/Ppi/NtPeiLoadFile.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

- NtPeiLoadFile.h

-

-Abstract:

-

-  WinNt Load File PPI.

-

-  When the PEI core is done it calls the DXE IPL via PPI

-

---*/

-

-#ifndef __NT_PEI_LOAD_FILE_H__

-#define __NT_PEI_LOAD_FILE_H__

-

-#include <WinNtDxe.h>

-

-#define NT_PEI_LOAD_FILE_GUID \

-  { \

-    0xfd0c65eb, 0x405, 0x4cd2, {0x8a, 0xee, 0xf4, 0x0, 0xef, 0x13, 0xba, 0xc2 } \

-  }

-

-typedef

-EFI_STATUS

-(EFIAPI *NT_PEI_LOAD_FILE) (

-  VOID                  *Pe32Data,

-  EFI_PHYSICAL_ADDRESS  *ImageAddress,

-  UINT64                *ImageSize,

-  EFI_PHYSICAL_ADDRESS  *EntryPoint

-  );

-

-/*++

-

-Routine Description:

-  Loads and relocates a PE/COFF image into memory.

-

-Arguments:

-  Pe32Data         - The base address of the PE/COFF file that is to be loaded and relocated

-  ImageAddress     - The base address of the relocated PE/COFF image

-  ImageSize        - The size of the relocated PE/COFF image

-  EntryPoint       - The entry point of the relocated PE/COFF image

-

-Returns:

-  EFI_SUCCESS   - The file was loaded and relocated

-  EFI_OUT_OF_RESOURCES - There was not enough memory to load and relocate the PE/COFF file

-

---*/

-typedef struct {

-  NT_PEI_LOAD_FILE  PeiLoadFileService;

-} NT_PEI_LOAD_FILE_PPI;

-

-extern EFI_GUID gNtPeiLoadFilePpiGuid;

-

-#endif

diff --git a/EdkNt32Pkg/Include/Ppi/NtThunk.h b/EdkNt32Pkg/Include/Ppi/NtThunk.h
deleted file mode 100644
index 782c510..0000000
--- a/EdkNt32Pkg/Include/Ppi/NtThunk.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  NtThunk.h

-

-Abstract:

-

-  WinNt Thunk interface PPI

-

---*/

-

-#ifndef __NT_PEI_WIN_NT_THUNK_H__

-#define __NT_PEI_WIN_NT_THUNK_H__

-

-#include <WinNtDxe.h>

-

-#define PEI_NT_THUNK_PPI_GUID \

-  { \

-    0x98c281e5, 0xf906, 0x43dd, {0xa9, 0x2b, 0xb0, 0x3, 0xbf, 0x27, 0x65, 0xda } \

-  }

-

-typedef

-VOID *

-(EFIAPI *PEI_NT_THUNK_INTERFACE) (

-  VOID

-  );

-

-/*++

-

-Routine Description:

-  Export of EFI_WIN_NT_THUNK_PROTOCOL from the Windows SEC.

-

-Arguments:

-  InterfaceBase - Address of the EFI_WIN_NT_THUNK_PROTOCOL

-

-Returns:

-  EFI_SUCCESS - Data returned

-

---*/

-typedef struct {

-  PEI_NT_THUNK_INTERFACE  NtThunk;

-} PEI_NT_THUNK_PPI;

-

-extern EFI_GUID gPeiNtThunkPpiGuid;

-

-#endif

diff --git a/EdkNt32Pkg/Include/Protocol/WinNtIo.h b/EdkNt32Pkg/Include/Protocol/WinNtIo.h
deleted file mode 100644
index 1f2aaa5..0000000
--- a/EdkNt32Pkg/Include/Protocol/WinNtIo.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  WinNtIo.h

-

-Abstract:

-

---*/

-

-#ifndef __WIN_NT_IO_H__

-#define __WIN_NT_IO_H__

-

-#define EFI_WIN_NT_IO_PROTOCOL_GUID \

-  { 0x96eb4ad6, 0xa32a, 0x11d4, { 0xbc, 0xfd, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }

-

-extern EFI_GUID gEfiWinNtIoProtocolGuid;

-

-typedef struct {

-  EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;

-  EFI_GUID                  *TypeGuid;

-  CHAR16                    *EnvString;

-  UINT16                    InstanceNumber;

-} EFI_WIN_NT_IO_PROTOCOL;

-

-//

-// The following GUIDs are used in EFI_WIN_NT_IO_PROTOCOL_GUID

-// Device paths. They map 1:1 with NT envirnment variables. The variables

-// define what virtual hardware the emulator/WinNtBusDriver will produce.

-//

-//

-// EFI_WIN_NT_VIRTUAL_DISKS

-//

-#define EFI_WIN_NT_VIRTUAL_DISKS_GUID \

-  { \

-    0xc95a928, 0xa006, 0x11d4, {0xbc, 0xfa, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \

-  }

-

-extern EFI_GUID gEfiWinNtVirtualDisksGuid;

-

-//

-// EFI_WIN_NT_PHYSICAL_DISKS

-//

-#define EFI_WIN_NT_PHYSICAL_DISKS_GUID \

-  { \

-    0xc95a92f, 0xa006, 0x11d4, {0xbc, 0xfa, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \

-  }

-

-extern EFI_GUID gEfiWinNtPhysicalDisksGuid;

-

-//

-// EFI_WIN_NT_GOP_GUID

-//

-#define EFI_WIN_NT_GOP_GUID \

-  { \

-    0x4e11e955, 0xccca, 0x11d4, {0xbd, 0x0d, 0x00, 0x80, 0xc7, 0x3c, 0x88, 0x81} \

-  }

-

-extern EFI_GUID gEfiWinNtGopGuid;

-

-//

-// EFI_WIN_NT_FILE_SYSTEM

-//

-#define EFI_WIN_NT_FILE_SYSTEM_GUID \

-  { \

-    0xc95a935, 0xa006, 0x11d4, {0xbc, 0xfa, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \

-  }

-

-extern EFI_GUID gEfiWinNtFileSystemGuid;

-

-//

-// EFI_WIN_NT_SERIAL_PORT

-//

-#define EFI_WIN_NT_SERIAL_PORT_GUID \

-  { \

-    0xc95a93d, 0xa006, 0x11d4, {0xbc, 0xfa, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \

-  }

-

-extern EFI_GUID gEfiWinNtSerialPortGuid;

-

-//

-// EFI_WIN_NT_UGA

-//

-#define EFI_WIN_NT_UGA_GUID \

-  { \

-    0xab248e99, 0xabe1, 0x11d4, {0xbd, 0xd, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \

-  }

-

-extern EFI_GUID gEfiWinNtUgaGuid;

-

-//

-// EFI_WIN_NT_CONSOLE

-//

-#define EFI_WIN_NT_CONSOLE_GUID \

-  { \

-    0xba73672c, 0xa5d3, 0x11d4, {0xbd, 0x0, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \

-  }

-

-extern EFI_GUID gEfiWinNtConsoleGuid;

-

-//

-// EFI_WIN_NT_MEMORY

-//

-#define EFI_WIN_NT_MEMORY_GUID \

-  { \

-    0x99042912, 0x122a, 0x11d4, {0xbd, 0xd, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \

-  }

-

-extern EFI_GUID gEfiWinNtMemoryGuid;

-

-//

-// EFI_WIN_NT_CPU_MODEL

-//

-#define EFI_WIN_NT_CPU_MODEL_GUID \

-  { \

-    0xbee9b6ce, 0x2f8a, 0x11d4, {0xbd, 0xd, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \

-  }

-

-extern EFI_GUID gEfiWinNtCPUModelGuid;

-

-//

-// EFI_WIN_NT_CPU_SPEED

-//

-#define EFI_WIN_NT_CPU_SPEED_GUID \

-  { \

-    0xd4f29055, 0xe1fb, 0x11d4, {0xbd, 0xd, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \

-  }

-

-extern EFI_GUID gEfiWinNtCPUSpeedGuid;

-

-//

-// EFI_WIN_NT_PASS_THROUGH

-//

-#define EFI_WIN_NT_PASS_THROUGH_GUID \

-  { \

-    0xcc664eb8, 0x3c24, 0x4086, {0xb6, 0xf6, 0x34, 0xe8, 0x56, 0xbc, 0xe3, 0x6e } \

-  }

-

-extern EFI_GUID gEfiWinNtPassThroughGuid;

-

-#endif

diff --git a/EdkNt32Pkg/Include/Protocol/WinNtThunk.h b/EdkNt32Pkg/Include/Protocol/WinNtThunk.h
deleted file mode 100644
index b3e161f..0000000
--- a/EdkNt32Pkg/Include/Protocol/WinNtThunk.h
+++ /dev/null
@@ -1,1265 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  WinNtThunk.h

-

-Abstract:

-

-  This protocol allows an EFI driver (DLL) in the NT emulation envirnment

-  to make Win32 API calls.

-

-  NEVER make a Win32 call directly, always make the call via this protocol.

-

-  There are no This pointers on the protocol member functions as they map

-  exactly into Win32 system calls.

-

-  YOU MUST include EfiWinNT.h in place of Efi.h to make this file compile.

-

---*/

-

-#ifndef __WIN_NT_THUNK_H__

-#define __WIN_NT_THUNK_H__

-

-#define EFI_WIN_NT_THUNK_PROTOCOL_GUID \

-  { 0x58c518b1, 0x76f3, 0x11d4, { 0xbc, 0xea, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }

-

-typedef

-WINBASEAPI

-VOID

-(WINAPI *WinNtSleep) (

-  DWORD Milliseconds

-  );

-

-typedef

-WINBASEAPI

-DWORD

-(WINAPI *WinNtSuspendThread) (

-  HANDLE hThread

-  );

-

-typedef

-WINBASEAPI

-HANDLE

-(WINAPI *WinNtGetCurrentThread) (

-  VOID

-  );

-

-typedef

-WINBASEAPI

-DWORD

-(WINAPI *WinNtGetCurrentThreadId) (

-  VOID

-  );

-

-typedef

-WINBASEAPI

-HANDLE

-(WINAPI *WinNtGetCurrentProcess) (

-  VOID

-  );

-

-typedef

-WINBASEAPI

-HANDLE

-(WINAPI *WinNtCreateThread) (

-  LPSECURITY_ATTRIBUTES   lpThreadAttributes,

-  DWORD                   dwStackSize,

-  LPTHREAD_START_ROUTINE  lpStartAddress,

-  LPVOID                  lpParameter,

-  DWORD                   dwCreationFlags,

-  LPDWORD                 lpThreadId

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtTerminateThread) (

-  HANDLE hThread,

-  DWORD  dwExitCode

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtSendMessage) (

-  HWND    hWnd,

-  UINT    Msg,

-  WPARAM  wParam,

-  LPARAM  lParam

-  );

-

-typedef

-WINBASEAPI

-VOID

-(WINAPI *WinNtExitThread) (

-  DWORD   dwExitCode

-  );

-

-typedef

-WINBASEAPI

-DWORD

-(WINAPI *WinNtResumeThread) (

-  HANDLE hThread

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtSetThreadPriority) (

-  HANDLE    hThread,

-  INTN      nPriority

-  );

-

-typedef

-WINBASEAPI

-VOID

-(WINAPI *WinNtInitializeCriticalSection) (

-  LPCRITICAL_SECTION lpCriticalSection

-  );

-

-typedef

-WINBASEAPI

-VOID

-(WINAPI *WinNtDeleteCriticalSection) (

-  LPCRITICAL_SECTION lpCriticalSection

-  );

-

-typedef

-WINBASEAPI

-VOID

-(WINAPI *WinNtEnterCriticalSection) (

-  LPCRITICAL_SECTION lpCriticalSection

-  );

-

-typedef

-WINBASEAPI

-VOID

-(WINAPI *WinNtLeaveCriticalSection) (

-  LPCRITICAL_SECTION lpCriticalSection

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtTlsAlloc) (

-  VOID

-  );

-

-typedef

-WINBASEAPI

-LPVOID

-(WINAPI *WinNtTlsGetValue) (

-  DWORD dwTlsIndex

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtTlsSetValue) (

-  DWORD  dwTlsIndex,

-  LPVOID lpTlsValue

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtTlsFree) (

-  DWORD dwTlsIndex

-  );

-

-typedef

-WINBASEAPI

-HANDLE

-(WINAPI *WinNtCreateSemaphore) (

-  LPSECURITY_ATTRIBUTES lpSemaphoreAttributes,

-  LONG                  lInitialCount,

-  LONG                  lMaximumCount,

-  LPCWSTR               lpName

-  );

-

-typedef

-WINBASEAPI

-DWORD

-(WINAPI *WinNtWaitForSingleObject) (

-  HANDLE  hHandle,

-  DWORD   dwMilliseconds

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtReleaseSemaphore) (

-  HANDLE  hSemaphore,

-  LONG    lReleaseCount,

-  LPLONG  lpPreviousCount

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtDuplicateHandle) (

-  HANDLE   hSourceProcessHandle,

-  HANDLE   hSourceHandle,

-  HANDLE   hTargetProcessHandle,

-  LPHANDLE lpTargetHandle,

-  DWORD    dwDesiredAccess,

-  BOOL     bInheritHandle,

-  DWORD    dwOptions

-  );

-

-typedef

-WINBASEAPI

-HANDLE

-(WINAPI *WinNtCreateConsoleScreenBuffer) (

-  DWORD                       DesiredAccess,

-  DWORD                       ShareMode,

-  CONST SECURITY_ATTRIBUTES   *SecurityAttributes,

-  DWORD                       Flags,

-  LPVOID                      ScreenBufferData

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtSetConsoleScreenBufferSize) (

-  HANDLE  ConsoleOutput,

-  COORD   Size

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtSetConsoleActiveScreenBuffer) (

-  HANDLE  ConsoleOutput

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtFillConsoleOutputAttribute) (

-  HANDLE  ConsoleOutput,

-  WORD    Attribute,

-  DWORD   Length,

-  COORD   WriteCoord,

-  LPDWORD NumberOfAttrsWritten

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtFillConsoleOutputCharacter) (

-  HANDLE  ConsoleOutput,

-  TCHAR   Character,

-  DWORD   Length,

-  COORD   WriteCoord,

-  LPDWORD NumberOfCharsWritten

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtWriteConsoleOutput) (

-  HANDLE          ConsoleOutput,

-  CONST CHAR_INFO *Buffer,

-  COORD           BufferSize,

-  COORD           BufferCoord,

-  PSMALL_RECT     WriteRegion

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtScrollConsoleScreenBuffer) (

-  HANDLE            ConsoleOutput,

-  CONST SMALL_RECT  *ScrollRectangle,

-  CONST SMALL_RECT  *ClipRectangle,

-  COORD             DestinationOrigin,

-  CONST CHAR_INFO   *Fill

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtSetConsoleTitleW) (

-  LPCTSTR   ConsoleTitle

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtGetConsoleCursorInfo) (

-  HANDLE                ConsoleOutput,

-  PCONSOLE_CURSOR_INFO  ConsoleCursorInfo

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtSetConsoleCursorInfo) (

-  HANDLE                      ConsoleOutput,

-  CONST CONSOLE_CURSOR_INFO   *ConsoleCursorInfo

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtSetPriorityClass) (

-  HANDLE  Process,

-  DWORD   PriorityClass

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtWriteConsoleInput) (

-  HANDLE              ConsoleInput,

-  CONST INPUT_RECORD  *Buffer,

-  DWORD               Legnth,

-  LPDWORD             NumberOfEventsWritten

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtGetNumberOfConsoleInputEvents) (

-  HANDLE              ConsoleInput,

-  LPDWORD             NumberOfEvents

-  );

-

-typedef

-WINBASEAPI

-HANDLE

-(WINAPI *WinNtGetStdHandle) (

-  DWORD   StdHandle

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtReadConsoleInput) (

-  HANDLE              ConsoleInput,

-  PINPUT_RECORD       Buffer,

-  DWORD               Length,

-  LPDWORD             NumberOfEventsRead

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtPeekConsoleInput) (

-  HANDLE              ConsoleInput,

-  PINPUT_RECORD       Buffer,

-  DWORD               Length,

-  LPDWORD             NumberOfEventsRead

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtSetConsoleCursorPosition) (

-  HANDLE              ConsoleInput,

-  COORD               CursorPosition

-  );

-

-typedef

-WINBASEAPI

-HANDLE

-(WINAPI *WinNtCreateFile) (

-  LPCWSTR               FileName,

-  DWORD                 DesiredAccess,

-  DWORD                 SharedMode,

-  LPSECURITY_ATTRIBUTES SecurityAttributes,

-  DWORD                 CreationDisposition,

-  DWORD                 FlagsAndAttributes,

-  HANDLE                TemplateFile

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtDeviceIoControl) (

-  HANDLE                DeviceHandle,

-  DWORD                 IoControlCode,

-  LPVOID                InBuffer,

-  DWORD                 InBufferSize,

-  LPVOID                OutBuffer,

-  DWORD                 OutBufferSize,

-  LPDWORD               BytesReturned,

-  LPOVERLAPPED          Overlapped

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtCreateDirectory) (

-  LPCWSTR               PathName,

-  LPSECURITY_ATTRIBUTES SecurityAttributes

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtRemoveDirectory) (

-  LPCWSTR               PathName

-  );

-

-typedef

-WINBASEAPI

-DWORD

-(WINAPI *WinNtGetFileAttributes) (

-  LPCWSTR               FileName

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtSetFileAttributes) (

-  LPCWSTR               FileName,

-  DWORD                 FileAttributes

-  );

-

-typedef

-WINBASEAPI

-HANDLE

-(WINAPI *WinNtCreateFileMapping) (

-  HANDLE                  FileHandle,

-  LPSECURITY_ATTRIBUTES   Attributes,

-  DWORD                   Protect,

-  DWORD                   MaximumSizeHigh,

-  DWORD                   MaximumSizeLow,

-  LPCTSTR                 Name

-  );

-

-typedef

-WINBASEAPI

-LPVOID

-(WINAPI *WinNtMapViewOfFileEx) (

-  HANDLE                  FileHandle,

-  DWORD                   DesiredAccess,

-  DWORD                   FileOffsetHigh,

-  DWORD                   FileOffsetLow,

-  DWORD                   NumberOfBytesToMap,

-  LPVOID                  BaseAddress

-  );

-

-typedef

-WINBASEAPI

-DWORD

-(WINAPI *WinNtGetEnvironmentVariable) (

-  LPCTSTR Name,

-  LPTSTR  Buffer,

-  DWORD   Size

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtCloseHandle) (

-  HANDLE    Object

-  );

-

-typedef

-WINBASEAPI

-DWORD

-(WINAPI *WinNtSetFilePointer) (

-  HANDLE    FileHandle,

-  LONG      DistanceToMove,

-  PLONG     DistanceToHoveHigh,

-  DWORD     MoveMethod

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtSetEndOfFile) (

-  HANDLE    FileHandle

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtReadFile) (

-  HANDLE        FileHandle,

-  LPVOID        Buffer,

-  DWORD         NumberOfBytesToRead,

-  LPDWORD       NumberOfBytesRead,

-  LPOVERLAPPED  Overlapped

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtWriteFile) (

-  HANDLE        FileHandle,

-  LPCVOID       Buffer,

-  DWORD         NumberOfBytesToWrite,

-  LPDWORD       NumberOfBytesWritten,

-  LPOVERLAPPED  Overlapped

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtGetFileInformationByHandle) (

-  HANDLE                      FileHandle,

-  BY_HANDLE_FILE_INFORMATION  *FileInfo

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtGetDiskFreeSpace) (

-  LPCTSTR     RootPathName,

-  LPDWORD     SectorsPerCluster,

-  LPDWORD     BytesPerSector,

-  LPDWORD     NumberOfFreeClusters,

-  LPDWORD     TotalNumberOfClusters

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtGetDiskFreeSpaceEx) (

-  LPCTSTR             DirectoryName,

-  PULARGE_INTEGER     FreeBytesAvailable,

-  PULARGE_INTEGER     TotalNumberOfBytes,

-  PULARGE_INTEGER     TotoalNumberOfFreeBytes

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtMoveFile) (

-  LPCTSTR     ExistingFileName,

-  LPCTSTR     NewFileName

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtSetFileTime) (

-  HANDLE      FileHandle,

-  FILETIME    *CreationTime,

-  FILETIME    *LastAccessTime,

-  FILETIME    *LastWriteTime

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtSystemTimeToFileTime) (

-  SYSTEMTIME  * SystemTime,

-  FILETIME    * FileTime

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtDeleteFile) (

-  LPCTSTR   FileName

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtFlushFileBuffers) (

-  HANDLE

-  );

-

-typedef

-WINBASEAPI

-DWORD

-(WINAPI *WinNtGetLastError) (

-  VOID

-  );

-

-typedef

-WINBASEAPI

-UINT

-(WINAPI *WinNtSetErrorMode) (

-  UINT  Mode

-  );

-

-typedef

-WINBASEAPI

-DWORD

-(WINAPI *WinNtGetTickCount) (

-  VOID

-  );

-

-typedef

-WINBASEAPI

-HMODULE

-(WINAPI *WinNtLoadLibraryEx) (

-  LPCTSTR LibFileName,

-  HANDLE  FileHandle,

-  DWORD   Flags

-  );

-

-typedef

-WINBASEAPI

-FARPROC

-(WINAPI *WinNtGetProcAddress) (

-  HMODULE Module,

-  LPCSTR  ProcName

-  );

-

-typedef

-WINBASEAPI

-DWORD

-(WINAPI *WinNtGetTimeZoneInformation) (

-  LPTIME_ZONE_INFORMATION timeZoneInformation

-  );

-

-typedef

-WINBASEAPI

-MMRESULT

-(WINAPI *WinNttimeSetEvent) (

-  UINT           uDelay,

-  UINT           uResolution,

-  LPTIMECALLBACK lpTimeProc,

-  DWORD_PTR      dwUser,

-  UINT           fuEvent

-  );

-

-typedef

-WINBASEAPI

-MMRESULT

-(WINAPI *WinNttimeKillEvent) (

-  UINT           uTimerID

-  );

-

-typedef

-WINBASEAPI

-DWORD

-(WINAPI *WinNtSetTimeZoneInformation) (

-  LPTIME_ZONE_INFORMATION timeZoneInformation

-  );

-

-typedef

-WINBASEAPI

-VOID

-(WINAPI *WinNtGetSystemTime) (

-  LPSYSTEMTIME        SystemTime

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtSetSystemTime) (

-  CONST SYSTEMTIME    *SystemTime

-  );

-

-typedef

-WINBASEAPI

-VOID

-(WINAPI *WinNtGetLocalTime) (

-  LPSYSTEMTIME        SystemTime

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtSetLocalTime) (

-  CONST SYSTEMTIME    *SystemTime

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtFileTimeToLocalFileTime) (

-  CONST FILETIME  *FileTime,

-  LPFILETIME      LocalFileTime

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtFileTimeToSystemTime) (

-  CONST FILETIME  *FileTime,

-  LPSYSTEMTIME    SystemTime

-  );

-

-typedef

-WINBASEAPI

-HANDLE

-(WINAPI *WinNtFindFirstFile) (

-  LPCTSTR           FileName,

-  LPWIN32_FIND_DATA FindFileData

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtFindNextFile) (

-  HANDLE            FindFile,

-  LPWIN32_FIND_DATA FindFileData

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtFindClose) (

-  HANDLE            FindFile

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtGetCommState) (

-  HANDLE  FileHandle,

-  LPDCB   DCB

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtSetCommState) (

-  HANDLE  FileHandle,

-  LPDCB   DCB

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtSetCommState) (

-  HANDLE  FileHandle,

-  LPDCB   DCB

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtSetCommTimeouts) (

-  HANDLE          FileHandle,

-  LPCOMMTIMEOUTS  CommTimeouts

-  );

-

-typedef

-WINBASEAPI

-VOID

-(WINAPI *WinNtExitProcess) (

-  UINT uExitCode  // exit code for all threads

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtPurgeComm) (

-  HANDLE  FileHandle,

-  DWORD   Flags

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtEscapeCommFunction) (

-  HANDLE  FileHandle,

-  DWORD   Func

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtGetCommModemStatus) (

-  HANDLE  FileHandle,

-  LPDWORD ModemStat

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtClearCommError) (

-  HANDLE    FileHandle,

-  LPDWORD   Errors,

-  LPCOMSTAT Stat

-  );

-

-typedef

-WINUSERAPI

-INT32

-(WINAPIV *WinNtSprintf) (

-  LPWSTR    Buffer,

-  size_t    Count,

-  LPCWSTR   String,

-  ...

-  );

-

-typedef

-WINUSERAPI

-HWND

-(WINAPI *WinNtGetDesktopWindow) (

-  VOID

-  );

-

-typedef

-WINUSERAPI

-HWND

-(WINAPI *WinNtGetForegroundWindow) (

-  VOID

-  );

-

-typedef

-WINUSERAPI

-HWND

-(WINAPI *WinNtCreateWindowEx) (

-  DWORD     dwExStyle,

-  LPCTSTR   lpClassName,

-  LPCTSTR   lpWindowName,

-  DWORD     dwStyle,

-  INT32     x,

-  INT32     y,

-  INT32     nWidth,

-  INT32     nHeight,

-  HWND      hWndParent,

-  HMENU     hMenu,

-  HINSTANCE hInstance,

-  LPVOID    *lpParam

-  );

-

-typedef

-WINUSERAPI

-BOOL

-(WINAPI *WinNtUpdateWindow) (

-  HWND      hWnd

-  );

-

-typedef

-WINUSERAPI

-BOOL

-(WINAPI *WinNtShowWindow) (

-  HWND        hWnd,

-  INT32       nCmdShow

-  );

-

-typedef

-WINGDIAPI

-BOOL

-(WINAPI *WinNtDestroyWindow) (

-  HWND    hWnd

-  );

-

-typedef

-WINUSERAPI

-HDC

-(WINAPI *WinNtGetWindowDC) (

-  HWND    hWnd

-  );

-

-typedef

-WINUSERAPI

-BOOL

-(WINAPI *WinNtGetClientRect) (

-  HWND    hWnd,

-  LPRECT  lpRect

-  );

-

-typedef

-WINUSERAPI

-BOOL

-(WINAPI *WinNtAdjustWindowRect) (

-  LPRECT  lpRect,

-  DWORD   dwStyle,

-  BOOL    bMenu

-  );

-

-typedef

-WINGDIAPI

-INT32

-(WINAPI *WinNtSetDIBitsToDevice) (

-  HDC,

-  INT32,

-  INT32,

-  DWORD,

-  DWORD,

-  INT32,

-  INT32,

-  UINT,

-  UINT,

-  CONST VOID       *,

-  CONST BITMAPINFO *,

-  UINT

-  );

-

-typedef

-WINGDIAPI

-BOOL

-(WINAPI *WinNtBitBlt) (

-  HDC,

-  INT32,

-  INT32,

-  INT32,

-  INT32,

-  HDC,

-  INT32,

-  INT32,

-  DWORD

-  );

-

-typedef

-WINUSERAPI

-BOOL

-(WINAPI *WinNtInvalidateRect) (

-  HWND        hWnd,

-  CONST RECT  *lpRect,

-  BOOL        bErase

-  );

-

-typedef

-WINUSERAPI

-HDC

-(WINAPI *WinNtGetDC) (

-  HWND    hWnd

-  );

-

-typedef

-WINUSERAPI

-INT32

-(WINAPI *WinNtReleaseDC) (

-  HWND    hWnd,

-  HDC     hDC

-  );

-

-typedef

-WINUSERAPI

-ATOM

-(WINAPI *WinNtRegisterClassEx) (

-  CONST   WNDCLASSEX *

-  );

-

-typedef

-WINUSERAPI

-BOOL

-(WINAPI *WinNtUnregisterClass) (

-  LPCTSTR   lpClassName,

-  HINSTANCE hInstance

-  );

-

-typedef

-WINUSERAPI

-HDC

-(WINAPI *WinNtBeginPaint) (

-  HWND          hWnd,

-  LPPAINTSTRUCT lpPaint

-  );

-

-typedef

-WINUSERAPI

-BOOL

-(WINAPI *WinNtEndPaint) (

-  HWND                hWnd,

-  CONST PAINTSTRUCT   *lpPaint

-  );

-

-typedef

-WINUSERAPI

-VOID

-(WINAPI *WinNtPostQuitMessage) (

-  INT32   nExitCode

-  );

-

-typedef

-WINUSERAPI

-LRESULT

-(WINAPI *WinNtDefWindowProc) (

-  HWND    hWnd,

-  UINT    Msg,

-  WPARAM  wParam,

-  LPARAM  lParam

-  );

-

-typedef

-WINUSERAPI

-HICON

-(WINAPI *WinNtLoadIcon) (

-  HINSTANCE hInstance,

-  LPCTSTR   lpIconName

-  );

-

-typedef

-WINUSERAPI

-HCURSOR

-(WINAPI *WinNtLoadCursor) (

-  HINSTANCE   hInstance,

-  LPCTSTR     lpCursorName

-  );

-

-typedef

-WINGDIAPI

-HGDIOBJ

-(WINAPI *WinNtGetStockObject) (

-  INT32

-  );

-

-typedef

-WINGDIAPI

-BOOL

-(WINAPI *WinNtSetViewportOrgEx) (

-  HDC,

-  INT32,

-  INT32,

-  LPPOINT

-  );

-

-typedef

-WINGDIAPI

-BOOL

-(WINAPI *WinNtSetWindowOrgEx) (

-  HDC,

-  INT32,

-  INT32,

-  LPPOINT

-  );

-typedef

-WINGDIAPI

-BOOL

-(WINAPI *WinNtMoveWindow) (

-  HWND,

-  INT32,

-  INT32,

-  INT32,

-  INT32,

-  BOOL

-  );

-

-typedef

-WINGDIAPI

-BOOL

-(WINAPI *WinNtGetWindowRect) (

-  HWND,

-  LPRECT

-  );

-

-typedef

-WINUSERAPI

-BOOL

-(WINAPI *WinNtGetMessage) (

-  LPMSG     lpMsg,

-  HWND      hWnd,

-  UINT      wMsgFilterMin,

-  UINT      wMsgFilterMax

-  );

-

-typedef

-WINUSERAPI

-BOOL

-(WINAPI *WinNtTranslateMessage) (

-  CONST MSG *lpMsg

-  );

-

-typedef

-WINUSERAPI

-BOOL

-(WINAPI *WinNtDispatchMessage) (

-  CONST MSG *lpMsg

-  );

-

-typedef

-WINUSERAPI

-HANDLE

-(WINAPI *WinNtGetProcessHeap) ();

-

-typedef

-WINUSERAPI

-LPVOID

-(WINAPI *WinNtHeapAlloc) (

-  HANDLE  hHeap,

-  DWORD   dwFlags,

-  SIZE_T  dwBytes

-  );

-

-typedef

-WINUSERAPI

-BOOL

-(WINAPI *WinNtHeapFree) (

-  HANDLE  hHeap,

-  DWORD   dwFlags,

-  LPVOID  lpMem

-  );

-

-typedef

-WINBASEAPI

-BOOL

-(WINAPI *WinNtFreeLibrary) (

-  HANDLE  ModHandle

-  );

-//

-//

-//

-

-#define EFI_WIN_NT_THUNK_PROTOCOL_SIGNATURE EFI_SIGNATURE_32 ('N', 'T', 'T', 'T')

-

-typedef struct {

-  UINT64                              Signature;

-

-  //

-  // Win32 Process APIs

-  //

-  WinNtGetProcAddress                 GetProcAddress;

-  WinNtGetTickCount                   GetTickCount;

-  WinNtLoadLibraryEx                  LoadLibraryEx;

-  WinNtFreeLibrary                    FreeLibrary;

-

-  WinNtSetPriorityClass               SetPriorityClass;

-  WinNtSetThreadPriority              SetThreadPriority;

-  WinNtSleep                          Sleep;

-

-  WinNtSuspendThread                  SuspendThread;

-  WinNtGetCurrentThread               GetCurrentThread;

-  WinNtGetCurrentThreadId             GetCurrentThreadId;

-  WinNtGetCurrentProcess              GetCurrentProcess;

-  WinNtCreateThread                   CreateThread;

-  WinNtTerminateThread                TerminateThread;

-  WinNtSendMessage                    SendMessage;

-  WinNtExitThread                     ExitThread;

-  WinNtResumeThread                   ResumeThread;

-  WinNtDuplicateHandle                DuplicateHandle;

-

-  //

-  // Wint32 Mutex primitive

-  //

-  WinNtInitializeCriticalSection      InitializeCriticalSection;

-  WinNtEnterCriticalSection           EnterCriticalSection;

-  WinNtLeaveCriticalSection           LeaveCriticalSection;

-  WinNtDeleteCriticalSection          DeleteCriticalSection;

-  WinNtTlsAlloc                       TlsAlloc;

-  WinNtTlsFree                        TlsFree;

-  WinNtTlsSetValue                    TlsSetValue;

-  WinNtTlsGetValue                    TlsGetValue;

-  WinNtCreateSemaphore                CreateSemaphore;

-  WinNtWaitForSingleObject            WaitForSingleObject;

-  WinNtReleaseSemaphore               ReleaseSemaphore;

-

-  //

-  // Win32 Console APIs

-  //

-  WinNtCreateConsoleScreenBuffer      CreateConsoleScreenBuffer;

-  WinNtFillConsoleOutputAttribute     FillConsoleOutputAttribute;

-  WinNtFillConsoleOutputCharacter     FillConsoleOutputCharacter;

-  WinNtGetConsoleCursorInfo           GetConsoleCursorInfo;

-  WinNtGetNumberOfConsoleInputEvents  GetNumberOfConsoleInputEvents;

-  WinNtPeekConsoleInput               PeekConsoleInput;

-  WinNtScrollConsoleScreenBuffer      ScrollConsoleScreenBuffer;

-  WinNtReadConsoleInput               ReadConsoleInput;

-

-  WinNtSetConsoleActiveScreenBuffer   SetConsoleActiveScreenBuffer;

-  WinNtSetConsoleCursorInfo           SetConsoleCursorInfo;

-  WinNtSetConsoleCursorPosition       SetConsoleCursorPosition;

-  WinNtSetConsoleScreenBufferSize     SetConsoleScreenBufferSize;

-  WinNtSetConsoleTitleW               SetConsoleTitleW;

-  WinNtWriteConsoleInput              WriteConsoleInput;

-  WinNtWriteConsoleOutput             WriteConsoleOutput;

-

-  //

-  // Win32 File APIs

-  //

-  WinNtCreateFile                     CreateFile;

-  WinNtDeviceIoControl                DeviceIoControl;

-  WinNtCreateDirectory                CreateDirectory;

-  WinNtRemoveDirectory                RemoveDirectory;

-  WinNtGetFileAttributes              GetFileAttributes;

-  WinNtSetFileAttributes              SetFileAttributes;

-  WinNtCreateFileMapping              CreateFileMapping;

-  WinNtCloseHandle                    CloseHandle;

-  WinNtDeleteFile                     DeleteFile;

-  WinNtFindFirstFile                  FindFirstFile;

-  WinNtFindNextFile                   FindNextFile;

-  WinNtFindClose                      FindClose;

-  WinNtFlushFileBuffers               FlushFileBuffers;

-  WinNtGetEnvironmentVariable         GetEnvironmentVariable;

-  WinNtGetLastError                   GetLastError;

-  WinNtSetErrorMode                   SetErrorMode;

-  WinNtGetStdHandle                   GetStdHandle;

-  WinNtMapViewOfFileEx                MapViewOfFileEx;

-  WinNtReadFile                       ReadFile;

-  WinNtSetEndOfFile                   SetEndOfFile;

-  WinNtSetFilePointer                 SetFilePointer;

-  WinNtWriteFile                      WriteFile;

-  WinNtGetFileInformationByHandle     GetFileInformationByHandle;

-  WinNtGetDiskFreeSpace               GetDiskFreeSpace;

-  WinNtGetDiskFreeSpaceEx             GetDiskFreeSpaceEx;

-  WinNtMoveFile                       MoveFile;

-  WinNtSetFileTime                    SetFileTime;

-  WinNtSystemTimeToFileTime           SystemTimeToFileTime;

-

-  //

-  // Win32 Time APIs

-  //

-  WinNtFileTimeToLocalFileTime        FileTimeToLocalFileTime;

-  WinNtFileTimeToSystemTime           FileTimeToSystemTime;

-  WinNtGetSystemTime                  GetSystemTime;

-  WinNtSetSystemTime                  SetSystemTime;

-  WinNtGetLocalTime                   GetLocalTime;

-  WinNtSetLocalTime                   SetLocalTime;

-  WinNtGetTimeZoneInformation         GetTimeZoneInformation;

-  WinNtSetTimeZoneInformation         SetTimeZoneInformation;

-  WinNttimeSetEvent                   timeSetEvent;

-  WinNttimeKillEvent                  timeKillEvent;

-

-  //

-  // Win32 Serial APIs

-  //

-  WinNtClearCommError                 ClearCommError;

-  WinNtEscapeCommFunction             EscapeCommFunction;

-  WinNtGetCommModemStatus             GetCommModemStatus;

-  WinNtGetCommState                   GetCommState;

-  WinNtSetCommState                   SetCommState;

-  WinNtPurgeComm                      PurgeComm;

-  WinNtSetCommTimeouts                SetCommTimeouts;

-

-  WinNtExitProcess                    ExitProcess;

-

-  WinNtSprintf                        SPrintf;

-

-  WinNtGetDesktopWindow               GetDesktopWindow;

-  WinNtGetForegroundWindow            GetForegroundWindow;

-  WinNtCreateWindowEx                 CreateWindowEx;

-  WinNtShowWindow                     ShowWindow;

-  WinNtUpdateWindow                   UpdateWindow;

-  WinNtDestroyWindow                  DestroyWindow;

-  WinNtInvalidateRect                 InvalidateRect;

-  WinNtGetWindowDC                    GetWindowDC;

-  WinNtGetClientRect                  GetClientRect;

-  WinNtAdjustWindowRect               AdjustWindowRect;

-  WinNtSetDIBitsToDevice              SetDIBitsToDevice;

-  WinNtBitBlt                         BitBlt;

-  WinNtGetDC                          GetDC;

-  WinNtReleaseDC                      ReleaseDC;

-  WinNtRegisterClassEx                RegisterClassEx;

-  WinNtUnregisterClass                UnregisterClass;

-

-  WinNtBeginPaint                     BeginPaint;

-  WinNtEndPaint                       EndPaint;

-  WinNtPostQuitMessage                PostQuitMessage;

-  WinNtDefWindowProc                  DefWindowProc;

-  WinNtLoadIcon                       LoadIcon;

-  WinNtLoadCursor                     LoadCursor;

-  WinNtGetStockObject                 GetStockObject;

-  WinNtSetViewportOrgEx               SetViewportOrgEx;

-  WinNtSetWindowOrgEx                 SetWindowOrgEx;

-  WinNtMoveWindow                     MoveWindow;

-  WinNtGetWindowRect                  GetWindowRect;

-

-  WinNtGetMessage                     GetMessage;

-  WinNtTranslateMessage               TranslateMessage;

-  WinNtDispatchMessage                DispatchMessage;

-

-  WinNtGetProcessHeap                 GetProcessHeap;

-  WinNtHeapAlloc                      HeapAlloc;

-  WinNtHeapFree                       HeapFree;

-

-} EFI_WIN_NT_THUNK_PROTOCOL;

-

-extern EFI_GUID gEfiWinNtThunkProtocolGuid;

-

-#endif

diff --git a/EdkNt32Pkg/Include/WinNtDxe.h b/EdkNt32Pkg/Include/WinNtDxe.h
deleted file mode 100644
index d82b2a2..0000000
--- a/EdkNt32Pkg/Include/WinNtDxe.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-  WinNtLib.h

-

-Abstract:

-  Public include file for the WinNt Library

-

---*/

-

-#ifndef __WIN_NT_DXE_H__

-#define __WIN_NT_DXE_H__

-

-#include <Ppi/NtPeiLoadFile.h>

-#include <Ppi/NtAutoscan.h>

-#include <Ppi/NtThunk.h>

-#include <Ppi/NtFwh.h>

-

-//

-// This forces Windows.h WIN32 include file to be included

-//  it's needed for WinNtThunk.h

-//  WinNtIo.h depends on WinNtThunk.h

-//

-#include <Common/WinNtInclude.h>

-

-#include <Protocol/WinNtThunk.h>

-#include <Protocol/WinNtIo.h>

-

-#endif

diff --git a/EdkNt32Pkg/Include/WinNtPeim.h b/EdkNt32Pkg/Include/WinNtPeim.h
deleted file mode 100644
index 0b2240b..0000000
--- a/EdkNt32Pkg/Include/WinNtPeim.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-  WinNtLib.h

-

-Abstract:

-  Public include file for the WinNt Library

-

---*/

-

-#ifndef __WIN_NT_PEIM_H__

-#define __WIN_NT_PEIM_H__

-

-#include <Ppi/NtPeiLoadFile.h>

-#include <Ppi/NtAutoscan.h>

-#include <Ppi/NtThunk.h>

-#include <Ppi/NtFwh.h>

-

-//

-// This forces Windows.h WIN32 include file to be included

-//  it's needed for WinNtThunk.h

-//

-#include <Common/WinNtInclude.h>

-

-#include <Protocol/WinNtThunk.h>

-

-#endif

diff --git a/EdkNt32Pkg/Library/DxeNt32OemHookStatusCodeLib/DxeNt32OemHookStatusCodeLib.msa b/EdkNt32Pkg/Library/DxeNt32OemHookStatusCodeLib/DxeNt32OemHookStatusCodeLib.msa
deleted file mode 100644
index 394fc24..0000000
--- a/EdkNt32Pkg/Library/DxeNt32OemHookStatusCodeLib/DxeNt32OemHookStatusCodeLib.msa
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>DxeNt32OemHookStatusCodeLib</ModuleName>

-    <ModuleType>DXE_DRIVER</ModuleType>

-    <GuidValue>EF172A23-C7C5-47b7-B24E-D10DFE15540F</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>Memory Status Code Library for UEFI drivers</Abstract>

-    <Description>Lib to provide memory journal status code reporting Routines</Description>

-    <Copyright>Copyright (c) 2007, Intel Corporation.</Copyright>

-    <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>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>DxeNt32OemHookStatusCodeLib</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">

-      <Keyword>OemHookStatusCodeLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>HobLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>PrintLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseMemoryLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>ReportStatusCodeLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>Nt32OemHookStatusCodeLib.c</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <Hobs>

-    <HobTypes HobGuidCName="gEfiWinNtThunkProtocolGuid" Usage="ALWAYS_CONSUMED">

-      <HobType>GUID_EXTENSION</HobType>

-    </HobTypes>

-  </Hobs>

-  <Guids>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiStatusCodeSpecificDataGuid</GuidCName>

-    </GuidCNames>

-  </Guids>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-  </Externs>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Library/DxeNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c b/EdkNt32Pkg/Library/DxeNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c
deleted file mode 100644
index 942d7ea..0000000
--- a/EdkNt32Pkg/Library/DxeNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/** @file

-  OEM hook status code library functions with no library constructor/destructor

-

-  Copyright (c) 2006, Intel Corporation

-  All rights reserved. This program and the accompanying materials

-  are licensed and made available under the terms and conditions of the BSD License

-  which accompanies this distribution.  The full text of the license may be found at

-  http://opensource.org/licenses/bsd-license.php

-

-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-  Module Name:  Nt32OemHookStatusCodeLib.c

-

-**/

-

-//

-// Cache of WinNtThunk protocol 

-//

-STATIC

-EFI_WIN_NT_THUNK_PROTOCOL   *mWinNt;

-

-//

-// Cache of standard output handle . 

-//

-STATIC

-HANDLE                      mStdOut;

-

-/**

-

-  Initialize OEM status code device .

-

-  @return    Always return EFI_SUCCESS.

-

-**/

-EFI_STATUS

-EFIAPI

-OemHookStatusCodeInitialize (

-  VOID

-  )

-{

-  EFI_HOB_GUID_TYPE   *GuidHob;

-

-  //

-  // Retrieve WinNtThunkProtocol from GUID'ed HOB

-  //

-  GuidHob = GetFirstGuidHob (&gEfiWinNtThunkProtocolGuid);

-  ASSERT (GuidHob != NULL);

-  mWinNt = (EFI_WIN_NT_THUNK_PROTOCOL *)(*(UINTN *)(GET_GUID_HOB_DATA (GuidHob)));

-  ASSERT (mWinNt != NULL);

-

-  //

-  // Cache standard output handle.

-  //

-  mStdOut = mWinNt->GetStdHandle (STD_OUTPUT_HANDLE);

-

-  return EFI_SUCCESS;

-}

-

-/**

-  Report status code to OEM device.

- 

-  @param  CodeType      Indicates the type of status code being reported.  Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.

- 

-  @param  Value         Describes the current status of a hardware or software entity.  

-                        This included information about the class and subclass that is used to classify the entity 

-                        as well as an operation.  For progress codes, the operation is the current activity. 

-                        For error codes, it is the exception.  For debug codes, it is not defined at this time. 

-                        Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.  

-                        Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.

- 

-  @param  Instance      The enumeration of a hardware or software entity within the system.  

-                        A system may contain multiple entities that match a class/subclass pairing. 

-                        The instance differentiates between them.  An instance of 0 indicates that instance information is unavailable, 

-                        not meaningful, or not relevant.  Valid instance numbers start with 1.

-

-

-  @param  CallerId      This optional parameter may be used to identify the caller. 

-                        This parameter allows the status code driver to apply different rules to different callers. 

-                        Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.

-

-

-  @param  Data          This optional parameter may be used to pass additional data

- 

-  @return               The function always return EFI_SUCCESS.

-

-**/

-EFI_STATUS

-EFIAPI

-OemHookStatusCodeReport (

-  IN EFI_STATUS_CODE_TYPE     CodeType,

-  IN EFI_STATUS_CODE_VALUE    Value,

-  IN UINT32                   Instance,

-  IN EFI_GUID                 *CallerId, OPTIONAL

-  IN EFI_STATUS_CODE_DATA     *Data      OPTIONAL

-  )

-{

-  CHAR8           *Filename;

-  CHAR8           *Description;

-  CHAR8           *Format;

-  CHAR8           Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE];

-  UINT32          ErrorLevel;

-  UINT32          LineNumber;

-  UINTN           CharCount;

-  VA_LIST         Marker;

-  EFI_DEBUG_INFO  *DebugInfo;

-

-  Buffer[0] = '\0';

-

-  if (Data != NULL &&

-      ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber)) {

-    //

-    // Print ASSERT() information into output buffer.

-    //

-    CharCount = AsciiSPrint (

-                  Buffer,

-                  EFI_STATUS_CODE_DATA_MAX_SIZE,

-                  "\n\rASSERT!: %a (%d): %a\n\r",

-                  Filename,

-                  LineNumber,

-                  Description

-                  );

-

-    //

-    // Callout to standard output.

-    //

-    mWinNt->WriteFile (

-              mStdOut,

-              Buffer,

-              CharCount,

-              &CharCount,

-              NULL

-              );

-

-    return EFI_SUCCESS;

-

-  } else if (Data != NULL &&

-             ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {

-    //

-    // Print DEBUG() information into output buffer.

-    //

-    CharCount = AsciiVSPrint (

-                  Buffer, 

-                  EFI_STATUS_CODE_DATA_MAX_SIZE, 

-                  Format, 

-                  Marker

-                  );

-  } else if (Data != NULL && 

-             CompareGuid (&Data->Type, &gEfiStatusCodeSpecificDataGuid) &&

-             (CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) {

-    //

-    // Print specific data into output buffer.

-    //

-    DebugInfo = (EFI_DEBUG_INFO *) (Data + 1);

-    Marker    = (VA_LIST) (DebugInfo + 1);

-    Format    = (CHAR8 *) (((UINT64 *) Marker) + 12);

-

-    CharCount = AsciiVSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, Format, Marker);

-  } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {

-    //

-    // Print ERROR information into output buffer.

-    //

-    CharCount = AsciiSPrint (

-                  Buffer, 

-                  EFI_STATUS_CODE_DATA_MAX_SIZE, 

-                  "ERROR: C%x:V%x I%x", 

-                  CodeType, 

-                  Value, 

-                  Instance

-                  );

-

-    //

-    // Make sure we don't try to print values that weren't intended to be printed, especially NULL GUID pointers.

-    //

-    

-    if (CallerId != NULL) {

-      CharCount += AsciiSPrint (

-                     &Buffer[CharCount - 1],

-                     (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),

-                     " %g",

-                     CallerId

-                     );

-    }

-

-    if (Data != NULL) {

-      CharCount += AsciiSPrint (

-                     &Buffer[CharCount - 1],

-                     (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),

-                     " %x",

-                     Data

-                     );

-    }

-

-    CharCount += AsciiSPrint (

-                   &Buffer[CharCount - 1],

-                   (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),

-                   "\n\r"

-                   );

-  } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {

-    CharCount = AsciiSPrint (

-                  Buffer, 

-                  EFI_STATUS_CODE_DATA_MAX_SIZE, 

-                  "PROGRESS CODE: V%x I%x\n\r", 

-                  Value, 

-                  Instance

-                  );

-  } else {

-    CharCount = AsciiSPrint (

-                  Buffer, 

-                  EFI_STATUS_CODE_DATA_MAX_SIZE, 

-                  "Undefined: C%x:V%x I%x\n\r", 

-                  CodeType, 

-                  Value, 

-                  Instance

-                  );

-  }

-

-  //

-  // Callout to standard output.

-  //

-  mWinNt->WriteFile (

-            mStdOut,

-            Buffer,

-            CharCount,

-            &CharCount,

-            NULL

-            );

-

-  return EFI_SUCCESS;

-}

-

diff --git a/EdkNt32Pkg/Library/DxeWinNtLib/DxeWinNtLib.msa b/EdkNt32Pkg/Library/DxeWinNtLib/DxeWinNtLib.msa
deleted file mode 100644
index 562616c..0000000
--- a/EdkNt32Pkg/Library/DxeWinNtLib/DxeWinNtLib.msa
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>DxeWinNtLib</ModuleName>

-    <ModuleType>DXE_DRIVER</ModuleType>

-    <GuidValue>f6b5871d-5226-41b3-a569-3ff893fdc7bc</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>A library to produce the global variable 'gWinNt'</Abstract>

-    <Description>This library contains a single global variable 'gWinNt' along with a constructor to initialize that global.</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>DxeWinNtLib</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">

-      <Keyword>WinNtLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>HobLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>WinNtLib.c</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <Hobs>

-    <HobTypes HobGuidCName="gEfiWinNtThunkProtocolGuid" Usage="ALWAYS_CONSUMED">

-      <HobType>GUID_EXTENSION</HobType>

-    </HobTypes>

-  </Hobs>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-    <Extern>

-      <Constructor>WinNtLibConstructor</Constructor>

-    </Extern>

-  </Externs>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Library/DxeWinNtLib/WinNtLib.c b/EdkNt32Pkg/Library/DxeWinNtLib/WinNtLib.c
deleted file mode 100644
index 9010d8a..0000000
--- a/EdkNt32Pkg/Library/DxeWinNtLib/WinNtLib.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  WinNtLib.c

-

-Abstract:

-

-  WinNt Library 

-

---*/

-

-

-

-EFI_WIN_NT_THUNK_PROTOCOL *gWinNt;

-

-EFI_STATUS

-WinNtLibConstructor (

-  IN EFI_HANDLE        ImageHandle,

-  IN EFI_SYSTEM_TABLE  *SystemTable

-  )

-/*++

-

-Routine Description:

-

-Arguments:

-

-Returns:

-

---*/

-{

-  EFI_HOB_GUID_TYPE        *GuidHob;

-

-  GuidHob = GetFirstGuidHob (&gEfiWinNtThunkProtocolGuid);

-  ASSERT (GuidHob != NULL);

-  gWinNt = (EFI_WIN_NT_THUNK_PROTOCOL *)(*(UINTN *)(GET_GUID_HOB_DATA (GuidHob)));

-  ASSERT (gWinNt != NULL);

-  return EFI_SUCCESS;

-}

diff --git a/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsBoot.c b/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsBoot.c
deleted file mode 100644
index 05c8e7d..0000000
--- a/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsBoot.c
+++ /dev/null
@@ -1,1101 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  BdsBoot.c

-

-Abstract:

-

-  BDS Lib functions which relate with create or process the boot

-  option.

-

---*/

-#include "Performance.h"

-

-BOOLEAN mEnumBootDevice = FALSE;

-

-EFI_STATUS

-BdsLibDoLegacyBoot (

-  IN  BDS_COMMON_OPTION           *Option

-  )

-/*++

-

-Routine Description:

-

-  Boot the legacy system with the boot option

-

-Arguments:

-

-  Option           - The legacy boot option which have BBS device path

-

-Returns:

-

-  EFI_UNSUPPORTED  - There is no legacybios protocol, do not support

-                     legacy boot.

-

-  EFI_STATUS       - Return the status of LegacyBios->LegacyBoot ().

-

---*/

-{

-  EFI_STATUS                Status;

-  EFI_LEGACY_BIOS_PROTOCOL  *LegacyBios;

-

-  Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, &LegacyBios);

-  if (EFI_ERROR (Status)) {

-    //

-    // If no LegacyBios protocol we do not support legacy boot

-    //

-    return EFI_UNSUPPORTED;

-  }

-  //

-  // Notes: if we seperate the int 19, then we don't need to refresh BBS

-  //

-  BdsRefreshBbsTableForBoot (Option);

-

-  //

-  // Write boot to OS performance data to a file

-  //

-  PERF_CODE (

-    WriteBootToOsPerformanceData ();

-  );

-

-

-  DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Legacy Boot: %S\n", Option->Description));

-  return LegacyBios->LegacyBoot (

-                      LegacyBios,

-                      (BBS_BBS_DEVICE_PATH *) Option->DevicePath,

-                      Option->LoadOptionsSize,

-                      Option->LoadOptions

-                      );

-}

-

-EFI_STATUS

-BdsLibBootViaBootOption (

-  IN  BDS_COMMON_OPTION             * Option,

-  IN  EFI_DEVICE_PATH_PROTOCOL      * DevicePath,

-  OUT UINTN                         *ExitDataSize,

-  OUT CHAR16                        **ExitData OPTIONAL

-  )

-/*++

-

-Routine Description:

-

-  Process the boot option follow the EFI 1.1 specification and

-  special treat the legacy boot option with BBS_DEVICE_PATH.

-

-Arguments:

-

-  Option       - The boot option need to be processed

-

-  DevicePath   - The device path which describe where to load

-                 the boot image or the legcy BBS device path

-                 to boot the legacy OS

-

-  ExitDataSize - Returned directly from gBS->StartImage ()

-

-  ExitData     - Returned directly from gBS->StartImage ()

-

-Returns:

-

-  EFI_SUCCESS   - Status from gBS->StartImage (),

-                  or BdsBootByDiskSignatureAndPartition ()

-

-  EFI_NOT_FOUND - If the Device Path is not found in the system

-

---*/

-{

-  EFI_STATUS                Status;

-  EFI_HANDLE                Handle;

-  EFI_HANDLE                ImageHandle;

-  EFI_DEVICE_PATH_PROTOCOL  *TempDevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  *FilePath;

-  EFI_LOADED_IMAGE_PROTOCOL *ImageInfo;

-  EFI_ACPI_S3_SAVE_PROTOCOL *AcpiS3Save;

-  EFI_BLOCK_IO_PROTOCOL     *BlkIo;

-  VOID                      *Buffer;

-

-  //

-  // Record the performance data for End of BDS

-  //

-  PERF_END (0, BDS_TOK, NULL, 0);

-

-  *ExitDataSize = 0;

-  *ExitData     = NULL;

-

-  //

-  // Notes: put EFI64 ROM Shadow Solution

-  //

-  EFI64_SHADOW_ALL_LEGACY_ROM ();

-

-  //

-  // Notes: this code can be remove after the s3 script table

-  // hook on the event EFI_EVENT_SIGNAL_READY_TO_BOOT or

-  // EFI_EVENT_SIGNAL_LEGACY_BOOT

-  //

-  Status = gBS->LocateProtocol (&gEfiAcpiS3SaveProtocolGuid, NULL, &AcpiS3Save);

-  if (!EFI_ERROR (Status)) {

-    AcpiS3Save->S3Save (AcpiS3Save, NULL);

-  }

-  //

-  // If it's Device Path that starts with a hard drive path,

-  // this routine will do the booting.

-  //

-  Status = BdsBootByDiskSignatureAndPartition (

-            Option,

-            (HARDDRIVE_DEVICE_PATH *) DevicePath,

-            Option->LoadOptionsSize,

-            Option->LoadOptions,

-            ExitDataSize,

-            ExitData

-            );

-  if (!EFI_ERROR (Status)) {

-    //

-    // If we found a disk signature and partition device path return success

-    //

-    return EFI_SUCCESS;

-  }

-  //

-  // Signal the EFI_EVENT_SIGNAL_READY_TO_BOOT event

-  //

-  EfiSignalEventReadyToBoot ();

-

-  //

-  // Set Boot Current

-  //

-  gRT->SetVariable (

-        L"BootCurrent",

-        &gEfiGlobalVariableGuid,

-        EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,

-        sizeof (UINT16),

-        &Option->BootCurrent

-        );

-

-  if ((DevicePathType (Option->DevicePath) == BBS_DEVICE_PATH) &&

-      (DevicePathSubType (Option->DevicePath) == BBS_BBS_DP)

-    ) {

-    //

-    // Check to see if we should legacy BOOT. If yes then do the legacy boot

-    //

-    return BdsLibDoLegacyBoot (Option);

-  }

-

-  DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Booting EFI 1.1 way %S\n", Option->Description));

-

-  Status = gBS->LoadImage (

-                  TRUE,

-                  mBdsImageHandle,

-                  DevicePath,

-                  NULL,

-                  0,

-                  &ImageHandle

-                  );

-

-  //

-  // If we didn't find an image, we may need to load the default

-  // boot behavior for the device.

-  //

-  if (EFI_ERROR (Status)) {

-    //

-    // Find a Simple File System protocol on the device path. If the remaining

-    // device path is set to end then no Files are being specified, so try

-    // the removable media file name.

-    //

-    TempDevicePath = DevicePath;

-    Status = gBS->LocateDevicePath (

-                    &gEfiSimpleFileSystemProtocolGuid,

-                    &TempDevicePath,

-                    &Handle

-                    );

-    if (!EFI_ERROR (Status) && IsDevicePathEnd (TempDevicePath)) {

-      FilePath = FileDevicePath (Handle, EFI_REMOVABLE_MEDIA_FILE_NAME);

-      if (FilePath) {

-        //

-        // Issue a dummy read to the device to check for media change.

-        // When the removable media is changed, any Block IO read/write will

-        // cause the BlockIo protocol be reinstalled and EFI_MEDIA_CHANGED is

-        // returned. After the Block IO protocol is reinstalled, subsequent

-        // Block IO read/write will success.

-        //

-        Status = gBS->HandleProtocol (

-                        Handle,

-                        &gEfiBlockIoProtocolGuid,

-                        (VOID **) &BlkIo

-                        );

-        if (!EFI_ERROR (Status)) {

-          Buffer = AllocatePool (BlkIo->Media->BlockSize);

-          if (Buffer != NULL) {

-            BlkIo->ReadBlocks (

-                     BlkIo,

-                     BlkIo->Media->MediaId,

-                     0,

-                     BlkIo->Media->BlockSize,

-                     Buffer

-                     );

-            FreePool (Buffer);

-          }

-        }

-

-        Status = gBS->LoadImage (

-                        TRUE,

-                        mBdsImageHandle,

-                        FilePath,

-                        NULL,

-                        0,

-                        &ImageHandle

-                        );

-        if (EFI_ERROR (Status)) {

-          //

-          // The DevicePath failed, and it's not a valid

-          // removable media device.

-          //

-          goto Done;

-        }

-      }

-    } else {

-      Status = EFI_NOT_FOUND;

-    }

-  }

-

-  if (EFI_ERROR (Status)) {

-    //

-    // It there is any error from the Boot attempt exit now.

-    //

-    goto Done;

-  }

-  //

-  // Provide the image with it's load options

-  //

-  Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, &ImageInfo);

-  ASSERT_EFI_ERROR (Status);

-

-  if (Option->LoadOptionsSize != 0) {

-    ImageInfo->LoadOptionsSize  = Option->LoadOptionsSize;

-    ImageInfo->LoadOptions      = Option->LoadOptions;

-  }

-  //

-  // Before calling the image, enable the Watchdog Timer for

-  // the 5 Minute period

-  //

-  gBS->SetWatchdogTimer (5 * 60, 0x0000, 0x00, NULL);

-

-  Status = gBS->StartImage (ImageHandle, ExitDataSize, ExitData);

-  DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Image Return Status = %r\n", Status));

-

-  //

-  // Clear the Watchdog Timer after the image returns

-  //

-  gBS->SetWatchdogTimer (0x0000, 0x0000, 0x0000, NULL);

-

-Done:

-  //

-  // Clear Boot Current

-  //

-  gRT->SetVariable (

-        L"BootCurrent",

-        &gEfiGlobalVariableGuid,

-        EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,

-        0,

-        &Option->BootCurrent

-        );

-

-  return Status;

-}

-

-EFI_STATUS

-BdsBootByDiskSignatureAndPartition (

-  IN  BDS_COMMON_OPTION          * Option,

-  IN  HARDDRIVE_DEVICE_PATH      * HardDriveDevicePath,

-  IN  UINT32                     LoadOptionsSize,

-  IN  VOID                       *LoadOptions,

-  OUT UINTN                      *ExitDataSize,

-  OUT CHAR16                     **ExitData OPTIONAL

-  )

-/*++

-

-Routine Description:

-

-  Check to see if a hard ware device path was passed in. If it was then search

-  all the block IO devices for the passed in hard drive device path.

-

-Arguments:

-

-  Option - The current processing boot option.

-

-  HardDriveDevicePath - EFI Device Path to boot, if it starts with a hard

-                        drive device path.

-

-  LoadOptionsSize - Passed into gBS->StartImage ()

-                    via the loaded image protocol.

-

-  LoadOptions     - Passed into gBS->StartImage ()

-                    via the loaded image protocol.

-

-  ExitDataSize - returned directly from gBS->StartImage ()

-

-  ExitData     - returned directly from gBS->StartImage ()

-

-Returns:

-

-  EFI_SUCCESS   - Status from gBS->StartImage (),

-                  or BootByDiskSignatureAndPartition ()

-

-  EFI_NOT_FOUND - If the Device Path is not found in the system

-

---*/

-{

-  EFI_STATUS                Status;

-  UINTN                     BlockIoHandleCount;

-  EFI_HANDLE                *BlockIoBuffer;

-  EFI_DEVICE_PATH_PROTOCOL  *BlockIoDevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  *BlockIoHdDevicePath;

-  HARDDRIVE_DEVICE_PATH     *TmpHdPath;

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  *NewDevicePath;

-  UINTN                     Index;

-  BOOLEAN                   DevicePathMatch;

-  HARDDRIVE_DEVICE_PATH     *TempPath;

-

-  *ExitDataSize = 0;

-  *ExitData     = NULL;

-

-  if ( !((DevicePathType (&HardDriveDevicePath->Header) == MEDIA_DEVICE_PATH) &&

-          (DevicePathSubType (&HardDriveDevicePath->Header) == MEDIA_HARDDRIVE_DP))

-        ) {

-    //

-    // If the HardDriveDevicePath does not start with a Hard Drive Device Path

-    // exit.

-    //

-    return EFI_NOT_FOUND;

-  }

-  //

-  // The boot device have already been connected

-  //

-  Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiBlockIoProtocolGuid, NULL, &BlockIoHandleCount, &BlockIoBuffer);

-  if (EFI_ERROR (Status) || BlockIoHandleCount == 0) {

-    //

-    // If there was an error or there are no device handles that support

-    // the BLOCK_IO Protocol, then return.

-    //

-    return EFI_NOT_FOUND;

-  }

-  //

-  // Loop through all the device handles that support the BLOCK_IO Protocol

-  //

-  for (Index = 0; Index < BlockIoHandleCount; Index++) {

-

-    Status = gBS->HandleProtocol (BlockIoBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID *) &BlockIoDevicePath);

-    if (EFI_ERROR (Status) || BlockIoDevicePath == NULL) {

-      continue;

-    }

-    //

-    // Make PreviousDevicePath == the device path node before the end node

-    //

-    DevicePath          = BlockIoDevicePath;

-    BlockIoHdDevicePath = NULL;

-

-    //

-    // find HardDriver device path node

-    //

-    while (!IsDevicePathEnd (DevicePath)) {

-      if ((DevicePathType (DevicePath) == MEDIA_DEVICE_PATH) &&

-          (DevicePathSubType (DevicePath) == MEDIA_HARDDRIVE_DP)

-          ) {

-        BlockIoHdDevicePath = DevicePath;

-        break;

-      }

-

-      DevicePath = NextDevicePathNode (DevicePath);

-    }

-

-    if (BlockIoHdDevicePath == NULL) {

-      continue;

-    }

-    //

-    // See if the harddrive device path in blockio matches the orig Hard Drive Node

-    //

-    DevicePathMatch = FALSE;

-

-    TmpHdPath       = (HARDDRIVE_DEVICE_PATH *) BlockIoHdDevicePath;

-    TempPath        = (HARDDRIVE_DEVICE_PATH *) BdsLibUnpackDevicePath ((EFI_DEVICE_PATH_PROTOCOL *) HardDriveDevicePath);

-

-    //

-    // Only several fields will be checked. NOT whole NODE

-    //

-    if ( TmpHdPath->PartitionNumber == TempPath->PartitionNumber &&

-        TmpHdPath->MBRType == TempPath->MBRType &&

-        TmpHdPath->SignatureType == TempPath->SignatureType &&

-        CompareGuid ((EFI_GUID *) TmpHdPath->Signature, (EFI_GUID *) TempPath->Signature)) {

-      //

-      // Get the matched device path

-      //

-      DevicePathMatch = TRUE;

-    }

-    //

-    // Only do the boot, when devicepath match

-    //

-    if (DevicePathMatch) {

-      //

-      // Combine the Block IO and Hard Drive Device path together and try

-      // to boot from it.

-      //

-      DevicePath    = NextDevicePathNode ((EFI_DEVICE_PATH_PROTOCOL *) HardDriveDevicePath);

-      NewDevicePath = AppendDevicePath (BlockIoDevicePath, DevicePath);

-

-      //

-      // Recursive boot with new device path

-      //

-      Status = BdsLibBootViaBootOption (Option, NewDevicePath, ExitDataSize, ExitData);

-      if (!EFI_ERROR (Status)) {

-        break;

-      }

-    }

-  }

-

-  FreePool (BlockIoBuffer);

-  return Status;

-}

-

-EFI_STATUS

-BdsLibDeleteOptionFromHandle (

-  IN  EFI_HANDLE                 Handle

-  )

-/*++

-

-Routine Description:

-

-  Delete the boot option associated with the handle passed in

-

-Arguments:

-

-  Handle - The handle which present the device path to create boot option

-

-Returns:

-

-  EFI_SUCCESS           - Delete the boot option success

-

-  EFI_NOT_FOUND         - If the Device Path is not found in the system

-

-  EFI_OUT_OF_RESOURCES  - Lack of memory resource

-

-  Other                 - Error return value from SetVariable()

-

---*/

-{

-  UINT16                    *BootOrder;

-  UINT8                     *BootOptionVar;

-  UINTN                     BootOrderSize;

-  UINTN                     BootOptionSize;

-  EFI_STATUS                Status;

-  UINTN                     Index;

-  UINT16                    BootOption[BOOT_OPTION_MAX_CHAR];

-  UINTN                     DevicePathSize;

-  UINTN                     OptionDevicePathSize;

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  *OptionDevicePath;

-  UINT8                     *TempPtr;

-  CHAR16                    *Description;

-

-  Status        = EFI_SUCCESS;

-  BootOrder     = NULL;

-  BootOrderSize = 0;

-

-  BootOrder = BdsLibGetVariableAndSize (

-                L"BootOrder",

-                &gEfiGlobalVariableGuid,

-                &BootOrderSize

-                );

-  if (NULL == BootOrder) {

-    return EFI_NOT_FOUND;

-  }

-

-  DevicePath = DevicePathFromHandle (Handle);

-  if (DevicePath == NULL) {

-    return EFI_NOT_FOUND;

-  }

-  DevicePathSize = GetDevicePathSize (DevicePath);

-

-  Index = 0;

-  while (Index < BootOrderSize / sizeof (UINT16)) {

-    UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", BootOrder[Index]);

-    BootOptionVar = BdsLibGetVariableAndSize (

-                      BootOption,

-                      &gEfiGlobalVariableGuid,

-                      &BootOptionSize

-                      );

-    if (NULL == BootOptionVar) {

-      FreePool (BootOrder);

-      return EFI_OUT_OF_RESOURCES;

-    }

-

-    TempPtr = BootOptionVar;

-    TempPtr += sizeof (UINT32) + sizeof (UINT16);

-    Description = (CHAR16 *) TempPtr;

-    TempPtr += StrSize ((CHAR16 *) TempPtr);

-    OptionDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) TempPtr;

-    OptionDevicePathSize = GetDevicePathSize (OptionDevicePath);

-

-    //

-    // Check whether the device path match

-    //

-    if ((OptionDevicePathSize == DevicePathSize) &&

-        (CompareMem (DevicePath, OptionDevicePath, DevicePathSize) == 0)) {

-      BdsDeleteBootOption (BootOrder[Index], BootOrder, &BootOrderSize);

-      FreePool (BootOptionVar);

-      break;

-    }

-

-    FreePool (BootOptionVar);

-    Index++;

-  }

-

-  Status = gRT->SetVariable (

-                  L"BootOrder",

-                  &gEfiGlobalVariableGuid,

-                  EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,

-                  BootOrderSize,

-                  BootOrder

-                  );

-

-  FreePool (BootOrder);

-

-  return Status;

-}

-

-EFI_STATUS

-BdsDeleteAllInvalidEfiBootOption (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  Delete all invalid EFI boot options. The probable invalid boot option could

-  be Removable media or Network boot device.

-

-Arguments:

-

-  VOID

-

-Returns:

-

-  EFI_SUCCESS           - Delete all invalid boot option success

-

-  EFI_NOT_FOUND         - Variable "BootOrder" is not found

-

-  EFI_OUT_OF_RESOURCES  - Lack of memory resource

-

-  Other                 - Error return value from SetVariable()

-

---*/

-{

-  UINT16                    *BootOrder;

-  UINT8                     *BootOptionVar;

-  UINTN                     BootOrderSize;

-  UINTN                     BootOptionSize;

-  EFI_STATUS                Status;

-  UINTN                     Index;

-  UINTN                     Index2;

-  UINT16                    BootOption[BOOT_OPTION_MAX_CHAR];

-  UINTN                     OptionDevicePathSize;

-  EFI_DEVICE_PATH_PROTOCOL  *TempDevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  *LastDeviceNode;

-  EFI_DEVICE_PATH_PROTOCOL  *OptionDevicePath;

-  UINT8                     *TempPtr;

-  CHAR16                    *Description;

-  EFI_HANDLE                Handle;

-  BOOLEAN                   NeedDelete;

-

-  Status        = EFI_SUCCESS;

-  BootOrder     = NULL;

-  BootOrderSize = 0;

-

-  BootOrder = BdsLibGetVariableAndSize (

-                L"BootOrder",

-                &gEfiGlobalVariableGuid,

-                &BootOrderSize

-                );

-  if (NULL == BootOrder) {

-    return EFI_NOT_FOUND;

-  }

-

-  Index = 0;

-  while (Index < BootOrderSize / sizeof (UINT16)) {

-    UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", BootOrder[Index]);

-    BootOptionVar = BdsLibGetVariableAndSize (

-                      BootOption,

-                      &gEfiGlobalVariableGuid,

-                      &BootOptionSize

-                      );

-    if (NULL == BootOptionVar) {

-      FreePool (BootOrder);

-      return EFI_OUT_OF_RESOURCES;

-    }

-

-    TempPtr = BootOptionVar;

-    TempPtr += sizeof (UINT32) + sizeof (UINT16);

-    Description = (CHAR16 *) TempPtr;

-    TempPtr += StrSize ((CHAR16 *) TempPtr);

-    OptionDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) TempPtr;

-    OptionDevicePathSize = GetDevicePathSize (OptionDevicePath);

-

-    //

-    // Skip legacy boot option (BBS boot device)

-    //

-    if ((DevicePathType (OptionDevicePath) == BBS_DEVICE_PATH) &&

-        (DevicePathSubType (OptionDevicePath) == BBS_BBS_DP)) {

-      FreePool (BootOptionVar);

-      Index++;

-      continue;

-    }

-

-    TempDevicePath = OptionDevicePath;

-    LastDeviceNode = OptionDevicePath;

-    while (!EfiIsDevicePathEnd (TempDevicePath)) {

-      LastDeviceNode = TempDevicePath;

-      TempDevicePath = EfiNextDevicePathNode (TempDevicePath);

-    }

-    //

-    // Skip the boot option that point to a file, since the device path in

-    // removable media boot option doesn't contains a file name.

-    //

-    if (((DevicePathType (LastDeviceNode) == MEDIA_DEVICE_PATH) &&

-         (DevicePathSubType (LastDeviceNode) == MEDIA_FILEPATH_DP)) ||

-        //

-        // Skip boot option for internal Shell, it's always valid

-        //

-        (EfiGetNameGuidFromFwVolDevicePathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) LastDeviceNode) != NULL)) {

-      FreePool (BootOptionVar);

-      Index++;

-      continue;

-    }

-

-    NeedDelete = TRUE;

-    //

-    // Check if it's a valid boot option for removable media

-    //

-    TempDevicePath = OptionDevicePath;

-    Status = gBS->LocateDevicePath (

-                    &gEfiSimpleFileSystemProtocolGuid,

-                    &TempDevicePath,

-                    &Handle

-                    );

-    if (!EFI_ERROR (Status)) {

-      NeedDelete = FALSE;

-    }

-    //

-    // Check if it's a valid boot option for network boot device

-    //

-    TempDevicePath = OptionDevicePath;

-    Status = gBS->LocateDevicePath (

-                    &gEfiLoadFileProtocolGuid,

-                    &TempDevicePath,

-                    &Handle

-                    );

-    if (!EFI_ERROR (Status)) {

-      NeedDelete = FALSE;

-    }

-

-    if (NeedDelete) {

-      //

-      // Delete this invalid boot option "Boot####"

-      //

-      Status = gRT->SetVariable (

-                      BootOption,

-                      &gEfiGlobalVariableGuid,

-                      EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,

-                      0,

-                      NULL

-                      );

-      //

-      // Mark this boot option in boot order as deleted

-      //

-      BootOrder[Index] = 0xffff;

-    }

-

-    FreePool (BootOptionVar);

-    Index++;

-  }

-

-  //

-  // Adjust boot order array

-  //

-  Index2 = 0;

-  for (Index = 0; Index < BootOrderSize / sizeof (UINT16); Index++) {

-    if (BootOrder[Index] != 0xffff) {

-      BootOrder[Index2] = BootOrder[Index];

-      Index2 ++;

-    }

-  }

-  Status = gRT->SetVariable (

-                  L"BootOrder",

-                  &gEfiGlobalVariableGuid,

-                  EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,

-                  Index2 * sizeof (UINT16),

-                  BootOrder

-                  );

-

-  FreePool (BootOrder);

-

-  return Status;

-}

-

-EFI_STATUS

-BdsLibEnumerateAllBootOption (

-  IN OUT LIST_ENTRY      *BdsBootOptionList

-  )

-/*++

-

-Routine Description:

-

-  This function will enumerate all possible boot device in the system,

-  it will only excute once of every boot.

-

-Arguments:

-

-  BdsBootOptionList - The header of the link list which indexed all

-                      current boot options

-

-Returns:

-

-  EFI_SUCCESS - Finished all the boot device enumerate and create

-                the boot option base on that boot device

-

---*/

-{

-  EFI_STATUS                    Status;

-  UINT16                        BootOptionNumber;

-  UINTN                         NumberFileSystemHandles;

-  EFI_HANDLE                    *FileSystemHandles;

-  EFI_BLOCK_IO_PROTOCOL         *BlkIo;

-  UINTN                         Index;

-  UINTN                         NumberLoadFileHandles;

-  EFI_HANDLE                    *LoadFileHandles;

-  VOID                          *ProtocolInstance;

-  EFI_FIRMWARE_VOLUME_PROTOCOL  *Fv;

-  UINTN                         FvHandleCount;

-  EFI_HANDLE                    *FvHandleBuffer;

-  EFI_FV_FILETYPE               Type;

-  UINTN                         Size;

-  EFI_FV_FILE_ATTRIBUTES        Attributes;

-  UINT32                        AuthenticationStatus;

-  EFI_DEVICE_PATH_PROTOCOL      *FilePath;

-  EFI_HANDLE                    ImageHandle;

-  EFI_LOADED_IMAGE_PROTOCOL     *ImageInfo;

-  BOOLEAN                       NeedDelete;

-

-  BootOptionNumber = 0;

-

-  //

-  // If the boot device enumerate happened, just get the boot

-  // device from the boot order variable

-  //

-  if (mEnumBootDevice) {

-    BdsLibBuildOptionFromVar (BdsBootOptionList, L"BootOrder");

-    return EFI_SUCCESS;

-  }

-  //

-  // Notes: this dirty code is to get the legacy boot option from the

-  // BBS table and create to variable as the EFI boot option, it should

-  // be removed after the CSM can provide legacy boot option directly

-  //

-  REFRESH_LEGACY_BOOT_OPTIONS;

-

-  //

-  // Delete invalid boot option

-  //

-  BdsDeleteAllInvalidEfiBootOption ();

-  //

-  // Parse removable media

-  //

-  gBS->LocateHandleBuffer (

-        ByProtocol,

-        &gEfiSimpleFileSystemProtocolGuid,

-        NULL,

-        &NumberFileSystemHandles,

-        &FileSystemHandles

-        );

-  for (Index = 0; Index < NumberFileSystemHandles; Index++) {

-    Status = gBS->HandleProtocol (

-                    FileSystemHandles[Index],

-                    &gEfiBlockIoProtocolGuid,

-                    (VOID **) &BlkIo

-                    );

-    if (!EFI_ERROR (Status)) {

-      if (!BlkIo->Media->RemovableMedia) {

-        //

-        // If the file system handle supports a BlkIo protocol,

-        // skip the removable media devices

-        //

-        continue;

-      }

-    }

-

-    //

-    // Do the removable Media thing. \EFI\BOOT\boot{machinename}.EFI

-    //  machinename is ia32, ia64, x64, ...

-    //

-    FilePath = FileDevicePath (FileSystemHandles[Index], EFI_REMOVABLE_MEDIA_FILE_NAME);

-    NeedDelete = TRUE;

-    Status = gBS->LoadImage (

-                    TRUE,

-                    mBdsImageHandle,

-                    FilePath,

-                    NULL,

-                    0,

-                    &ImageHandle

-                    );

-    if (!EFI_ERROR(Status)) {

-      //

-      // Verify the image is a EFI application (and not a driver)

-      //

-      Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &ImageInfo);

-      ASSERT (!EFI_ERROR(Status));

-

-      if (ImageInfo->ImageCodeType == EfiLoaderCode) {

-        NeedDelete = FALSE;

-      }

-    }

-

-    if (NeedDelete) {

-      //

-      // No such file or the file is not a EFI application, delete this boot option

-      //

-      BdsLibDeleteOptionFromHandle (FileSystemHandles[Index]);

-    } else {

-      BdsLibBuildOptionFromHandle (FileSystemHandles[Index], BdsBootOptionList);

-      BootOptionNumber++;

-    }

-  }

-

-  if (NumberFileSystemHandles) {

-    FreePool (FileSystemHandles);

-  }

-  //

-  // Parse Network Boot Device

-  //

-  gBS->LocateHandleBuffer (

-        ByProtocol,

-        &gEfiSimpleNetworkProtocolGuid,

-        NULL,

-        &NumberLoadFileHandles,

-        &LoadFileHandles

-        );

-  for (Index = 0; Index < NumberLoadFileHandles; Index++) {

-    Status = gBS->HandleProtocol (

-                    LoadFileHandles[Index],

-                    &gEfiLoadFileProtocolGuid,

-                    (VOID **) &ProtocolInstance

-                    );

-    if (EFI_ERROR (Status)) {

-      continue;

-    }

-

-    BdsLibBuildOptionFromHandle (LoadFileHandles[Index], BdsBootOptionList);

-    BootOptionNumber++;

-  }

-

-  if (NumberLoadFileHandles) {

-    FreePool (LoadFileHandles);

-  }

-  //

-  // Check if we have on flash shell

-  //

-  gBS->LocateHandleBuffer (

-        ByProtocol,

-        &gEfiFirmwareVolumeProtocolGuid,

-        NULL,

-        &FvHandleCount,

-        &FvHandleBuffer

-        );

-  for (Index = 0; Index < FvHandleCount; Index++) {

-    gBS->HandleProtocol (

-          FvHandleBuffer[Index],

-          &gEfiFirmwareVolumeProtocolGuid,

-          (VOID **) &Fv

-          );

-

-    Status = Fv->ReadFile (

-                  Fv,

-                  &gEfiShellFileGuid,

-                  NULL,

-                  &Size,

-                  &Type,

-                  &Attributes,

-                  &AuthenticationStatus

-                  );

-    if (EFI_ERROR (Status)) {

-      //

-      // Skip if no shell file in the FV

-      //

-      continue;

-    }

-    //

-    // Build the shell boot option

-    //

-    BdsLibBuildOptionFromShell (FvHandleBuffer[Index], BdsBootOptionList);

-    BootOptionNumber++;

-  }

-

-  if (FvHandleCount) {

-   FreePool (FvHandleBuffer);

-  }

-  //

-  // Make sure every boot only have one time

-  // boot device enumerate

-  //

-  BdsLibBuildOptionFromVar (BdsBootOptionList, L"BootOrder");

-  mEnumBootDevice = TRUE;

-

-  return EFI_SUCCESS;

-}

-

-VOID

-BdsLibBuildOptionFromHandle (

-  IN  EFI_HANDLE             Handle,

-  IN  LIST_ENTRY             *BdsBootOptionList

-  )

-/*++

-

-Routine Description:

-

-  Build the boot option with the handle parsed in

-

-Arguments:

-

-  Handle - The handle which present the device path to create boot option

-

-  BdsBootOptionList - The header of the link list which indexed all current

-                      boot options

-

-Returns:

-

-  VOID

-

---*/

-{

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;

-  CHAR16                    *TempString;

-

-  DevicePath  = DevicePathFromHandle (Handle);

-  TempString  = DevicePathToStr (DevicePath);

-

-  //

-  // Create and register new boot option

-  //

-  BdsLibRegisterNewOption (BdsBootOptionList, DevicePath, TempString, L"BootOrder");

-}

-

-VOID

-BdsLibBuildOptionFromShell (

-  IN EFI_HANDLE              Handle,

-  IN OUT LIST_ENTRY          *BdsBootOptionList

-  )

-/*++

-

-Routine Description:

-

-  Build the on flash shell boot option with the handle parsed in

-

-Arguments:

-

-  Handle - The handle which present the device path to create on flash shell

-           boot option

-

-  BdsBootOptionList - The header of the link list which indexed all current

-                      boot options

-

-Returns:

-

-  None

-

---*/

-{

-  EFI_DEVICE_PATH_PROTOCOL          *DevicePath;

-  MEDIA_FW_VOL_FILEPATH_DEVICE_PATH ShellNode;

-

-  DevicePath = DevicePathFromHandle (Handle);

-

-  //

-  // Build the shell device path

-  //

-  EfiInitializeFwVolDevicepathNode (&ShellNode, &gEfiShellFileGuid);

-  DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *) &ShellNode);

-

-  //

-  // Create and register the shell boot option

-  //

-  BdsLibRegisterNewOption (BdsBootOptionList, DevicePath, L"Internal EFI Shell", L"BootOrder");

-

-}

-

-VOID

-BdsLibBootNext (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  Boot from the EFI1.1 spec defined "BootNext" variable

-

-Arguments:

-

-  None

-

-Returns:

-

-  None

-

---*/

-{

-  UINT16            *BootNext;

-  UINTN             BootNextSize;

-  CHAR16            Buffer[20];

-  BDS_COMMON_OPTION *BootOption;

-  LIST_ENTRY        TempList;

-  UINTN             ExitDataSize;

-  CHAR16            *ExitData;

-

-  //

-  // Init the boot option name buffer and temp link list

-  //

-  InitializeListHead (&TempList);

-  ZeroMem (Buffer, sizeof (Buffer));

-

-  BootNext = BdsLibGetVariableAndSize (

-              L"BootNext",

-              &gEfiGlobalVariableGuid,

-              &BootNextSize

-              );

-

-  //

-  // Clear the boot next variable first

-  //

-  if (BootNext != NULL) {

-    gRT->SetVariable (

-          L"BootNext",

-          &gEfiGlobalVariableGuid,

-          EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,

-          0,

-          BootNext

-          );

-

-    //

-    // Start to build the boot option and try to boot

-    //

-    UnicodeSPrint (Buffer, sizeof (Buffer), L"Boot%04x", *BootNext);

-    BootOption = BdsLibVariableToOption (&TempList, Buffer);

-    BdsLibConnectDevicePath (BootOption->DevicePath);

-    BdsLibBootViaBootOption (BootOption, BootOption->DevicePath, &ExitDataSize, &ExitData);

-  }

-

-}

diff --git a/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsConnect.c b/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsConnect.c
deleted file mode 100644
index 772b339..0000000
--- a/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsConnect.c
+++ /dev/null
@@ -1,357 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  BdsConnect.c

-

-Abstract:

-

-  BDS Lib functions which relate with connect the device

-

---*/

-

-VOID

-BdsLibConnectAll (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  This function will connect all the system driver to controller

-  first, and then special connect the default console, this make

-  sure all the system controller avialbe and the platform default

-  console connected.

-

-Arguments:

-

-  None

-

-Returns:

-

-  None

-

---*/

-{

-  //

-  // Connect the platform console first

-  //

-  BdsLibConnectAllDefaultConsoles ();

-

-  //

-  // Generic way to connect all the drivers

-  //

-  BdsLibConnectAllDriversToAllControllers ();

-

-  //

-  // Here we have the assumption that we have already had

-  // platform default console

-  //

-  BdsLibConnectAllDefaultConsoles ();

-}

-

-VOID

-BdsLibGenericConnectAll (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  This function will connect all the system drivers to all controllers

-  first, and then connect all the console devices the system current

-  have. After this we should get all the device work and console avariable

-  if the system have console device.

-

-Arguments:

-

-  None

-

-Returns:

-

-  None

-

---*/

-{

-  //

-  // Most generic way to connect all the drivers

-  //

-  BdsLibConnectAllDriversToAllControllers ();

-  BdsLibConnectAllConsoles ();

-}

-

-EFI_STATUS

-BdsLibConnectDevicePath (

-  IN EFI_DEVICE_PATH_PROTOCOL  *DevicePathToConnect

-  )

-/*++

-

-Routine Description:

-  This function will create all handles associate with every device

-  path node. If the handle associate with one device path node can not

-  be created success, then still give one chance to do the dispatch,

-  which load the missing drivers if possible.

-

-Arguments:

-

-  DevicePathToConnect  - The device path which will be connected, it can

-                         be a multi-instance device path

-

-Returns:

-

-  EFI_SUCCESS          - All handles associate with every device path

-                         node have been created

-

-  EFI_OUT_OF_RESOURCES - There is no resource to create new handles

-

-  EFI_NOT_FOUND        - Create the handle associate with one device

-                         path node failed

-

---*/

-{

-  EFI_STATUS                Status;

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  *CopyOfDevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  *Instance;

-  EFI_DEVICE_PATH_PROTOCOL  *RemainingDevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  *Next;

-  EFI_HANDLE                Handle;

-  EFI_HANDLE                PreviousHandle;

-  UINTN                     Size;

-

-  if (DevicePathToConnect == NULL) {

-    return EFI_SUCCESS;

-  }

-

-  DevicePath        = DuplicateDevicePath (DevicePathToConnect);

-  CopyOfDevicePath  = DevicePath;

-  if (DevicePath == NULL) {

-    return EFI_OUT_OF_RESOURCES;

-  }

-

-  do {

-    //

-    // The outer loop handles multi instance device paths.

-    // Only console variables contain multiple instance device paths.

-    //

-    // After this call DevicePath points to the next Instance

-    //

-    Instance  = GetNextDevicePathInstance (&DevicePath, &Size);

-    Next      = Instance;

-    while (!IsDevicePathEndType (Next)) {

-      Next = NextDevicePathNode (Next);

-    }

-

-    SetDevicePathEndNode (Next);

-

-    //

-    // Start the real work of connect with RemainingDevicePath

-    //

-    PreviousHandle = NULL;

-    do {

-      //

-      // Find the handle that best matches the Device Path. If it is only a

-      // partial match the remaining part of the device path is returned in

-      // RemainingDevicePath.

-      //

-      RemainingDevicePath = Instance;

-      Status              = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &Handle);

-

-      if (!EFI_ERROR (Status)) {

-        if (Handle == PreviousHandle) {

-          //

-          // If no forward progress is made try invoking the Dispatcher.

-          // A new FV may have been added to the system an new drivers

-          // may now be found.

-          // Status == EFI_SUCCESS means a driver was dispatched

-          // Status == EFI_NOT_FOUND means no new drivers were dispatched

-          //

-          Status = gDS->Dispatch ();

-        }

-

-        if (!EFI_ERROR (Status)) {

-          PreviousHandle = Handle;

-          //

-          // Connect all drivers that apply to Handle and RemainingDevicePath,

-          // the Recursive flag is FALSE so only one level will be expanded.

-          //

-          // Do not check the connect status here, if the connect controller fail,

-          // then still give the chance to do dispatch, because partial

-          // RemainingDevicepath may be in the new FV

-          //

-          // 1. If the connect fail, RemainingDevicepath and handle will not

-          //    change, so next time will do the dispatch, then dispatch's status

-          //    will take effect

-          // 2. If the connect success, the RemainingDevicepath and handle will

-          //    change, then avoid the dispatch, we have chance to continue the

-          //    next connection

-          //

-          gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);

-        }

-      }

-      //

-      // Loop until RemainingDevicePath is an empty device path

-      //

-    } while (!EFI_ERROR (Status) && !IsDevicePathEnd (RemainingDevicePath));

-

-  } while (DevicePath != NULL);

-

-  if (CopyOfDevicePath != NULL) {

-    FreePool (CopyOfDevicePath);

-  }

-  //

-  // All handle with DevicePath exists in the handle database

-  //

-  return Status;

-}

-

-EFI_STATUS

-BdsLibConnectAllEfi (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  This function will connect all current system handles recursively. The

-  connection will finish until every handle's child handle created if it have.

-

-Arguments:

-

-  None

-

-Returns:

-

-  EFI_SUCCESS          - All handles and it's child handle have been connected

-

-  EFI_STATUS           - Return the status of gBS->LocateHandleBuffer().

-

---*/

-{

-  EFI_STATUS  Status;

-  UINTN       HandleCount;

-  EFI_HANDLE  *HandleBuffer;

-  UINTN       Index;

-

-  Status = gBS->LocateHandleBuffer (

-                  AllHandles,

-                  NULL,

-                  NULL,

-                  &HandleCount,

-                  &HandleBuffer

-                  );

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  for (Index = 0; Index < HandleCount; Index++) {

-    Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);

-  }

-

-  FreePool (HandleBuffer);

-

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-BdsLibDisconnectAllEfi (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  This function will disconnect all current system handles. The disconnection

-  will finish until every handle have been disconnected.

-

-Arguments:

-

-  None

-

-Returns:

-

-  EFI_SUCCESS          - All handles have been disconnected

-

-  EFI_STATUS           - Return the status of gBS->LocateHandleBuffer().

-

---*/

-{

-  EFI_STATUS  Status;

-  UINTN       HandleCount;

-  EFI_HANDLE  *HandleBuffer;

-  UINTN       Index;

-

-  //

-  // Disconnect all

-  //

-  Status = gBS->LocateHandleBuffer (

-                  AllHandles,

-                  NULL,

-                  NULL,

-                  &HandleCount,

-                  &HandleBuffer

-                  );

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  for (Index = 0; Index < HandleCount; Index++) {

-    Status = gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);

-  }

-

-  FreePool (HandleBuffer);

-

-  return EFI_SUCCESS;

-}

-

-VOID

-BdsLibConnectAllDriversToAllControllers (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  Connects all drivers to all controllers.

-  This function make sure all the current system driver will manage

-  the correspoinding controllers if have. And at the same time, make

-  sure all the system controllers have driver to manage it if have.

-

-Arguments:

-

-  None

-

-Returns:

-

-  None

-

---*/

-{

-  EFI_STATUS  Status;

-

-  do {

-    //

-    // Connect All EFI 1.10 drivers following EFI 1.10 algorithm

-    //

-    BdsLibConnectAllEfi ();

-

-    //

-    // Check to see if it's possible to dispatch an more DXE drivers.

-    // The BdsLibConnectAllEfi () may have made new DXE drivers show up.

-    // If anything is Dispatched Status == EFI_SUCCESS and we will try

-    // the connect again.

-    //

-    Status = gDS->Dispatch ();

-

-  } while (!EFI_ERROR (Status));

-

-}

diff --git a/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsConsole.c b/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsConsole.c
deleted file mode 100644
index 96a1f4b..0000000
--- a/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsConsole.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  BdsConsole.c

-

-Abstract:

-

-  BDS Lib functions which contain all the code to connect console device

-

---*/

-

-BOOLEAN

-IsNvNeed (

-  IN CHAR16 *ConVarName

-  )

-{

-  CHAR16 *Ptr;

-

-  Ptr = ConVarName;

-

-  //

-  // If the variable includes "Dev" at last, we consider

-  // it does not support NV attribute.

-  //

-  while (*Ptr) {

-    Ptr++;

-  }

-

-  if ((*(Ptr - 3) == 'D') && (*(Ptr - 2) == 'e') && (*(Ptr - 1) == 'v')) {

-    return FALSE;

-  } else {

-    return TRUE;

-  }

-}

-

-EFI_STATUS

-BdsLibUpdateConsoleVariable (

-  IN  CHAR16                    *ConVarName,

-  IN  EFI_DEVICE_PATH_PROTOCOL  *CustomizedConDevicePath,

-  IN  EFI_DEVICE_PATH_PROTOCOL  *ExclusiveDevicePath

-  )

-/*++

-

-Routine Description:

-

-  This function update console variable based on ConVarName, it can

-  add or remove one specific console device path from the variable

-

-Arguments:

-

-  ConVarName   - Console related variable name, ConIn, ConOut, ErrOut.

-

-  CustomizedConDevicePath - The console device path which will be added to

-                            the console variable ConVarName, this parameter

-                            can not be multi-instance.

-

-  ExclusiveDevicePath     - The console device path which will be removed

-                            from the console variable ConVarName, this

-                            parameter can not be multi-instance.

-

-Returns:

-

-  EFI_UNSUPPORTED         - Add or remove the same device path.

-

-  EFI_SUCCESS             - Success add or remove the device path from

-                            the console variable.

-

---*/

-{

-  EFI_STATUS                Status;

-  EFI_DEVICE_PATH_PROTOCOL  *VarConsole;

-  UINTN                     DevicePathSize;

-  EFI_DEVICE_PATH_PROTOCOL  *NewDevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  *TempNewDevicePath;

-  UINT32                    Attributes;

-

-  VarConsole      = NULL;

-  DevicePathSize  = 0;

-  Status          = EFI_UNSUPPORTED;

-

-  //

-  // Notes: check the device path point, here should check

-  // with compare memory

-  //

-  if (CustomizedConDevicePath == ExclusiveDevicePath) {

-    return EFI_UNSUPPORTED;

-  }

-  //

-  // Delete the ExclusiveDevicePath from current default console

-  //

-  VarConsole = BdsLibGetVariableAndSize (

-                ConVarName,

-                &gEfiGlobalVariableGuid,

-                &DevicePathSize

-                );

-

-  //

-  // Initialize NewDevicePath

-  //

-  NewDevicePath  = VarConsole;

-

-  //

-  // If ExclusiveDevicePath is even the part of the instance in VarConsole, delete it.

-  // In the end, NewDevicePath is the final device path.

-  //

-  if (ExclusiveDevicePath != NULL && VarConsole != NULL) {

-      NewDevicePath = BdsLibDelPartMatchInstance (VarConsole, ExclusiveDevicePath);

-  }

-  //

-  // Try to append customized device path to NewDevicePath.

-  //

-  if (CustomizedConDevicePath != NULL) {

-    if (!BdsLibMatchDevicePaths (NewDevicePath, CustomizedConDevicePath)) {

-      //

-      // Check if there is part of CustomizedConDevicePath in NewDevicePath, delete it.

-      //

-      NewDevicePath = BdsLibDelPartMatchInstance (NewDevicePath, CustomizedConDevicePath);

-      //

-      // In the first check, the default console variable will be null,

-      // just append current customized device path

-      //

-      TempNewDevicePath = NewDevicePath;

-      NewDevicePath = AppendDevicePathInstance (NewDevicePath, CustomizedConDevicePath);

-      BdsLibSafeFreePool(TempNewDevicePath);

-    }

-  }

-

-  //

-  // The attribute for ConInDev, ConOutDev and ErrOutDev does not include NV.

-  //

-  if (IsNvNeed(ConVarName)) {

-    //

-    // ConVarName has NV attribute.

-    //

-    Attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE;

-  } else {

-    //

-    // ConVarName does not have NV attribute.

-    //

-    Attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS;

-  }

-

-  //

-  // Finally, Update the variable of the default console by NewDevicePath

-  //

-  gRT->SetVariable (

-        ConVarName,

-        &gEfiGlobalVariableGuid,

-        Attributes,

-        GetDevicePathSize (NewDevicePath),

-        NewDevicePath

-        );

-

-  if (VarConsole == NewDevicePath) {

-    BdsLibSafeFreePool(VarConsole);

-  } else {

-    BdsLibSafeFreePool(VarConsole);

-    BdsLibSafeFreePool(NewDevicePath);

-  }

-

-  return EFI_SUCCESS;

-

-}

-

-EFI_STATUS

-BdsLibConnectConsoleVariable (

-  IN  CHAR16                 *ConVarName

-  )

-/*++

-

-Routine Description:

-

-  Connect the console device base on the variable ConVarName, if

-  device path of the ConVarName is multi-instance device path, if

-  anyone of the instances is connected success, then this function

-  will return success.

-

-Arguments:

-

-  ConVarName   - Console related variable name, ConIn, ConOut, ErrOut.

-

-Returns:

-

-  EFI_NOT_FOUND           - There is not any console devices connected success

-

-  EFI_SUCCESS             - Success connect any one instance of the console

-                            device path base on the variable ConVarName.

-

---*/

-{

-  EFI_STATUS                Status;

-  EFI_DEVICE_PATH_PROTOCOL  *StartDevicePath;

-  UINTN                     VariableSize;

-  EFI_DEVICE_PATH_PROTOCOL  *Instance;

-  EFI_DEVICE_PATH_PROTOCOL  *Next;

-  EFI_DEVICE_PATH_PROTOCOL  *CopyOfDevicePath;

-  UINTN                     Size;

-  BOOLEAN                   DeviceExist;

-

-  Status      = EFI_SUCCESS;

-  DeviceExist = FALSE;

-

-  //

-  // Check if the console variable exist

-  //

-  StartDevicePath = BdsLibGetVariableAndSize (

-                      ConVarName,

-                      &gEfiGlobalVariableGuid,

-                      &VariableSize

-                      );

-  if (StartDevicePath == NULL) {

-    return EFI_UNSUPPORTED;

-  }

-

-  CopyOfDevicePath = StartDevicePath;

-  do {

-    //

-    // Check every instance of the console variable

-    //

-    Instance  = GetNextDevicePathInstance (&CopyOfDevicePath, &Size);

-    Next      = Instance;

-    while (!IsDevicePathEndType (Next)) {

-      Next = NextDevicePathNode (Next);

-    }

-

-    SetDevicePathEndNode (Next);

-

-    //

-    // Connect the instance device path

-    //

-    Status = BdsLibConnectDevicePath (Instance);

-    if (EFI_ERROR (Status)) {

-      //

-      // Delete the instance from the console varialbe

-      //

-      BdsLibUpdateConsoleVariable (ConVarName, NULL, Instance);

-    } else {

-      DeviceExist = TRUE;

-    }

-    BdsLibSafeFreePool(Instance);

-  } while (CopyOfDevicePath != NULL);

-

-  FreePool (StartDevicePath);

-

-  if (DeviceExist == FALSE) {

-    return EFI_NOT_FOUND;

-  }

-

-  return EFI_SUCCESS;

-}

-

-VOID

-BdsLibConnectAllConsoles (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  This function will search every simpletxt devive in current system,

-  and make every simpletxt device as pertantial console device.

-

-Arguments:

-

-  None

-

-Returns:

-

-  None

-

---*/

-{

-  EFI_STATUS                Status;

-  UINTN                     Index;

-  EFI_DEVICE_PATH_PROTOCOL  *ConDevicePath;

-  UINTN                     HandleCount;

-  EFI_HANDLE                *HandleBuffer;

-

-  Index         = 0;

-  HandleCount   = 0;

-  HandleBuffer  = NULL;

-  ConDevicePath = NULL;

-

-  //

-  // Update all the console varables

-  //

-  Status = gBS->LocateHandleBuffer (

-                  ByProtocol,

-                  &gEfiSimpleTextInProtocolGuid,

-                  NULL,

-                  &HandleCount,

-                  &HandleBuffer

-                  );

-  for (Index = 0; Index < HandleCount; Index++) {

-    Status = gBS->HandleProtocol (

-                    HandleBuffer[Index],

-                    &gEfiDevicePathProtocolGuid,

-                    (VOID **) &ConDevicePath

-                    );

-    BdsLibUpdateConsoleVariable (L"ConIn", ConDevicePath, NULL);

-  }

-

-  BdsLibSafeFreePool(HandleBuffer);

-

-  Status = gBS->LocateHandleBuffer (

-                  ByProtocol,

-                  &gEfiSimpleTextOutProtocolGuid,

-                  NULL,

-                  &HandleCount,

-                  &HandleBuffer

-                  );

-  for (Index = 0; Index < HandleCount; Index++) {

-    Status = gBS->HandleProtocol (

-                    HandleBuffer[Index],

-                    &gEfiDevicePathProtocolGuid,

-                    (VOID **) &ConDevicePath

-                    );

-    BdsLibUpdateConsoleVariable (L"ConOut", ConDevicePath, NULL);

-    BdsLibUpdateConsoleVariable (L"ErrOut", ConDevicePath, NULL);

-  }

-

-  BdsLibSafeFreePool(HandleBuffer);

-

-  //

-  // Connect all console variables

-  //

-  BdsLibConnectAllDefaultConsoles ();

-

-}

-

-EFI_STATUS

-BdsLibConnectAllDefaultConsoles (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  This function will connect console device base on the console

-  device variable ConIn, ConOut and ErrOut.

-

-Arguments:

-

-  None

-

-Returns:

-

-  EFI_SUCCESS      - At least one of the ConIn and ConOut device have

-                     been connected success.

-

-  EFI_STATUS       - Return the status of BdsLibConnectConsoleVariable ().

-

---*/

-{

-  EFI_STATUS                Status;

-

-  //

-  // Connect all default console variables

-  //

-

-  //

-  // Because possibly the platform is legacy free, in such case,

-  // ConIn devices (Serial Port and PS2 Keyboard ) does not exist,

-  // so we need not check the status.

-  //

-  BdsLibConnectConsoleVariable (L"ConIn");

-

-  //

-  // It seems impossible not to have any ConOut device on platform,

-  // so we check the status here.

-  //

-  Status = BdsLibConnectConsoleVariable (L"ConOut");

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-  //

-  // Special treat the err out device, becaues the null

-  // err out var is legal.

-  //

-  BdsLibConnectConsoleVariable (L"ErrOut");

-

-  return EFI_SUCCESS;

-

-}

diff --git a/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsMisc.c b/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsMisc.c
deleted file mode 100644
index b8be94e..0000000
--- a/EdkNt32Pkg/Library/EdkGenericBdsLib/BdsMisc.c
+++ /dev/null
@@ -1,1094 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  BdsMisc.c

-

-Abstract:

-

-  Misc BDS library function

-

---*/

-

-#define MAX_STRING_LEN        200

-static BOOLEAN   mFeaturerSwitch = TRUE;

-static BOOLEAN   mResetRequired  = FALSE;

-extern UINT16 gPlatformBootTimeOutDefault;

-

-UINT16

-BdsLibGetTimeout (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  Return the default value for system Timeout variable.

-

-Arguments:

-

-  None

-

-Returns:

-

-  Timeout value.

-

---*/

-{

-  UINT16      Timeout;

-  UINTN       Size;

-  EFI_STATUS  Status;

-

-  //

-  // Return Timeout variable or 0xffff if no valid

-  // Timeout variable exists.

-  //

-  Size    = sizeof (UINT16);

-  Status  = gRT->GetVariable (L"Timeout", &gEfiGlobalVariableGuid, NULL, &Size, &Timeout);

-  if (!EFI_ERROR (Status)) {

-    return Timeout;

-  }

-  //

-  // To make the current EFI Automatic-Test activity possible, just add

-  // following code to make AutoBoot enabled when this variable is not

-  // present.

-  // This code should be removed later.

-  //

-  Timeout = gPlatformBootTimeOutDefault;

-

-  //

-  // Notes: Platform should set default variable if non exists on all error cases!!!

-  //

-  Status = gRT->SetVariable (

-                  L"Timeout",

-                  &gEfiGlobalVariableGuid,

-                  EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,

-                  sizeof (UINT16),

-                  &Timeout

-                  );

-  return Timeout;

-}

-

-VOID

-BdsLibLoadDrivers (

-  IN LIST_ENTRY               *BdsDriverLists

-  )

-/*++

-

-Routine Description:

-

-  The function will go through the driver optoin link list, load and start

-  every driver the driver optoin device path point to.

-

-Arguments:

-

-  BdsDriverLists   - The header of the current driver option link list

-

-Returns:

-

-  None

-

---*/

-{

-  EFI_STATUS                Status;

-  LIST_ENTRY                *Link;

-  BDS_COMMON_OPTION         *Option;

-  EFI_HANDLE                ImageHandle;

-  EFI_LOADED_IMAGE_PROTOCOL *ImageInfo;

-  UINTN                     ExitDataSize;

-  CHAR16                    *ExitData;

-  BOOLEAN                   ReconnectAll;

-

-  ReconnectAll = FALSE;

-

-  //

-  // Process the driver option

-  //

-  for (Link = BdsDriverLists->ForwardLink; Link != BdsDriverLists; Link = Link->ForwardLink) {

-    Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);

-    //

-    // If a load option is not marked as LOAD_OPTION_ACTIVE,

-    // the boot manager will not automatically load the option.

-    //

-    if (!IS_LOAD_OPTION_TYPE (Option->Attribute, LOAD_OPTION_ACTIVE)) {

-      continue;

-    }

-    //

-    // If a driver load option is marked as LOAD_OPTION_FORCE_RECONNECT,

-    // then all of the EFI drivers in the system will be disconnected and

-    // reconnected after the last driver load option is processed.

-    //

-    if (IS_LOAD_OPTION_TYPE (Option->Attribute, LOAD_OPTION_FORCE_RECONNECT)) {

-      ReconnectAll = TRUE;

-    }

-    //

-    // Make sure the driver path is connected.

-    //

-    BdsLibConnectDevicePath (Option->DevicePath);

-

-    //

-    // Load and start the image that Driver#### describes

-    //

-    Status = gBS->LoadImage (

-                    FALSE,

-                    mBdsImageHandle,

-                    Option->DevicePath,

-                    NULL,

-                    0,

-                    &ImageHandle

-                    );

-

-    if (!EFI_ERROR (Status)) {

-      gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, &ImageInfo);

-

-      //

-      // Verify whether this image is a driver, if not,

-      // exit it and continue to parse next load option

-      //

-      if (ImageInfo->ImageCodeType != EfiBootServicesCode && ImageInfo->ImageCodeType != EfiRuntimeServicesCode) {

-        gBS->Exit (ImageHandle, EFI_INVALID_PARAMETER, 0, NULL);

-        continue;

-      }

-

-      if (Option->LoadOptionsSize != 0) {

-        ImageInfo->LoadOptionsSize  = Option->LoadOptionsSize;

-        ImageInfo->LoadOptions      = Option->LoadOptions;

-      }

-      //

-      // Before calling the image, enable the Watchdog Timer for

-      // the 5 Minute period

-      //

-      gBS->SetWatchdogTimer (5 * 60, 0x0000, 0x00, NULL);

-

-      Status = gBS->StartImage (ImageHandle, &ExitDataSize, &ExitData);

-      DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Driver Return Status = %r\n", Status));

-

-      //

-      // Clear the Watchdog Timer after the image returns

-      //

-      gBS->SetWatchdogTimer (0x0000, 0x0000, 0x0000, NULL);

-    }

-  }

-  //

-  // Process the LOAD_OPTION_FORCE_RECONNECT driver option

-  //

-  if (ReconnectAll) {

-    BdsLibDisconnectAllEfi ();

-    BdsLibConnectAll ();

-  }

-

-}

-

-EFI_STATUS

-BdsLibRegisterNewOption (

-  IN  LIST_ENTRY                     *BdsOptionList,

-  IN  EFI_DEVICE_PATH_PROTOCOL       *DevicePath,

-  IN  CHAR16                         *String,

-  IN  CHAR16                         *VariableName

-  )

-/*++

-

-Routine Description:

-

-  This function will register the new boot#### or driver#### option base on

-  the VariableName. The new registered boot#### or driver#### will be linked

-  to BdsOptionList and also update to the VariableName. After the boot#### or

-  driver#### updated, the BootOrder or DriverOrder will also be updated.

-

-Arguments:

-

-  BdsOptionList    - The header of the boot#### or driver#### link list

-

-  DevicePath       - The device path which the boot####

-                     or driver#### option present

-

-  String           - The description of the boot#### or driver####

-

-  VariableName     - Indicate if the boot#### or driver#### option

-

-Returns:

-

-  EFI_SUCCESS      - The boot#### or driver#### have been success registered

-

-  EFI_STATUS       - Return the status of gRT->SetVariable ().

-

---*/

-{

-  EFI_STATUS                Status;

-  UINTN                     Index;

-  UINT16                    MaxOptionNumber;

-  UINT16                    RegisterOptionNumber;

-  UINT16                    *TempOptionPtr;

-  UINTN                     TempOptionSize;

-  UINT16                    *OptionOrderPtr;

-  VOID                      *OptionPtr;

-  UINTN                     OptionSize;

-  UINT8                     *TempPtr;

-  EFI_DEVICE_PATH_PROTOCOL  *OptionDevicePath;

-  CHAR16                    *Description;

-  CHAR16                    OptionName[10];

-  BOOLEAN                   UpdateBootDevicePath;

-

-  OptionPtr             = NULL;

-  OptionSize            = 0;

-  TempPtr               = NULL;

-  OptionDevicePath      = NULL;

-  Description           = NULL;

-  MaxOptionNumber       = 0;

-  OptionOrderPtr        = NULL;

-  UpdateBootDevicePath  = FALSE;

-  ZeroMem (OptionName, sizeof (OptionName));

-

-  TempOptionSize = 0;

-

-  TempOptionPtr = BdsLibGetVariableAndSize (

-                    VariableName,

-                    &gEfiGlobalVariableGuid,

-                    &TempOptionSize

-                    );

-

-  //

-  // Compare with current option variable

-  //

-  for (Index = 0; Index < TempOptionSize / sizeof (UINT16); Index++) {

-    //

-    // Got the max option#### number

-    //

-    if (MaxOptionNumber < TempOptionPtr[Index]) {

-      MaxOptionNumber = TempOptionPtr[Index];

-    }

-

-    if (*VariableName == 'B') {

-      UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", TempOptionPtr[Index]);

-    } else {

-      UnicodeSPrint (OptionName, sizeof (OptionName), L"Driver%04x", TempOptionPtr[Index]);

-    }

-

-    OptionPtr = BdsLibGetVariableAndSize (

-                  OptionName,

-                  &gEfiGlobalVariableGuid,

-                  &OptionSize

-                  );

-    TempPtr = OptionPtr;

-    TempPtr += sizeof (UINT32) + sizeof (UINT16);

-    Description = (CHAR16 *) TempPtr;

-    TempPtr += StrSize ((CHAR16 *) TempPtr);

-    OptionDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) TempPtr;

-

-    //

-    // Notes: the description may will change base on the GetStringToken

-    //

-    if (CompareMem (Description, String, StrSize (Description)) == 0) {

-      if (CompareMem (OptionDevicePath, DevicePath, GetDevicePathSize (OptionDevicePath)) == 0) {

-        //

-        // Got the option, so just return

-        //

-        FreePool (OptionPtr);

-        FreePool (TempOptionPtr);

-        return EFI_SUCCESS;

-      } else {

-        //

-        // Boot device path changed, need update.

-        //

-        UpdateBootDevicePath = TRUE;

-        break;

-      }

-    }

-

-    FreePool (OptionPtr);

-  }

-

-  OptionSize          = sizeof (UINT32) + sizeof (UINT16) + StrSize (String) + GetDevicePathSize (DevicePath);

-  OptionPtr           = AllocateZeroPool (OptionSize);

-  TempPtr             = OptionPtr;

-  *(UINT32 *) TempPtr = LOAD_OPTION_ACTIVE;

-  TempPtr += sizeof (UINT32);

-  *(UINT16 *) TempPtr = (UINT16) GetDevicePathSize (DevicePath);

-  TempPtr += sizeof (UINT16);

-  CopyMem (TempPtr, String, StrSize (String));

-  TempPtr += StrSize (String);

-  CopyMem (TempPtr, DevicePath, GetDevicePathSize (DevicePath));

-

-  if (UpdateBootDevicePath) {

-    //

-    // The number in option#### to be updated

-    //

-    RegisterOptionNumber = TempOptionPtr[Index];

-  } else {

-    //

-    // The new option#### number

-    //

-    RegisterOptionNumber = MaxOptionNumber + 1;

-  }

-

-  if (*VariableName == 'B') {

-    UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", RegisterOptionNumber);

-  } else {

-    UnicodeSPrint (OptionName, sizeof (OptionName), L"Driver%04x", RegisterOptionNumber);

-  }

-

-  Status = gRT->SetVariable (

-                  OptionName,

-                  &gEfiGlobalVariableGuid,

-                  EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,

-                  OptionSize,

-                  OptionPtr

-                  );

-  if (EFI_ERROR (Status) || UpdateBootDevicePath) {

-    FreePool (OptionPtr);

-    FreePool (TempOptionPtr);

-    return Status;

-  }

-

-  FreePool (OptionPtr);

-

-  //

-  // Update the option order variable

-  //

-  OptionOrderPtr = AllocateZeroPool ((Index + 1) * sizeof (UINT16));

-  CopyMem (OptionOrderPtr, TempOptionPtr, Index * sizeof (UINT16));

-  OptionOrderPtr[Index] = RegisterOptionNumber;

-  Status = gRT->SetVariable (

-                  VariableName,

-                  &gEfiGlobalVariableGuid,

-                  EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,

-                  (Index + 1) * sizeof (UINT16),

-                  OptionOrderPtr

-                  );

-  if (EFI_ERROR (Status)) {

-    FreePool (TempOptionPtr);

-    FreePool (OptionOrderPtr);

-    return Status;

-  }

-

-  if (TempOptionPtr != NULL) {

-    FreePool (TempOptionPtr);

-  }

-  FreePool (OptionOrderPtr);

-

-  return EFI_SUCCESS;

-}

-

-BDS_COMMON_OPTION *

-BdsLibVariableToOption (

-  IN OUT LIST_ENTRY               *BdsCommonOptionList,

-  IN  CHAR16                      *VariableName

-  )

-/*++

-

-Routine Description:

-

-  Build the boot#### or driver#### option from the VariableName, the

-  build boot#### or driver#### will also be linked to BdsCommonOptionList

-

-Arguments:

-

-  BdsCommonOptionList - The header of the boot#### or driver#### option link list

-

-  VariableName - EFI Variable name indicate if it is boot#### or driver####

-

-Returns:

-

-  BDS_COMMON_OPTION    - Get the option just been created

-

-  NULL                 - Failed to get the new option

-

---*/

-{

-  UINT32                    Attribute;

-  UINT16                    FilePathSize;

-  UINT8                     *Variable;

-  UINT8                     *TempPtr;

-  UINTN                     VariableSize;

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;

-  BDS_COMMON_OPTION         *Option;

-  VOID                      *LoadOptions;

-  UINT32                    LoadOptionsSize;

-  CHAR16                    *Description;

-

-  //

-  // Read the variable. We will never free this data.

-  //

-  Variable = BdsLibGetVariableAndSize (

-              VariableName,

-              &gEfiGlobalVariableGuid,

-              &VariableSize

-              );

-  if (Variable == NULL) {

-    return NULL;

-  }

-  //

-  // Notes: careful defined the variable of Boot#### or

-  // Driver####, consider use some macro to abstract the code

-  //

-  //

-  // Get the option attribute

-  //

-  TempPtr   = Variable;

-  Attribute = *(UINT32 *) Variable;

-  TempPtr += sizeof (UINT32);

-

-  //

-  // Get the option's device path size

-  //

-  FilePathSize = *(UINT16 *) TempPtr;

-  TempPtr += sizeof (UINT16);

-

-  //

-  // Get the option's description string

-  //

-  Description = (CHAR16 *) TempPtr;

-

-  //

-  // Get the option's description string size

-  //

-  TempPtr += StrSize ((CHAR16 *) TempPtr);

-

-  //

-  // Get the option's device path

-  //

-  DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) TempPtr;

-  TempPtr += FilePathSize;

-

-  LoadOptions     = TempPtr;

-  LoadOptionsSize = (UINT32) (VariableSize - (UINTN) (TempPtr - Variable));

-

-  //

-  // The Console variables may have multiple device paths, so make

-  // an Entry for each one.

-  //

-  Option = AllocateZeroPool (sizeof (BDS_COMMON_OPTION));

-  if (Option == NULL) {

-    return NULL;

-  }

-

-  Option->Signature   = BDS_LOAD_OPTION_SIGNATURE;

-  Option->DevicePath  = AllocateZeroPool (GetDevicePathSize (DevicePath));

-  CopyMem (Option->DevicePath, DevicePath, GetDevicePathSize (DevicePath));

-  Option->Attribute   = Attribute;

-  Option->Description = AllocateZeroPool (StrSize (Description));

-  CopyMem (Option->Description, Description, StrSize (Description));

-  Option->LoadOptions = AllocateZeroPool (LoadOptionsSize);

-  CopyMem (Option->LoadOptions, LoadOptions, LoadOptionsSize);

-  Option->LoadOptionsSize = LoadOptionsSize;

-

-  //

-  // Insert active entry to BdsDeviceList

-  //

-  if ((Option->Attribute & LOAD_OPTION_ACTIVE) == LOAD_OPTION_ACTIVE) {

-    InsertTailList (BdsCommonOptionList, &Option->Link);

-    FreePool (Variable);

-    return Option;

-  }

-

-  FreePool (Variable);

-  FreePool (Option);

-  return NULL;

-

-}

-

-EFI_STATUS

-BdsLibBuildOptionFromVar (

-  IN  LIST_ENTRY                  *BdsCommonOptionList,

-  IN  CHAR16                      *VariableName

-  )

-/*++

-

-Routine Description:

-

-  Process BootOrder, or DriverOrder variables, by calling

-  BdsLibVariableToOption () for each UINT16 in the variables.

-

-Arguments:

-

-  BdsCommonOptionList - The header of the option list base on variable

-                        VariableName

-

-  VariableName - EFI Variable name indicate the BootOrder or DriverOrder

-

-Returns:

-

-  EFI_SUCCESS - Success create the boot option or driver option list

-

-  EFI_OUT_OF_RESOURCES - Failed to get the boot option or driver option list

-

---*/

-{

-  UINT16            *OptionOrder;

-  UINTN             OptionOrderSize;

-  UINTN             Index;

-  BDS_COMMON_OPTION *Option;

-  CHAR16            OptionName[20];

-

-  //

-  // Zero Buffer in order to get all BOOT#### variables

-  //

-  ZeroMem (OptionName, sizeof (OptionName));

-

-  //

-  // Read the BootOrder, or DriverOrder variable.

-  //

-  OptionOrder = BdsLibGetVariableAndSize (

-                  VariableName,

-                  &gEfiGlobalVariableGuid,

-                  &OptionOrderSize

-                  );

-  if (OptionOrder == NULL) {

-    return EFI_OUT_OF_RESOURCES;

-  }

-

-  for (Index = 0; Index < OptionOrderSize / sizeof (UINT16); Index++) {

-    if (*VariableName == 'B') {

-      UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", OptionOrder[Index]);

-    } else {

-      UnicodeSPrint (OptionName, sizeof (OptionName), L"Driver%04x", OptionOrder[Index]);

-    }

-    Option              = BdsLibVariableToOption (BdsCommonOptionList, OptionName);

-    Option->BootCurrent = OptionOrder[Index];

-

-  }

-

-  FreePool (OptionOrder);

-

-  return EFI_SUCCESS;

-}

-

-VOID *

-BdsLibGetVariableAndSize (

-  IN  CHAR16              *Name,

-  IN  EFI_GUID            *VendorGuid,

-  OUT UINTN               *VariableSize

-  )

-/*++

-

-Routine Description:

-

-  Read the EFI variable (VendorGuid/Name) and return a dynamically allocated

-  buffer, and the size of the buffer. If failure return NULL.

-

-Arguments:

-

-  Name       - String part of EFI variable name

-

-  VendorGuid - GUID part of EFI variable name

-

-  VariableSize - Returns the size of the EFI variable that was read

-

-Returns:

-

-  Dynamically allocated memory that contains a copy of the EFI variable.

-  Caller is responsible freeing the buffer.

-

-  NULL - Variable was not read

-

---*/

-{

-  EFI_STATUS  Status;

-  UINTN       BufferSize;

-  VOID        *Buffer;

-

-  Buffer = NULL;

-

-  //

-  // Pass in a zero size buffer to find the required buffer size.

-  //

-  BufferSize  = 0;

-  Status      = gRT->GetVariable (Name, VendorGuid, NULL, &BufferSize, Buffer);

-  if (Status == EFI_BUFFER_TOO_SMALL) {

-    //

-    // Allocate the buffer to return

-    //

-    Buffer = AllocateZeroPool (BufferSize);

-    if (Buffer == NULL) {

-      return NULL;

-    }

-    //

-    // Read variable into the allocated buffer.

-    //

-    Status = gRT->GetVariable (Name, VendorGuid, NULL, &BufferSize, Buffer);

-    if (EFI_ERROR (Status)) {

-      BufferSize = 0;

-    }

-  }

-

-  *VariableSize = BufferSize;

-  return Buffer;

-}

-

-VOID

-BdsLibSafeFreePool (

-  IN  VOID             *Buffer

-  )

-/*++

-

-Routine Description:

-

-  Free pool safely.

-

-Arguments:

-

-  Buffer          - The allocated pool entry to free

-

-Returns:

-

-  Pointer of the buffer allocated.

-

---*/

-{

-  if (Buffer != NULL) {

-    FreePool (Buffer);

-    Buffer = NULL;

-  }

-}

-

-EFI_DEVICE_PATH_PROTOCOL *

-BdsLibDelPartMatchInstance (

-  IN     EFI_DEVICE_PATH_PROTOCOL  *Multi,

-  IN     EFI_DEVICE_PATH_PROTOCOL  *Single

-  )

-/*++

-

-Routine Description:

-

-  Delete the instance in Multi which matches partly with Single instance

-

-Arguments:

-

-  Multi        - A pointer to a multi-instance device path data structure.

-

-  Single       - A pointer to a single-instance device path data structure.

-

-Returns:

-

-  This function will remove the device path instances in Multi which partly

-  match with the Single, and return the result device path. If there is no

-  remaining device path as a result, this function will return NULL.

-

---*/

-{

-  EFI_DEVICE_PATH_PROTOCOL  *Instance;

-  EFI_DEVICE_PATH_PROTOCOL  *NewDevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  *TempNewDevicePath;

-  UINTN                     InstanceSize;

-  UINTN                     SingleDpSize;

-  UINTN                     Size;

-

-  NewDevicePath     = NULL;

-  TempNewDevicePath = NULL;

-

-  if (Multi == NULL || Single == NULL) {

-    return Multi;

-  }

-

-  Instance        =  GetNextDevicePathInstance (&Multi, &InstanceSize);

-  SingleDpSize    =  GetDevicePathSize (Single) - END_DEVICE_PATH_LENGTH;

-  InstanceSize    -= END_DEVICE_PATH_LENGTH;

-

-  while (Instance != NULL) {

-

-    Size = (SingleDpSize < InstanceSize) ? SingleDpSize : InstanceSize;

-

-    if ((CompareMem (Instance, Single, Size) != 0)) {

-      //

-      // Append the device path instance which does not match with Single

-      //

-      TempNewDevicePath = NewDevicePath;

-      NewDevicePath = AppendDevicePathInstance (NewDevicePath, Instance);

-      BdsLibSafeFreePool(TempNewDevicePath);

-    }

-    BdsLibSafeFreePool(Instance);

-    Instance = GetNextDevicePathInstance (&Multi, &InstanceSize);

-    InstanceSize  -= END_DEVICE_PATH_LENGTH;

-  }

-

-  return NewDevicePath;

-}

-

-BOOLEAN

-BdsLibMatchDevicePaths (

-  IN  EFI_DEVICE_PATH_PROTOCOL  *Multi,

-  IN  EFI_DEVICE_PATH_PROTOCOL  *Single

-  )

-/*++

-

-Routine Description:

-

-  Function compares a device path data structure to that of all the nodes of a

-  second device path instance.

-

-Arguments:

-

-  Multi        - A pointer to a multi-instance device path data structure.

-

-  Single       - A pointer to a single-instance device path data structure.

-

-Returns:

-

-  TRUE   - If the Single is contained within Multi

-

-  FALSE  - The Single is not match within Multi

-

-

---*/

-{

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePathInst;

-  UINTN                     Size;

-

-  if (!Multi || !Single) {

-    return FALSE;

-  }

-

-  DevicePath      = Multi;

-  DevicePathInst  = GetNextDevicePathInstance (&DevicePath, &Size);

-

-  //

-  // Search for the match of 'Single' in 'Multi'

-  //

-  while (DevicePathInst != NULL) {

-    //

-    // If the single device path is found in multiple device paths,

-    // return success

-    //

-    if (CompareMem (Single, DevicePathInst, Size) == 0) {

-      FreePool (DevicePathInst);

-      return TRUE;

-    }

-

-    FreePool (DevicePathInst);

-    DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);

-  }

-

-  return FALSE;

-}

-

-EFI_STATUS

-BdsLibOutputStrings (

-  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL   *ConOut,

-  ...

-  )

-/*++

-

-Routine Description:

-

-  This function prints a series of strings.

-

-Arguments:

-

-  ConOut               - Pointer to EFI_SIMPLE_TEXT_OUT_PROTOCOL

-

-  ...                  - A variable argument list containing series of strings,

-                         the last string must be NULL.

-

-Returns:

-

-  EFI_SUCCESS          - Success print out the string using ConOut.

-

-  EFI_STATUS           - Return the status of the ConOut->OutputString ().

-

---*/

-{

-  VA_LIST     args;

-  EFI_STATUS  Status;

-  CHAR16      *String;

-

-  Status = EFI_SUCCESS;

-  VA_START (args, ConOut);

-

-  while (!EFI_ERROR (Status)) {

-    //

-    // If String is NULL, then it's the end of the list

-    //

-    String = VA_ARG (args, CHAR16 *);

-    if (!String) {

-      break;

-    }

-

-    Status = ConOut->OutputString (ConOut, String);

-

-    if (EFI_ERROR (Status)) {

-      break;

-    }

-  }

-

-  return Status;

-}

-

-//

-//  Following are BDS Lib functions which  contain all the code about setup browser reset reminder feature.

-//  Setup Browser reset reminder feature is that an reset reminder will be given before user leaves the setup browser  if

-//  user change any option setting which needs a reset to be effective, and  the reset will be applied according to  the user selection.

-//

-

-VOID

-EnableResetReminderFeature (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  Enable the setup browser reset reminder feature.

-  This routine is used in platform tip. If the platform policy need the feature, use the routine to enable it.

-

-Arguments:

-

-  VOID

-

-Returns:

-

-  VOID

-

---*/

-{

-  mFeaturerSwitch = TRUE;

-}

-

-VOID

-DisableResetReminderFeature (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  Disable the setup browser reset reminder feature.

-  This routine is used in platform tip. If the platform policy do not want the feature, use the routine to disable it.

-

-Arguments:

-

-  VOID

-

-Returns:

-

-  VOID

-

---*/

-{

-  mFeaturerSwitch = FALSE;

-}

-

-VOID

-EnableResetRequired (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-   Record the info that  a reset is required.

-   A  module boolean variable is used to record whether a reset is required.

-

-Arguments:

-

-  VOID

-

-Returns:

-

-  VOID

-

---*/

-{

-  mResetRequired = TRUE;

-}

-

-VOID

-DisableResetRequired (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-   Record the info that  no reset is required.

-   A  module boolean variable is used to record whether a reset is required.

-

-Arguments:

-

-  VOID

-

-Returns:

-

-  VOID

-

---*/

-{

-  mResetRequired = FALSE;

-}

-

-BOOLEAN

-IsResetReminderFeatureEnable (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  Check whether platform policy enable the reset reminder feature. The default is enabled.

-

-Arguments:

-

-  VOID

-

-Returns:

-

-  VOID

-

---*/

-{

-  return mFeaturerSwitch;

-}

-

-BOOLEAN

-IsResetRequired (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  Check if  user changed any option setting which needs a system reset to be effective.

-

-Arguments:

-

-  VOID

-

-Returns:

-

-  VOID

-

---*/

-{

-  return mResetRequired;

-}

-

-VOID

-SetupResetReminder (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  Check whether a reset is needed, and finish the reset reminder feature.

-  If a reset is needed, Popup a menu to notice user, and finish the feature

-  according to the user selection.

-

-Arguments:

-

-  VOID

-

-Returns:

-

-  VOID

-

---*/

-{

-  EFI_STATUS                    Status;

-  EFI_FORM_BROWSER_PROTOCOL     *Browser;

-  EFI_INPUT_KEY                 Key;

-  CHAR16                        *StringBuffer1;

-  CHAR16                        *StringBuffer2;

-

-

-  //

-  //check any reset required change is applied? if yes, reset system

-  //

-  if (IsResetReminderFeatureEnable ()) {

-    if (IsResetRequired ()) {

-

-      Status = gBS->LocateProtocol (

-                      &gEfiFormBrowserProtocolGuid,

-                      NULL,

-                      &Browser

-                      );

-

-      ASSERT (Status != EFI_SUCCESS);

-

-      StringBuffer1 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));

-      ASSERT (StringBuffer1 != NULL);

-      StringBuffer2 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));

-      ASSERT (StringBuffer2 != NULL);

-      StrCpy (StringBuffer1, L"Configuration changed. Reset to apply it Now ? ");

-      StrCpy (StringBuffer2, L"Enter (YES)  /   Esc (NO)");

-      //

-      // Popup a menu to notice user

-      //

-      do {

-        Browser->CreatePopUp (2, TRUE, 0, NULL, &Key, StringBuffer1, StringBuffer2);

-      } while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN));

-

-      FreePool (StringBuffer1);

-      FreePool (StringBuffer2);

-      //

-      // If the user hits the YES Response key, reset

-      //

-      if ((Key.UnicodeChar == CHAR_CARRIAGE_RETURN)) {

-        gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);

-      }

-      gST->ConOut->ClearScreen (gST->ConOut);

-    }

-  }

-}

-

-EFI_STATUS

-BdsLibGetHiiHandles (

-  IN     EFI_HII_PROTOCOL *Hii,

-  IN OUT UINT16           *HandleBufferLength,

-  OUT    EFI_HII_HANDLE   **HiiHandleBuffer

-  )

-/*++

-

-Routine Description:

-

-  Determines the handles that are currently active in the database.

-  It's the caller's responsibility to free handle buffer.

-

-Arguments:

-

-  This                  - A pointer to the EFI_HII_PROTOCOL instance.

-  HandleBufferLength    - On input, a pointer to the length of the handle buffer. On output,

-                          the length of the handle buffer that is required for the handles found.

-  HiiHandleBuffer       - Pointer to an array of EFI_HII_PROTOCOL instances returned.

-

-Returns:

-

-  EFI_SUCCESS           - Get an array of EFI_HII_PROTOCOL instances successfully.

-  EFI_INVALID_PARAMETER - Hii is NULL.

-  EFI_NOT_FOUND         - Database not found.

-

---*/

-{

-  UINT16      TempBufferLength;

-  EFI_STATUS  Status;

-

-  TempBufferLength = 0;

-

-  //

-  // Try to find the actual buffer size for HiiHandle Buffer.

-  //

-  Status = Hii->FindHandles (Hii, &TempBufferLength, *HiiHandleBuffer);

-

-  if (Status == EFI_BUFFER_TOO_SMALL) {

-    *HiiHandleBuffer = AllocateZeroPool (TempBufferLength);

-    Status = Hii->FindHandles (Hii, &TempBufferLength, *HiiHandleBuffer);

-    //

-    // we should not fail here.

-    //

-    ASSERT_EFI_ERROR (Status);

-  }

-

-  *HandleBufferLength = TempBufferLength;

-

-  return Status;

-

-}

diff --git a/EdkNt32Pkg/Library/EdkGenericBdsLib/DevicePath.c b/EdkNt32Pkg/Library/EdkGenericBdsLib/DevicePath.c
deleted file mode 100644
index e893046..0000000
--- a/EdkNt32Pkg/Library/EdkGenericBdsLib/DevicePath.c
+++ /dev/null
@@ -1,1119 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  DevicePath.c

-

-Abstract:

-

-  BDS internal function define the default device path string, it can be

-  replaced by platform device path.

-

---*/

-

-EFI_GUID  mEfiWinNtThunkProtocolGuid  = EFI_WIN_NT_THUNK_PROTOCOL_GUID;

-EFI_GUID  mEfiWinNtUgaGuid            = EFI_WIN_NT_UGA_GUID;

-EFI_GUID  mEfiWinNtGopGuid            = EFI_WIN_NT_GOP_GUID;

-EFI_GUID  mEfiWinNtSerialPortGuid     = EFI_WIN_NT_SERIAL_PORT_GUID;

-EFI_GUID  mEfiMsgPcAnsiGuid           = DEVICE_PATH_MESSAGING_PC_ANSI;

-EFI_GUID  mEfiMsgVt100Guid            = DEVICE_PATH_MESSAGING_VT_100;

-EFI_GUID  mEfiMsgVt100PlusGuid        = DEVICE_PATH_MESSAGING_VT_100_PLUS;

-EFI_GUID  mEfiMsgVt100Utf8Guid        = DEVICE_PATH_MESSAGING_VT_UTF8;

-

-VOID *

-ReallocatePool (

-  IN VOID                 *OldPool,

-  IN UINTN                OldSize,

-  IN UINTN                NewSize

-  )

-/*++

-

-Routine Description:

-

-  Adjusts the size of a previously allocated buffer.

-

-Arguments:

-

-  OldPool               - A pointer to the buffer whose size is being adjusted.

-

-  OldSize               - The size of the current buffer.

-

-  NewSize               - The size of the new buffer.

-

-Returns:

-

-  EFI_SUCEESS           - The requested number of bytes were allocated.

-

-  EFI_OUT_OF_RESOURCES  - The pool requested could not be allocated.

-

-  EFI_INVALID_PARAMETER - The buffer was invalid.

-

---*/

-{

-  VOID  *NewPool;

-

-  NewPool = NULL;

-  if (NewSize) {

-    NewPool = AllocateZeroPool (NewSize);

-  }

-

-  if (OldPool) {

-    if (NewPool) {

-      CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize);

-    }

-

-    FreePool (OldPool);

-  }

-

-  return NewPool;

-}

-

-CHAR16 *

-CatPrint (

-  IN OUT POOL_PRINT   *Str,

-  IN CHAR16           *fmt,

-  ...

-  )

-/*++

-

-Routine Description:

-

-    Concatenates a formatted unicode string to allocated pool.

-    The caller must free the resulting buffer.

-

-Arguments:

-

-    Str         - Tracks the allocated pool, size in use, and

-                  amount of pool allocated.

-

-    fmt         - The format string

-

-Returns:

-

-    Allocated buffer with the formatted string printed in it.

-    The caller must free the allocated buffer.   The buffer

-    allocation is not packed.

-

---*/

-{

-  UINT16  *AppendStr;

-  VA_LIST args;

-  UINTN   strsize;

-

-  AppendStr = AllocateZeroPool (0x1000);

-  if (AppendStr == NULL) {

-    return Str->str;

-  }

-

-  VA_START (args, fmt);

-  UnicodeVSPrint (AppendStr, 0x1000, fmt, args);

-  VA_END (args);

-  if (NULL == Str->str) {

-    strsize   = StrSize (AppendStr);

-    Str->str  = AllocateZeroPool (strsize);

-    ASSERT (Str->str != NULL);

-  } else {

-    strsize = StrSize (AppendStr) + StrSize (Str->str) - sizeof (UINT16);

-    Str->str = ReallocatePool (

-                Str->str,

-                StrSize (Str->str),

-                strsize

-                );

-    ASSERT (Str->str != NULL);

-  }

-

-  Str->maxlen = MAX_CHAR * sizeof (UINT16);

-  if (strsize < Str->maxlen) {

-    StrCat (Str->str, AppendStr);

-    Str->len = strsize - sizeof (UINT16);

-  }

-

-  FreePool (AppendStr);

-  return Str->str;

-}

-

-EFI_DEVICE_PATH_PROTOCOL *

-BdsLibUnpackDevicePath (

-  IN EFI_DEVICE_PATH_PROTOCOL  *DevPath

-  )

-/*++

-

-Routine Description:

-

-  Function unpacks a device path data structure so that all the nodes

-  of a device path are naturally aligned.

-

-Arguments:

-

-  DevPath        - A pointer to a device path data structure

-

-Returns:

-

-  If the memory for the device path is successfully allocated, then a

-  pointer to the new device path is returned.  Otherwise, NULL is returned.

-

---*/

-{

-  EFI_DEVICE_PATH_PROTOCOL  *Src;

-  EFI_DEVICE_PATH_PROTOCOL  *Dest;

-  EFI_DEVICE_PATH_PROTOCOL  *NewPath;

-  UINTN                     Size;

-

-  //

-  // Walk device path and round sizes to valid boundries

-  //

-  Src   = DevPath;

-  Size  = 0;

-  for (;;) {

-    Size += DevicePathNodeLength (Src);

-    Size += ALIGN_SIZE (Size);

-

-    if (IsDevicePathEnd (Src)) {

-      break;

-    }

-

-    Src = NextDevicePathNode (Src);

-  }

-  //

-  // Allocate space for the unpacked path

-  //

-  NewPath = AllocateZeroPool (Size);

-  if (NewPath) {

-

-    ASSERT (((UINTN) NewPath) % MIN_ALIGNMENT_SIZE == 0);

-

-    //

-    // Copy each node

-    //

-    Src   = DevPath;

-    Dest  = NewPath;

-    for (;;) {

-      Size = DevicePathNodeLength (Src);

-      CopyMem (Dest, Src, Size);

-      Size += ALIGN_SIZE (Size);

-      SetDevicePathNodeLength (Dest, Size);

-      Dest->Type |= EFI_DP_TYPE_UNPACKED;

-      Dest = (EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *) Dest) + Size);

-

-      if (IsDevicePathEnd (Src)) {

-        break;

-      }

-

-      Src = NextDevicePathNode (Src);

-    }

-  }

-

-  return NewPath;

-}

-

-VOID

-DevPathPci (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  PCI_DEVICE_PATH *Pci;

-

-  Pci = DevPath;

-  CatPrint (Str, L"Pci(%x|%x)", Pci->Device, Pci->Function);

-}

-

-VOID

-DevPathPccard (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  PCCARD_DEVICE_PATH  *Pccard;

-

-  Pccard = DevPath;

-  CatPrint (Str, L"Pcmcia(Function%x)", Pccard->FunctionNumber);

-}

-

-VOID

-DevPathMemMap (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  MEMMAP_DEVICE_PATH  *MemMap;

-

-  MemMap = DevPath;

-  CatPrint (

-    Str,

-    L"MemMap(%d:%.lx-%.lx)",

-    MemMap->MemoryType,

-    MemMap->StartingAddress,

-    MemMap->EndingAddress

-    );

-}

-

-VOID

-DevPathController (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  CONTROLLER_DEVICE_PATH  *Controller;

-

-  Controller = DevPath;

-  CatPrint (Str, L"Ctrl(%d)", Controller->ControllerNumber);

-}

-

-VOID

-DevPathVendor (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-/*++

-

-Routine Description:

-

-  Convert Vendor device path to device name

-

-Arguments:

-

-  Str     - The buffer store device name

-  DevPath - Pointer to vendor device path

-

-Returns:

-

-  When it return, the device name have been stored in *Str.

-

---*/

-{

-  VENDOR_DEVICE_PATH  *Vendor;

-  CHAR16              *Type;

-  INT32               *Temp;

-

-  Vendor  = DevPath;

-  Temp    = (INT32 *) (&Vendor->Guid);

-

-  switch (DevicePathType (&Vendor->Header)) {

-  case HARDWARE_DEVICE_PATH:

-    //

-    // If the device is a winntbus device, we will give it a readable device name.

-    //

-    if (CompareGuid (&Vendor->Guid, &mEfiWinNtThunkProtocolGuid)) {

-      CatPrint (Str, L"%s", L"WinNtBus");

-      return ;

-    } else if (CompareGuid (&Vendor->Guid, &mEfiWinNtUgaGuid)) {

-      CatPrint (Str, L"%s", L"UGA");

-      return ;

-    } else if (CompareGuid (&Vendor->Guid, &mEfiWinNtGopGuid)) {

-      CatPrint (Str, L"%s", L"GOP");

-      return ;

-    } else if (CompareGuid (&Vendor->Guid, &mEfiWinNtSerialPortGuid)) {

-      CatPrint (Str, L"%s", L"Serial");

-      return ;

-    } else {

-      Type = L"Hw";

-      break;

-    }

-

-  case MESSAGING_DEVICE_PATH:

-    //

-    // If the device is a winntbus device, we will give it a readable device name.

-    //

-    if (CompareGuid (&Vendor->Guid, &mEfiMsgPcAnsiGuid)) {

-      CatPrint (Str, L"%s", L"PC-ANSI");

-      return ;

-    } else if (CompareGuid (&Vendor->Guid, &mEfiMsgVt100Guid)) {

-      CatPrint (Str, L"%s", L"VT100");

-      return ;

-    } else if (CompareGuid (&Vendor->Guid, &mEfiMsgVt100PlusGuid)) {

-      CatPrint (Str, L"%s", L"VT100+");

-      return ;

-    } else if (CompareGuid (&Vendor->Guid, &mEfiMsgVt100Utf8Guid)) {

-      CatPrint (Str, L"%s", L"VT100-UTF8");

-      return ;

-    } else {

-      Type = L"Msg";

-      break;

-    }

-

-  case MEDIA_DEVICE_PATH:

-    Type = L"Media";

-    break;

-

-  default:

-    Type = L"?";

-    break;

-  }

-

-  CatPrint (Str, L"Ven%s(%g)", Type, &Vendor->Guid);

-}

-

-VOID

-DevPathAcpi (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  ACPI_HID_DEVICE_PATH  *Acpi;

-

-  Acpi = DevPath;

-  if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {

-    CatPrint (Str, L"Acpi(PNP%04x,%x)", EISA_ID_TO_NUM (Acpi->HID), Acpi->UID);

-  } else {

-    CatPrint (Str, L"Acpi(%08x,%x)", Acpi->HID, Acpi->UID);

-  }

-}

-

-VOID

-DevPathExtendedAcpi (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  ACPI_EXTENDED_HID_DEVICE_PATH   *ExtendedAcpi;

-  //

-  // Index for HID, UID and CID strings, 0 for non-exist

-  //

-  UINT16                          HIDSTRIdx;

-  UINT16                          UIDSTRIdx;

-  UINT16                          CIDSTRIdx;

-  UINT16                          Index;

-  UINT16                          Length;

-  UINT16                          Anchor;

-  CHAR8                           *AsChar8Array;

-

-  ASSERT (Str != NULL);

-  ASSERT (DevPath != NULL);

-

-  HIDSTRIdx    = 0;

-  UIDSTRIdx    = 0;

-  CIDSTRIdx    = 0;

-  ExtendedAcpi = DevPath;

-  Length       = DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) ExtendedAcpi);

-

-  ASSERT (Length >= 19);

-  AsChar8Array = (CHAR8 *) ExtendedAcpi;

-

-  //

-  // find HIDSTR

-  //

-  Anchor = 16;

-  for (Index = Anchor; Index < Length && AsChar8Array[Index]; Index++) {

-    ;

-  }

-  if (Index > Anchor) {

-    HIDSTRIdx = Anchor;

-  }

-  //

-  // find UIDSTR

-  //

-  Anchor = Index + 1;

-  for (Index = Anchor; Index < Length && AsChar8Array[Index]; Index++) {

-    ;

-  }

-  if (Index > Anchor) {

-    UIDSTRIdx = Anchor;

-  }

-  //

-  // find CIDSTR

-  //

-  Anchor = Index + 1;

-  for (Index = Anchor; Index < Length && AsChar8Array[Index]; Index++) {

-    ;

-  }

-  if (Index > Anchor) {

-    CIDSTRIdx = Anchor;

-  }

-

-  if (HIDSTRIdx == 0 && CIDSTRIdx == 0 && ExtendedAcpi->UID == 0) {

-    CatPrint (Str, L"AcpiExp(");

-    if ((ExtendedAcpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {

-      CatPrint (Str, L"PNP%04x,", EISA_ID_TO_NUM (ExtendedAcpi->HID));

-    } else {

-      CatPrint (Str, L"%08x,", ExtendedAcpi->HID);

-    }

-    if ((ExtendedAcpi->CID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {

-      CatPrint (Str, L"PNP%04x,", EISA_ID_TO_NUM (ExtendedAcpi->CID));

-    } else {

-      CatPrint (Str, L"%08x,", ExtendedAcpi->CID);

-    }

-    if (UIDSTRIdx != 0) {

-      CatPrint (Str, L"%a)", AsChar8Array + UIDSTRIdx);

-    } else {

-      CatPrint (Str, L"\"\")");

-    }

-  } else {

-    CatPrint (Str, L"AcpiEx(");

-    if ((ExtendedAcpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {

-      CatPrint (Str, L"PNP%04x,", EISA_ID_TO_NUM (ExtendedAcpi->HID));

-    } else {

-      CatPrint (Str, L"%08x,", ExtendedAcpi->HID);

-    }

-    if ((ExtendedAcpi->CID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {

-      CatPrint (Str, L"PNP%04x,", EISA_ID_TO_NUM (ExtendedAcpi->CID));

-    } else {

-      CatPrint (Str, L"%08x,", ExtendedAcpi->CID);

-    }

-    CatPrint (Str, L"%x,", ExtendedAcpi->UID);

-

-    if (HIDSTRIdx != 0) {

-      CatPrint (Str, L"%a,", AsChar8Array + HIDSTRIdx);

-    } else {

-      CatPrint (Str, L"\"\",");

-    }

-    if (CIDSTRIdx != 0) {

-      CatPrint (Str, L"%a,", AsChar8Array + CIDSTRIdx);

-    } else {

-      CatPrint (Str, L"\"\",");

-    }

-    if (UIDSTRIdx != 0) {

-      CatPrint (Str, L"%a)", AsChar8Array + UIDSTRIdx);

-    } else {

-      CatPrint (Str, L"\"\")");

-    }

-  }

-

-}

-

-VOID

-DevPathAdrAcpi (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  ACPI_ADR_DEVICE_PATH    *AcpiAdr;

-  UINT16                  Index;

-  UINT16                  Length;

-  UINT16                  AdditionalAdrCount;

-

-  AcpiAdr            = DevPath;

-  Length             = DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) AcpiAdr);

-  AdditionalAdrCount = (Length - 8) / 4;

-

-  CatPrint (Str, L"AcpiAdr(%x", AcpiAdr->ADR);

-  for (Index = 0; Index < AdditionalAdrCount; Index++) {

-    CatPrint (Str, L",%x", *(UINT32 *) ((UINT8 *) AcpiAdr + 8 + Index * 4));

-  }

-  CatPrint (Str, L")");

-}

-

-VOID

-DevPathAtapi (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  ATAPI_DEVICE_PATH *Atapi;

-

-  Atapi = DevPath;

-  CatPrint (

-    Str,

-    L"Ata(%s,%s)",

-    Atapi->PrimarySecondary ? L"Secondary" : L"Primary",

-    Atapi->SlaveMaster ? L"Slave" : L"Master"

-    );

-}

-

-VOID

-DevPathScsi (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  SCSI_DEVICE_PATH  *Scsi;

-

-  Scsi = DevPath;

-  CatPrint (Str, L"Scsi(Pun%x,Lun%x)", Scsi->Pun, Scsi->Lun);

-}

-

-VOID

-DevPathFibre (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  FIBRECHANNEL_DEVICE_PATH  *Fibre;

-

-  Fibre = DevPath;

-  CatPrint (Str, L"Fibre(Wwn%lx,Lun%x)", Fibre->WWN, Fibre->Lun);

-}

-

-VOID

-DevPath1394 (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  F1394_DEVICE_PATH *F1394;

-

-  F1394 = DevPath;

-  CatPrint (Str, L"1394(%g)", &F1394->Guid);

-}

-

-VOID

-DevPathUsb (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  USB_DEVICE_PATH *Usb;

-

-  Usb = DevPath;

-  CatPrint (Str, L"Usb(%x, %x)", Usb->ParentPortNumber, Usb->InterfaceNumber);

-}

-

-VOID

-DevPathUsbClass (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  USB_CLASS_DEVICE_PATH *UsbClass;

-

-  UsbClass = DevPath;

-  CatPrint (

-    Str,

-    L"Usb Class(%x, %x, %x, %x, %x)",

-    UsbClass->VendorId,

-    UsbClass->ProductId,

-    UsbClass->DeviceClass,

-    UsbClass->DeviceSubClass,

-    UsbClass->DeviceProtocol

-    );

-}

-

-VOID

-DevPathI2O (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  I2O_DEVICE_PATH *I2O;

-

-  I2O = DevPath;

-  CatPrint (Str, L"I2O(%x)", I2O->Tid);

-}

-

-VOID

-DevPathMacAddr (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  MAC_ADDR_DEVICE_PATH  *MAC;

-  UINTN                 HwAddressSize;

-  UINTN                 Index;

-

-  MAC           = DevPath;

-

-  HwAddressSize = sizeof (EFI_MAC_ADDRESS);

-  if (MAC->IfType == 0x01 || MAC->IfType == 0x00) {

-    HwAddressSize = 6;

-  }

-

-  CatPrint (Str, L"Mac(");

-

-  for (Index = 0; Index < HwAddressSize; Index++) {

-    CatPrint (Str, L"%02x", MAC->MacAddress.Addr[Index]);

-  }

-

-  CatPrint (Str, L")");

-}

-

-VOID

-DevPathIPv4 (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  IPv4_DEVICE_PATH  *IP;

-

-  IP = DevPath;

-  CatPrint (

-    Str,

-    L"IPv4(%d.%d.%d.%d:%d)",

-    IP->RemoteIpAddress.Addr[0],

-    IP->RemoteIpAddress.Addr[1],

-    IP->RemoteIpAddress.Addr[2],

-    IP->RemoteIpAddress.Addr[3],

-    IP->RemotePort

-    );

-}

-

-VOID

-DevPathIPv6 (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  IPv6_DEVICE_PATH  *IP;

-

-  IP = DevPath;

-  CatPrint (Str, L"IP-v6(not-done)");

-}

-

-VOID

-DevPathInfiniBand (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  INFINIBAND_DEVICE_PATH  *InfiniBand;

-

-  InfiniBand = DevPath;

-  CatPrint (Str, L"InfiniBand(not-done)");

-}

-

-VOID

-DevPathUart (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  UART_DEVICE_PATH  *Uart;

-  CHAR8             Parity;

-

-  Uart = DevPath;

-  switch (Uart->Parity) {

-  case 0:

-    Parity = 'D';

-    break;

-

-  case 1:

-    Parity = 'N';

-    break;

-

-  case 2:

-    Parity = 'E';

-    break;

-

-  case 3:

-    Parity = 'O';

-    break;

-

-  case 4:

-    Parity = 'M';

-    break;

-

-  case 5:

-    Parity = 'S';

-    break;

-

-  default:

-    Parity = 'x';

-    break;

-  }

-

-  if (Uart->BaudRate == 0) {

-    CatPrint (Str, L"Uart(DEFAULT %c", Parity);

-  } else {

-    CatPrint (Str, L"Uart(%d %c", Uart->BaudRate, Parity);

-  }

-

-  if (Uart->DataBits == 0) {

-    CatPrint (Str, L"D");

-  } else {

-    CatPrint (Str, L"%d", Uart->DataBits);

-  }

-

-  switch (Uart->StopBits) {

-  case 0:

-    CatPrint (Str, L"D)");

-    break;

-

-  case 1:

-    CatPrint (Str, L"1)");

-    break;

-

-  case 2:

-    CatPrint (Str, L"1.5)");

-    break;

-

-  case 3:

-    CatPrint (Str, L"2)");

-    break;

-

-  default:

-    CatPrint (Str, L"x)");

-    break;

-  }

-}

-

-VOID

-DevPathHardDrive (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  HARDDRIVE_DEVICE_PATH *Hd;

-

-  Hd = DevPath;

-  switch (Hd->SignatureType) {

-  case SIGNATURE_TYPE_MBR:

-    CatPrint (

-      Str,

-      L"HD(Part%d,Sig%08x)",

-      Hd->PartitionNumber,

-      *((UINT32 *) (&(Hd->Signature[0])))

-      );

-    break;

-

-  case SIGNATURE_TYPE_GUID:

-    CatPrint (

-      Str,

-      L"HD(Part%d,Sig%g)",

-      Hd->PartitionNumber,

-      (EFI_GUID *) &(Hd->Signature[0])

-      );

-    break;

-

-  default:

-    CatPrint (

-      Str,

-      L"HD(Part%d,MBRType=%02x,SigType=%02x)",

-      Hd->PartitionNumber,

-      Hd->MBRType,

-      Hd->SignatureType

-      );

-    break;

-  }

-}

-

-VOID

-DevPathCDROM (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  CDROM_DEVICE_PATH *Cd;

-

-  Cd = DevPath;

-  CatPrint (Str, L"CDROM(Entry%x)", Cd->BootEntry);

-}

-

-VOID

-DevPathFilePath (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  FILEPATH_DEVICE_PATH  *Fp;

-

-  Fp = DevPath;

-  CatPrint (Str, L"%s", Fp->PathName);

-}

-

-VOID

-DevPathMediaProtocol (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  MEDIA_PROTOCOL_DEVICE_PATH  *MediaProt;

-

-  MediaProt = DevPath;

-  CatPrint (Str, L"%g", &MediaProt->Protocol);

-}

-

-VOID

-DevPathFvFilePath (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFilePath;

-

-  FvFilePath = DevPath;

-  CatPrint (Str, L"%g", &FvFilePath->NameGuid);

-}

-

-VOID

-DevPathBssBss (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  BBS_BBS_DEVICE_PATH *Bbs;

-  CHAR16              *Type;

-

-  Bbs = DevPath;

-  switch (Bbs->DeviceType) {

-  case BBS_TYPE_FLOPPY:

-    Type = L"Floppy";

-    break;

-

-  case BBS_TYPE_HARDDRIVE:

-    Type = L"Harddrive";

-    break;

-

-  case BBS_TYPE_CDROM:

-    Type = L"CDROM";

-    break;

-

-  case BBS_TYPE_PCMCIA:

-    Type = L"PCMCIA";

-    break;

-

-  case BBS_TYPE_USB:

-    Type = L"Usb";

-    break;

-

-  case BBS_TYPE_EMBEDDED_NETWORK:

-    Type = L"Net";

-    break;

-

-  default:

-    Type = L"?";

-    break;

-  }

-  //

-  // Since current Print function hasn't implemented %a (for ansi string)

-  // we will only print Unicode strings.

-  //

-  CatPrint (Str, L"Legacy-%s", Type);

-}

-

-VOID

-DevPathEndInstance (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  CatPrint (Str, L",");

-}

-

-VOID

-DevPathNodeUnknown (

-  IN OUT POOL_PRINT       *Str,

-  IN VOID                 *DevPath

-  )

-{

-  CatPrint (Str, L"?");

-}

-

-DEVICE_PATH_STRING_TABLE  DevPathTable[] = {

-  HARDWARE_DEVICE_PATH,

-  HW_PCI_DP,

-  DevPathPci,

-  HARDWARE_DEVICE_PATH,

-  HW_PCCARD_DP,

-  DevPathPccard,

-  HARDWARE_DEVICE_PATH,

-  HW_MEMMAP_DP,

-  DevPathMemMap,

-  HARDWARE_DEVICE_PATH,

-  HW_VENDOR_DP,

-  DevPathVendor,

-  HARDWARE_DEVICE_PATH,

-  HW_CONTROLLER_DP,

-  DevPathController,

-  ACPI_DEVICE_PATH,

-  ACPI_DP,

-  DevPathAcpi,

-  ACPI_DEVICE_PATH,

-  ACPI_EXTENDED_DP,

-  DevPathExtendedAcpi,

-  ACPI_DEVICE_PATH,

-  ACPI_ADR_DP,

-  DevPathAdrAcpi,

-  MESSAGING_DEVICE_PATH,

-  MSG_ATAPI_DP,

-  DevPathAtapi,

-  MESSAGING_DEVICE_PATH,

-  MSG_SCSI_DP,

-  DevPathScsi,

-  MESSAGING_DEVICE_PATH,

-  MSG_FIBRECHANNEL_DP,

-  DevPathFibre,

-  MESSAGING_DEVICE_PATH,

-  MSG_1394_DP,

-  DevPath1394,

-  MESSAGING_DEVICE_PATH,

-  MSG_USB_DP,

-  DevPathUsb,

-  MESSAGING_DEVICE_PATH,

-  MSG_USB_CLASS_DP,

-  DevPathUsbClass,

-  MESSAGING_DEVICE_PATH,

-  MSG_I2O_DP,

-  DevPathI2O,

-  MESSAGING_DEVICE_PATH,

-  MSG_MAC_ADDR_DP,

-  DevPathMacAddr,

-  MESSAGING_DEVICE_PATH,

-  MSG_IPv4_DP,

-  DevPathIPv4,

-  MESSAGING_DEVICE_PATH,

-  MSG_IPv6_DP,

-  DevPathIPv6,

-  MESSAGING_DEVICE_PATH,

-  MSG_INFINIBAND_DP,

-  DevPathInfiniBand,

-  MESSAGING_DEVICE_PATH,

-  MSG_UART_DP,

-  DevPathUart,

-  MESSAGING_DEVICE_PATH,

-  MSG_VENDOR_DP,

-  DevPathVendor,

-  MEDIA_DEVICE_PATH,

-  MEDIA_HARDDRIVE_DP,

-  DevPathHardDrive,

-  MEDIA_DEVICE_PATH,

-  MEDIA_CDROM_DP,

-  DevPathCDROM,

-  MEDIA_DEVICE_PATH,

-  MEDIA_VENDOR_DP,

-  DevPathVendor,

-  MEDIA_DEVICE_PATH,

-  MEDIA_FILEPATH_DP,

-  DevPathFilePath,

-  MEDIA_DEVICE_PATH,

-  MEDIA_PROTOCOL_DP,

-  DevPathMediaProtocol,

-  BBS_DEVICE_PATH,

-  BBS_BBS_DP,

-  DevPathBssBss,

-  END_DEVICE_PATH_TYPE,

-  END_INSTANCE_DEVICE_PATH_SUBTYPE,

-  DevPathEndInstance,

-  0,

-  0,

-  NULL

-};

-

-CHAR16 *

-DevicePathToStr (

-  IN EFI_DEVICE_PATH_PROTOCOL     *DevPath

-  )

-/*++

-

-  Turns the Device Path into a printable string.  Allcoates

-  the string from pool.  The caller must SafeFreePool the returned

-  string.

-

---*/

-{

-  POOL_PRINT                Str;

-  EFI_DEVICE_PATH_PROTOCOL  *DevPathNode;

-  VOID (*DumpNode) (POOL_PRINT *, VOID *);

-

-  UINTN Index;

-  UINTN NewSize;

-

-  ZeroMem (&Str, sizeof (Str));

-

-  if (DevPath == NULL) {

-    goto Done;

-  }

-  //

-  // Unpacked the device path

-  //

-  DevPath = BdsLibUnpackDevicePath (DevPath);

-  ASSERT (DevPath);

-

-  //

-  // Process each device path node

-  //

-  DevPathNode = DevPath;

-  while (!IsDevicePathEnd (DevPathNode)) {

-    //

-    // Find the handler to dump this device path node

-    //

-    DumpNode = NULL;

-    for (Index = 0; DevPathTable[Index].Function; Index += 1) {

-

-      if (DevicePathType (DevPathNode) == DevPathTable[Index].Type &&

-          DevicePathSubType (DevPathNode) == DevPathTable[Index].SubType

-          ) {

-        DumpNode = DevPathTable[Index].Function;

-        break;

-      }

-    }

-    //

-    // If not found, use a generic function

-    //

-    if (!DumpNode) {

-      DumpNode = DevPathNodeUnknown;

-    }

-    //

-    //  Put a path seperator in if needed

-    //

-    if (Str.len && DumpNode != DevPathEndInstance) {

-      CatPrint (&Str, L"/");

-    }

-    //

-    // Print this node of the device path

-    //

-    DumpNode (&Str, DevPathNode);

-

-    //

-    // Next device path node

-    //

-    DevPathNode = NextDevicePathNode (DevPathNode);

-  }

-  //

-  // Shrink pool used for string allocation

-  //

-  FreePool (DevPath);

-

-Done:

-  NewSize = (Str.len + 1) * sizeof (CHAR16);

-  Str.str = ReallocatePool (Str.str, NewSize, NewSize);

-  ASSERT (Str.str != NULL);

-  Str.str[Str.len] = 0;

-  return Str.str;

-}

-

-EFI_DEVICE_PATH_PROTOCOL *

-LibDuplicateDevicePathInstance (

-  IN EFI_DEVICE_PATH_PROTOCOL  *DevPath

-  )

-/*++

-

-Routine Description:

-

-  Function creates a device path data structure that identically matches the

-  device path passed in.

-

-Arguments:

-

-  DevPath      - A pointer to a device path data structure.

-

-Returns:

-

-  The new copy of DevPath is created to identically match the input.

-  Otherwise, NULL is returned.

-

---*/

-{

-  EFI_DEVICE_PATH_PROTOCOL  *NewDevPath;

-  EFI_DEVICE_PATH_PROTOCOL  *DevicePathInst;

-  EFI_DEVICE_PATH_PROTOCOL  *Temp;

-  UINTN                     Size;

-

-  //

-  // get the size of an instance from the input

-  //

-  Temp            = DevPath;

-  DevicePathInst  = GetNextDevicePathInstance (&Temp, &Size);

-

-  //

-  // Make a copy

-  //

-  NewDevPath = NULL;

-  if (Size) {

-    NewDevPath = AllocateZeroPool (Size);

-    ASSERT (NewDevPath != NULL);

-  }

-

-  if (NewDevPath) {

-    CopyMem (NewDevPath, DevicePathInst, Size);

-  }

-

-  return NewDevPath;

-}

diff --git a/EdkNt32Pkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.msa b/EdkNt32Pkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.msa
deleted file mode 100644
index 0626602..0000000
--- a/EdkNt32Pkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.msa
+++ /dev/null
@@ -1,144 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>EdkGenericBdsLib</ModuleName>

-    <ModuleType>DXE_DRIVER</ModuleType>

-    <GuidValue>1ec995b2-d15b-44f6-abd2-050ea7dd37d2</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>EDK Generic BDS Common APIs Library Instance.</Abstract>

-    <Description>The library instance provides common library routines help in

-    performance measurement, device path debug print, boot device selections,

-    boot device connection, console supports in BDS phase and boot from boot

-    device.</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>EdkGenericBdsLib</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER">

-      <Keyword>EdkGenericBdsLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DxeServicesTableLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>PrintLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>HobLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseMemoryLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>MemoryAllocationLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiBootServicesTableLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiRuntimeServicesTableLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DevicePathLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>PerformanceLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>PeCoffLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>BdsBoot.c</Filename>

-    <Filename>BdsConsole.c</Filename>

-    <Filename>BdsConnect.c</Filename>

-    <Filename>DevicePath.c</Filename>

-    <Filename>Performance.h</Filename>

-    <Filename>Performance.c</Filename>

-    <Filename>BdsMisc.c</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <Protocols>

-    <Protocol Usage="ALWAYS_CONSUMED">

-      <ProtocolCName>gEfiLoadedImageProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="SOMETIMES_CONSUMED">

-      <ProtocolCName>gEfiFirmwareVolumeProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="SOMETIMES_CONSUMED">

-      <ProtocolCName>gEfiAcpiS3SaveProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="SOMETIMES_CONSUMED">

-      <ProtocolCName>gEfiSimpleTextOutProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="SOMETIMES_CONSUMED">

-      <ProtocolCName>gEfiSimpleTextInProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="SOMETIMES_CONSUMED">

-      <ProtocolCName>gEfiSimpleNetworkProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="ALWAYS_CONSUMED">

-      <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="ALWAYS_CONSUMED">

-      <ProtocolCName>gEfiCpuArchProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="ALWAYS_CONSUMED">

-      <ProtocolCName>gEfiLegacyBiosProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="ALWAYS_CONSUMED">

-      <ProtocolCName>gEfiBlockIoProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="SOMETIMES_CONSUMED">

-      <ProtocolCName>gEfiDriverBindingProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="ALWAYS_CONSUMED">

-      <ProtocolCName>gEfiFormBrowserProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="SOMETIMES_CONSUMED">

-      <ProtocolCName>gEfiLoadFileProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="SOMETIMES_CONSUMED">

-      <ProtocolCName>gEfiSimpleFileSystemProtocolGuid</ProtocolCName>

-    </Protocol>

-  </Protocols>

-  <Guids>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiShellFileGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiGenericPlatformVariableGuid</GuidCName>

-    </GuidCNames>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiGlobalVariableGuid</GuidCName>

-    </GuidCNames>

-  </Guids>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-  </Externs>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Library/EdkGenericBdsLib/Performance.c b/EdkNt32Pkg/Library/EdkGenericBdsLib/Performance.c
deleted file mode 100644
index 2d157ae..0000000
--- a/EdkNt32Pkg/Library/EdkGenericBdsLib/Performance.c
+++ /dev/null
@@ -1,386 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  Performance.c

-

-Abstract:

-

-  This file include the file which can help to get the system

-  performance, all the function will only include if the performance

-  switch is set.

-

---*/

-

-#include "Performance.h"

-

-

-STATIC

-VOID

-GetShortPdbFileName (

-  CHAR8  *PdbFileName,

-  CHAR8  *GaugeString

-  )

-/*++

-

-Routine Description:

-

-Arguments:

-

-Returns:

-

---*/

-{

-  UINTN Index;

-  UINTN Index1;

-  UINTN StartIndex;

-  UINTN EndIndex;

-

-  if (PdbFileName == NULL) {

-    AsciiStrCpy (GaugeString, " ");

-  } else {

-    StartIndex = 0;

-    for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++)

-      ;

-

-    for (Index = 0; PdbFileName[Index] != 0; Index++) {

-      if (PdbFileName[Index] == '\\') {

-        StartIndex = Index + 1;

-      }

-

-      if (PdbFileName[Index] == '.') {

-        EndIndex = Index;

-      }

-    }

-

-    Index1 = 0;

-    for (Index = StartIndex; Index < EndIndex; Index++) {

-      GaugeString[Index1] = PdbFileName[Index];

-      Index1++;

-      if (Index1 == PERF_TOKEN_LENGTH - 1) {

-        break;

-      }

-    }

-

-    GaugeString[Index1] = 0;

-  }

-

-  return ;

-}

-

-

-

-STATIC

-CHAR8 *

-GetPdbPath (

-  VOID *ImageBase

-  )

-/*++

-

-Routine Description:

-

-  Located PDB path name in PE image

-

-Arguments:

-

-  ImageBase - base of PE to search

-

-Returns:

-

-  Pointer into image at offset of PDB file name if PDB file name is found,

-  Otherwise a pointer to an empty string.

-

---*/

-{

-  PE_COFF_LOADER_IMAGE_CONTEXT          ImageContext;

-

-  ZeroMem (&ImageContext, sizeof (ImageContext));

-  ImageContext.Handle    = ImageBase;

-  ImageContext.ImageRead = PeCoffLoaderImageReadFromMemory;

-

-  PeCoffLoaderGetImageInfo (&ImageContext);

-

-  return ImageContext.PdbPointer;

-}

-

-

-STATIC

-VOID

-GetNameFromHandle (

-  IN  EFI_HANDLE     Handle,

-  OUT CHAR8          *GaugeString

-  )

-{

-  EFI_STATUS                  Status;

-  EFI_LOADED_IMAGE_PROTOCOL   *Image;

-  CHAR8                       *PdbFileName;

-  EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;

-

-  AsciiStrCpy (GaugeString, " ");

-

-  //

-  // Get handle name from image protocol

-  //

-  Status = gBS->HandleProtocol (

-                  Handle,

-                  &gEfiLoadedImageProtocolGuid,

-                  &Image

-                  );

-

-  if (EFI_ERROR (Status)) {

-    Status = gBS->OpenProtocol (

-                    Handle,

-                    &gEfiDriverBindingProtocolGuid,

-                    (VOID **) &DriverBinding,

-                    NULL,

-                    NULL,

-                    EFI_OPEN_PROTOCOL_GET_PROTOCOL

-                    );

-    if (EFI_ERROR (Status)) {

-      return ;

-    }

-    //

-    // Get handle name from image protocol

-    //

-    Status = gBS->HandleProtocol (

-                    DriverBinding->ImageHandle,

-                    &gEfiLoadedImageProtocolGuid,

-                    &Image

-                    );

-  }

-

-  PdbFileName = GetPdbPath (Image->ImageBase);

-

-  if (PdbFileName != NULL) {

-    GetShortPdbFileName (PdbFileName, GaugeString);

-  }

-

-  return ;

-}

-

-

-

-VOID

-WriteBootToOsPerformanceData (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  Allocates a block of memory and writes performance data of booting to OS into it.

-

-Arguments:

-

-  None

-

-Returns:

-

-  None

-

---*/

-{

-  EFI_STATUS                Status;

-  EFI_CPU_ARCH_PROTOCOL     *Cpu;

-  EFI_PHYSICAL_ADDRESS      mAcpiLowMemoryBase;

-  UINT32                    mAcpiLowMemoryLength;

-  UINT32                    LimitCount;

-  PERF_HEADER               mPerfHeader;

-  PERF_DATA                 mPerfData;

-  EFI_HANDLE                *Handles;

-  UINTN                     NoHandles;

-  CHAR8                     GaugeString[PERF_TOKEN_LENGTH];

-  UINT8                     *Ptr;

-  UINT32                    mIndex;

-  UINT64                    Ticker;

-  UINT64                    Freq;

-  UINT32                    Duration;

-  UINT64                    CurrentTicker;

-  UINT64                    TimerPeriod;

-  UINTN                     LogEntryKey;

-  CONST VOID                *Handle;

-  CONST CHAR8               *Token;

-  CONST CHAR8               *Module;

-  UINT64                    StartTicker;

-  UINT64                    EndTicker;

-

-  //

-  // Retrive time stamp count as early as possilbe

-  //

-  Ticker = AsmReadTsc ();

-

-  //

-  // Allocate a block of memory that contain performance data to OS

-  //

-  mAcpiLowMemoryBase = 0xFFFFFFFF;

-  Status = gBS->AllocatePages (

-                  AllocateMaxAddress,

-                  EfiReservedMemoryType,

-                  4,

-                  &mAcpiLowMemoryBase

-                  );

-  if (EFI_ERROR (Status)) {

-    return ;

-  }

-

-  mAcpiLowMemoryLength  = EFI_PAGES_TO_SIZE(4);

-

-  Ptr                   = (UINT8 *) ((UINT32) mAcpiLowMemoryBase + sizeof (PERF_HEADER));

-  LimitCount            = (mAcpiLowMemoryLength - sizeof (PERF_HEADER)) / sizeof (PERF_DATA);

-

-  //

-  // Initialize performance data structure

-  //

-  ZeroMem (&mPerfHeader, sizeof (PERF_HEADER));

-

-  //

-  // Get CPU frequency

-  //

-  Status = gBS->LocateProtocol (

-                  &gEfiCpuArchProtocolGuid,

-                  NULL,

-                  &Cpu

-                  );

-  if (EFI_ERROR (Status)) {

-    gBS->FreePages (mAcpiLowMemoryBase, 4);

-    return ;

-  }

-  //

-  // Get Cpu Frequency

-  //

-  Status = Cpu->GetTimerValue (Cpu, 0, &(CurrentTicker), &TimerPeriod);

-  if (EFI_ERROR (Status)) {

-    gBS->FreePages (mAcpiLowMemoryBase, 4);

-    return ;

-  }

-

-  Freq                = DivU64x32 (1000000000000, (UINTN) TimerPeriod);

-

-  mPerfHeader.CpuFreq = Freq;

-

-  //

-  // Record BDS raw performance data

-  //

-  mPerfHeader.BDSRaw = Ticker;

-

-  //

-  // Put Detailed performance data into memory

-  //

-  Handles = NULL;

-  Status = gBS->LocateHandleBuffer (

-                  AllHandles,

-                  NULL,

-                  NULL,

-                  &NoHandles,

-                  &Handles

-                  );

-  if (EFI_ERROR (Status)) {

-    gBS->FreePages (mAcpiLowMemoryBase, 4);

-    return ;

-  }

-  //

-  // Get DXE drivers performance

-  //

-  for (mIndex = 0; mIndex < NoHandles; mIndex++) {

-    Ticker = 0;

-    LogEntryKey = 0;

-    while ((LogEntryKey = GetPerformanceMeasurement (

-                            LogEntryKey,

-                            &Handle,

-                            &Token,

-                            &Module,

-                            &StartTicker,

-                            &EndTicker)) != 0) {

-      if ((Handle == Handles[mIndex]) && (StartTicker < EndTicker)) {

-        Ticker += (EndTicker - StartTicker);

-      }

-    }

-

-    Duration = (UINT32) DivU64x32 (

-                          Ticker,

-                          (UINT32) Freq

-                          );

-

-    if (Duration > 0) {

-      ZeroMem (&mPerfData, sizeof (PERF_DATA));

-

-      GetNameFromHandle (Handles[mIndex], GaugeString);

-

-      AsciiStrCpy (mPerfData.Token, GaugeString);

-      mPerfData.Duration = Duration;

-

-      CopyMem (Ptr, &mPerfData, sizeof (PERF_DATA));

-      Ptr += sizeof (PERF_DATA);

-

-      mPerfHeader.Count++;

-      if (mPerfHeader.Count == LimitCount) {

-        goto Done;

-      }

-    }

-  }

-

-  FreePool (Handles);

-

-  //

-  // Get inserted performance data

-  //

-  LogEntryKey = 0;

-  while ((LogEntryKey = GetPerformanceMeasurement (

-                          LogEntryKey,

-                          &Handle,

-                          &Token,

-                          &Module,

-                          &StartTicker,

-                          &EndTicker)) != 0) {

-    if ((Handle == NULL) && (StartTicker <= EndTicker)) {

-

-      ZeroMem (&mPerfData, sizeof (PERF_DATA));

-

-      AsciiStrnCpy (mPerfData.Token, Token, DXE_PERFORMANCE_STRING_SIZE);

-      mPerfData.Duration = (UINT32) DivU64x32 (

-                                      EndTicker - StartTicker,

-                                      (UINT32) Freq

-                                      );

-

-      CopyMem (Ptr, &mPerfData, sizeof (PERF_DATA));

-      Ptr += sizeof (PERF_DATA);

-

-      mPerfHeader.Count++;

-      if (mPerfHeader.Count == LimitCount) {

-        goto Done;

-      }

-    }

-  }

-

-Done:

-

-  mPerfHeader.Signiture = 0x66726550;

-

-  //

-  // Put performance data to memory

-  //

-  CopyMem (

-    (UINT32 *) (UINT32) mAcpiLowMemoryBase,

-    &mPerfHeader,

-    sizeof (PERF_HEADER)

-    );

-

-  gRT->SetVariable (

-        L"PerfDataMemAddr",

-        &gEfiGenericPlatformVariableGuid,

-        EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,

-        sizeof (UINT32),

-        (VOID *) &mAcpiLowMemoryBase

-        );

-

-  return ;

-}

diff --git a/EdkNt32Pkg/Library/EdkGenericBdsLib/Performance.h b/EdkNt32Pkg/Library/EdkGenericBdsLib/Performance.h
deleted file mode 100644
index e7f80ab..0000000
--- a/EdkNt32Pkg/Library/EdkGenericBdsLib/Performance.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  Performance.h

-

-Abstract:

-

-  This file included the performance relete function header and 

-  definition.

-

---*/

-

-#ifndef _PERF_H_

-#define _PERF_H_

-

-#define PERF_TOKEN_LENGTH       28

-#define PERF_PEI_ENTRY_MAX_NUM  50

-

-typedef struct {

-  CHAR8   Token[PERF_TOKEN_LENGTH];

-  UINT32  Duration;

-} PERF_DATA;

-

-typedef struct {

-  UINT64        BootToOs;

-  UINT64        S3Resume;

-  UINT32        S3EntryNum;

-  PERF_DATA     S3Entry[PERF_PEI_ENTRY_MAX_NUM];

-  UINT64        CpuFreq;

-  UINT64        BDSRaw;

-  UINT32        Count;

-  UINT32        Signiture;

-} PERF_HEADER;

-

-VOID

-WriteBootToOsPerformanceData (

-  VOID

-  );

-

-VOID

-ClearDebugRegisters (

-  VOID

-  );

-

-#endif

diff --git a/EdkNt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.msa b/EdkNt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.msa
deleted file mode 100644
index 79fc9ec..0000000
--- a/EdkNt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.msa
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>EdkNt32PeiPeCoffGetEntryPointLib</ModuleName>

-    <ModuleType>PEIM</ModuleType>

-    <GuidValue>434b164e-5fa6-4a3d-bc04-02da2a4eeb26</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>Component description file for the EdkNt32PeiPeCoffGetEntryPointLib library.</Abstract>

-    <Description>PeCoffGetEntryPointLib library class for NT32 instance implemented by use NTPeiLoadFile PPI.</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>EdkNt32PeiPeCoffGetEntryPointLib</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_PRODUCED"  SupModuleList="PEI_CORE PEIM">

-      <Keyword>PeCoffGetEntryPointLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>PeiServicesLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>PeCoffGetEntryPoint.c</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <PPIs>

-    <Ppi Usage="ALWAYS_CONSUMED">

-      <PpiCName>gNtPeiLoadFilePpiGuid</PpiCName>

-    </Ppi>

-  </PPIs>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-  </Externs>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c b/EdkNt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c
deleted file mode 100644
index da2f8e9..0000000
--- a/EdkNt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  PeCoffGetEntryPoint.c

-

-Abstract:

-

-  Tiano PE/COFF loader

-

-Revision History

-

---*/

-

-

-RETURN_STATUS

-EFIAPI

-PeCoffLoaderGetEntryPoint (

-  IN     VOID  *Pe32Data,

-  IN OUT VOID  **EntryPoint

-  )

-/*++

-

-Routine Description:

-

-  Loads a PE/COFF image into memory, this is not follow the original purpose of 

-  PeCoffGetEntryPoint library class.  But it's ok that Unix package not run on a real 

-  platform and this is for source level debug.

-

-Arguments:

-

-  Pe32Data   - Pointer to a PE/COFF Image

-

-  EntryPoint - Pointer to the entry point of the PE/COFF image

-

-Returns:

-

-  EFI_SUCCESS            if the EntryPoint was returned

-  EFI_INVALID_PARAMETER  if the EntryPoint could not be found from Pe32Data

-

---*/

-{

-  EFI_STATUS              Status;

-  EFI_PEI_PPI_DESCRIPTOR  *PpiDescriptor;

-  NT_PEI_LOAD_FILE_PPI    *PeiNtService;

-  EFI_PHYSICAL_ADDRESS    ImageAddress;

-  UINT64                  ImageSize;

-  EFI_PHYSICAL_ADDRESS    ImageEntryPoint;

-

-  Status = PeiServicesLocatePpi (

-             &gNtPeiLoadFilePpiGuid,

-             0,

-             &PpiDescriptor,

-             &PeiNtService

-             );

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  Status = PeiNtService->PeiLoadFileService (

-                           Pe32Data,

-                           &ImageAddress,

-                           &ImageSize,

-                           &ImageEntryPoint

-                           );

-  *EntryPoint = (VOID*)(UINTN)ImageEntryPoint;

-  return Status;

-}

-

-/**

-  Returns the machine type of PE/COFF image. 

-  This is copied from MDE BasePeCoffGetEntryPointLib, the code should be sync with it.

-  The reason is NT32 package needs to load the image to memory to support source

-  level debug.

-   

-

-  @param  Image   Pointer to a PE/COFF header

-

-  @return         Machine type or zero if not a valid iamge

-

-**/

-UINT16

-EFIAPI

-PeCoffLoaderGetMachineType (

-  IN  VOID  *Pe32Data

-  )

-{  

-  EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION  Hdr;

-  EFI_IMAGE_DOS_HEADER                 *DosHdr;

-

-  DosHdr = (EFI_IMAGE_DOS_HEADER  *)Pe32Data;

-  if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {

-    Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)Pe32Data + DosHdr->e_lfanew);

-  } else {

-    Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)Pe32Data);

-  }

-

-  if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE)  {

-    return Hdr.Pe32->FileHeader.Machine;

-  }

-

-  return 0x0000;

-}

-

diff --git a/EdkNt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoader.c b/EdkNt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoader.c
deleted file mode 100644
index 47446d3..0000000
--- a/EdkNt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoader.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  TianoPeCoffLoader.c

-

-Abstract:

-

-  Wrap the Base PE/COFF loader with the PE COFF Protocol

-

-

---*/

-

-

-

-EFI_PEI_PE_COFF_LOADER_PROTOCOL  *mPeiEfiPeiPeCoffLoader;

-

-EFI_STATUS

-EFIAPI

-PeCoffLoaderConstructor (

-  IN EFI_FFS_FILE_HEADER      *FfsHeader,

-  IN EFI_PEI_SERVICES          **PeiServices

-  )

-{

-  EFI_STATUS  Status;

-

-  Status = (*PeiServices)->LocatePpi (

-                            PeiServices,

-                            &gEfiPeiPeCoffLoaderGuid,

-                            0,

-                            NULL,

-                            &mPeiEfiPeiPeCoffLoader

-                            );

-  return Status;

-}

-

-EFI_PEI_PE_COFF_LOADER_PROTOCOL *

-EFIAPI

-GetPeCoffLoaderProtocol (

-  )

-{

-  return mPeiEfiPeiPeCoffLoader;

-}

diff --git a/EdkNt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoaderLib.msa b/EdkNt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoaderLib.msa
deleted file mode 100644
index 1759b4b..0000000
--- a/EdkNt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoaderLib.msa
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>Nt32PeCoffLoaderLib</ModuleName>

-    <ModuleType>PEIM</ModuleType>

-    <GuidValue>3c5702f2-9b17-4273-b60c-b96e6cd13066</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>Component description file for the Nt32PeCoffLoaderLib library.</Abstract>

-    <Description>EdkPeCoffLoaderLib library class for NT32 instance implemented by PeiPeCoffLoader PPI.</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>Nt32PeCoffLoaderLib</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_CORE PEIM">

-      <Keyword>EdkPeCoffLoaderLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>Nt32PeCoffLoader.c</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-  </PackageDependencies>

-  <PPIs>

-    <Ppi Usage="ALWAYS_CONSUMED">

-      <PpiCName>gEfiPeiPeCoffLoaderGuid</PpiCName>

-    </Ppi>

-  </PPIs>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-    <Extern>

-      <Constructor>PeCoffLoaderConstructor</Constructor>

-    </Extern>

-  </Externs>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Library/PeiNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c b/EdkNt32Pkg/Library/PeiNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c
deleted file mode 100644
index 629982f..0000000
--- a/EdkNt32Pkg/Library/PeiNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/** @file

-  OEM hook status code library functions with no library constructor/destructor

-

-  Copyright (c) 2006, Intel Corporation

-  All rights reserved. This program and the accompanying materials

-  are licensed and made available under the terms and conditions of the BSD License

-  which accompanies this distribution.  The full text of the license may be found at

-  http://opensource.org/licenses/bsd-license.php

-

-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-  Module Name:  Nt32OemHookStatusCodeLib.c

-

-**/

-

-//

-// Cache of WinNtThunk protocol 

-//

-STATIC

-EFI_WIN_NT_THUNK_PROTOCOL   *mWinNt;

-

-//

-// Cache of standard output handle . 

-//

-STATIC

-HANDLE                      mStdOut;

-

-/**

-

-  Initialize OEM status code device .

-

-  @return    Always return EFI_SUCCESS.

-

-**/

-EFI_STATUS

-EFIAPI

-OemHookStatusCodeInitialize (

-  VOID

-  )

-{

-  PEI_NT_THUNK_PPI  *NtThunkPpi;

-  EFI_STATUS        Status;

-

-  

-  //

-  // Locate NtThunkPpi for retrieving standard output handle

-  //

-  Status = PeiServicesLocatePpi (

-              &gPeiNtThunkPpiGuid,

-              0,

-              NULL,

-              (VOID **) &NtThunkPpi

-              );

-

-  ASSERT_EFI_ERROR (Status);

-

-  mWinNt  = (EFI_WIN_NT_THUNK_PROTOCOL *) NtThunkPpi->NtThunk ();

-  

-

-  //

-  // Cache standard output handle.

-  //

-  mStdOut = mWinNt->GetStdHandle (STD_OUTPUT_HANDLE);

-

-  return EFI_SUCCESS;

-}

-

-/**

-  Report status code to OEM device.

- 

-  @param  CodeType      Indicates the type of status code being reported.  Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.

- 

-  @param  Value         Describes the current status of a hardware or software entity.  

-                        This included information about the class and subclass that is used to classify the entity 

-                        as well as an operation.  For progress codes, the operation is the current activity. 

-                        For error codes, it is the exception.  For debug codes, it is not defined at this time. 

-                        Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.  

-                        Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.

- 

-  @param  Instance      The enumeration of a hardware or software entity within the system.  

-                        A system may contain multiple entities that match a class/subclass pairing. 

-                        The instance differentiates between them.  An instance of 0 indicates that instance information is unavailable, 

-                        not meaningful, or not relevant.  Valid instance numbers start with 1.

-

-

-  @param  CallerId      This optional parameter may be used to identify the caller. 

-                        This parameter allows the status code driver to apply different rules to different callers. 

-                        Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.

-

-

-  @param  Data          This optional parameter may be used to pass additional data

- 

-  @return               The function always return EFI_SUCCESS.

-

-**/

-EFI_STATUS

-EFIAPI

-OemHookStatusCodeReport (

-  IN EFI_STATUS_CODE_TYPE     CodeType,

-  IN EFI_STATUS_CODE_VALUE    Value,

-  IN UINT32                   Instance,

-  IN EFI_GUID                 *CallerId, OPTIONAL

-  IN EFI_STATUS_CODE_DATA     *Data      OPTIONAL

-  )

-{

-  CHAR8           *Filename;

-  CHAR8           *Description;

-  CHAR8           *Format;

-  CHAR8           Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE];

-  UINT32          ErrorLevel;

-  UINT32          LineNumber;

-  UINTN           CharCount;

-  VA_LIST         Marker;

-  EFI_DEBUG_INFO  *DebugInfo;

-

-  Buffer[0] = '\0';

-

-  if (Data != NULL &&

-      ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber)) {

-    //

-    // Print ASSERT() information into output buffer.

-    //

-    CharCount = AsciiSPrint (

-                  Buffer,

-                  EFI_STATUS_CODE_DATA_MAX_SIZE,

-                  "\n\rASSERT!: %a (%d): %a\n\r",

-                  Filename,

-                  LineNumber,

-                  Description

-                  );

-

-    //

-    // Callout to standard output.

-    //

-    mWinNt->WriteFile (

-              mStdOut,

-              Buffer,

-              CharCount,

-              &CharCount,

-              NULL

-              );

-

-    return EFI_SUCCESS;

-

-  } else if (Data != NULL &&

-             ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {

-    //

-    // Print DEBUG() information into output buffer.

-    //

-    CharCount = AsciiVSPrint (

-                  Buffer, 

-                  EFI_STATUS_CODE_DATA_MAX_SIZE, 

-                  Format, 

-                  Marker

-                  );

-  } else if (Data != NULL && 

-             CompareGuid (&Data->Type, &gEfiStatusCodeSpecificDataGuid) &&

-             (CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) {

-    //

-    // Print specific data into output buffer.

-    //

-    DebugInfo = (EFI_DEBUG_INFO *) (Data + 1);

-    Marker    = (VA_LIST) (DebugInfo + 1);

-    Format    = (CHAR8 *) (((UINT64 *) Marker) + 12);

-

-    CharCount = AsciiVSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, Format, Marker);

-  } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {

-    //

-    // Print ERROR information into output buffer.

-    //

-    CharCount = AsciiSPrint (

-                  Buffer, 

-                  EFI_STATUS_CODE_DATA_MAX_SIZE, 

-                  "ERROR: C%x:V%x I%x", 

-                  CodeType, 

-                  Value, 

-                  Instance

-                  );

-

-    //

-    // Make sure we don't try to print values that weren't intended to be printed, especially NULL GUID pointers.

-    //

-    

-    if (CallerId != NULL) {

-      CharCount += AsciiSPrint (

-                     &Buffer[CharCount - 1],

-                     (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),

-                     " %g",

-                     CallerId

-                     );

-    }

-

-    if (Data != NULL) {

-      CharCount += AsciiSPrint (

-                     &Buffer[CharCount - 1],

-                     (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),

-                     " %x",

-                     Data

-                     );

-    }

-

-    CharCount += AsciiSPrint (

-                   &Buffer[CharCount - 1],

-                   (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),

-                   "\n\r"

-                   );

-  } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {

-    CharCount = AsciiSPrint (

-                  Buffer, 

-                  EFI_STATUS_CODE_DATA_MAX_SIZE, 

-                  "PROGRESS CODE: V%x I%x\n\r", 

-                  Value, 

-                  Instance

-                  );

-  } else {

-    CharCount = AsciiSPrint (

-                  Buffer, 

-                  EFI_STATUS_CODE_DATA_MAX_SIZE, 

-                  "Undefined: C%x:V%x I%x\n\r", 

-                  CodeType, 

-                  Value, 

-                  Instance

-                  );

-  }

-

-  //

-  // Callout to standard output.

-  //

-  mWinNt->WriteFile (

-            mStdOut,

-            Buffer,

-            CharCount,

-            &CharCount,

-            NULL

-            );

-

-  return EFI_SUCCESS;

-}

-

diff --git a/EdkNt32Pkg/Library/PeiNt32OemHookStatusCodeLib/PeiNt32OemHookStatusCodeLib.msa b/EdkNt32Pkg/Library/PeiNt32OemHookStatusCodeLib/PeiNt32OemHookStatusCodeLib.msa
deleted file mode 100644
index b9c3a56..0000000
--- a/EdkNt32Pkg/Library/PeiNt32OemHookStatusCodeLib/PeiNt32OemHookStatusCodeLib.msa
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>PeiNt32OemHookStatusCodeLib</ModuleName>

-    <ModuleType>PEIM</ModuleType>

-    <GuidValue>0C2070F9-02A7-4e8e-B584-84EA922363FB</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>Memory Status Code Library for UEFI drivers</Abstract>

-    <Description>Lib to provide memory journal status code reporting Routines</Description>

-    <Copyright>Copyright (c) 2007, Intel Corporation.</Copyright>

-    <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>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>PeiNt32OemHookStatusCodeLib</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="PEIM">

-      <Keyword>OemHookStatusCodeLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>PrintLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseMemoryLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>ReportStatusCodeLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>PeiServicesLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>Nt32OemHookStatusCodeLib.c</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <PPIs>

-    <Ppi Usage="ALWAYS_CONSUMED">

-      <PpiCName>gPeiNtThunkPpiGuid</PpiCName>

-    </Ppi>

-  </PPIs>

-  <Guids>

-    <GuidCNames Usage="SOMETIMES_CONSUMED">

-      <GuidCName>gEfiStatusCodeSpecificDataGuid</GuidCName>

-    </GuidCNames>

-  </Guids>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-  </Externs>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Logo/Logo.msa b/EdkNt32Pkg/Logo/Logo.msa
deleted file mode 100644
index dd9f167..0000000
--- a/EdkNt32Pkg/Logo/Logo.msa
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>Logo</ModuleName>

-    <ModuleType>BASE</ModuleType>

-    <GuidValue>7BB28B99-61BB-11D5-9A5D-0090273FC14D</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>Component description file for creating a Logo file.</Abstract>

-    <Description>This module provides the logo bitmap picture shown on setup screen.</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>

-    <BinaryModule>true</BinaryModule>

-    <OutputFileBasename>Logo</OutputFileBasename>

-  </ModuleDefinitions>

-  <SourceFiles>

-    <Filename>logo.bmp</Filename>

-  </SourceFiles>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-  </Externs>

-</ModuleSurfaceArea>

diff --git a/EdkNt32Pkg/Logo/logo.bmp b/EdkNt32Pkg/Logo/logo.bmp
deleted file mode 100644
index 3e85229..0000000
--- a/EdkNt32Pkg/Logo/logo.bmp
+++ /dev/null
Binary files differ
diff --git a/EdkNt32Pkg/Nt32.fpd b/EdkNt32Pkg/Nt32.fpd
deleted file mode 100644
index ba0e697..0000000
--- a/EdkNt32Pkg/Nt32.fpd
+++ /dev/null
@@ -1,8283 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<PlatformSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <PlatformHeader>

-    <PlatformName>NT32</PlatformName>

-    <GuidValue>eb216561-961f-47ee-9ef9-ca426ef547c2</GuidValue>

-    <Version>0.3</Version>

-    <Abstract>EFI/Framework Emulation Platform</Abstract>

-    <Description>The Emulation Platform can be used to debug individual modules, prior to creating
-      a real platform. This also provides an example for how an FPD is created.</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials
-      are licensed and made available under the terms and conditions of the BSD License
-      which accompanies this distribution.  The full text of the license may be found at
-      http://opensource.org/licenses/bsd-license.php
-
-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </PlatformHeader>

-  <PlatformDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BuildTargets>DEBUG RELEASE</BuildTargets>

-    <IntermediateDirectories>UNIFIED</IntermediateDirectories>

-    <OutputDirectory>Build/Nt32</OutputDirectory>

-    <SkuInfo>

-      <UiSkuName SkuID="0">DEFAULT</UiSkuName>

-    </SkuInfo>

-  </PlatformDefinitions>

-  <Flash>

-    <FlashDefinitionFile>FlashMap.fdf</FlashDefinitionFile>

-    <!--FlashDefinitionFile-->

-    <FvImages>

-      <!--Global Varables-->

-      <NameValue Name="FV_RECOVERY_BASE_ADDRESS" Value="0xFFD80000"/>

-      <NameValue Name="FV_MAIN_BASE_ADDRESS" Value="0xFFF00000"/>

-      <!--Define Valid Image Names-->

-      <FvImage Type="ImageName">

-        <FvImageNames>FV_RECOVERY</FvImageNames>

-        <FvImageNames>NV_STORAGE</FvImageNames>

-      </FvImage>

-      <!--Define Attributes for on or more Images Names-->

-      <FvImage Type="Attributes">

-        <FvImageNames>FV_RECOVERY</FvImageNames>

-        <FvImageNames>NV_STORAGE</FvImageNames>

-        <FvImageNames>FV_FILE</FvImageNames>

-        <FvImageOptions>

-          <NameValue Name="EFI_ERASE_POLARITY" Value="1"/>

-          <NameValue Name="EFI_READ_DISABLED_CAP" Value="TRUE"/>

-          <NameValue Name="EFI_READ_ENABLED_CAP" Value="TRUE"/>

-          <NameValue Name="EFI_READ_STATUS" Value="TRUE"/>

-          <NameValue Name="EFI_WRITE_DISABLED_CAP" Value="TRUE"/>

-          <NameValue Name="EFI_WRITE_ENABLED_CAP" Value="TRUE"/>

-          <NameValue Name="EFI_WRITE_STATUS" Value="TRUE"/>

-          <NameValue Name="EFI_LOCK_CAP" Value="TRUE"/>

-          <NameValue Name="EFI_LOCK_STATUS" Value="TRUE"/>

-          <NameValue Name="EFI_MEMORY_MAPPED" Value="TRUE"/>

-          <NameValue Name="EFI_ALIGNMENT_CAP" Value="TRUE"/>

-          <NameValue Name="EFI_ALIGNMENT_2" Value="TRUE"/>

-          <NameValue Name="EFI_ALIGNMENT_4" Value="TRUE"/>

-          <NameValue Name="EFI_ALIGNMENT_8" Value="TRUE"/>

-          <NameValue Name="EFI_ALIGNMENT_16" Value="TRUE"/>

-          <NameValue Name="EFI_ALIGNMENT_32" Value="TRUE"/>

-          <NameValue Name="EFI_ALIGNMENT_64" Value="TRUE"/>

-          <NameValue Name="EFI_ALIGNMENT_128" Value="TRUE"/>

-          <NameValue Name="EFI_ALIGNMENT_256" Value="TRUE"/>

-          <NameValue Name="EFI_ALIGNMENT_512" Value="TRUE"/>

-          <NameValue Name="EFI_ALIGNMENT_1K" Value="TRUE"/>

-          <NameValue Name="EFI_ALIGNMENT_2K" Value="TRUE"/>

-          <NameValue Name="EFI_ALIGNMENT_4K" Value="TRUE"/>

-          <NameValue Name="EFI_ALIGNMENT_8K" Value="TRUE"/>

-          <NameValue Name="EFI_ALIGNMENT_16K" Value="TRUE"/>

-          <NameValue Name="EFI_ALIGNMENT_32K" Value="TRUE"/>

-          <NameValue Name="EFI_ALIGNMENT_64K" Value="TRUE"/>

-          <NameValue Name="EFI_STICKY_WRITE" Value="FALSE"/>

-        </FvImageOptions>

-      </FvImage>

-      <!--Define Components for one or more Image Names-->

-      <FvImage Type="Components">

-        <FvImageNames>NV_STORAGE</FvImageNames>

-        <FvImageOptions>

-          <NameValue Name="EFI_NV_VARIABLE" Value="0xC000"/>

-          <NameValue Name="EFI_NV_EVENT_LOG" Value="0x2000"/>

-          <NameValue Name="EFI_NV_FTW_WORKING" Value="0x2000"/>

-          <NameValue Name="EFI_NV_FTW_SPARE" Value="0x10000"/>

-        </FvImageOptions>

-      </FvImage>

-      <!--Define Options for Individual Image Names-->

-      <FvImage Type="Options">

-        <FvImageNames>FV_RECOVERY</FvImageNames>

-        <FvImageOptions>

-          <NameValue Name="EFI_BASE_ADDRESS" Value="${FV_RECOVERY_BASE_ADDRESS}"/>

-          <NameValue Name="EFI_FILE_NAME" Value="FV_RECOVERY.fv"/>

-          <NameValue Name="EFI_NUM_BLOCKS" Value="0x28"/>

-          <NameValue Name="EFI_BLOCK_SIZE" Value="0x10000"/>

-        </FvImageOptions>

-      </FvImage>

-      <FvImage Type="Options">

-        <FvImageNames>FV_FILE</FvImageNames>

-        <FvImageOptions>

-          <NameValue Name="EFI_BASE_ADDRESS" Value="0x00000000"/>

-          <NameValue Name="EFI_FILE_NAME" Value="${FV_FILENAME}.fv"/>

-          <NameValue Name="EFI_SYM_FILE_NAME" Value="${FV_FILENAME}.sym"/>

-          <NameValue Name="EFI_NUM_BLOCKS" Value="0x2"/>

-          <NameValue Name="EFI_BLOCK_SIZE" Value="0x10000"/>

-        </FvImageOptions>

-      </FvImage>

-      <FvImage Type="Options">

-        <FvImageNames>NV_STORAGE</FvImageNames>

-        <FvImageOptions>

-          <NameValue Name="EFI_BASE_ADDRESS" Value="0xFFFC0000"/>

-          <NameValue Name="EFI_FILE_NAME" Value="${FV_FILENAME}.fv"/>

-          <NameValue Name="EFI_NUM_BLOCKS" Value="0x2"/>

-          <NameValue Name="EFI_BLOCK_SIZE" Value="0x10000"/>

-          <NameValue Name="EFI_FV_GUID" Value="fff12b8d-7696-4c8b-a985-2747075b4f50"/>

-        </FvImageOptions>

-      </FvImage>

-      <FvImage Type="Options">

-        <FvImageNames>CAPSULE_A</FvImageNames>

-        <FvImageOptions>

-          <NameValue Name="EFI_BASE_ADDRESS" Value="${FV_RECOVERY_BASE_ADDRESS}"/>

-          <NameValue Name="EFI_FILE_NAME" Value="Capsule_A.fv"/>

-          <NameValue Name="EFI_NUM_BLOCKS" Value="0x28"/>

-          <NameValue Name="EFI_BLOCK_SIZE" Value="0x10000"/>

-        </FvImageOptions>

-      </FvImage>

-    </FvImages>

-  </Flash>

-  <FrameworkModules>

-    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="4b837b03-6587-4d19-b82b-edfad836c0a0">

-      <Libraries>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="556f5d10-7309-4af4-b80a-8196bd60946f" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="9ba1d976-0624-41a3-8650-28165e8d9ae8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdWinNtMemorySizeForSecMain</C_Name>

-          <Token>0x0000100c</Token>

-          <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>VOID*</DatumType>

-          <MaxDatumSize>10</MaxDatumSize>

-          <Value>L"64!64"</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdWinNtFirmwareVolume</C_Name>

-          <Token>0x00001009</Token>

-          <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>VOID*</DatumType>

-          <MaxDatumSize>52</MaxDatumSize>

-          <Value>L"..\\Fv\\Fv_Recovery.fd"</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdWinNtBootMode</C_Name>

-          <Token>0x00001006</Token>

-          <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>NULL</FvBinding>

-        <FfsFormatKey>CUSTOM_BUILD</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="52C05B14-0B98-496c-BC3B-04B50211D680">

-      <Libraries>

-        <Instance ModuleGuid="434b164e-5fa6-4a3d-bc04-02da2a4eeb26" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-        <Instance ModuleGuid="b3b0654a-969d-4096-86cb-27e262a02083" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="FC120ED3-40E1-46dc-8C9C-AAE3CA139ACF" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="556f5d10-7309-4af4-b80a-8196bd60946f" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="b2585b69-fb63-4220-844a-8fbea8bf01af" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <!--Pkg: MdePkg Mod: BaseTimerLibNullTemplate Path: MdePkg\Library\BaseTimerLibNullTemplate\BaseTimerLibNullTemplate.msa-->

-        <Instance ModuleGuid="f4731d79-537e-4505-bd52-c03f9b1f6b89" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdPerformanceLibraryPropertyMask</C_Name>

-          <Token>0x00000009</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>PEI_CORE</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="9B3ADA4F-AE56-4c24-8DEA-F03B7558AE50">

-      <Libraries>

-        <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="b694e0dc-cd4e-4b30-885b-9c164ed3e74a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaxPeiPcdCallBackNumberPerPcdEntry</C_Name>

-          <Token>0x0001000f</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x08</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdVpdBaseAddress</C_Name>

-          <Token>0x00010010</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x0</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdPeiPcdDatabaseTraverseEnabled</C_Name>

-          <Token>0x00010020</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>TRUE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdPeiPcdDatabaseCallbackOnSetEnabled</C_Name>

-          <Token>0x00010032</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>TRUE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdPeiPcdDatabaseExEnabled</C_Name>

-          <Token>0x00010033</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>TRUE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdPeiPcdDatabaseGetSizeEnabled</C_Name>

-          <Token>0x00010031</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>TRUE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdPeiPcdDatabaseSetEnabled</C_Name>

-          <Token>0x00010030</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>TRUE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>PE32_PEIM</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="1EC0F53A-FDE0-4576-8F25-7A1A410F58EB">

-      <Libraries>

-        <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <Instance ModuleGuid="9dbf6f25-0da2-4a1d-8e12-e78de6ab4d0e" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <Instance ModuleGuid="9ba1d976-0624-41a3-8650-28165e8d9ae8" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <Instance ModuleGuid="926c9cd0-4bb8-479b-9ac4-8a2a23f85307" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <Instance ModuleGuid="e6e9c1f8-2c8a-4f4b-a27c-c382e4bb8e67" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <Instance ModuleGuid="b5a05743-9b71-489b-a0ed-a0eb3950d23b" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <Instance ModuleGuid="E4541241-8897-411a-91F8-7D7E45837146" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>

-        <!--Pkg: EdkNt32Pkg Mod: PeiNt32OemHookStatusCodeLib Path: EdkNt32Pkg\Library\PeiNt32OemHookStatusCodeLib\PeiNt32OemHookStatusCodeLib.msa-->

-        <Instance ModuleGuid="0C2070F9-02A7-4e8e-B584-84EA922363FB" ModuleVersion="1.0" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" PackageVersion="0.3"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdStatusCodeUseSerial</C_Name>

-          <Token>0x00010022</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdStatusCodeUseMemory</C_Name>

-          <Token>0x00010023</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdStatusCodeUseOEM</C_Name>

-          <Token>0x00010024</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>TRUE</Value>

-        </PcdData>

-        <PcdData ItemType="PATCHABLE_IN_MODULE">

-          <C_Name>PcdStatusCodeMemorySize</C_Name>

-          <Token>0x00010025</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT16</DatumType>

-          <MaxDatumSize>2</MaxDatumSize>

-          <Value>1</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdFSBClock</C_Name>

-          <Token>0x0000000c</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>200000000</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>PE32_PEIM</FfsFormatKey>

-        <Options>

-          <Option BuildTargets="DEBUG" ToolChainFamily="MSFT" SupArchList="IA32" ToolCode="DLINK">Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib</Option>

-          <Option BuildTargets="RELEASE" ToolChainFamily="MSFT" SupArchList="IA32" ToolCode="DLINK">Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib</Option>

-        </Options>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="B7611005-1F26-45ba-A3DB-01F39DDB2785">

-      <Libraries>

-        <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>PE32_PEIM</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="681F3771-6F1D-42DE-9AA2-F82BBCDBC5F9">

-      <Libraries>

-        <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="9dbf6f25-0da2-4a1d-8e12-e78de6ab4d0e" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="DYNAMIC">

-          <C_Name>PcdFlashNvStorageVariableBase</C_Name>

-          <Token>0x30000001</Token>

-          <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x0</Value>

-        </PcdData>

-        <PcdData ItemType="DYNAMIC">

-          <C_Name>PcdFlashNvStorageVariableSize</C_Name>

-          <Token>0x30000002</Token>

-          <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x0</Value>

-        </PcdData>

-        <PcdData ItemType="DYNAMIC">

-          <C_Name>PcdFlashNvStorageFtwSpareBase</C_Name>

-          <Token>0x30000013</Token>

-          <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x0</Value>

-        </PcdData>

-        <PcdData ItemType="DYNAMIC">

-          <C_Name>PcdFlashNvStorageFtwSpareSize</C_Name>

-          <Token>0x30000014</Token>

-          <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x0</Value>

-        </PcdData>

-        <PcdData ItemType="DYNAMIC">

-          <C_Name>PcdFlashNvStorageFtwWorkingBase</C_Name>

-          <Token>0x30000010</Token>

-          <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x0</Value>

-        </PcdData>

-        <PcdData ItemType="DYNAMIC">

-          <C_Name>PcdFlashNvStorageFtwWorkingSize</C_Name>

-          <Token>0x30000011</Token>

-          <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x0</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>PE32_PEIM</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="736EB068-8C01-47c5-964B-1C57BD5D4D64">

-      <Libraries>

-        <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>PE32_PEIM</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="34C8C28F-B61C-45a2-8F2E-89E46BECC63B">

-      <Libraries>

-        <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="9dbf6f25-0da2-4a1d-8e12-e78de6ab4d0e" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="DYNAMIC">

-          <C_Name>PcdFlashNvStorageVariableBase</C_Name>

-          <Token>0x30000001</Token>

-          <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x0</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>PE32_PEIM</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="BE0FEABA-3443-4919-9F3A-2D4216329EA9">

-      <Libraries>

-        <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>PE32_PEIM</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="F0384FFD-8633-452f-9010-F6B7D2EAE2F1">

-      <Libraries>

-        <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>PE32_PEIM</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="D3AAD8DC-3A48-46ac-B1C7-28A9D3CF6755">

-      <Libraries>

-        <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>PE32_PEIM</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="86D70125-BAA3-4296-A62F-602BEBBB9081">

-      <Libraries>

-        <Instance ModuleGuid="3c5702f2-9b17-4273-b60c-b96e6cd13066" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-        <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="123dd843-57c9-4158-8418-ce68b3944ce7" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="d774c4d9-c121-4da3-a5e2-0f317e3c630c" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="e5566134-c75e-4ace-bad1-e23a3b335e30" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="b694e0dc-cd4e-4b30-885b-9c164ed3e74a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <!--Instance ModuleGuid="556f5d10-7309-4af4-b80a-8196bd60946f" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/-->

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDxeIplSwitchToLongMode</C_Name>

-          <Token>0x0001003b</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDxeIplSupportEfiDecompress</C_Name>

-          <Token>0x00010034</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>TRUE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDxeIplSupportTianoDecompress</C_Name>

-          <Token>0x00010035</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>TRUE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDxeIplSupportCustomDecompress</C_Name>

-          <Token>0x00010036</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>TRUE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDxeIplBuildShareCodeHobs</C_Name>

-          <Token>0x0001003c</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>TRUE</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>PE32_PEIM</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="D6A2CB7F-6A18-4e2f-B43B-9920A733700A">

-      <Libraries>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="123dd843-57c9-4158-8418-ce68b3944ce7" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="5c12c06f-5cf8-48a6-9860-6c5b2c036bbf" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="cef487a1-751d-4fe0-a39b-e6892b4610c8" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="942e0182-3e1d-47f9-92dc-4939d1a0ba00" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="ed3de5c8-c389-44f2-a35e-2ebdc9802a49" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="882ee1a3-35b2-412c-b8a2-7a8d34a7c390" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="d258d6af-2fc0-4019-9c1f-1101c3dd19b5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="FC120ED3-40E1-46dc-8C9C-AAE3CA139ACF" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <!--Pkg: MdePkg Mod: BasePrintLib Path: MdePkg\Library\BasePrintLib\BasePrintLib.msa-->

-        <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <!--Pkg: MdePkg Mod: UefiBootServicesTableLib Path: MdePkg\Library\UefiBootServicesTableLib\UefiBootServicesTableLib.msa-->

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <!--Pkg: MdePkg Mod: BasePcdLibNull Path: MdePkg\Library\BasePcdLibNull\BasePcdLibNull.msa-->

-        <Instance ModuleGuid="40096a3a-5c2a-4fbc-aef7-5475dd7ab334" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdPerformanceLibraryPropertyMask</C_Name>

-          <Token>0x00000009</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>DXE_CORE</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="80CF7257-87AB-47f9-A3FE-D50B76D89541">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <!--Pkg: MdePkg Mod: BasePrintLib Path: MdePkg\Library\BasePrintLib\BasePrintLib.msa-->

-        <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdVpdBaseAddress</C_Name>

-          <Token>0x00010010</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x0</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDxePcdDatabaseTraverseEnabled</C_Name>

-          <Token>0x00010021</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>TRUE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="51C9F40C-5243-4473-B265-B3C8FFAFF9FA">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="ee993080-5197-4d4e-b63c-f1f7413e33ce">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <!--Pkg: MdePkg Mod: UefiRuntimeServicesTableLib Path: MdePkg\Library\UefiRuntimeServicesTableLib\UefiRuntimeServicesTableLib.msa-->

-        <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="154CAB4A-52B5-46CD-99C3-4368ABBACFFD">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f6b5871d-5226-41b3-a569-3ff893fdc7bc" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-        <!--Pkg: MdePkg Mod: UefiRuntimeServicesTableLib Path: MdePkg\Library\UefiRuntimeServicesTableLib\UefiRuntimeServicesTableLib.msa-->

-        <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="C3811036-710B-4E39-8CF1-0AF9BE3A8198">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f6b5871d-5226-41b3-a569-3ff893fdc7bc" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="27F05AF5-1644-4EF4-8944-48C4F75675A0">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f6b5871d-5226-41b3-a569-3ff893fdc7bc" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="BA929954-35B0-4dd3-90CD-9634BD7E1CF1">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f6b5871d-5226-41b3-a569-3ff893fdc7bc" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="A6F691AC-31C8-4444-854C-E2C1A6950F92">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="baa1baa3-0a8d-402c-8042-985115fae953" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="1ec995b2-d15b-44f6-abd2-050ea7dd37d2" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-        <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="08c1a0e4-1208-47f8-a2c5-f42eabee653a" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="ea55bada-d488-427b-9d2d-227e0aaa3707" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="FC120ED3-40E1-46dc-8C9C-AAE3CA139ACF" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="556f5d10-7309-4af4-b80a-8196bd60946f" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdPerformanceLibraryPropertyMask</C_Name>

-          <Token>0x00000009</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="F099D67F-71AE-4c36-B2A3-DCEB0EB2B7D8">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="B601F8C4-43B7-4784-95B1-F4226CB40CEE">

-      <Libraries>

-        <Instance ModuleGuid="123dd843-57c9-4158-8418-ce68b3944ce7" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="556f5d10-7309-4af4-b80a-8196bd60946f" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>RT_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="AD608272-D07F-4964-801E-7BD3B7888652">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>RT_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="FEDE0A1B-BCA2-4A9F-BB2B-D9FD7DEC2E9F">

-      <Libraries>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="926c9cd0-4bb8-479b-9ac4-8a2a23f85307" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="E4541241-8897-411a-91F8-7D7E45837146" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <!--Pkg: EdkNt32Pkg Mod: DxeWinNtLib Path: EdkNt32Pkg\Library\DxeWinNtLib\DxeWinNtLib.msa-->

-        <Instance ModuleGuid="f6b5871d-5226-41b3-a569-3ff893fdc7bc" ModuleVersion="1.0" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" PackageVersion="0.3"/>

-        <!--Pkg: MdePkg Mod: UefiRuntimeServicesTableLib Path: MdePkg\Library\UefiRuntimeServicesTableLib\UefiRuntimeServicesTableLib.msa-->

-        <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <!--Pkg: MdePkg Mod: BaseTimerLibNullTemplate Path: MdePkg\Library\BaseTimerLibNullTemplate\BaseTimerLibNullTemplate.msa-->

-        <Instance ModuleGuid="f4731d79-537e-4505-bd52-c03f9b1f6b89" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <!--Pkg: EdkNt32Pkg Mod: DxeNt32OemHookStatusCodeLib Path: EdkNt32Pkg\Library\DxeNt32OemHookStatusCodeLib\DxeNt32OemHookStatusCodeLib.msa-->

-        <Instance ModuleGuid="EF172A23-C7C5-47b7-B24E-D10DFE15540F" ModuleVersion="1.0" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" PackageVersion="0.3"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdStatusCodeUseHardSerial</C_Name>

-          <Token>0x00010027</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdStatusCodeUseEfiSerial</C_Name>

-          <Token>0x00010026</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdStatusCodeUseRuntimeMemory</C_Name>

-          <Token>0x00010028</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdStatusCodeUseDataHub</C_Name>

-          <Token>0x00010029</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdStatusCodeUseOEM</C_Name>

-          <Token>0x00010024</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>TRUE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdStatusCodeReplayInSerial</C_Name>

-          <Token>0x0001002a</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdStatusCodeReplayInDataHub</C_Name>

-          <Token>0x0001002c</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdStatusCodeReplayInRuntimeMemory</C_Name>

-          <Token>0x0001002b</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdStatusCodeReplayInOEM</C_Name>

-          <Token>0x0001002d</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="PATCHABLE_IN_MODULE">

-          <C_Name>PcdStatusCodeRuntimeMemorySize</C_Name>

-          <Token>0x0001002e</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT16</DatumType>

-          <MaxDatumSize>2</MaxDatumSize>

-          <Value>128</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-        <Options>

-          <Option BuildTargets="DEBUG" ToolChainFamily="MSFT" SupArchList="IA32" ToolCode="DLINK">Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib</Option>

-          <Option BuildTargets="RELEASE" ToolChainFamily="MSFT" SupArchList="IA32" ToolCode="DLINK">Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib</Option>

-        </Options>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="BDFE5FAA-2A35-44bb-B17A-8084D4E2B9E9">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="baa1baa3-0a8d-402c-8042-985115fae953" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="9ba1d976-0624-41a3-8650-28165e8d9ae8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>RT_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="4C862FC6-0E54-4e36-8C8F-FF6F3167951F">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <!--Pkg: MdePkg Mod: DxePcdLib Path: MdePkg\Library\DxePcdLib\DxePcdLib.msa-->

-        <Instance ModuleGuid="af97eb89-4cc6-45f8-a514-ca025b346480" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="DYNAMIC">

-          <C_Name>PcdFlashNvStorageFtwSpareBase</C_Name>

-          <Token>0x30000013</Token>

-          <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x0</Value>

-        </PcdData>

-        <PcdData ItemType="DYNAMIC">

-          <C_Name>PcdFlashNvStorageFtwSpareSize</C_Name>

-          <Token>0x30000014</Token>

-          <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x0</Value>

-        </PcdData>

-        <PcdData ItemType="DYNAMIC">

-          <C_Name>PcdFlashNvStorageFtwWorkingBase</C_Name>

-          <Token>0x30000010</Token>

-          <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x0</Value>

-        </PcdData>

-        <PcdData ItemType="DYNAMIC">

-          <C_Name>PcdFlashNvStorageFtwWorkingSize</C_Name>

-          <Token>0x30000011</Token>

-          <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x0</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="CBD2E4D5-7068-4FF5-B462-9822B4AD8D60">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="baa1baa3-0a8d-402c-8042-985115fae953" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bd4d540e-04b0-4b10-8fd5-4a7bb533cf67" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <!--Pkg: MdePkg Mod: DxePcdLib Path: MdePkg\Library\DxePcdLib\DxePcdLib.msa-->

-        <Instance ModuleGuid="af97eb89-4cc6-45f8-a514-ca025b346480" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="DYNAMIC">

-          <C_Name>PcdFlashNvStorageVariableBase</C_Name>

-          <Token>0x30000001</Token>

-          <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x0</Value>

-        </PcdData>

-        <PcdData ItemType="DYNAMIC">

-          <C_Name>PcdFlashNvStorageVariableSize</C_Name>

-          <Token>0x30000002</Token>

-          <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x0</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>RT_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="42857F0A-13F2-4B21-8A23-53D3F714B840">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="baa1baa3-0a8d-402c-8042-985115fae953" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="9ba1d976-0624-41a3-8650-28165e8d9ae8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdSupportUpdateCapsuleRest</C_Name>

-          <Token>0x0001001d</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaxSizePopulateCapsule</C_Name>

-          <Token>0x0001001e</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x0</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaxSizeNonPopulateCapsule</C_Name>

-          <Token>0x0001001f</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x0</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>RT_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="F80697E9-7FD6-4665-8646-88E33EF71DFC">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="73E9457A-CEA1-4917-9A9C-9F1F0F0FD322">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>NULL</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="911D584C-35F7-4955-BEF9-B452769DDC3A">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdNtEmulatorEnable</C_Name>

-          <Token>0x0001003e</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>NULL</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="51ccf399-4fdf-4e55-a45b-e123f84d456a">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="408edcec-cf6d-477c-a5a8-b4844e3de281">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="CCCB0C28-4B24-11d5-9A5A-0090273FC14D">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="9E863906-A40F-4875-977F-5B93FF237FC6">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="53BCC14F-C24F-434C-B294-8ED2D4CC1860">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="CA515306-00CE-4032-874E-11B755FF6866">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <!--Pkg: MdePkg Mod: UefiRuntimeServicesTableLib Path: MdePkg\Library\UefiRuntimeServicesTableLib\UefiRuntimeServicesTableLib.msa-->

-        <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="9B680FCE-AD6B-4F3A-B60B-F59899003443">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDevicePathSupportDevicePathToText</C_Name>

-          <Token>0x00010037</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>TRUE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDevicePathSupportDevicePathFromText</C_Name>

-          <Token>0x00010038</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>TRUE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="6B38F7B4-AD98-40e9-9093-ACA2B5A253C4">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="13AC6DD0-73D0-11D4-B06B-00AA00BD6DE7">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="96B5C032-DF4C-4b6e-8232-438DCF448D0E">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="baa1baa3-0a8d-402c-8042-985115fae953" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="FCD337AB-B1D3-4EF8-957C-8048606FF670">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="ea55bada-d488-427b-9d2d-227e0aaa3707" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="1FA1F39E-FEFF-4aae-BD7B-38A070A3B609">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="7BB28B99-61BB-11D5-9A5D-0090273FC14D">

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>Logo</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="93B80004-9FB3-11d4-9A3A-0090273FC14D">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="be490364-73d2-420d-950e-f6450ca75dfb" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <!--Pkg: EdkModulePkg Mod: EdkPciIncompatibleDeviceSuppportLib Path: EdkModulePkg\Library\EdkPciIncompatibleDeviceSupportLib\EdkPciIncompatibleDeviceSupportLib.msa-->

-        <Instance ModuleGuid="1ca1c1f9-5baf-4204-b6e5-5e24109a4e4e" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdPciIsaEnable</C_Name>

-          <Token>0x00010039</Token>

-          <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdPciVgaEnable</C_Name>

-          <Token>0x0001003a</Token>

-          <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdPciBusHotplugDeviceSupport</C_Name>

-          <Token>0x0001003d</Token>

-          <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>TRUE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdPciIncompatibleDeviceSupportMask</C_Name>

-          <Token>0x0001003f</Token>

-          <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x0</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="EBf342FE-B1D3-4EF8-957C-8048606FF670">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="08c1a0e4-1208-47f8-a2c5-f42eabee653a" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="FE3542FE-C1D3-4EF8-657C-8048606FF670">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="08c1a0e4-1208-47f8-a2c5-f42eabee653a" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="ea55bada-d488-427b-9d2d-227e0aaa3707" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="CD3BAFB6-50FB-4fe8-8E4E-AB74D2C1A600">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="E49061CE-99A7-41d3-AB3A-36E5CFBAD63E">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="555F76EA-785F-40d7-9174-153C43636C68">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="69FD8E47-A161-4550-B01A-5594CEB2B2B2">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="FC120ED3-40E1-46dc-8C9C-AAE3CA139ACF" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdPerformanceLibraryPropertyMask</C_Name>

-          <Token>0x00000009</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="2FB92EFA-2EE0-4bae-9EB6-7464125E1EF7">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="BDFE430E-8F2A-4db0-9991-6F856594777E">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_MAIN</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="0167CCC4-D0F7-4f21-A3EF-9E64B7CDCE8B">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="46c9adef-aee6-410c-99e4-240e3af18d8b" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="0A66E322-3740-4cce-AD62-BD172CECCA35">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="46c9adef-aee6-410c-99e4-240e3af18d8b" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="B40612B9-A063-11d4-9A3A-0090273FC14D">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="240612B7-A063-11d4-9A3A-0090273FC14D">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="A3527D16-E6CC-42f5-BADB-BF3DE177742B">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="B40612B2-A063-11d4-9A3A-0090273FC14D">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="2D2E62CF-9ECF-43b7-8219-94E7FC713DFE">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="A5C6D68B-E78A-4426-9278-A8F0D9EB4D8F">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="2D2E62AA-9ECF-43b7-8219-94E7FC713DFE">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="A3f436EA-A127-4EF8-957C-8048606FF670">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <!--Pkg: MdePkg Mod: BasePrintLib Path: MdePkg\Library\BasePrintLib\BasePrintLib.msa-->

-        <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="a46c3330-be36-4977-9d24-a7cf92eef0fe">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="A2f436EA-A127-4EF8-957C-8048606FF670">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="0C95A916-A006-11d4-BCFA-0080C73C8881">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f6b5871d-5226-41b3-a569-3ff893fdc7bc" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="BD7E9A27-D6C5-416a-B245-5F507D95B2BD">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="af97eb89-4cc6-45f8-a514-ca025b346480" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-        <PcdData ItemType="DYNAMIC">

-          <C_Name>PcdWinNtConsole</C_Name>

-          <Token>0x0000100a</Token>

-          <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>VOID*</DatumType>

-          <MaxDatumSize>50</MaxDatumSize>

-          <Value>L"Bus Driver Console Window"</Value>

-        </PcdData>

-        <PcdData ItemType="DYNAMIC">

-          <C_Name>PcdWinNtUga</C_Name>

-          <Token>0x00001003</Token>

-          <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>VOID*</DatumType>

-          <MaxDatumSize>50</MaxDatumSize>

-          <Value>L"UGA Window 1!UGA Window 2"</Value>

-        </PcdData>

-        <PcdData ItemType="DYNAMIC">

-          <C_Name>PcdWinNtGop</C_Name>

-          <Token>0x0000100d</Token>

-          <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>VOID*</DatumType>

-          <MaxDatumSize>50</MaxDatumSize>

-          <Value>L"UGA Window 1!UGA Window 2"</Value>

-        </PcdData>

-        <PcdData ItemType="DYNAMIC">

-          <C_Name>PcdWinNtSerialPort</C_Name>

-          <Token>0x00001002</Token>

-          <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>VOID*</DatumType>

-          <MaxDatumSize>18</MaxDatumSize>

-          <Value>L"COM1!COM2"</Value>

-        </PcdData>

-        <PcdData ItemType="DYNAMIC">

-          <C_Name>PcdWinNtFileSystem</C_Name>

-          <Token>0x00001004</Token>

-          <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>VOID*</DatumType>

-          <MaxDatumSize>106</MaxDatumSize>

-          <Value>L".!..\\..\\..\\..\\EdkShellBinPkg\\bin\\ia32\\Apps"</Value>

-        </PcdData>

-        <PcdData ItemType="DYNAMIC">

-          <C_Name>PcdWinNtVirtualDisk</C_Name>

-          <Token>0x00001001</Token>

-          <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>VOID*</DatumType>

-          <MaxDatumSize>24</MaxDatumSize>

-          <Value>L"FW;40960;512"</Value>

-        </PcdData>

-        <PcdData ItemType="DYNAMIC">

-          <C_Name>PcdWinNtPhysicalDisk</C_Name>

-          <Token>0x00001000</Token>

-          <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>VOID*</DatumType>

-          <MaxDatumSize>30</MaxDatumSize>

-          <Value>L"E:RW;245760;512"</Value>

-        </PcdData>

-        <PcdData ItemType="DYNAMIC">

-          <C_Name>PcdWinNtCpuModel</C_Name>

-          <Token>0x00001007</Token>

-          <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>VOID*</DatumType>

-          <MaxDatumSize>48</MaxDatumSize>

-          <Value>L"Intel(R) Processor Model"</Value>

-        </PcdData>

-        <PcdData ItemType="DYNAMIC">

-          <C_Name>PcdWinNtCpuSpeed</C_Name>

-          <Token>0x00001008</Token>

-          <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>VOID*</DatumType>

-          <MaxDatumSize>8</MaxDatumSize>

-          <Value>L"3000"</Value>

-        </PcdData>

-        <PcdData ItemType="DYNAMIC">

-          <C_Name>PcdWinNtMemorySize</C_Name>

-          <Token>0x00001005</Token>

-          <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>VOID*</DatumType>

-          <MaxDatumSize>10</MaxDatumSize>

-          <Value>L"64!64"</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="F479E147-A125-11d4-BCFC-0080C73C8881">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="b57a1df6-ffdb-4247-a3df-3a562176751a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="263631d7-5836-4b74-be48-ee22e92ce5d3">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="b57a1df6-ffdb-4247-a3df-3a562176751a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="6B41B553-A649-11d4-BD02-0080C73C8881">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="b57a1df6-ffdb-4247-a3df-3a562176751a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="9C25E18B-76BA-43da-A132-DBB0997CEFEF">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="b57a1df6-ffdb-4247-a3df-3a562176751a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="4A9B9DB8-EC62-4A92-818F-8AA0246D246E">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>

-          <Token>0x00000007</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x06</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="d4266a1b-1d38-4116-93ae-60dc3e2012a6" ModuleGuid="c57ad6b7-0515-40a8-9d21-551652854e37">

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>APPLICATION</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="0fd7197b-9bde-44fe-a7e4-d2177a9922e5" ModuleGuid="961578FE-B6B7-44c3-AF35-6BC705CD2B1F">

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="6987936E-ED34-44db-AE97-1FA5E4ED2116">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="b57a1df6-ffdb-4247-a3df-3a562176751a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <!--Pkg: MdePkg Mod: UefiApplicationEntryPoint Path: MdePkg\Library\UefiApplicationEntryPoint\UefiApplicationEntryPoint.msa-->

-        <Instance ModuleGuid="DADE8301-CB29-4fd5-8148-56FD246C5B88" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <!--Pkg: Original MdePkg Mod: UefiLib Path: OldMdePkg\Library\UefiLib\UefiLib.msa-->

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1F</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>APPLICATION</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <!--Mod: WinNtGop Type: DXE_DRIVER Path: EdkNt32Pkg\Dxe\WinNtThunk\Bus\Gop\WinNtGop.msa-->

-    <ModuleSA ModuleGuid="29b3c4c6-e5aa-49e4-8ce0-2772f782ddc2" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" SupArchList="IA32">

-      <Libraries>

-        <!--Pkg: MdePkg Mod: UefiLib Path: MdePkg\Library\UefiLib\UefiLib.msa-->

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <!--Pkg: MdePkg Mod: BaseDebugLibNull Path: MdePkg\Library\BaseDebugLibNull\BaseDebugLibNull.msa-->

-        <Instance ModuleGuid="9ba1d976-0624-41a3-8650-28165e8d9ae8" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <!--Pkg: MdePkg Mod: UefiBootServicesTableLib Path: MdePkg\Library\UefiBootServicesTableLib\UefiBootServicesTableLib.msa-->

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <!--Pkg: MdePkg Mod: BaseMemoryLib Path: MdePkg\Library\BaseMemoryLib\BaseMemoryLib.msa-->

-        <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <!--Pkg: MdePkg Mod: BasePcdLibNull Path: MdePkg\Library\BasePcdLibNull\BasePcdLibNull.msa-->

-        <Instance ModuleGuid="40096a3a-5c2a-4fbc-aef7-5475dd7ab334" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <!--Pkg: MdePkg Mod: BasePrintLib Path: MdePkg\Library\BasePrintLib\BasePrintLib.msa-->

-        <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <!--Pkg: MdePkg Mod: UefiDriverEntryPoint Path: MdePkg\Library\UefiDriverEntryPoint\UefiDriverEntryPoint.msa-->

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <!--Pkg: MdePkg Mod: UefiDriverModelLib Path: MdePkg\Library\UefiDriverModelLib\UefiDriverModelLib.msa-->

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-        <!--Pkg: MdePkg Mod: UefiRuntimeServicesTableLib Path: MdePkg\Library\UefiRuntimeServicesTableLib\UefiRuntimeServicesTableLib.msa-->

-        <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>FV_RECOVERY</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="AB248E8D-ABE1-11d4-BD0D-0080C73C8881">

-      <Libraries>

-        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="b57a1df6-ffdb-4247-a3df-3a562176751a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      </Libraries>

-      <PcdBuildDefinition>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumUnicodeStringLength</C_Name>

-          <Token>0x00000001</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumAsciiStringLength</C_Name>

-          <Token>0x00000002</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdMaximumLinkedListLength</C_Name>

-          <Token>0x00000003</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>1000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdSpinLockTimeout</C_Name>

-          <Token>0x00000004</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>10000000</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPropertyMask</C_Name>

-          <Token>0x00000005</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0x1f</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugClearMemoryValue</C_Name>

-          <Token>0x00000008</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT8</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>0xAF</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdDebugPrintErrorLevel</C_Name>

-          <Token>0x00000006</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>0x80000000</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdComponentNameDisable</C_Name>

-          <Token>0x0000000d</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FEATURE_FLAG">

-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>

-          <Token>0x0000000e</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>BOOLEAN</DatumType>

-          <MaxDatumSize>1</MaxDatumSize>

-          <Value>FALSE</Value>

-        </PcdData>

-        <PcdData ItemType="FIXED_AT_BUILD">

-          <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>

-          <Token>0x101</Token>

-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>

-          <DatumType>UINT32</DatumType>

-          <MaxDatumSize>4</MaxDatumSize>

-          <Value>320</Value>

-        </PcdData>

-      </PcdBuildDefinition>

-      <ModuleSaBuildOptions>

-        <FvBinding>NULL</FvBinding>

-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>

-      </ModuleSaBuildOptions>

-    </ModuleSA>

-  </FrameworkModules>

-  <DynamicPcdBuildDefinitions>

-    <PcdBuildData ItemType="DYNAMIC">

-      <C_Name>PcdFlashNvStorageVariableBase</C_Name>

-      <Token>0x30000001</Token>

-      <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>UINT32</DatumType>

-      <MaxDatumSize>4</MaxDatumSize>

-      <SkuInfo>

-        <SkuId>0</SkuId>

-        <Value>0x0</Value>

-      </SkuInfo>

-    </PcdBuildData>

-    <PcdBuildData ItemType="DYNAMIC">

-      <C_Name>PcdFlashNvStorageVariableSize</C_Name>

-      <Token>0x30000002</Token>

-      <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>UINT32</DatumType>

-      <MaxDatumSize>4</MaxDatumSize>

-      <SkuInfo>

-        <SkuId>0</SkuId>

-        <Value>0x0</Value>

-      </SkuInfo>

-    </PcdBuildData>

-    <PcdBuildData ItemType="DYNAMIC">

-      <C_Name>PcdFlashNvStorageFtwSpareBase</C_Name>

-      <Token>0x30000013</Token>

-      <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>UINT32</DatumType>

-      <MaxDatumSize>4</MaxDatumSize>

-      <SkuInfo>

-        <SkuId>0</SkuId>

-        <Value>0x0</Value>

-      </SkuInfo>

-    </PcdBuildData>

-    <PcdBuildData ItemType="DYNAMIC">

-      <C_Name>PcdFlashNvStorageFtwSpareSize</C_Name>

-      <Token>0x30000014</Token>

-      <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>UINT32</DatumType>

-      <MaxDatumSize>4</MaxDatumSize>

-      <SkuInfo>

-        <SkuId>0</SkuId>

-        <Value>0x0</Value>

-      </SkuInfo>

-    </PcdBuildData>

-    <PcdBuildData ItemType="DYNAMIC">

-      <C_Name>PcdFlashNvStorageFtwWorkingBase</C_Name>

-      <Token>0x30000010</Token>

-      <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>UINT32</DatumType>

-      <MaxDatumSize>4</MaxDatumSize>

-      <SkuInfo>

-        <SkuId>0</SkuId>

-        <Value>0x0</Value>

-      </SkuInfo>

-    </PcdBuildData>

-    <PcdBuildData ItemType="DYNAMIC">

-      <C_Name>PcdFlashNvStorageFtwWorkingSize</C_Name>

-      <Token>0x30000011</Token>

-      <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>UINT32</DatumType>

-      <MaxDatumSize>4</MaxDatumSize>

-      <SkuInfo>

-        <SkuId>0</SkuId>

-        <Value>0x0</Value>

-      </SkuInfo>

-    </PcdBuildData>

-    <PcdBuildData ItemType="DYNAMIC">

-      <C_Name>PcdWinNtConsole</C_Name>

-      <Token>0x0000100a</Token>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>VOID*</DatumType>

-      <MaxDatumSize>50</MaxDatumSize>

-      <SkuInfo>

-        <SkuId>0</SkuId>

-        <Value>L"Bus Driver Console Window"</Value>

-      </SkuInfo>

-    </PcdBuildData>

-    <PcdBuildData ItemType="DYNAMIC">

-      <C_Name>PcdWinNtUga</C_Name>

-      <Token>0x00001003</Token>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>VOID*</DatumType>

-      <MaxDatumSize>50</MaxDatumSize>

-      <SkuInfo>

-        <SkuId>0</SkuId>

-        <Value>L"UGA Window 1!UGA Window 2"</Value>

-      </SkuInfo>

-    </PcdBuildData>

-    <PcdBuildData ItemType="DYNAMIC">

-      <C_Name>PcdWinNtGop</C_Name>

-      <Token>0x0000100d</Token>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>VOID*</DatumType>

-      <MaxDatumSize>50</MaxDatumSize>

-      <SkuInfo>

-        <SkuId>0</SkuId>

-        <Value>L"UGA Window 1!UGA Window 2"</Value>

-      </SkuInfo>

-    </PcdBuildData>

-    <PcdBuildData ItemType="DYNAMIC">

-      <C_Name>PcdWinNtSerialPort</C_Name>

-      <Token>0x00001002</Token>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>VOID*</DatumType>

-      <MaxDatumSize>18</MaxDatumSize>

-      <SkuInfo>

-        <SkuId>0</SkuId>

-        <Value>L"COM1!COM2"</Value>

-      </SkuInfo>

-    </PcdBuildData>

-    <PcdBuildData ItemType="DYNAMIC">

-      <C_Name>PcdWinNtFileSystem</C_Name>

-      <Token>0x00001004</Token>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>VOID*</DatumType>

-      <MaxDatumSize>106</MaxDatumSize>

-      <SkuInfo>

-        <SkuId>0</SkuId>

-        <Value>L".!..\\..\\..\\..\\EdkShellBinPkg\\bin\\ia32\\Apps"</Value>

-      </SkuInfo>

-    </PcdBuildData>

-    <PcdBuildData ItemType="DYNAMIC">

-      <C_Name>PcdWinNtVirtualDisk</C_Name>

-      <Token>0x00001001</Token>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>VOID*</DatumType>

-      <MaxDatumSize>24</MaxDatumSize>

-      <SkuInfo>

-        <SkuId>0</SkuId>

-        <Value>L"FW;40960;512"</Value>

-      </SkuInfo>

-    </PcdBuildData>

-    <PcdBuildData ItemType="DYNAMIC">

-      <C_Name>PcdWinNtPhysicalDisk</C_Name>

-      <Token>0x00001000</Token>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>VOID*</DatumType>

-      <MaxDatumSize>30</MaxDatumSize>

-      <SkuInfo>

-        <SkuId>0</SkuId>

-        <Value>L"E:RW;245760;512"</Value>

-      </SkuInfo>

-    </PcdBuildData>

-    <PcdBuildData ItemType="DYNAMIC">

-      <C_Name>PcdWinNtCpuModel</C_Name>

-      <Token>0x00001007</Token>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>VOID*</DatumType>

-      <MaxDatumSize>48</MaxDatumSize>

-      <SkuInfo>

-        <SkuId>0</SkuId>

-        <Value>L"Intel(R) Processor Model"</Value>

-      </SkuInfo>

-    </PcdBuildData>

-    <PcdBuildData ItemType="DYNAMIC">

-      <C_Name>PcdWinNtCpuSpeed</C_Name>

-      <Token>0x00001008</Token>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>VOID*</DatumType>

-      <MaxDatumSize>8</MaxDatumSize>

-      <SkuInfo>

-        <SkuId>0</SkuId>

-        <Value>L"3000"</Value>

-      </SkuInfo>

-    </PcdBuildData>

-    <PcdBuildData ItemType="DYNAMIC">

-      <C_Name>PcdWinNtMemorySize</C_Name>

-      <Token>0x00001005</Token>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <DatumType>VOID*</DatumType>

-      <MaxDatumSize>10</MaxDatumSize>

-      <SkuInfo>

-        <SkuId>0</SkuId>

-        <Value>L"64!64"</Value>

-      </SkuInfo>

-    </PcdBuildData>

-  </DynamicPcdBuildDefinitions>

-  <BuildOptions>

-    <Options>

-      <Option BuildTargets="DEBUG" ToolChainFamily="MSFT" SupArchList="IA32" ToolCode="DLINK">/EXPORT:InitializeDriver=_ModuleEntryPoint /ALIGN:4096 /SUBSYSTEM:CONSOLE</Option>

-      <Option BuildTargets="RELEASE" ToolChainFamily="MSFT" SupArchList="IA32" ToolCode="DLINK">/ALIGN:4096</Option>

-    </Options>

-    <Ffs FfsKey="APPLICATION">

-      <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_APPLICATION"/>

-      <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>

-      <Sections EncapsulationType="Compress">

-        <Sections EncapsulationType="Guid-Defined">

-          <Section SectionType="EFI_SECTION_PE32"/>

-          <Section SectionType="EFI_SECTION_USER_INTERFACE"/>

-          <Section SectionType="EFI_SECTION_VERSION"/>

-        </Sections>

-      </Sections>

-    </Ffs>

-    <Ffs FfsKey="FILE">

-      <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_FREEFORM"/>

-      <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>

-      <Sections>

-        <Section SectionType="EFI_SECTION_RAW"/>

-      </Sections>

-    </Ffs>

-    <Ffs FfsKey="Apriori">

-      <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_FREEFORM"/>

-      <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>

-      <Sections>

-        <Section SectionType="EFI_SECTION_RAW"/>

-      </Sections>

-    </Ffs>

-    <Ffs FfsKey="Logo">

-      <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_FREEFORM"/>

-      <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>

-      <Sections EncapsulationType="Compress">

-        <Sections EncapsulationType="Guid-Defined">

-          <Section SectionType="EFI_SECTION_RAW"/>

-        </Sections>

-      </Sections>

-    </Ffs>

-    <Ffs FfsKey="RAWFILE">

-      <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_RAW"/>

-      <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>

-      <Sections>

-        <Section SectionType="EFI_SECTION_RAW"/>

-      </Sections>

-    </Ffs>

-    <Ffs FfsKey="Legacy16">

-      <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_FREEFORM"/>

-      <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>

-      <Sections EncapsulationType="Compress">

-        <Sections EncapsulationType="Guid-Defined">

-          <Section SectionType="EFI_SECTION_RAW"/>

-        </Sections>

-      </Sections>

-    </Ffs>

-    <Ffs FfsKey="BINARY">

-      <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_FREEFORM"/>

-      <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>

-      <Sections EncapsulationType="Compress">

-        <Sections EncapsulationType="Guid-Defined">

-          <Section SectionType="EFI_SECTION_RAW"/>

-        </Sections>

-      </Sections>

-    </Ffs>

-    <Ffs FfsKey="PE32_PEIM_TE_PEIM">

-      <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_PEIM"/>

-      <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>

-      <Sections>

-        <Section SectionType="EFI_SECTION_PEI_DEPEX"/>

-        <Section SectionType="EFI_SECTION_TE"/>

-        <Section SectionType="EFI_SECTION_USER_INTERFACE"/>

-        <Section SectionType="EFI_SECTION_VERSION"/>

-      </Sections>

-    </Ffs>

-    <Ffs FfsKey="Config_Config">

-      <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_RAW"/>

-      <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>

-      <Sections>

-        <Section SectionType="EFI_SECTION_RAW"/>

-      </Sections>

-    </Ffs>

-    <Ffs FfsKey="BS_DRIVER_Ifr_Bin">

-      <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_DRIVER"/>

-      <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>

-      <Sections EncapsulationType="Compress">

-        <Sections EncapsulationType="Guid-Defined">

-          <Section SectionType="EFI_SECTION_PEI_DEPEX"/>

-          <Section SectionType="EFI_SECTION_PE32"/>

-          <Section SectionType="EFI_SECTION_USER_INTERFACE"/>

-          <Section SectionType="EFI_SECTION_VERSION"/>

-          <Section SectionType="EFI_SECTION_RAW"/>

-        </Sections>

-      </Sections>

-    </Ffs>

-    <Ffs FfsKey="PEI_CORE">

-      <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_PEI_CORE"/>

-      <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>

-      <Sections>

-        <Section SectionType="EFI_SECTION_PE32"/>

-        <Section SectionType="EFI_SECTION_USER_INTERFACE"/>

-        <Section SectionType="EFI_SECTION_VERSION"/>

-      </Sections>

-    </Ffs>

-    <Ffs FfsKey="PE32_PEIM">

-      <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_PEIM"/>

-      <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>

-      <Sections>

-        <Section SectionType="EFI_SECTION_PEI_DEPEX"/>

-        <Section SectionType="EFI_SECTION_PE32"/>

-        <Section SectionType="EFI_SECTION_USER_INTERFACE"/>

-        <Section SectionType="EFI_SECTION_VERSION"/>

-      </Sections>

-    </Ffs>

-    <Ffs FfsKey="PE32_PEIM_Relocatable">

-      <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_PEIM"/>

-      <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>

-      <Sections>

-        <Section SectionType="EFI_SECTION_PEI_DEPEX"/>

-        <Section SectionType="EFI_SECTION_PE32"/>

-      </Sections>

-    </Ffs>

-    <Ffs FfsKey="PE32_PEIM_CompressPEIM">

-      <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_PEIM"/>

-      <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>

-      <Sections>

-        <Section SectionType="EFI_SECTION_PEI_DEPEX"/>

-        <Sections EncapsulationType="Compress">

-          <Section SectionType="EFI_SECTION_PE32"/>

-          <Section SectionType="EFI_SECTION_USER_INTERFACE"/>

-          <Section SectionType="EFI_SECTION_VERSION"/>

-        </Sections>

-      </Sections>

-    </Ffs>

-    <Ffs FfsKey="COMBINED_PEIM_DRIVER">

-      <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER"/>

-      <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>

-      <Sections>

-        <Section SectionType="EFI_SECTION_PEI_DEPEX"/>

-        <!--Section SectionType="EFI_SECTION_UNKNOW"/-->

-        <Section SectionType="EFI_SECTION_PE32"/>

-        <Section SectionType="EFI_SECTION_USER_INTERFACE"/>

-        <Section SectionType="EFI_SECTION_VERSION"/>

-      </Sections>

-    </Ffs>

-    <Ffs FfsKey="DXE_CORE">

-      <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_DXE_CORE"/>

-      <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>

-      <Sections EncapsulationType="Compress">

-        <Section SectionType="EFI_SECTION_PE32"/>

-        <Section SectionType="EFI_SECTION_USER_INTERFACE"/>

-        <Section SectionType="EFI_SECTION_VERSION"/>

-      </Sections>

-    </Ffs>

-    <Ffs FfsKey="BS_DRIVER">

-      <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_DRIVER"/>

-      <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>

-      <Sections EncapsulationType="Compress">

-        <Sections EncapsulationType="Guid-Defined">

-          <Section SectionType="EFI_SECTION_DXE_DEPEX"/>

-          <Section SectionType="EFI_SECTION_PE32"/>

-          <Section SectionType="EFI_SECTION_USER_INTERFACE"/>

-          <Section SectionType="EFI_SECTION_VERSION"/>

-        </Sections>

-      </Sections>

-    </Ffs>

-    <Ffs FfsKey="RT_DRIVER">

-      <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_DRIVER"/>

-      <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>

-      <Sections EncapsulationType="Compress">

-        <Sections EncapsulationType="Guid-Defined">

-          <Section SectionType="EFI_SECTION_DXE_DEPEX"/>

-          <Section SectionType="EFI_SECTION_PE32"/>

-          <Section SectionType="EFI_SECTION_USER_INTERFACE"/>

-          <Section SectionType="EFI_SECTION_VERSION"/>

-        </Sections>

-      </Sections>

-    </Ffs>

-    <Ffs FfsKey="SAL_RT_DRIVER">

-      <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_DRIVER"/>

-      <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>

-      <Sections EncapsulationType="Compress">

-        <Sections EncapsulationType="Guid-Defined">

-          <Section SectionType="EFI_SECTION_DXE_DEPEX"/>

-          <Section SectionType="EFI_SECTION_PE32"/>

-          <Section SectionType="EFI_SECTION_USER_INTERFACE"/>

-          <Section SectionType="EFI_SECTION_VERSION"/>

-        </Sections>

-      </Sections>

-    </Ffs>

-    <Ffs FfsKey="BS_DRIVER_EFI">

-      <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_DRIVER"/>

-      <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>

-      <Sections EncapsulationType="Compress">

-        <Sections EncapsulationType="Guid-Defined">

-          <Section SectionType="EFI_SECTION_DXE_DEPEX"/>

-          <Section SectionType="EFI_SECTION_PE32"/>

-          <Section SectionType="EFI_SECTION_USER_INTERFACE"/>

-          <Section SectionType="EFI_SECTION_VERSION"/>

-        </Sections>

-      </Sections>

-    </Ffs>

-    <Ffs FfsKey="RT_DRIVER_EFI">

-      <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_DRIVER"/>

-      <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>

-      <Sections EncapsulationType="Compress">

-        <Sections EncapsulationType="Guid-Defined">

-          <Section SectionType="EFI_SECTION_DXE_DEPEX"/>

-          <Section SectionType="EFI_SECTION_PE32"/>

-          <Section SectionType="EFI_SECTION_USER_INTERFACE"/>

-          <Section SectionType="EFI_SECTION_VERSION"/>

-        </Sections>

-      </Sections>

-    </Ffs>

-    <Ffs FfsKey="APPLICATION_EFI">

-      <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_APPLICATION"/>

-      <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>

-      <Sections EncapsulationType="Compress">

-        <Sections EncapsulationType="Guid-Defined">

-          <Section SectionType="EFI_SECTION_PE32"/>

-          <Section SectionType="EFI_SECTION_USER_INTERFACE"/>

-          <Section SectionType="EFI_SECTION_VERSION"/>

-        </Sections>

-      </Sections>

-    </Ffs>

-    <Ffs FfsKey="Microcode">

-      <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_RAW"/>

-      <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>

-      <Sections>

-        <Section SectionType="EFI_SECTION_RAW"/>

-      </Sections>

-    </Ffs>

-  </BuildOptions>

-  <UserExtensions UserID="TianoCore" Identifier="1">

-    <concat destfile="${FV_DIR}/FV_RECOVERY.fd" binary="true" force="no">

-      <fileset dir="${FV_DIR}" includes="*.fv"/>

-    </concat>

-    <pathconvert property="SecMainPath" targetos="windows">

-      <path path="${TARGET_DIR}/IA32"/>

-    </pathconvert>

-    <echo file="${TARGET_DIR}/run.cmd">@REM
-      @REM Copyright (c) 2006, Intel Corporation
-      @REM All rights reserved. This program and the accompanying materials
-      @REM are licensed and made available under the terms and conditions of the BSD License
-      @REM which accompanies this distribution.  The full text of the license may be found at
-      @REM http://opensource.org/licenses/bsd-license.php
-      @REM
-      @REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-      @REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-      @REM
-
-      @echo off
-      pushd .
-      cd ${SecMainPath}
-      SecMain.exe
-      popd
-      @echo on</echo>

-  </UserExtensions>

-  <UserExtensions UserID="TianoCore" Identifier="run">

-    <!--execute the NT32 simulator-->

-    <exec executable="${TARGET_DIR}/IA32/SecMain.exe" dir="${TARGET_DIR}/IA32" spawn="false"/>

-  </UserExtensions>

-</PlatformSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Pei/Autoscan/WinNtAutoScan.msa b/EdkNt32Pkg/Pei/Autoscan/WinNtAutoScan.msa
deleted file mode 100644
index 8a0beea..0000000
--- a/EdkNt32Pkg/Pei/Autoscan/WinNtAutoScan.msa
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>WinNtAutoScan</ModuleName>

-    <ModuleType>PEIM</ModuleType>

-    <GuidValue>BE0FEABA-3443-4919-9F3A-2D4216329EA9</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>Component description file for WinNtAutoScan module</Abstract>

-    <Description>This module abstracts memory auto-scan in a Windows NT environment.</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>WinNtAutoScan</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>PeimEntryPoint</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>HobLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>WinntAutoscan.c</Filename>

-    <Filename>WinNtAutoscan.dxs</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <PPIs>

-    <Ppi Usage="ALWAYS_CONSUMED">

-      <PpiCName>gPeiNtAutoScanPpiGuid</PpiCName>

-    </Ppi>

-    <Ppi Usage="ALWAYS_CONSUMED">

-      <PpiCName>gPeiBaseMemoryTestPpiGuid</PpiCName>

-    </Ppi>

-  </PPIs>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-    <Extern>

-      <ModuleEntryPoint>PeimInitializeWinNtAutoScan</ModuleEntryPoint>

-    </Extern>

-  </Externs>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Pei/Autoscan/WinNtAutoscan.dxs b/EdkNt32Pkg/Pei/Autoscan/WinNtAutoscan.dxs
deleted file mode 100644
index f216445..0000000
--- a/EdkNt32Pkg/Pei/Autoscan/WinNtAutoscan.dxs
+++ /dev/null
@@ -1,28 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  WinNtAutoscan.dxs

-

-Abstract:

-

-  Dependency expression file for WinNtAutoscan.

-

---*/  

-

-#include <PeimDepex.h>

-

-DEPENDENCY_START

-  PEI_NT_AUTOSCAN_PPI_GUID AND EFI_PEI_MASTER_BOOT_MODE_PEIM_PPI AND PEI_BASE_MEMORY_TEST_GUID

-DEPENDENCY_END

-

-

diff --git a/EdkNt32Pkg/Pei/Autoscan/WinntAutoscan.c b/EdkNt32Pkg/Pei/Autoscan/WinntAutoscan.c
deleted file mode 100644
index 47f766c..0000000
--- a/EdkNt32Pkg/Pei/Autoscan/WinntAutoscan.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-  WinNtAutoscan.c

-

-Abstract:

-  This PEIM to abstract memory auto-scan in a Windows NT environment.

-

-Revision History

-

---*/

-

-EFI_STATUS

-EFIAPI

-PeimInitializeWinNtAutoScan (

-  IN EFI_FFS_FILE_HEADER       *FfsHeader,

-  IN EFI_PEI_SERVICES          **PeiServices

-  )

-/*++

-

-Routine Description:

-  Perform a call-back into the SEC simulator to get a memory value

-

-Arguments:

-  FfsHeader   - General purpose data available to every PEIM

-  PeiServices - General purpose services available to every PEIM.

-    

-Returns:

-  None

-

---*/

-{

-  EFI_STATUS                  Status;

-  EFI_PEI_PPI_DESCRIPTOR      *PpiDescriptor;

-  PEI_NT_AUTOSCAN_PPI         *PeiNtService;

-  UINT64                      MemorySize;

-  EFI_PHYSICAL_ADDRESS        MemoryBase;

-  PEI_BASE_MEMORY_TEST_PPI    *MemoryTestPpi;

-  EFI_PHYSICAL_ADDRESS        ErrorAddress;

-  UINTN                       Index;

-  EFI_RESOURCE_ATTRIBUTE_TYPE Attributes;

-

-

-  DEBUG ((EFI_D_ERROR, "NT 32 Autoscan PEIM Loaded\n"));

-

-  //

-  // Get the PEI NT Autoscan PPI

-  //

-  Status = (**PeiServices).LocatePpi (

-                            PeiServices,

-                            &gPeiNtAutoScanPpiGuid, // GUID

-                            0,                      // INSTANCE

-                            &PpiDescriptor,         // EFI_PEI_PPI_DESCRIPTOR

-                            &PeiNtService           // PPI

-                            );

-  ASSERT_EFI_ERROR (Status);

-

-  //

-  // Get the Memory Test PPI

-  //

-  Status = (**PeiServices).LocatePpi (

-                            PeiServices,

-                            &gPeiBaseMemoryTestPpiGuid,

-                            0,

-                            NULL,

-                            &MemoryTestPpi

-                            );

-  ASSERT_EFI_ERROR (Status);

-

-  Index = 0;

-  do {

-    Status = PeiNtService->NtAutoScan (Index, &MemoryBase, &MemorySize);

-    if (!EFI_ERROR (Status)) {

-      Attributes =

-        (

-          EFI_RESOURCE_ATTRIBUTE_PRESENT |

-          EFI_RESOURCE_ATTRIBUTE_INITIALIZED |

-          EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |

-          EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |

-          EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |

-          EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE

-        );

-

-      if (Index == 0) {

-        //

-        // For the first area register it as PEI tested memory

-        //

-        Status = MemoryTestPpi->BaseMemoryTest (

-                                  PeiServices,

-                                  MemoryTestPpi,

-                                  MemoryBase,

-                                  MemorySize,

-                                  Quick,

-                                  &ErrorAddress

-                                  );

-        ASSERT_EFI_ERROR (Status);

-

-        //

-        // Register the "tested" memory with the PEI Core

-        //

-        Status = (**PeiServices).InstallPeiMemory (PeiServices, MemoryBase, MemorySize);

-        ASSERT_EFI_ERROR (Status);

-

-        Attributes |= EFI_RESOURCE_ATTRIBUTE_TESTED;

-      }

-      

-      BuildResourceDescriptorHob (

-        EFI_RESOURCE_SYSTEM_MEMORY,

-        Attributes,

-        MemoryBase,

-        MemorySize

-        );

-    }

-    Index++;

-  } while (!EFI_ERROR (Status));

-

-  //

-  // Build the CPU hob with 36-bit addressing and 16-bits of IO space.

-  //

-  BuildCpuHob (36, 16);

-  

-  return Status;

-}

diff --git a/EdkNt32Pkg/Pei/BootMode/BootMode.c b/EdkNt32Pkg/Pei/BootMode/BootMode.c
deleted file mode 100644
index 955c759..0000000
--- a/EdkNt32Pkg/Pei/BootMode/BootMode.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  BootMode.c

-   

-Abstract:

-

-  Tiano PEIM to provide the platform support functionality within Windows

-

---*/

-

-

-

-//

-// Module globals

-//

-EFI_PEI_PPI_DESCRIPTOR  mPpiListBootMode = {

-  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),

-  &gEfiPeiMasterBootModePpiGuid,

-  NULL

-};

-

-EFI_PEI_PPI_DESCRIPTOR  mPpiListRecoveryBootMode = {

-  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),

-  &gEfiPeiBootInRecoveryModePpiGuid,

-  NULL

-};

-

-EFI_STATUS

-EFIAPI

-InitializeBootMode (

-  IN EFI_FFS_FILE_HEADER       *FfsHeader,

-  IN EFI_PEI_SERVICES          **PeiServices

-  )

-/*++

-

-Routine Description:

-

-  Peform the boot mode determination logic

-

-Arguments:

-

-  PeiServices - General purpose services available to every PEIM.

-    

-Returns:

-

-  Status -  EFI_SUCCESS if the boot mode could be set

-

---*/

-// TODO:    FfsHeader - add argument and description to function comment

-{

-  EFI_STATUS  Status;

-  UINTN       BootMode;

-

-  DEBUG ((EFI_D_ERROR, "NT32 Boot Mode PEIM Loaded\n"));

-

-  //

-  // Let's assume things are OK if not told otherwise

-  // Should we read an environment variable in order to easily change this?

-  //

-  BootMode  = BOOT_WITH_FULL_CONFIGURATION;

-

-  Status    = (**PeiServices).SetBootMode (PeiServices, (UINT8) BootMode);

-  ASSERT_EFI_ERROR (Status);

-

-  Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListBootMode);

-  ASSERT_EFI_ERROR (Status);

-

-  if (BootMode == BOOT_IN_RECOVERY_MODE) {

-    Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListRecoveryBootMode);

-    ASSERT_EFI_ERROR (Status);

-  }

-

-  return Status;

-}

diff --git a/EdkNt32Pkg/Pei/BootMode/BootMode.dxs b/EdkNt32Pkg/Pei/BootMode/BootMode.dxs
deleted file mode 100644
index 7c3b9d9..0000000
--- a/EdkNt32Pkg/Pei/BootMode/BootMode.dxs
+++ /dev/null
@@ -1,28 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  BootMode.dxs

-

-Abstract:

-

-  Dependency expression file for BootMode.

-

---*/  

-

-#include <PeimDepex.h>

-

-DEPENDENCY_START

-  TRUE

-DEPENDENCY_END

-

-

diff --git a/EdkNt32Pkg/Pei/BootMode/BootMode.msa b/EdkNt32Pkg/Pei/BootMode/BootMode.msa
deleted file mode 100644
index e8225a8..0000000
--- a/EdkNt32Pkg/Pei/BootMode/BootMode.msa
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>BootMode</ModuleName>

-    <ModuleType>PEIM</ModuleType>

-    <GuidValue>B7611005-1F26-45ba-A3DB-01F39DDB2785</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>Component description file for BootMode module</Abstract>

-    <Description>This module provides platform specific function to detect boot mode.</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>BootMode</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>PeimEntryPoint</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>BootMode.c</Filename>

-    <Filename>BootMode.dxs</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-  </PackageDependencies>

-  <PPIs>

-    <Ppi Usage="SOMETIMES_PRODUCED">

-      <PpiCName>gEfiPeiBootInRecoveryModePpiGuid</PpiCName>

-    </Ppi>

-    <Ppi Usage="ALWAYS_PRODUCED">

-      <PpiCName>gEfiPeiMasterBootModePpiGuid</PpiCName>

-    </Ppi>

-  </PPIs>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-    <Extern>

-      <ModuleEntryPoint>InitializeBootMode</ModuleEntryPoint>

-    </Extern>

-  </Externs>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Pei/FirmwareVolume/WinNtFwh.dxs b/EdkNt32Pkg/Pei/FirmwareVolume/WinNtFwh.dxs
deleted file mode 100644
index e9c9352..0000000
--- a/EdkNt32Pkg/Pei/FirmwareVolume/WinNtFwh.dxs
+++ /dev/null
@@ -1,28 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  WinNtFwh.dxs

-

-Abstract:

-

-  Dependency expression file for WinNtFwh PEIM.

-

---*/  

-

-#include <PeimDepex.h>

-

-DEPENDENCY_START

-  NT_FWH_PPI_GUID AND EFI_PEI_PERMANENT_MEMORY_INSTALLED_PPI_GUID

-DEPENDENCY_END

-

-

diff --git a/EdkNt32Pkg/Pei/FirmwareVolume/WinNtFwh.msa b/EdkNt32Pkg/Pei/FirmwareVolume/WinNtFwh.msa
deleted file mode 100644
index 9d600f2..0000000
--- a/EdkNt32Pkg/Pei/FirmwareVolume/WinNtFwh.msa
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>WinNtFwh</ModuleName>

-    <ModuleType>PEIM</ModuleType>

-    <GuidValue>F0384FFD-8633-452f-9010-F6B7D2EAE2F1</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>Component description file for WinNtFwh module</Abstract>

-    <Description>This PEIM will produce the HOB to describe Firmware Volume, Firmware Devices

-    on the NT32 emulator.</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>WinNtFwh</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>PeimEntryPoint</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>HobLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>WinntFwh.c</Filename>

-    <Filename>WinNtFwh.dxs</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <PPIs>

-    <Ppi Usage="ALWAYS_CONSUMED">

-      <PpiCName>gNtFwhPpiGuid</PpiCName>

-    </Ppi>

-  </PPIs>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-    <Extern>

-      <ModuleEntryPoint>PeimInitializeWinNtFwh</ModuleEntryPoint>

-    </Extern>

-  </Externs>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Pei/FirmwareVolume/WinntFwh.c b/EdkNt32Pkg/Pei/FirmwareVolume/WinntFwh.c
deleted file mode 100644
index 3764cb7..0000000
--- a/EdkNt32Pkg/Pei/FirmwareVolume/WinntFwh.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-  WinNtFwh.c

-    

-Abstract:

-  PEIM to abstract construction of firmware volume in a Windows NT environment.

-

-Revision History

-

---*/

-

-

-#include <FlashLayout.h>

-

-

-EFI_STATUS

-EFIAPI

-PeimInitializeWinNtFwh (

-  IN EFI_FFS_FILE_HEADER       *FfsHeader,

-  IN EFI_PEI_SERVICES          **PeiServices

-  )

-/*++

-

-Routine Description:

-  Perform a call-back into the SEC simulator to get address of the Firmware Hub

-

-Arguments:

-  FfsHeader   - Ffs Header availible to every PEIM

-  PeiServices - General purpose services available to every PEIM.

-    

-Returns:

-  None

-

---*/

-{

-  EFI_STATUS                  Status;

-  EFI_PEI_PPI_DESCRIPTOR      *PpiDescriptor;

-  NT_FWH_PPI                  *FwhPpi;

-  EFI_PHYSICAL_ADDRESS        FdBase;

-  EFI_FIRMWARE_VOLUME_HEADER  *FvHeader;

-  UINT64                      FdSize;

-  UINTN                       Index;

-

-  DEBUG ((EFI_D_ERROR, "NT 32 Firmware Volume PEIM Loaded\n"));

-

-  //

-  // Get the Fwh Information PPI

-  //

-  Status = (**PeiServices).LocatePpi (

-                            PeiServices,

-                            &gNtFwhPpiGuid, // GUID

-                            0,              // INSTANCE

-                            &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR

-                            &FwhPpi         // PPI

-                            );

-  ASSERT_EFI_ERROR (Status);

-

-  Index = 0;

-  do {

-    //

-    // Get information about all the FD's in the system

-    //

-    Status = FwhPpi->NtFwh (Index, &FdBase, &FdSize);

-    if (!EFI_ERROR (Status)) {

-      //

-      // Assume the FD starts with an FV header

-      //

-      FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) FdBase;

-

-      //

-      // Make an FV Hob for the first FV in the FD

-      //

-      BuildFvHob (FdBase, FvHeader->FvLength);

-

-      if (Index == 0) {

-        //

-        // Assume the first FD was produced by the NT32.DSC

-        //  All these strange offests are needed to keep in

-        //  sync with the FlashMap and NT32.dsc file

-        //

-        BuildResourceDescriptorHob (

-          EFI_RESOURCE_FIRMWARE_DEVICE,

-          (EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED | EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE),

-          FdBase,

-          (FvHeader->FvLength + EFI_WINNT_RUNTIME_UPDATABLE_LENGTH + EFI_WINNT_FTW_SPARE_BLOCK_LENGTH)

-          );

-

-        //

-        // Hard code the address of the spare block and variable services.

-        //  Assume it's a hard coded offset from FV0 in FD0.

-        //

-        FdBase  = FdBase + EFI_WINNT_RUNTIME_UPDATABLE_OFFSET;

-        FdSize  = EFI_WINNT_RUNTIME_UPDATABLE_LENGTH + EFI_WINNT_FTW_SPARE_BLOCK_LENGTH;

-

-        BuildFvHob (FdBase, FdSize);

-      } else {

-        //

-        // For other FD's just map them in.

-        //

-        BuildResourceDescriptorHob (

-          EFI_RESOURCE_FIRMWARE_DEVICE,

-          (EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED | EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE),

-          FdBase,

-          FdSize

-          );

-      }

-    }

-

-    Index++;

-  } while (!EFI_ERROR (Status));

-

-  return Status;

-}

diff --git a/EdkNt32Pkg/Pei/FlashMap/FlashMap.c b/EdkNt32Pkg/Pei/FlashMap/FlashMap.c
deleted file mode 100644
index ae3ceb9..0000000
--- a/EdkNt32Pkg/Pei/FlashMap/FlashMap.c
+++ /dev/null
@@ -1,302 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  FlashMap.c

-   

-Abstract:

-

-  PEIM to build GUIDed HOBs for platform specific flash map

-

---*/

-

-

-#include <FlashLayout.h>

-

-EFI_STATUS

-EFIAPI

-GetAreaInfo (

-  IN  EFI_PEI_SERVICES            **PeiServices,

-  IN PEI_FLASH_MAP_PPI            *This,

-  IN  EFI_FLASH_AREA_TYPE         AreaType,

-  IN  EFI_GUID                    *AreaTypeGuid,

-  OUT UINT32                      *NumEntries,

-  OUT EFI_FLASH_SUBAREA_ENTRY     **Entries

-  );

-

-EFI_STATUS

-EFIAPI

-MemoryDiscoveredPpiNotifyCallback (

-  IN EFI_PEI_SERVICES           **PeiServices,

-  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,

-  IN VOID                       *Ppi

-  );

-

-//

-// Module globals

-//

-static PEI_FLASH_MAP_PPI      mFlashMapPpi = { GetAreaInfo };

-

-static EFI_PEI_PPI_DESCRIPTOR mPpiListFlashMap = {

-  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),

-  &gPeiFlashMapPpiGuid,

-  &mFlashMapPpi

-};

-

-static EFI_FLASH_AREA_DATA    mFlashAreaData[] = {

-  //

-  // Variable area

-  //

-  {

-    EFI_VARIABLE_STORE_OFFSET,

-    EFI_VARIABLE_STORE_LENGTH,

-    EFI_FLASH_AREA_SUBFV | EFI_FLASH_AREA_MEMMAPPED_FV,

-    EFI_FLASH_AREA_EFI_VARIABLES,

-    0, 0, 0,

-    { 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }

-  },

-  //

-  // FTW spare (backup) block

-  //

-  {

-    EFI_WINNT_FTW_SPARE_BLOCK_OFFSET,

-    EFI_WINNT_FTW_SPARE_BLOCK_LENGTH,

-    EFI_FLASH_AREA_SUBFV | EFI_FLASH_AREA_MEMMAPPED_FV,

-    EFI_FLASH_AREA_FTW_BACKUP,

-    0, 0, 0,

-    { 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }

-  },

-  //

-  // FTW private working (state) area

-  //

-  {

-    EFI_FTW_WORKING_OFFSET,

-    EFI_FTW_WORKING_LENGTH,

-    EFI_FLASH_AREA_SUBFV | EFI_FLASH_AREA_MEMMAPPED_FV,

-    EFI_FLASH_AREA_FTW_STATE,

-    0, 0, 0,

-    { 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }

-  },

-  //

-  // Recovery FV

-  //

-  {

-    EFI_WINNT_FIRMWARE_OFFSET,

-    EFI_WINNT_FIRMWARE_LENGTH,

-    EFI_FLASH_AREA_FV | EFI_FLASH_AREA_MEMMAPPED_FV,

-    EFI_FLASH_AREA_RECOVERY_BIOS,

-    0, 0, 0,

-    { 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }

-  },

-  //

-  // System Non-Volatile Storage FV

-  //

-  {

-    EFI_WINNT_RUNTIME_UPDATABLE_OFFSET,

-    EFI_WINNT_RUNTIME_UPDATABLE_LENGTH + EFI_WINNT_FTW_SPARE_BLOCK_LENGTH,

-    EFI_FLASH_AREA_FV | EFI_FLASH_AREA_MEMMAPPED_FV,

-    EFI_FLASH_AREA_GUID_DEFINED,

-    0, 0, 0,

-    EFI_SYSTEM_NV_DATA_HOB_GUID

-  },

-};

-

-

-EFI_STATUS

-EFIAPI

-PeimInitializeFlashMap (

-  IN EFI_FFS_FILE_HEADER       *FfsHeader,

-  IN EFI_PEI_SERVICES          **PeiServices

-  )

-/*++

-

-Routine Description:

-  Build GUIDed HOBs for platform specific flash map

-  

-Arguments:

-  FfsHeader   - A pointer to the EFI_FFS_FILE_HEADER structure.

-  PeiServices - General purpose services available to every PEIM.

-    

-Returns:

-  EFI_STATUS

-

---*/

-// TODO:    EFI_SUCCESS - add return value to function comment

-{

-  EFI_STATUS              Status;

-  NT_FWH_PPI              *NtFwhPpi;

-  EFI_PEI_PPI_DESCRIPTOR  *PpiDescriptor;

-  EFI_PHYSICAL_ADDRESS    FdBase;

-  UINT64                  FdSize;

-  UINTN                   NumOfHobData;

-  UINTN                   Index;

-  EFI_FLASH_AREA_HOB_DATA FlashHobData;

-

-  DEBUG ((EFI_D_ERROR, "NT 32 Flash Map PEIM Loaded\n"));

-

-  //

-  // Install FlashMap PPI

-  //

-  Status = PeiServicesInstallPpi (&mPpiListFlashMap);

-  ASSERT_EFI_ERROR (Status);

-

-

-  //

-  // Get the Fwh Information PPI

-  //

-  Status = PeiServicesLocatePpi (

-            &gNtFwhPpiGuid, // GUID

-            0,              // INSTANCE

-            &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR

-            &NtFwhPpi       // PPI

-            );

-  ASSERT_EFI_ERROR (Status);

-

-  //

-  // Assume that FD0 contains the Flash map.

-  //

-  Status = NtFwhPpi->NtFwh (0, &FdBase, &FdSize);

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  //

-  // Get number of types

-  //

-  NumOfHobData = sizeof (mFlashAreaData) / sizeof (EFI_FLASH_AREA_DATA);

-

-  //

-  // Build flash area entries as GUIDed HOBs.

-  //

-  for (Index = 0; Index < NumOfHobData; Index++) {

-    (*PeiServices)->SetMem (&FlashHobData, sizeof (EFI_FLASH_AREA_HOB_DATA), 0);

-

-    FlashHobData.AreaType               = mFlashAreaData[Index].AreaType;

-    FlashHobData.NumberOfEntries        = 1;

-    FlashHobData.SubAreaData.Attributes = mFlashAreaData[Index].Attributes;

-    FlashHobData.SubAreaData.Base       = FdBase + (EFI_PHYSICAL_ADDRESS) (UINTN) mFlashAreaData[Index].Base;

-    FlashHobData.SubAreaData.Length     = (EFI_PHYSICAL_ADDRESS) (UINTN) mFlashAreaData[Index].Length;

-

-    //

-    // We also update a PCD entry so that any driver that depend on

-    // PCD entry will get the information.

-    //

-    if (FlashHobData.AreaType == EFI_FLASH_AREA_EFI_VARIABLES) {

-      PcdSet32 (PcdFlashNvStorageVariableBase, (UINT32) FlashHobData.SubAreaData.Base);

-      PcdSet32 (PcdFlashNvStorageVariableSize, (UINT32) FlashHobData.SubAreaData.Length);

-    }

-

-    if (FlashHobData.AreaType == EFI_FLASH_AREA_FTW_STATE) {

-      PcdSet32 (PcdFlashNvStorageFtwWorkingBase, (UINT32) FlashHobData.SubAreaData.Base);

-      PcdSet32 (PcdFlashNvStorageFtwWorkingSize, (UINT32) FlashHobData.SubAreaData.Length);

-    }

-

-    if (FlashHobData.AreaType == EFI_FLASH_AREA_FTW_BACKUP) {

-      PcdSet32 (PcdFlashNvStorageFtwSpareBase, (UINT32) FlashHobData.SubAreaData.Base);

-      PcdSet32 (PcdFlashNvStorageFtwSpareSize, (UINT32) FlashHobData.SubAreaData.Length);

-    }

-

-    switch (FlashHobData.AreaType) {

-    case EFI_FLASH_AREA_RECOVERY_BIOS:

-    case EFI_FLASH_AREA_MAIN_BIOS:

-      (*PeiServices)->CopyMem (

-                        &FlashHobData.AreaTypeGuid,

-                        &gEfiFirmwareFileSystemGuid,

-                        sizeof (EFI_GUID)

-                        );

-      (*PeiServices)->CopyMem (

-                        &FlashHobData.SubAreaData.FileSystem,

-                        &gEfiFirmwareVolumeBlockProtocolGuid,

-                        sizeof (EFI_GUID)

-                        );

-      break;

-

-    case EFI_FLASH_AREA_GUID_DEFINED:

-      (*PeiServices)->CopyMem (

-                        &FlashHobData.AreaTypeGuid,

-                        &mFlashAreaData[Index].AreaTypeGuid,

-                        sizeof (EFI_GUID)

-                        );

-      (*PeiServices)->CopyMem (

-                        &FlashHobData.SubAreaData.FileSystem,

-                        &gEfiFirmwareVolumeBlockProtocolGuid,

-                        sizeof (EFI_GUID)

-                        );

-      break;

-

-    default:

-      break;

-    }

-

-    BuildGuidDataHob (

-      &gEfiFlashMapHobGuid,

-      &FlashHobData,

-      sizeof (EFI_FLASH_AREA_HOB_DATA)

-      );

-  }

-

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-EFIAPI

-GetAreaInfo (

-  IN  EFI_PEI_SERVICES            **PeiServices,

-  IN PEI_FLASH_MAP_PPI            *This,

-  IN  EFI_FLASH_AREA_TYPE         AreaType,

-  IN  EFI_GUID                    *AreaTypeGuid,

-  OUT UINT32                      *NumEntries,

-  OUT EFI_FLASH_SUBAREA_ENTRY     **Entries

-  )

-/*++

-

-  Routine Description:    

-    Implementation of Flash Map PPI

-    

---*/

-// TODO: function comment is missing 'Arguments:'

-// TODO: function comment is missing 'Returns:'

-// TODO:    PeiServices - add argument and description to function comment

-// TODO:    This - add argument and description to function comment

-// TODO:    AreaType - add argument and description to function comment

-// TODO:    AreaTypeGuid - add argument and description to function comment

-// TODO:    NumEntries - add argument and description to function comment

-// TODO:    Entries - add argument and description to function comment

-// TODO:    EFI_SUCCESS - add return value to function comment

-// TODO:    EFI_NOT_FOUND - add return value to function comment

-{

-  EFI_STATUS                    Status;

-  EFI_PEI_HOB_POINTERS          Hob;

-  EFI_HOB_FLASH_MAP_ENTRY_TYPE  *FlashMapEntry;

-

-  Status = PeiServicesGetHobList (&Hob.Raw);

-  while (!END_OF_HOB_LIST (Hob)) {

-    if (Hob.Header->HobType == EFI_HOB_TYPE_GUID_EXTENSION && CompareGuid (&Hob.Guid->Name, &gEfiFlashMapHobGuid)) {

-      FlashMapEntry = (EFI_HOB_FLASH_MAP_ENTRY_TYPE *) Hob.Raw;

-      if (AreaType == FlashMapEntry->AreaType) {

-        if (AreaType == EFI_FLASH_AREA_GUID_DEFINED) {

-          if (!CompareGuid (AreaTypeGuid, &FlashMapEntry->AreaTypeGuid)) {

-            goto NextHob;

-          }

-        }

-

-        *NumEntries = FlashMapEntry->NumEntries;

-        *Entries    = FlashMapEntry->Entries;

-        return EFI_SUCCESS;

-      }

-    }

-  NextHob:

-    Hob.Raw = GET_NEXT_HOB (Hob);

-  }

-

-  return EFI_NOT_FOUND;

-}

diff --git a/EdkNt32Pkg/Pei/FlashMap/FlashMap.dxs b/EdkNt32Pkg/Pei/FlashMap/FlashMap.dxs
deleted file mode 100644
index 91f2a4e..0000000
--- a/EdkNt32Pkg/Pei/FlashMap/FlashMap.dxs
+++ /dev/null
@@ -1,27 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-  

-    FlashMap.dxs

-

-Abstract:

-

-  Dependency expression file for FindFv.

-

---*/  

-

-#include <PeimDepex.h>

-

-DEPENDENCY_START

- PCD_PPI_GUID

-DEPENDENCY_END

-

diff --git a/EdkNt32Pkg/Pei/FlashMap/FlashMap.msa b/EdkNt32Pkg/Pei/FlashMap/FlashMap.msa
deleted file mode 100644
index 3bf00a0..0000000
--- a/EdkNt32Pkg/Pei/FlashMap/FlashMap.msa
+++ /dev/null
@@ -1,119 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>PeiFlashMap</ModuleName>

-    <ModuleType>PEIM</ModuleType>

-    <GuidValue>681F3771-6F1D-42DE-9AA2-F82BBCDBC5F9</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>Component description file for FlashMap PEI module</Abstract>

-    <Description>This module installs FlashMap PPI which is used to get flash layout information.</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>PeiFlashMap</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>PeimEntryPoint</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>HobLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>PeiServicesLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseMemoryLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>PcdLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>FlashMap.c</Filename>

-    <Filename>FlashMap.dxs</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <Protocols>

-    <Protocol Usage="ALWAYS_CONSUMED">

-      <ProtocolCName>gEfiFirmwareVolumeBlockProtocolGuid</ProtocolCName>

-    </Protocol>

-  </Protocols>

-  <Hobs>

-    <HobTypes HobGuidCName="gEfiFlashMapHobGuid" Usage="ALWAYS_CONSUMED">

-      <HobType>GUID_EXTENSION</HobType>

-    </HobTypes>

-  </Hobs>

-  <PPIs>

-    <Ppi Usage="ALWAYS_PRODUCED">

-      <PpiCName>gPeiFlashMapPpiGuid</PpiCName>

-    </Ppi>

-    <Ppi Usage="ALWAYS_CONSUMED">

-      <PpiCName>gNtFwhPpiGuid</PpiCName>

-    </Ppi>

-  </PPIs>

-  <Guids>

-    <GuidCNames Usage="ALWAYS_CONSUMED">

-      <GuidCName>gEfiFirmwareFileSystemGuid</GuidCName>

-    </GuidCNames>

-  </Guids>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-    <Extern>

-      <ModuleEntryPoint>PeimInitializeFlashMap</ModuleEntryPoint>

-    </Extern>

-  </Externs>

-  <PcdCoded>

-    <PcdEntry PcdItemType="DYNAMIC">

-      <C_Name>PcdFlashNvStorageVariableBase</C_Name>

-      <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-      <HelpText>The driver sets the NV Storage FV base address defined by this PCD.

-        This base address point to an EFI_FIRMWARE_VOLUMN_HEADER struct. Variable PEIM

-        will get the base address from this PCD. In NT emulator, this PCD is a DYNAMIC

-        type, as FD is mapped to process space by WinNT OS. On real platform, it is

-        normally a FIXED_AT_BUILD type as system memory map is fixed to BIOS.</HelpText>

-    </PcdEntry>

-    <PcdEntry PcdItemType="DYNAMIC">

-      <C_Name>PcdFlashNvStorageVariableSize</C_Name>

-      <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-      <HelpText>To get the NvStorage Variable size from this PCD.</HelpText>

-    </PcdEntry>

-    <PcdEntry PcdItemType="DYNAMIC" Usage="ALWAYS_CONSUMED">

-      <C_Name>PcdFlashNvStorageFtwSpareBase</C_Name>

-      <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-      <HelpText>To get base address of the FTW spare block section in NV firmware volume.</HelpText>

-    </PcdEntry>

-    <PcdEntry PcdItemType="DYNAMIC" Usage="ALWAYS_CONSUMED">

-      <C_Name>PcdFlashNvStorageFtwSpareSize</C_Name>

-      <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-      <HelpText>To get size of the FTW spare block section in NV firmware volume.</HelpText>

-    </PcdEntry>

-    <PcdEntry PcdItemType="DYNAMIC" Usage="ALWAYS_CONSUMED">

-      <C_Name>PcdFlashNvStorageFtwWorkingBase</C_Name>

-      <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-      <HelpText>To get base address of the FTW working block section in NV firmware volume.</HelpText>

-    </PcdEntry>

-    <PcdEntry PcdItemType="DYNAMIC" Usage="ALWAYS_CONSUMED">

-      <C_Name>PcdFlashNvStorageFtwWorkingSize</C_Name>

-      <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>

-      <HelpText>To get size of the FTW working block section in NV firmware volume.</HelpText>

-    </PcdEntry>

-  </PcdCoded>

-</ModuleSurfaceArea>

diff --git a/EdkNt32Pkg/Pei/WinNtStuff/WinNtStuff.dxs b/EdkNt32Pkg/Pei/WinNtStuff/WinNtStuff.dxs
deleted file mode 100644
index 86f5a30..0000000
--- a/EdkNt32Pkg/Pei/WinNtStuff/WinNtStuff.dxs
+++ /dev/null
@@ -1,28 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  WinNtStuff.dxs

-

-Abstract:

-

-  Dependency expression file for WinNtStuff PEIM.

-

---*/  

-

-#include <PeimDepex.h>

-

-DEPENDENCY_START

-  PEI_NT_THUNK_PPI_GUID AND EFI_PEI_PERMANENT_MEMORY_INSTALLED_PPI_GUID

-DEPENDENCY_END

-

-

diff --git a/EdkNt32Pkg/Pei/WinNtStuff/WinNtStuff.msa b/EdkNt32Pkg/Pei/WinNtStuff/WinNtStuff.msa
deleted file mode 100644
index 9b4faf1..0000000
--- a/EdkNt32Pkg/Pei/WinNtStuff/WinNtStuff.msa
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>WinNtStuff</ModuleName>

-    <ModuleType>PEIM</ModuleType>

-    <GuidValue>D3AAD8DC-3A48-46ac-B1C7-28A9D3CF6755</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>Stuff driver</Abstract>

-    <Description>Tiano PEIM to abstract construction of firmware volume in a Windows NT environment.</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>WinNtStuff</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>PeimEntryPoint</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>HobLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>winntstuff.c</Filename>

-    <Filename>WinNtStuff.dxs</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <Protocols>

-    <Protocol Usage="ALWAYS_CONSUMED">

-      <ProtocolCName>gEfiWinNtThunkProtocolGuid</ProtocolCName>

-    </Protocol>

-  </Protocols>

-  <PPIs>

-    <Ppi Usage="ALWAYS_CONSUMED">

-      <PpiCName>gPeiNtThunkPpiGuid</PpiCName>

-    </Ppi>

-  </PPIs>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-    <Extern>

-      <ModuleEntryPoint>PeimInitializeWinNtStuff</ModuleEntryPoint>

-    </Extern>

-  </Externs>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Pei/WinNtStuff/winntstuff.c b/EdkNt32Pkg/Pei/WinNtStuff/winntstuff.c
deleted file mode 100644
index 4685928..0000000
--- a/EdkNt32Pkg/Pei/WinNtStuff/winntstuff.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-    WinNtStuff.c

-    

-Abstract:

-

-    Tiano PEIM to abstract construction of firmware volume in a Windows NT environment.

-

-Revision History

-

---*/

-

-

-

-EFI_STATUS

-EFIAPI

-PeimInitializeWinNtStuff (

-  IN EFI_FFS_FILE_HEADER       *FfsHeader,

-  IN EFI_PEI_SERVICES          **PeiServices

-  )

-/*++

-

-Routine Description:

-

-  Perform a call-back into the SEC simulator to get NT Stuff

-

-Arguments:

-

-  PeiServices - General purpose services available to every PEIM.

-    

-Returns:

-

-  None

-

---*/

-// TODO:    FfsHeader - add argument and description to function comment

-{

-  EFI_STATUS              Status;

-  EFI_PEI_PPI_DESCRIPTOR  *PpiDescriptor;

-  PEI_NT_THUNK_PPI        *PeiNtService;

-  VOID                    *Ptr;

-

-  DEBUG ((EFI_D_ERROR, "NT 32 WinNT Stuff PEIM Loaded\n"));

-

-  Status = (**PeiServices).LocatePpi (

-                            PeiServices,

-                            &gPeiNtThunkPpiGuid,  // GUID

-                            0,                    // INSTANCE

-                            &PpiDescriptor,       // EFI_PEI_PPI_DESCRIPTOR

-                            &PeiNtService         // PPI

-                            );

-  ASSERT_EFI_ERROR (Status);

-

-  Ptr = PeiNtService->NtThunk ();

-

-  BuildGuidDataHob (

-    &gEfiWinNtThunkProtocolGuid,         // Guid

-    &Ptr,                                // Buffer

-    sizeof (VOID *)                      // Sizeof Buffer

-    );

-  return Status;

-}

diff --git a/EdkNt32Pkg/RuntimeDxe/FvbServices/FWBlockService.c b/EdkNt32Pkg/RuntimeDxe/FvbServices/FWBlockService.c
deleted file mode 100644
index 531194e..0000000
--- a/EdkNt32Pkg/RuntimeDxe/FvbServices/FWBlockService.c
+++ /dev/null
@@ -1,1478 +0,0 @@
-/*++

-

-Copyright (c) 2006 - 2007, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  FWBlockService.c

-

-Abstract:

-

-Revision History

-

---*/

-

-#include "FWBlockService.h"

-

-ESAL_FWB_GLOBAL         *mFvbModuleGlobal;

-

-EFI_FW_VOL_BLOCK_DEVICE mFvbDeviceTemplate = {

-  FVB_DEVICE_SIGNATURE,

-  {

-    {

-      {

-        HARDWARE_DEVICE_PATH,

-        HW_MEMMAP_DP,

-        {

-          sizeof (MEMMAP_DEVICE_PATH),

-          0

-        }

-      },

-      EfiMemoryMappedIO,

-      0,

-      0,

-    },

-    {

-      END_DEVICE_PATH_TYPE,

-      END_ENTIRE_DEVICE_PATH_SUBTYPE,

-      {

-        sizeof (EFI_DEVICE_PATH_PROTOCOL),

-        0

-      }

-    }

-  },

-  0,

-  {

-    FvbProtocolGetAttributes,

-    FvbProtocolSetAttributes,

-    FvbProtocolGetPhysicalAddress,

-    FvbProtocolGetBlockSize,

-    FvbProtocolRead,

-    FvbProtocolWrite,

-    FvbProtocolEraseBlocks,

-    NULL

-  },

-  {

-    FvbExtendProtocolEraseCustomBlockRange

-  }

-};

-

-

-

-VOID

-EFIAPI

-FvbVirtualddressChangeEvent (

-  IN EFI_EVENT        Event,

-  IN VOID             *Context

-  )

-/*++

-

-Routine Description:

-

-  Fixup internal data so that EFI and SAL can be call in virtual mode.

-  Call the passed in Child Notify event and convert the mFvbModuleGlobal

-  date items to there virtual address.

-

-  mFvbModuleGlobal->FvInstance[FVB_PHYSICAL]  - Physical copy of instance data

-  mFvbModuleGlobal->FvInstance[FVB_VIRTUAL]   - Virtual pointer to common

-                                                instance data.

-

-Arguments:

-

-  (Standard EFI notify event - EFI_EVENT_NOTIFY)

-

-Returns:

-

-  None

-

---*/

-{

-  EFI_FW_VOL_INSTANCE *FwhInstance;

-  UINTN               Index;

-

-  EfiConvertPointer (0x0, (VOID **) &mFvbModuleGlobal->FvInstance[FVB_VIRTUAL]);

-

-  //

-  // Convert the base address of all the instances

-  //

-  Index       = 0;

-  FwhInstance = mFvbModuleGlobal->FvInstance[FVB_PHYSICAL];

-  while (Index < mFvbModuleGlobal->NumFv) {

-    EfiConvertPointer (0x0, (VOID **) &FwhInstance->FvBase[FVB_VIRTUAL]);

-    FwhInstance = (EFI_FW_VOL_INSTANCE *)

-      (

-        (UINTN) ((UINT8 *) FwhInstance) + FwhInstance->VolumeHeader.HeaderLength +

-          (sizeof (EFI_FW_VOL_INSTANCE) - sizeof (EFI_FIRMWARE_VOLUME_HEADER))

-      );

-    Index++;

-  }

-

-  EfiConvertPointer (0x0, (VOID **) &mFvbModuleGlobal->FvbScratchSpace[FVB_VIRTUAL]);

-  EfiConvertPointer (0x0, (VOID **) &mFvbModuleGlobal);

-}

-

-EFI_STATUS

-GetFvbInstance (

-  IN  UINTN                               Instance,

-  IN  ESAL_FWB_GLOBAL                     *Global,

-  OUT EFI_FW_VOL_INSTANCE                 **FwhInstance,

-  IN BOOLEAN                              Virtual

-  )

-/*++

-

-Routine Description:

-  Retrieves the physical address of a memory mapped FV

-

-Arguments:

-  Instance              - The FV instance whose base address is going to be

-                          returned

-  Global                - Pointer to ESAL_FWB_GLOBAL that contains all

-                          instance data

-  FwhInstance           - The EFI_FW_VOL_INSTANCE fimrware instance structure

-  Virtual               - Whether CPU is in virtual or physical mode

-

-Returns:

-  EFI_SUCCESS           - Successfully returns

-  EFI_INVALID_PARAMETER - Instance not found

-

---*/

-{

-  EFI_FW_VOL_INSTANCE *FwhRecord;

-

-  if (Instance >= Global->NumFv) {

-    return EFI_INVALID_PARAMETER;

-  }

-  //

-  // Find the right instance of the FVB private data

-  //

-  FwhRecord = Global->FvInstance[Virtual];

-  while (Instance > 0) {

-    FwhRecord = (EFI_FW_VOL_INSTANCE *)

-      (

-        (UINTN) ((UINT8 *) FwhRecord) + FwhRecord->VolumeHeader.HeaderLength +

-          (sizeof (EFI_FW_VOL_INSTANCE) - sizeof (EFI_FIRMWARE_VOLUME_HEADER))

-      );

-    Instance--;

-  }

-

-  *FwhInstance = FwhRecord;

-

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-FvbGetPhysicalAddress (

-  IN UINTN                                Instance,

-  OUT EFI_PHYSICAL_ADDRESS                *Address,

-  IN ESAL_FWB_GLOBAL                      *Global,

-  IN BOOLEAN                              Virtual

-  )

-/*++

-

-Routine Description:

-  Retrieves the physical address of a memory mapped FV

-

-Arguments:

-  Instance              - The FV instance whose base address is going to be

-                          returned

-  Address               - Pointer to a caller allocated EFI_PHYSICAL_ADDRESS

-                          that on successful return, contains the base address

-                          of the firmware volume.

-  Global                - Pointer to ESAL_FWB_GLOBAL that contains all

-                          instance data

-  Virtual               - Whether CPU is in virtual or physical mode

-

-Returns:

-  EFI_SUCCESS           - Successfully returns

-  EFI_INVALID_PARAMETER - Instance not found

-

---*/

-{

-  EFI_FW_VOL_INSTANCE *FwhInstance;

-  EFI_STATUS          Status;

-

-  //

-  // Find the right instance of the FVB private data

-  //

-  Status = GetFvbInstance (Instance, Global, &FwhInstance, Virtual);

-  ASSERT_EFI_ERROR (Status);

-  *Address = FwhInstance->FvBase[Virtual];

-

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-FvbGetVolumeAttributes (

-  IN UINTN                                Instance,

-  OUT EFI_FVB_ATTRIBUTES                  *Attributes,

-  IN ESAL_FWB_GLOBAL                      *Global,

-  IN BOOLEAN                              Virtual

-  )

-/*++

-

-Routine Description:

-  Retrieves attributes, insures positive polarity of attribute bits, returns

-  resulting attributes in output parameter

-

-Arguments:

-  Instance              - The FV instance whose attributes is going to be

-                          returned

-  Attributes            - Output buffer which contains attributes

-  Global                - Pointer to ESAL_FWB_GLOBAL that contains all

-                          instance data

-  Virtual               - Whether CPU is in virtual or physical mode

-

-Returns:

-  EFI_SUCCESS           - Successfully returns

-  EFI_INVALID_PARAMETER - Instance not found

-

---*/

-{

-  EFI_FW_VOL_INSTANCE *FwhInstance;

-  EFI_STATUS          Status;

-

-  //

-  // Find the right instance of the FVB private data

-  //

-  Status = GetFvbInstance (Instance, Global, &FwhInstance, Virtual);

-  ASSERT_EFI_ERROR (Status);

-  *Attributes = FwhInstance->VolumeHeader.Attributes;

-

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-FvbGetLbaAddress (

-  IN  UINTN                               Instance,

-  IN  EFI_LBA                             Lba,

-  OUT UINTN                               *LbaAddress,

-  OUT UINTN                               *LbaLength,

-  OUT UINTN                               *NumOfBlocks,

-  IN  ESAL_FWB_GLOBAL                     *Global,

-  IN  BOOLEAN                             Virtual

-  )

-/*++

-

-Routine Description:

-  Retrieves the starting address of an LBA in an FV

-

-Arguments:

-  Instance              - The FV instance which the Lba belongs to

-  Lba                   - The logical block address

-  LbaAddress            - On output, contains the physical starting address

-                          of the Lba

-  LbaLength             - On output, contains the length of the block

-  NumOfBlocks           - A pointer to a caller allocated UINTN in which the

-                          number of consecutive blocks starting with Lba is

-                          returned. All blocks in this range have a size of

-                          BlockSize

-  Global                - Pointer to ESAL_FWB_GLOBAL that contains all

-                          instance data

-  Virtual               - Whether CPU is in virtual or physical mode

-

-Returns:

-  EFI_SUCCESS           - Successfully returns

-  EFI_INVALID_PARAMETER - Instance not found

-

---*/

-{

-  UINT32                  NumBlocks;

-  UINT32                  BlockLength;

-  UINTN                   Offset;

-  EFI_LBA                 StartLba;

-  EFI_LBA                 NextLba;

-  EFI_FW_VOL_INSTANCE     *FwhInstance;

-  EFI_FV_BLOCK_MAP_ENTRY  *BlockMap;

-  EFI_STATUS              Status;

-

-  //

-  // Find the right instance of the FVB private data

-  //

-  Status = GetFvbInstance (Instance, Global, &FwhInstance, Virtual);

-  ASSERT_EFI_ERROR (Status);

-

-  StartLba  = 0;

-  Offset    = 0;

-  BlockMap  = &(FwhInstance->VolumeHeader.FvBlockMap[0]);

-

-  //

-  // Parse the blockmap of the FV to find which map entry the Lba belongs to

-  //

-  while (TRUE) {

-    NumBlocks   = BlockMap->NumBlocks;

-    BlockLength = BlockMap->BlockLength;

-

-    if (NumBlocks == 0 || BlockLength == 0) {

-      return EFI_INVALID_PARAMETER;

-    }

-

-    NextLba = StartLba + NumBlocks;

-

-    //

-    // The map entry found

-    //

-    if (Lba >= StartLba && Lba < NextLba) {

-      Offset = Offset + (UINTN) MultU64x32 ((Lba - StartLba), BlockLength);

-      if (LbaAddress != NULL) {

-        *LbaAddress = FwhInstance->FvBase[Virtual] + Offset;

-      }

-

-      if (LbaLength != NULL) {

-        *LbaLength = BlockLength;

-      }

-

-      if (NumOfBlocks != NULL) {

-        *NumOfBlocks = (UINTN) (NextLba - Lba);

-      }

-

-      return EFI_SUCCESS;

-    }

-

-    StartLba  = NextLba;

-    Offset    = Offset + NumBlocks * BlockLength;

-    BlockMap++;

-  }

-}

-

-EFI_STATUS

-FvbReadBlock (

-  IN UINTN                                Instance,

-  IN EFI_LBA                              Lba,

-  IN UINTN                                BlockOffset,

-  IN OUT UINTN                            *NumBytes,

-  IN UINT8                                *Buffer,

-  IN ESAL_FWB_GLOBAL                      *Global,

-  IN BOOLEAN                              Virtual

-  )

-/*++

-

-Routine Description:

-  Reads specified number of bytes into a buffer from the specified block

-

-Arguments:

-  Instance              - The FV instance to be read from

-  Lba                   - The logical block address to be read from

-  BlockOffset           - Offset into the block at which to begin reading

-  NumBytes              - Pointer that on input contains the total size of

-                          the buffer. On output, it contains the total number

-                          of bytes read

-  Buffer                - Pointer to a caller allocated buffer that will be

-                          used to hold the data read

-  Global                - Pointer to ESAL_FWB_GLOBAL that contains all

-                          instance data

-  Virtual               - Whether CPU is in virtual or physical mode

-

-Returns:

-  EFI_SUCCESS           - The firmware volume was read successfully and

-                          contents are in Buffer

-  EFI_BAD_BUFFER_SIZE   - Read attempted across a LBA boundary. On output,

-                          NumBytes contains the total number of bytes returned

-                          in Buffer

-  EFI_ACCESS_DENIED     - The firmware volume is in the ReadDisabled state

-  EFI_DEVICE_ERROR      - The block device is not functioning correctly and

-                          could not be read

-  EFI_INVALID_PARAMETER - Instance not found, or NumBytes, Buffer are NULL

-

---*/

-{

-  EFI_FVB_ATTRIBUTES  Attributes;

-  UINTN               LbaAddress;

-  UINTN               LbaLength;

-  EFI_STATUS          Status;

-

-  //

-  // Check for invalid conditions

-  //

-  if ((NumBytes == NULL) || (Buffer == NULL)) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  if (*NumBytes == 0) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  Status = FvbGetLbaAddress (Instance, Lba, &LbaAddress, &LbaLength, NULL, Global, Virtual);

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-  //

-  // Check if the FV is read enabled

-  //

-  FvbGetVolumeAttributes (Instance, &Attributes, Global, Virtual);

-

-  if ((Attributes & EFI_FVB_READ_STATUS) == 0) {

-    return EFI_ACCESS_DENIED;

-  }

-  //

-  // Perform boundary checks and adjust NumBytes

-  //

-  if (BlockOffset > LbaLength) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  if (LbaLength < (*NumBytes + BlockOffset)) {

-    *NumBytes = (UINT32) (LbaLength - BlockOffset);

-    Status    = EFI_BAD_BUFFER_SIZE;

-  }

-

-  CopyMem (Buffer, (UINT8 *) (LbaAddress + BlockOffset), (UINTN) (*NumBytes));

-

-  return Status;

-}

-

-EFI_STATUS

-FvbWriteBlock (

-  IN UINTN                                Instance,

-  IN EFI_LBA                              Lba,

-  IN UINTN                                BlockOffset,

-  IN OUT UINTN                            *NumBytes,

-  IN UINT8                                *Buffer,

-  IN ESAL_FWB_GLOBAL                      *Global,

-  IN BOOLEAN                              Virtual

-  )

-/*++

-

-Routine Description:

-  Writes specified number of bytes from the input buffer to the block

-

-Arguments:

-  Instance              - The FV instance to be written to

-  Lba                   - The starting logical block index to write to

-  BlockOffset           - Offset into the block at which to begin writing

-  NumBytes              - Pointer that on input contains the total size of

-                          the buffer. On output, it contains the total number

-                          of bytes actually written

-  Buffer                - Pointer to a caller allocated buffer that contains

-                          the source for the write

-  Global                - Pointer to ESAL_FWB_GLOBAL that contains all

-                          instance data

-  Virtual               - Whether CPU is in virtual or physical mode

-

-Returns:

-  EFI_SUCCESS           - The firmware volume was written successfully

-  EFI_BAD_BUFFER_SIZE   - Write attempted across a LBA boundary. On output,

-                          NumBytes contains the total number of bytes

-                          actually written

-  EFI_ACCESS_DENIED     - The firmware volume is in the WriteDisabled state

-  EFI_DEVICE_ERROR      - The block device is not functioning correctly and

-                          could not be written

-  EFI_INVALID_PARAMETER - Instance not found, or NumBytes, Buffer are NULL

-

---*/

-{

-  EFI_FVB_ATTRIBUTES  Attributes;

-  UINTN               LbaAddress;

-  UINTN               LbaLength;

-  EFI_STATUS          Status;

-

-  //

-  // Check for invalid conditions

-  //

-  if ((NumBytes == NULL) || (Buffer == NULL)) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  if (*NumBytes == 0) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  Status = FvbGetLbaAddress (Instance, Lba, &LbaAddress, &LbaLength, NULL, Global, Virtual);

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-  //

-  // Check if the FV is write enabled

-  //

-  FvbGetVolumeAttributes (Instance, &Attributes, Global, Virtual);

-

-  if ((Attributes & EFI_FVB_WRITE_STATUS) == 0) {

-    return EFI_ACCESS_DENIED;

-  }

-  //

-  // Perform boundary checks and adjust NumBytes

-  //

-  if (BlockOffset > LbaLength) {

-    return EFI_INVALID_PARAMETER;

-  }

-

-  if (LbaLength < (*NumBytes + BlockOffset)) {

-    *NumBytes = (UINT32) (LbaLength - BlockOffset);

-    Status    = EFI_BAD_BUFFER_SIZE;

-  }

-  //

-  // Write data

-  //

-  CopyMem ((UINT8 *) (LbaAddress + BlockOffset), Buffer, (UINTN) (*NumBytes));

-

-  return Status;

-}

-

-EFI_STATUS

-FvbEraseBlock (

-  IN UINTN                                Instance,

-  IN EFI_LBA                              Lba,

-  IN ESAL_FWB_GLOBAL                      *Global,

-  IN BOOLEAN                              Virtual

-  )

-/*++

-

-Routine Description:

-  Erases and initializes a firmware volume block

-

-Arguments:

-  Instance              - The FV instance to be erased

-  Lba                   - The logical block index to be erased

-  Global                - Pointer to ESAL_FWB_GLOBAL that contains all

-                          instance data

-  Virtual               - Whether CPU is in virtual or physical mode

-

-Returns:

-  EFI_SUCCESS           - The erase request was successfully completed

-  EFI_ACCESS_DENIED     - The firmware volume is in the WriteDisabled state

-  EFI_DEVICE_ERROR      - The block device is not functioning correctly and

-                          could not be written. Firmware device may have been

-                          partially erased

-  EFI_INVALID_PARAMETER - Instance not found

-

---*/

-{

-

-  EFI_FVB_ATTRIBUTES  Attributes;

-  UINTN               LbaAddress;

-  UINTN               LbaLength;

-  EFI_STATUS          Status;

-  UINT8               Data;

-

-  //

-  // Check if the FV is write enabled

-  //

-  FvbGetVolumeAttributes (Instance, &Attributes, Global, Virtual);

-

-  if ((Attributes & EFI_FVB_WRITE_STATUS) == 0) {

-    return EFI_ACCESS_DENIED;

-  }

-  //

-  // Get the starting address of the block for erase.

-  //

-  Status = FvbGetLbaAddress (Instance, Lba, &LbaAddress, &LbaLength, NULL, Global, Virtual);

-

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  if ((Attributes & EFI_FVB_ERASE_POLARITY) != 0) {

-    Data = 0xFF;

-  } else {

-    Data = 0x0;

-  }

-

-  SetMem ((UINT8 *) LbaAddress, LbaLength, Data);

-

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-FvbEraseCustomBlockRange (

-  IN UINTN                                Instance,

-  IN EFI_LBA                              StartLba,

-  IN UINTN                                OffsetStartLba,

-  IN EFI_LBA                              LastLba,

-  IN UINTN                                OffsetLastLba,

-  IN ESAL_FWB_GLOBAL                      *Global,

-  IN BOOLEAN                              Virtual

-  )

-/*++

-

-Routine Description:

-  Erases and initializes a specified range of a firmware volume

-

-Arguments:

-  Instance              - The FV instance to be erased

-  StartLba              - The starting logical block index to be erased

-  OffsetStartLba        - Offset into the starting block at which to

-                          begin erasing

-  LastLba               - The last logical block index to be erased

-  OffsetStartLba        - Offset into the last block at which to end erasing

-  Global                - Pointer to ESAL_FWB_GLOBAL that contains all

-                          instance data

-  Virtual               - Whether CPU is in virtual or physical mode

-

-Returns:

-  EFI_SUCCESS           - The firmware volume was erased successfully

-  EFI_ACCESS_DENIED     - The firmware volume is in the WriteDisabled state

-  EFI_DEVICE_ERROR      - The block device is not functioning correctly and

-                          could not be written. Firmware device may have been

-                          partially erased

-  EFI_INVALID_PARAMETER - Instance not found

-

---*/

-{

-  EFI_LBA Index;

-  UINTN   LbaSize;

-  UINTN   ScratchLbaSizeData;

-

-  //

-  // First LBA

-  //

-  FvbGetLbaAddress (Instance, StartLba, NULL, &LbaSize, NULL, Global, Virtual);

-

-  //

-  // Use the scratch space as the intermediate buffer to transfer data

-  // Back up the first LBA in scratch space.

-  //

-  FvbReadBlock (Instance, StartLba, 0, &LbaSize, Global->FvbScratchSpace[Virtual], Global, Virtual);

-

-  //

-  // erase now

-  //

-  FvbEraseBlock (Instance, StartLba, Global, Virtual);

-  ScratchLbaSizeData = OffsetStartLba;

-

-  //

-  // write the data back to the first block

-  //

-  if (ScratchLbaSizeData > 0) {

-    FvbWriteBlock (Instance, StartLba, 0, &ScratchLbaSizeData, Global->FvbScratchSpace[Virtual], Global, Virtual);

-  }

-  //

-  // Middle LBAs

-  //

-  if (LastLba > (StartLba + 1)) {

-    for (Index = (StartLba + 1); Index <= (LastLba - 1); Index++) {

-      FvbEraseBlock (Instance, Index, Global, Virtual);

-    }

-  }

-  //

-  // Last LBAs, the same as first LBAs

-  //

-  if (LastLba > StartLba) {

-    FvbGetLbaAddress (Instance, LastLba, NULL, &LbaSize, NULL, Global, Virtual);

-    FvbReadBlock (Instance, LastLba, 0, &LbaSize, Global->FvbScratchSpace[Virtual], Global, Virtual);

-    FvbEraseBlock (Instance, LastLba, Global, Virtual);

-  }

-

-  ScratchLbaSizeData = LbaSize - (OffsetStartLba + 1);

-

-  return FvbWriteBlock (

-          Instance,

-          LastLba,

-          (OffsetLastLba + 1),

-          &ScratchLbaSizeData,

-          Global->FvbScratchSpace[Virtual],

-          Global,

-          Virtual

-          );

-}

-

-EFI_STATUS

-FvbSetVolumeAttributes (

-  IN UINTN                                Instance,

-  IN OUT EFI_FVB_ATTRIBUTES               *Attributes,

-  IN ESAL_FWB_GLOBAL                      *Global,

-  IN BOOLEAN                              Virtual

-  )

-/*++

-

-Routine Description:

-  Modifies the current settings of the firmware volume according to the

-  input parameter, and returns the new setting of the volume

-

-Arguments:

-  Instance              - The FV instance whose attributes is going to be

-                          modified

-  Attributes            - On input, it is a pointer to EFI_FVB_ATTRIBUTES

-                          containing the desired firmware volume settings.

-                          On successful return, it contains the new settings

-                          of the firmware volume

-  Global                - Pointer to ESAL_FWB_GLOBAL that contains all

-                          instance data

-  Virtual               - Whether CPU is in virtual or physical mode

-

-Returns:

-  EFI_SUCCESS           - Successfully returns

-  EFI_ACCESS_DENIED     - The volume setting is locked and cannot be modified

-  EFI_INVALID_PARAMETER - Instance not found, or The attributes requested are

-                          in conflict with the capabilities as declared in the

-                          firmware volume header

-

---*/

-{

-  EFI_FW_VOL_INSTANCE *FwhInstance;

-  EFI_FVB_ATTRIBUTES  OldAttributes;

-  EFI_FVB_ATTRIBUTES  *AttribPtr;

-  UINT32              Capabilities;

-  UINT32              OldStatus;

-  UINT32              NewStatus;

-  EFI_STATUS          Status;

-

-  //

-  // Find the right instance of the FVB private data

-  //

-  Status = GetFvbInstance (Instance, Global, &FwhInstance, Virtual);

-  ASSERT_EFI_ERROR (Status);

-

-  AttribPtr     = (EFI_FVB_ATTRIBUTES *) &(FwhInstance->VolumeHeader.Attributes);

-  OldAttributes = *AttribPtr;

-  Capabilities  = OldAttributes & EFI_FVB_CAPABILITIES;

-  OldStatus     = OldAttributes & EFI_FVB_STATUS;

-  NewStatus     = *Attributes & EFI_FVB_STATUS;

-

-  //

-  // If firmware volume is locked, no status bit can be updated

-  //

-  if (OldAttributes & EFI_FVB_LOCK_STATUS) {

-    if (OldStatus ^ NewStatus) {

-      return EFI_ACCESS_DENIED;

-    }

-  }

-  //

-  // Test read disable

-  //

-  if ((Capabilities & EFI_FVB_READ_DISABLED_CAP) == 0) {

-    if ((NewStatus & EFI_FVB_READ_STATUS) == 0) {

-      return EFI_INVALID_PARAMETER;

-    }

-  }

-  //

-  // Test read enable

-  //

-  if ((Capabilities & EFI_FVB_READ_ENABLED_CAP) == 0) {

-    if (NewStatus & EFI_FVB_READ_STATUS) {

-      return EFI_INVALID_PARAMETER;

-    }

-  }

-  //

-  // Test write disable

-  //

-  if ((Capabilities & EFI_FVB_WRITE_DISABLED_CAP) == 0) {

-    if ((NewStatus & EFI_FVB_WRITE_STATUS) == 0) {

-      return EFI_INVALID_PARAMETER;

-    }

-  }

-  //

-  // Test write enable

-  //

-  if ((Capabilities & EFI_FVB_WRITE_ENABLED_CAP) == 0) {

-    if (NewStatus & EFI_FVB_WRITE_STATUS) {

-      return EFI_INVALID_PARAMETER;

-    }

-  }

-  //

-  // Test lock

-  //

-  if ((Capabilities & EFI_FVB_LOCK_CAP) == 0) {

-    if (NewStatus & EFI_FVB_LOCK_STATUS) {

-      return EFI_INVALID_PARAMETER;

-    }

-  }

-

-  *AttribPtr  = (*AttribPtr) & (0xFFFFFFFF & (~EFI_FVB_STATUS));

-  *AttribPtr  = (*AttribPtr) | NewStatus;

-  *Attributes = *AttribPtr;

-

-  return EFI_SUCCESS;

-}

-//

-// FVB protocol APIs

-//

-EFI_STATUS

-EFIAPI

-FvbProtocolGetPhysicalAddress (

-  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,

-  OUT EFI_PHYSICAL_ADDRESS                        *Address

-  )

-/*++

-

-Routine Description:

-

-  Retrieves the physical address of the device.

-

-Arguments:

-

-  This                  - Calling context

-  Address               - Output buffer containing the address.

-

-Returns:

-

-Returns:

-  EFI_SUCCESS           - Successfully returns

-

---*/

-{

-  EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;

-

-  FvbDevice = FVB_DEVICE_FROM_THIS (This);

-

-  return FvbGetPhysicalAddress (FvbDevice->Instance, Address, mFvbModuleGlobal, EfiGoneVirtual ());

-}

-

-EFI_STATUS

-EFIAPI

-FvbProtocolGetBlockSize (

-  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,

-  IN  EFI_LBA                                     Lba,

-  OUT UINTN                                       *BlockSize,

-  OUT UINTN                                       *NumOfBlocks

-  )

-/*++

-

-Routine Description:

-  Retrieve the size of a logical block

-

-Arguments:

-  This                  - Calling context

-  Lba                   - Indicates which block to return the size for.

-  BlockSize             - A pointer to a caller allocated UINTN in which

-                          the size of the block is returned

-  NumOfBlocks           - a pointer to a caller allocated UINTN in which the

-                          number of consecutive blocks starting with Lba is

-                          returned. All blocks in this range have a size of

-                          BlockSize

-

-Returns:

-  EFI_SUCCESS           - The firmware volume was read successfully and

-                          contents are in Buffer

-

---*/

-{

-  EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;

-

-  FvbDevice = FVB_DEVICE_FROM_THIS (This);

-

-  return FvbGetLbaAddress (

-          FvbDevice->Instance,

-          Lba,

-          NULL,

-          BlockSize,

-          NumOfBlocks,

-          mFvbModuleGlobal,

-          EfiGoneVirtual ()

-          );

-}

-

-EFI_STATUS

-EFIAPI

-FvbProtocolGetAttributes (

-  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,

-  OUT EFI_FVB_ATTRIBUTES                          *Attributes

-  )

-/*++

-

-Routine Description:

-    Retrieves Volume attributes.  No polarity translations are done.

-

-Arguments:

-    This                - Calling context

-    Attributes          - output buffer which contains attributes

-

-Returns:

-  EFI_SUCCESS           - Successfully returns

-

---*/

-{

-  EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;

-

-  FvbDevice = FVB_DEVICE_FROM_THIS (This);

-

-  return FvbGetVolumeAttributes (FvbDevice->Instance, Attributes, mFvbModuleGlobal, EfiGoneVirtual ());

-}

-

-EFI_STATUS

-EFIAPI

-FvbProtocolSetAttributes (

-  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,

-  IN OUT EFI_FVB_ATTRIBUTES                       *Attributes

-  )

-/*++

-

-Routine Description:

-  Sets Volume attributes. No polarity translations are done.

-

-Arguments:

-  This                  - Calling context

-  Attributes            - output buffer which contains attributes

-

-Returns:

-  EFI_SUCCESS           - Successfully returns

-

---*/

-{

-  EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;

-

-  FvbDevice = FVB_DEVICE_FROM_THIS (This);

-

-  return FvbSetVolumeAttributes (FvbDevice->Instance, Attributes, mFvbModuleGlobal, EfiGoneVirtual ());

-}

-

-EFI_STATUS

-EFIAPI

-FvbProtocolEraseBlocks (

-  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL    *This,

-  ...

-  )

-/*++

-

-Routine Description:

-

-  The EraseBlock() function erases one or more blocks as denoted by the

-  variable argument list. The entire parameter list of blocks must be verified

-  prior to erasing any blocks.  If a block is requested that does not exist

-  within the associated firmware volume (it has a larger index than the last

-  block of the firmware volume), the EraseBlock() function must return

-  EFI_INVALID_PARAMETER without modifying the contents of the firmware volume.

-

-Arguments:

-  This                  - Calling context

-  ...                   - Starting LBA followed by Number of Lba to erase.

-                          a -1 to terminate the list.

-

-Returns:

-  EFI_SUCCESS           - The erase request was successfully completed

-  EFI_ACCESS_DENIED     - The firmware volume is in the WriteDisabled state

-  EFI_DEVICE_ERROR      - The block device is not functioning correctly and

-                          could not be written. Firmware device may have been

-                          partially erased

-

---*/

-{

-  EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;

-  EFI_FW_VOL_INSTANCE     *FwhInstance;

-  UINTN                   NumOfBlocks;

-  VA_LIST                 args;

-  EFI_LBA                 StartingLba;

-  UINTN                   NumOfLba;

-  EFI_STATUS              Status;

-

-  FvbDevice = FVB_DEVICE_FROM_THIS (This);

-

-  Status    = GetFvbInstance (FvbDevice->Instance, mFvbModuleGlobal, &FwhInstance, EfiGoneVirtual ());

-  ASSERT_EFI_ERROR (Status);

-

-  NumOfBlocks = FwhInstance->NumOfBlocks;

-

-  VA_START (args, This);

-

-  do {

-    StartingLba = VA_ARG (args, EFI_LBA);

-    if (StartingLba == EFI_LBA_LIST_TERMINATOR) {

-      break;

-    }

-

-    NumOfLba = VA_ARG (args, UINT32);

-

-    //

-    // Check input parameters

-    //

-    if (NumOfLba == 0) {

-      VA_END (args);

-      return EFI_INVALID_PARAMETER;

-    }

-

-    if ((StartingLba + NumOfLba) > NumOfBlocks) {

-      return EFI_INVALID_PARAMETER;

-    }

-  } while (1);

-

-  VA_END (args);

-

-  VA_START (args, This);

-  do {

-    StartingLba = VA_ARG (args, EFI_LBA);

-    if (StartingLba == EFI_LBA_LIST_TERMINATOR) {

-      break;

-    }

-

-    NumOfLba = VA_ARG (args, UINT32);

-

-    while (NumOfLba > 0) {

-      Status = FvbEraseBlock (FvbDevice->Instance, StartingLba, mFvbModuleGlobal, EfiGoneVirtual ());

-      if (EFI_ERROR (Status)) {

-        VA_END (args);

-        return Status;

-      }

-

-      StartingLba++;

-      NumOfLba--;

-    }

-

-  } while (1);

-

-  VA_END (args);

-

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-EFIAPI

-FvbProtocolWrite (

-  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,

-  IN EFI_LBA                                      Lba,

-  IN UINTN                                        Offset,

-  IN OUT UINTN                                    *NumBytes,

-  IN UINT8                                        *Buffer

-  )

-/*++

-

-Routine Description:

-

-  Writes data beginning at Lba:Offset from FV. The write terminates either

-  when *NumBytes of data have been written, or when a block boundary is

-  reached.  *NumBytes is updated to reflect the actual number of bytes

-  written. The write opertion does not include erase. This routine will

-  attempt to write only the specified bytes. If the writes do not stick,

-  it will return an error.

-

-Arguments:

-  This                  - Calling context

-  Lba                   - Block in which to begin write

-  Offset                - Offset in the block at which to begin write

-  NumBytes              - On input, indicates the requested write size. On

-                          output, indicates the actual number of bytes written

-  Buffer                - Buffer containing source data for the write.

-

-Returns:

-  EFI_SUCCESS           - The firmware volume was written successfully

-  EFI_BAD_BUFFER_SIZE   - Write attempted across a LBA boundary. On output,

-                          NumBytes contains the total number of bytes

-                          actually written

-  EFI_ACCESS_DENIED     - The firmware volume is in the WriteDisabled state

-  EFI_DEVICE_ERROR      - The block device is not functioning correctly and

-                          could not be written

-  EFI_INVALID_PARAMETER - NumBytes or Buffer are NULL

-

---*/

-{

-

-  EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;

-

-  FvbDevice = FVB_DEVICE_FROM_THIS (This);

-

-  return FvbWriteBlock (FvbDevice->Instance, Lba, Offset, NumBytes, Buffer, mFvbModuleGlobal, EfiGoneVirtual ());

-}

-

-EFI_STATUS

-EFIAPI

-FvbProtocolRead (

-  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,

-  IN EFI_LBA                                      Lba,

-  IN UINTN                                        Offset,

-  IN OUT UINTN                                    *NumBytes,

-  IN UINT8                                        *Buffer

-  )

-/*++

-

-Routine Description:

-

-  Reads data beginning at Lba:Offset from FV. The Read terminates either

-  when *NumBytes of data have been read, or when a block boundary is

-  reached.  *NumBytes is updated to reflect the actual number of bytes

-  written. The write opertion does not include erase. This routine will

-  attempt to write only the specified bytes. If the writes do not stick,

-  it will return an error.

-

-Arguments:

-  This                  - Calling context

-  Lba                   - Block in which to begin Read

-  Offset                - Offset in the block at which to begin Read

-  NumBytes              - On input, indicates the requested write size. On

-                          output, indicates the actual number of bytes Read

-  Buffer                - Buffer containing source data for the Read.

-

-Returns:

-  EFI_SUCCESS           - The firmware volume was read successfully and

-                          contents are in Buffer

-  EFI_BAD_BUFFER_SIZE   - Read attempted across a LBA boundary. On output,

-                          NumBytes contains the total number of bytes returned

-                          in Buffer

-  EFI_ACCESS_DENIED     - The firmware volume is in the ReadDisabled state

-  EFI_DEVICE_ERROR      - The block device is not functioning correctly and

-                          could not be read

-  EFI_INVALID_PARAMETER - NumBytes or Buffer are NULL

-

---*/

-{

-

-  EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;

-

-  FvbDevice = FVB_DEVICE_FROM_THIS (This);

-

-  return FvbReadBlock (FvbDevice->Instance, Lba, Offset, NumBytes, Buffer, mFvbModuleGlobal, EfiGoneVirtual ());

-}

-//

-// FVB Extension Protocols

-//

-EFI_STATUS

-EFIAPI

-FvbExtendProtocolEraseCustomBlockRange (

-  IN EFI_FVB_EXTENSION_PROTOCOL           *This,

-  IN EFI_LBA                              StartLba,

-  IN UINTN                                OffsetStartLba,

-  IN EFI_LBA                              LastLba,

-  IN UINTN                                OffsetLastLba

-  )

-/*++

-

-Routine Description:

-  Erases and initializes a specified range of a firmware volume

-

-Arguments:

-  This                  - Calling context

-  StartLba              - The starting logical block index to be erased

-  OffsetStartLba        - Offset into the starting block at which to

-                          begin erasing

-  LastLba               - The last logical block index to be erased

-  OffsetStartLba        - Offset into the last block at which to end erasing

-

-Returns:

-  EFI_SUCCESS           - The firmware volume was erased successfully

-  EFI_ACCESS_DENIED     - The firmware volume is in the WriteDisabled state

-  EFI_DEVICE_ERROR      - The block device is not functioning correctly and

-                          could not be written. Firmware device may have been

-                          partially erased

-

---*/

-{

-  EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;

-

-  FvbDevice = FVB_EXTEND_DEVICE_FROM_THIS (This);

-

-  return FvbEraseCustomBlockRange (

-          FvbDevice->Instance,

-          StartLba,

-          OffsetStartLba,

-          LastLba,

-          OffsetLastLba,

-          mFvbModuleGlobal,

-          EfiGoneVirtual ()

-          );

-}

-

-STATIC

-EFI_STATUS

-ValidateFvHeader (

-  EFI_FIRMWARE_VOLUME_HEADER            *FwVolHeader

-  )

-/*++

-

-Routine Description:

-  Check the integrity of firmware volume header

-

-Arguments:

-  FwVolHeader           - A pointer to a firmware volume header

-

-Returns:

-  EFI_SUCCESS           - The firmware volume is consistent

-  EFI_NOT_FOUND         - The firmware volume has corrupted. So it is not an FV

-

---*/

-{

-  UINT16  *Ptr;

-  UINT16  HeaderLength;

-  UINT16  Checksum;

-

-  //

-  // Verify the header revision, header signature, length

-  // Length of FvBlock cannot be 2**64-1

-  // HeaderLength cannot be an odd number

-  //

-  if ((FwVolHeader->Revision != EFI_FVH_REVISION) ||

-      (FwVolHeader->Signature != EFI_FVH_SIGNATURE) ||

-      (FwVolHeader->FvLength == ((UINTN) -1)) ||

-      ((FwVolHeader->HeaderLength & 0x01) != 0)

-      ) {

-    return EFI_NOT_FOUND;

-  }

-  //

-  // Verify the header checksum

-  //

-  HeaderLength  = (UINT16) (FwVolHeader->HeaderLength / 2);

-  Ptr           = (UINT16 *) FwVolHeader;

-  Checksum      = 0;

-  while (HeaderLength > 0) {

-    Checksum = Checksum + (*Ptr);

-    HeaderLength--;

-    Ptr++;

-  }

-

-  if (Checksum != 0) {

-    return EFI_NOT_FOUND;

-  }

-

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-EFIAPI

-FvbInitialize (

-  IN EFI_HANDLE         ImageHandle,

-  IN EFI_SYSTEM_TABLE   *SystemTable

-  )

-/*++

-

-Routine Description:

-  This function does common initialization for FVB services

-

-Arguments:

-

-Returns:

-

---*/

-{

-  EFI_STATUS                          Status;

-  EFI_FW_VOL_INSTANCE                 *FwhInstance;

-  EFI_FIRMWARE_VOLUME_HEADER          *FwVolHeader;

-  EFI_DXE_SERVICES                    *DxeServices;

-  EFI_GCD_MEMORY_SPACE_DESCRIPTOR     Descriptor;

-  UINT32                              BufferSize;

-  EFI_FV_BLOCK_MAP_ENTRY              *PtrBlockMapEntry;

-  EFI_HANDLE                          FwbHandle;

-  EFI_FW_VOL_BLOCK_DEVICE             *FvbDevice;

-  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *OldFwbInterface;

-  EFI_DEVICE_PATH_PROTOCOL            *TempFwbDevicePath;

-  FV_DEVICE_PATH                      TempFvbDevicePathData;

-  UINT32                              MaxLbaSize;

-  EFI_PHYSICAL_ADDRESS                BaseAddress;

-  UINT64                              Length;

-  UINTN                               NumOfBlocks;

-  EFI_PEI_HOB_POINTERS                FvHob;

-

-   //

-  // Get the DXE services table

-  //

-  DxeServices = gDS;

-

-  //

-  // Allocate runtime services data for global variable, which contains

-  // the private data of all firmware volume block instances

-  //

-  mFvbModuleGlobal = AllocateRuntimePool (sizeof (ESAL_FWB_GLOBAL));

-  ASSERT (mFvbModuleGlobal != NULL);

-

-  //

-  // Calculate the total size for all firmware volume block instances

-  //

-  BufferSize            = 0;

-

-  FvHob.Raw = GetHobList ();

-  while ((FvHob.Raw = GetNextHob (EFI_HOB_TYPE_FV, FvHob.Raw)) != NULL) {

-    BaseAddress = FvHob.FirmwareVolume->BaseAddress;

-    Length      = FvHob.FirmwareVolume->Length;

-    //

-    // Check if it is a "real" flash

-    //

-    Status = DxeServices->GetMemorySpaceDescriptor (

-                            BaseAddress,

-                            &Descriptor

-                            );

-    if (EFI_ERROR (Status)) {

-      break;

-    }

-

-    if (Descriptor.GcdMemoryType != EfiGcdMemoryTypeMemoryMappedIo) {

-      FvHob.Raw = GET_NEXT_HOB (FvHob);

-      continue;

-    }

-

-    FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) BaseAddress;

-    Status      = ValidateFvHeader (FwVolHeader);

-    if (EFI_ERROR (Status)) {

-      //

-      // Get FvbInfo

-      //

-      Status = GetFvbInfo (Length, &FwVolHeader);

-      if (EFI_ERROR (Status)) {

-        FvHob.Raw = GET_NEXT_HOB (FvHob);

-        continue;

-      }

-    }

-

-    BufferSize += (sizeof (EFI_FW_VOL_INSTANCE) + FwVolHeader->HeaderLength - sizeof (EFI_FIRMWARE_VOLUME_HEADER));

-    FvHob.Raw = GET_NEXT_HOB (FvHob);

-  }

-

-  //

-  // Only need to allocate once. There is only one copy of physical memory for

-  // the private data of each FV instance. But in virtual mode or in physical

-  // mode, the address of the the physical memory may be different.

-  //

-  mFvbModuleGlobal->FvInstance[FVB_PHYSICAL] = AllocateRuntimePool (BufferSize);

-  ASSERT (mFvbModuleGlobal->FvInstance[FVB_PHYSICAL] != NULL);

-

-  //

-  // Make a virtual copy of the FvInstance pointer.

-  //

-  FwhInstance = mFvbModuleGlobal->FvInstance[FVB_PHYSICAL];

-  mFvbModuleGlobal->FvInstance[FVB_VIRTUAL] = FwhInstance;

-

-  mFvbModuleGlobal->NumFv                   = 0;

-  MaxLbaSize = 0;

-

-  FvHob.Raw = GetHobList ();

-  while (NULL != (FvHob.Raw = GetNextHob (EFI_HOB_TYPE_FV, FvHob.Raw))) {

-    BaseAddress = FvHob.FirmwareVolume->BaseAddress;

-    Length      = FvHob.FirmwareVolume->Length;

-    //

-    // Check if it is a "real" flash

-    //

-    Status = DxeServices->GetMemorySpaceDescriptor (

-                            BaseAddress,

-                            &Descriptor

-                            );

-    if (EFI_ERROR (Status)) {

-      break;

-    }

-

-    if (Descriptor.GcdMemoryType != EfiGcdMemoryTypeMemoryMappedIo) {

-      FvHob.Raw = GET_NEXT_HOB (FvHob);

-      continue;

-    }

-

-    FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) BaseAddress;

-    Status      = ValidateFvHeader (FwVolHeader);

-    if (EFI_ERROR (Status)) {

-      //

-      // Get FvbInfo to provide in FwhInstance.

-      //

-      Status = GetFvbInfo (Length, &FwVolHeader);

-      if (EFI_ERROR (Status)) {

-        FvHob.Raw = GET_NEXT_HOB (FvHob);

-        continue;

-      }

-      //

-      //  Write healthy FV header back.

-      //

-      CopyMem (

-        (VOID *) (UINTN) BaseAddress,

-        (VOID *) FwVolHeader,

-        FwVolHeader->HeaderLength

-        );

-    }

-

-    FwhInstance->FvBase[FVB_PHYSICAL] = (UINTN) BaseAddress;

-    FwhInstance->FvBase[FVB_VIRTUAL]  = (UINTN) BaseAddress;

-

-    CopyMem ((UINTN *) &(FwhInstance->VolumeHeader), (UINTN *) FwVolHeader, FwVolHeader->HeaderLength);

-    FwVolHeader = &(FwhInstance->VolumeHeader);

-    EfiInitializeLock (&(FwhInstance->FvbDevLock), TPL_HIGH_LEVEL);

-

-    NumOfBlocks = 0;

-

-    for (PtrBlockMapEntry = FwVolHeader->FvBlockMap; PtrBlockMapEntry->NumBlocks != 0; PtrBlockMapEntry++) {

-      //

-      // Get the maximum size of a block. The size will be used to allocate

-      // buffer for Scratch space, the intermediate buffer for FVB extension

-      // protocol

-      //

-      if (MaxLbaSize < PtrBlockMapEntry->BlockLength) {

-        MaxLbaSize = PtrBlockMapEntry->BlockLength;

-      }

-

-      NumOfBlocks = NumOfBlocks + PtrBlockMapEntry->NumBlocks;

-    }

-    //

-    // The total number of blocks in the FV.

-    //

-    FwhInstance->NumOfBlocks = NumOfBlocks;

-

-    //

-    // Add a FVB Protocol Instance

-    //

-    FvbDevice = AllocateRuntimePool (sizeof (EFI_FW_VOL_BLOCK_DEVICE));

-    ASSERT (FvbDevice != NULL);

-

-    CopyMem (FvbDevice, &mFvbDeviceTemplate, sizeof (EFI_FW_VOL_BLOCK_DEVICE));

-

-    FvbDevice->Instance = mFvbModuleGlobal->NumFv;

-    mFvbModuleGlobal->NumFv++;

-

-    //

-    // Set up the devicepath

-    //

-    FvbDevice->DevicePath.MemMapDevPath.StartingAddress = BaseAddress;

-    FvbDevice->DevicePath.MemMapDevPath.EndingAddress   = BaseAddress + (FwVolHeader->FvLength - 1);

-

-    //

-    // Find a handle with a matching device path that has supports FW Block protocol

-    //

-    TempFwbDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) &TempFvbDevicePathData;

-    CopyMem (TempFwbDevicePath, &FvbDevice->DevicePath, sizeof (FV_DEVICE_PATH));

-    Status = gBS->LocateDevicePath (&gEfiFirmwareVolumeBlockProtocolGuid, &TempFwbDevicePath, &FwbHandle);

-    if (EFI_ERROR (Status)) {

-      //

-      // LocateDevicePath fails so install a new interface and device path

-      //

-      FwbHandle = NULL;

-      Status = gBS->InstallMultipleProtocolInterfaces (

-                      &FwbHandle,

-                      &gEfiFirmwareVolumeBlockProtocolGuid,

-                      &FvbDevice->FwVolBlockInstance,

-                      &gEfiDevicePathProtocolGuid,

-                      &FvbDevice->DevicePath,

-                      NULL

-                      );

-      ASSERT_EFI_ERROR (Status);

-    } else if (EfiIsDevicePathEnd (TempFwbDevicePath)) {

-      //

-      // Device allready exists, so reinstall the FVB protocol

-      //

-      Status = gBS->HandleProtocol (

-                      FwbHandle,

-                      &gEfiFirmwareVolumeBlockProtocolGuid,

-                      &OldFwbInterface

-                      );

-      ASSERT_EFI_ERROR (Status);

-

-      Status = gBS->ReinstallProtocolInterface (

-                      FwbHandle,

-                      &gEfiFirmwareVolumeBlockProtocolGuid,

-                      OldFwbInterface,

-                      &FvbDevice->FwVolBlockInstance

-                      );

-      ASSERT_EFI_ERROR (Status);

-

-    } else {

-      //

-      // There was a FVB protocol on an End Device Path node

-      //

-      ASSERT (FALSE);

-    }

-    //

-    // Install FVB Extension Protocol on the same handle

-    //

-    Status = gBS->InstallMultipleProtocolInterfaces (

-                    &FwbHandle,

-                    &gEfiFvbExtensionProtocolGuid,

-                    &FvbDevice->FvbExtension,

-                    &gEfiAlternateFvBlockGuid,

-                    NULL,

-                    NULL

-                    );

-

-    ASSERT_EFI_ERROR (Status);

-

-    FwhInstance = (EFI_FW_VOL_INSTANCE *)

-      (

-        (UINTN) ((UINT8 *) FwhInstance) + FwVolHeader->HeaderLength +

-          (sizeof (EFI_FW_VOL_INSTANCE) - sizeof (EFI_FIRMWARE_VOLUME_HEADER))

-      );

-

-    FvHob.Raw = GET_NEXT_HOB (FvHob);

-  }

-

-  //

-  // Allocate for scratch space, an intermediate buffer for FVB extention

-  //

-  mFvbModuleGlobal->FvbScratchSpace[FVB_PHYSICAL] = AllocateRuntimePool (MaxLbaSize);

-  ASSERT (mFvbModuleGlobal->FvbScratchSpace[FVB_PHYSICAL] != NULL);

-

-  mFvbModuleGlobal->FvbScratchSpace[FVB_VIRTUAL] = mFvbModuleGlobal->FvbScratchSpace[FVB_PHYSICAL];

-

-  return EFI_SUCCESS;

-}

diff --git a/EdkNt32Pkg/RuntimeDxe/FvbServices/FvbInfo.c b/EdkNt32Pkg/RuntimeDxe/FvbServices/FvbInfo.c
deleted file mode 100644
index d079423..0000000
--- a/EdkNt32Pkg/RuntimeDxe/FvbServices/FvbInfo.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  FvbInfo.c

-

-Abstract:

-

-  Defines data structure that is the volume header found.These data is intent

-  to decouple FVB driver with FV header.

-

---*/

-

-#include "FlashLayout.h"

-

-#define FIRMWARE_BLOCK_SIZE 0x10000

-

-typedef struct {

-  UINT64                      FvLength;

-  EFI_FIRMWARE_VOLUME_HEADER  FvbInfo;

-  //

-  // EFI_FV_BLOCK_MAP_ENTRY    ExtraBlockMap[n];//n=0

-  //

-  EFI_FV_BLOCK_MAP_ENTRY      End[1];

-} EFI_FVB_MEDIA_INFO;

-

-#define FVB_MEDIA_BLOCK_SIZE    FIRMWARE_BLOCK_SIZE

-#define RECOVERY_BOIS_BLOCK_NUM FIRMWARE_BLOCK_NUMBER

-#define SYSTEM_NV_BLOCK_NUM     2

-

-EFI_FVB_MEDIA_INFO  mPlatformFvbMediaInfo[] = {

-  //

-  // Recovery BOIS FVB

-  //

-  {

-    EFI_WINNT_FIRMWARE_LENGTH,

-    {

-      {

-        0,

-      },  // ZeroVector[16]

-      EFI_FIRMWARE_FILE_SYSTEM_GUID,

-      FVB_MEDIA_BLOCK_SIZE * RECOVERY_BOIS_BLOCK_NUM,

-      EFI_FVH_SIGNATURE,

-      EFI_FVB_READ_ENABLED_CAP |

-        EFI_FVB_READ_STATUS |

-        EFI_FVB_WRITE_ENABLED_CAP |

-        EFI_FVB_WRITE_STATUS |

-        EFI_FVB_ERASE_POLARITY,

-      sizeof (EFI_FIRMWARE_VOLUME_HEADER) + sizeof (EFI_FV_BLOCK_MAP_ENTRY),

-      0,  // CheckSum

-      {

-        0,

-      },  // Reserved[3]

-      1,  // Revision

-      {

-        RECOVERY_BOIS_BLOCK_NUM,

-        FVB_MEDIA_BLOCK_SIZE,

-      }

-    },

-    {

-      0,

-      0

-    }

-  },

-  //

-  // Systen NvStorage FVB

-  //

-  {

-    EFI_WINNT_RUNTIME_UPDATABLE_LENGTH + EFI_WINNT_FTW_SPARE_BLOCK_LENGTH,

-    {

-      {

-        0,

-      },  // ZeroVector[16]

-      EFI_SYSTEM_NV_DATA_HOB_GUID,

-      FVB_MEDIA_BLOCK_SIZE * SYSTEM_NV_BLOCK_NUM,

-      EFI_FVH_SIGNATURE,

-      EFI_FVB_READ_ENABLED_CAP |

-        EFI_FVB_READ_STATUS |

-        EFI_FVB_WRITE_ENABLED_CAP |

-        EFI_FVB_WRITE_STATUS |

-        EFI_FVB_ERASE_POLARITY,

-      sizeof (EFI_FIRMWARE_VOLUME_HEADER) + sizeof (EFI_FV_BLOCK_MAP_ENTRY),

-      0,  // CheckSum

-      {

-        0,

-      },  // Reserved[3]

-      1,  // Revision

-      {

-        SYSTEM_NV_BLOCK_NUM,

-        FVB_MEDIA_BLOCK_SIZE,

-      }

-    },

-    {

-      0,

-      0

-    }

-  }

-};

-

-EFI_STATUS

-GetFvbInfo (

-  IN  UINT64                        FvLength,

-  OUT EFI_FIRMWARE_VOLUME_HEADER    **FvbInfo

-  )

-{

-  UINTN Index;

-

-  for (Index = 0; Index < sizeof (mPlatformFvbMediaInfo) / sizeof (EFI_FVB_MEDIA_INFO); Index += 1) {

-    if (mPlatformFvbMediaInfo[Index].FvLength == FvLength) {

-      *FvbInfo = &mPlatformFvbMediaInfo[Index].FvbInfo;

-      return EFI_SUCCESS;

-    }

-  }

-

-  return EFI_NOT_FOUND;

-}

diff --git a/EdkNt32Pkg/RuntimeDxe/FvbServices/FwBlockService.h b/EdkNt32Pkg/RuntimeDxe/FvbServices/FwBlockService.h
deleted file mode 100644
index 6f949d3..0000000
--- a/EdkNt32Pkg/RuntimeDxe/FvbServices/FwBlockService.h
+++ /dev/null
@@ -1,238 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  FwBlockService.h

-  

-Abstract:

-

-  Firmware volume block driver for Intel Firmware Hub (FWH) device

-

---*/

-

-#ifndef _FW_BLOCK_SERVICE_H

-#define _FW_BLOCK_SERVICE_H

-

-//

-// BugBug: Add documentation here for data structure!!!!

-//

-#define FVB_PHYSICAL  0

-#define FVB_VIRTUAL   1

-

-typedef struct {

-  EFI_LOCK                    FvbDevLock;

-  UINTN                       FvBase[2];

-  UINTN                       NumOfBlocks;

-  EFI_FIRMWARE_VOLUME_HEADER  VolumeHeader;

-} EFI_FW_VOL_INSTANCE;

-

-typedef struct {

-  UINT32              NumFv;

-  EFI_FW_VOL_INSTANCE *FvInstance[2];

-  UINT8               *FvbScratchSpace[2];

-} ESAL_FWB_GLOBAL;

-

-//

-// Fvb Protocol instance data

-//

-#define FVB_DEVICE_FROM_THIS(a)         CR (a, EFI_FW_VOL_BLOCK_DEVICE, FwVolBlockInstance, FVB_DEVICE_SIGNATURE)

-#define FVB_EXTEND_DEVICE_FROM_THIS(a)  CR (a, EFI_FW_VOL_BLOCK_DEVICE, FvbExtension, FVB_DEVICE_SIGNATURE)

-#define FVB_DEVICE_SIGNATURE            EFI_SIGNATURE_32 ('F', 'V', 'B', 'N')

-

-typedef struct {

-  MEMMAP_DEVICE_PATH        MemMapDevPath;

-  EFI_DEVICE_PATH_PROTOCOL  EndDevPath;

-} FV_DEVICE_PATH;

-

-typedef struct {

-  UINTN                               Signature;

-  FV_DEVICE_PATH                      DevicePath;

-  UINTN                               Instance;

-  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  FwVolBlockInstance;

-  EFI_FVB_EXTENSION_PROTOCOL          FvbExtension;

-} EFI_FW_VOL_BLOCK_DEVICE;

-

-EFI_STATUS

-GetFvbInfo (

-  IN  UINT64                            FvLength,

-  OUT EFI_FIRMWARE_VOLUME_HEADER        **FvbInfo

-  )

-;

-

-EFI_STATUS

-FvbReadBlock (

-  IN UINTN                                Instance,

-  IN EFI_LBA                              Lba,

-  IN UINTN                                BlockOffset,

-  IN OUT UINTN                            *NumBytes,

-  IN UINT8                                *Buffer,

-  IN ESAL_FWB_GLOBAL                      *Global,

-  IN BOOLEAN                              Virtual

-  )

-;

-

-EFI_STATUS

-FvbWriteBlock (

-  IN UINTN                                Instance,

-  IN EFI_LBA                              Lba,

-  IN UINTN                                BlockOffset,

-  IN OUT UINTN                            *NumBytes,

-  IN UINT8                                *Buffer,

-  IN ESAL_FWB_GLOBAL                      *Global,

-  IN BOOLEAN                              Virtual

-  )

-;

-

-EFI_STATUS

-FvbEraseBlock (

-  IN UINTN                                Instance,

-  IN EFI_LBA                              Lba,

-  IN ESAL_FWB_GLOBAL                      *Global,

-  IN BOOLEAN                              Virtual

-  )

-;

-

-EFI_STATUS

-FvbSetVolumeAttributes (

-  IN UINTN                                Instance,

-  IN OUT EFI_FVB_ATTRIBUTES               *Attributes,

-  IN ESAL_FWB_GLOBAL                      *Global,

-  IN BOOLEAN                              Virtual

-  )

-;

-

-EFI_STATUS

-FvbGetVolumeAttributes (

-  IN UINTN                                Instance,

-  OUT EFI_FVB_ATTRIBUTES                  *Attributes,

-  IN ESAL_FWB_GLOBAL                      *Global,

-  IN BOOLEAN                              Virtual

-  )

-;

-

-EFI_STATUS

-FvbGetPhysicalAddress (

-  IN UINTN                                Instance,

-  OUT EFI_PHYSICAL_ADDRESS                *Address,

-  IN ESAL_FWB_GLOBAL                      *Global,

-  IN BOOLEAN                              Virtual

-  )

-;

-

-EFI_STATUS

-EFIAPI

-FvbInitialize (

-  IN EFI_HANDLE         ImageHandle,

-  IN EFI_SYSTEM_TABLE   *SystemTable

-  )

-;

-

-

-VOID

-EFIAPI

-FvbClassAddressChangeEvent (

-  IN EFI_EVENT        Event,

-  IN VOID             *Context

-  )

-;

-

-EFI_STATUS

-FvbGetLbaAddress (

-  IN  UINTN                               Instance,

-  IN  EFI_LBA                             Lba,

-  OUT UINTN                               *LbaAddress,

-  OUT UINTN                               *LbaLength,

-  OUT UINTN                               *NumOfBlocks,

-  IN  ESAL_FWB_GLOBAL                     *Global,

-  IN  BOOLEAN                             Virtual

-  )

-;

-

-//

-// Protocol APIs

-//

-EFI_STATUS

-EFIAPI

-FvbProtocolGetAttributes (

-  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,

-  OUT EFI_FVB_ATTRIBUTES                          *Attributes

-  )

-;

-

-EFI_STATUS

-EFIAPI

-FvbProtocolSetAttributes (

-  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,

-  IN OUT EFI_FVB_ATTRIBUTES                       *Attributes

-  )

-;

-

-EFI_STATUS

-EFIAPI

-FvbProtocolGetPhysicalAddress (

-  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,

-  OUT EFI_PHYSICAL_ADDRESS                        *Address

-  )

-;

-

-EFI_STATUS

-EFIAPI

-FvbProtocolGetBlockSize (

-  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,

-  IN  EFI_LBA                                     Lba,

-  OUT UINTN                                       *BlockSize,

-  OUT UINTN                                       *NumOfBlocks

-  )

-;

-

-EFI_STATUS

-EFIAPI

-FvbProtocolRead (

-  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,

-  IN EFI_LBA                                      Lba,

-  IN UINTN                                        Offset,

-  IN OUT UINTN                                    *NumBytes,

-  IN UINT8                                        *Buffer

-  )

-;

-

-EFI_STATUS

-EFIAPI

-FvbProtocolWrite (

-  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL           *This,

-  IN EFI_LBA                                      Lba,

-  IN UINTN                                        Offset,

-  IN OUT UINTN                                    *NumBytes,

-  IN UINT8                                        *Buffer

-  )

-;

-

-EFI_STATUS

-EFIAPI

-FvbProtocolEraseBlocks (

-  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL    *This,

-  ...

-  )

-;

-

-EFI_STATUS

-EFIAPI

-FvbExtendProtocolEraseCustomBlockRange (

-  IN EFI_FVB_EXTENSION_PROTOCOL           *This,

-  IN EFI_LBA                              StartLba,

-  IN UINTN                                OffsetStartLba,

-  IN EFI_LBA                              LastLba,

-  IN UINTN                                OffsetLastLba

-  )

-;

-

-#endif

diff --git a/EdkNt32Pkg/RuntimeDxe/FvbServices/Nt32Fwh.dxs b/EdkNt32Pkg/RuntimeDxe/FvbServices/Nt32Fwh.dxs
deleted file mode 100644
index b1ef272..0000000
--- a/EdkNt32Pkg/RuntimeDxe/FvbServices/Nt32Fwh.dxs
+++ /dev/null
@@ -1,26 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-  

-    Nt32Fwh.dxs

-

-Abstract:

-

-  Dependency expression source file.

-  

---*/  

-#include <DxeDepex.h>

-

-

-DEPENDENCY_START

-  TRUE

-DEPENDENCY_END
\ No newline at end of file
diff --git a/EdkNt32Pkg/RuntimeDxe/FvbServices/Nt32Fwh.msa b/EdkNt32Pkg/RuntimeDxe/FvbServices/Nt32Fwh.msa
deleted file mode 100644
index 0586c28..0000000
--- a/EdkNt32Pkg/RuntimeDxe/FvbServices/Nt32Fwh.msa
+++ /dev/null
@@ -1,102 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">

-  <MsaHeader>

-    <ModuleName>FwBlockService</ModuleName>

-    <ModuleType>DXE_RUNTIME_DRIVER</ModuleType>

-    <GuidValue>BDFE5FAA-2A35-44bb-B17A-8084D4E2B9E9</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>Component description file for Nt32 Fimware Volume Block DXE driver module.</Abstract>

-    <Description>This DXE runtime driver implements and produces the Fimware Volue Block Protocol on

-    NT32 emulator.

-    </Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>FwBlockService</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiDriverEntryPoint</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DxeServicesTableLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiRuntimeLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>HobLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseMemoryLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>MemoryAllocationLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>UefiBootServicesTableLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename>Nt32Fwh.dxs</Filename>

-    <Filename>FWBlockService.c</Filename>

-    <Filename>FwBlockService.h</Filename>

-    <Filename>FvbInfo.c</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <Protocols>

-    <Protocol Usage="SOMETIMES_PRODUCED">

-      <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="ALWAYS_PRODUCED">

-      <ProtocolCName>gEfiFirmwareVolumeBlockProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="ALWAYS_PRODUCED">

-      <ProtocolCName>gEfiFvbExtensionProtocolGuid</ProtocolCName>

-    </Protocol>

-    <Protocol Usage="ALWAYS_PRODUCED">

-      <ProtocolCName>gEfiAlternateFvBlockGuid</ProtocolCName>

-    </Protocol>

-  </Protocols>

-  <Events>

-    <CreateEvents>

-      <EventTypes EventGuidCName="gEfiEventVirtualAddressChangeGuid" Usage="ALWAYS_CONSUMED">

-        <EventType>EVENT_GROUP_GUID</EventType>

-      </EventTypes>

-    </CreateEvents>

-  </Events>

-  <Guids>

-    <GuidCNames Usage="ALWAYS_PRODUCED">

-      <GuidCName>gEfiAlternateFvBlockGuid</GuidCName>

-    </GuidCNames>

-  </Guids>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-    <Extern>

-      <ModuleEntryPoint>FvbInitialize</ModuleEntryPoint>

-    </Extern>

-  </Externs>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Sec/FwVol.c b/EdkNt32Pkg/Sec/FwVol.c
deleted file mode 100644
index 25ebe07..0000000
--- a/EdkNt32Pkg/Sec/FwVol.c
+++ /dev/null
@@ -1,314 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-  FwVol.c

-

-Abstract:

-  A simple FV stack so the SEC can extract the SEC Core from an

-  FV.

-

---*/

-

-#include "SecMain.h"

-

-#define GET_OCCUPIED_SIZE(ActualSize, Alignment) \

-  (ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1))

-

-EFI_FFS_FILE_STATE

-GetFileState (

-  IN UINT8                ErasePolarity,

-  IN EFI_FFS_FILE_HEADER  *FfsHeader

-  )

-/*++

-

-Routine Description:

-  Returns the highest bit set of the State field

-

-Arguments:

-  ErasePolarity   - Erase Polarity  as defined by EFI_FVB_ERASE_POLARITY

-                    in the Attributes field.

-  FfsHeader       - Pointer to FFS File Header.

-

-Returns:

-  Returns the highest bit in the State field

-

---*/

-{

-  EFI_FFS_FILE_STATE  FileState;

-  EFI_FFS_FILE_STATE  HighestBit;

-

-  FileState = FfsHeader->State;

-

-  if (ErasePolarity != 0) {

-    FileState = (EFI_FFS_FILE_STATE)~FileState;

-  }

-

-  HighestBit = 0x80;

-  while (HighestBit != 0 && (HighestBit & FileState) == 0) {

-    HighestBit >>= 1;

-  }

-

-  return HighestBit;

-}

-

-UINT8

-CalculateHeaderChecksum (

-  IN EFI_FFS_FILE_HEADER  *FileHeader

-  )

-/*++

-

-Routine Description:

-  Calculates the checksum of the header of a file.

-

-Arguments:

-  FileHeader       - Pointer to FFS File Header.

-

-Returns:

-  Checksum of the header.

-  

---*/

-{

-  UINT8 *ptr;

-  UINTN Index;

-  UINT8 Sum;

-

-  Sum = 0;

-  ptr = (UINT8 *) FileHeader;

-

-  for (Index = 0; Index < sizeof (EFI_FFS_FILE_HEADER) - 3; Index += 4) {

-    Sum = (UINT8) (Sum + ptr[Index]);

-    Sum = (UINT8) (Sum + ptr[Index + 1]);

-    Sum = (UINT8) (Sum + ptr[Index + 2]);

-    Sum = (UINT8) (Sum + ptr[Index + 3]);

-  }

-

-  for (; Index < sizeof (EFI_FFS_FILE_HEADER); Index++) {

-    Sum = (UINT8) (Sum + ptr[Index]);

-  }

-  //

-  // State field (since this indicates the different state of file).

-  //

-  Sum = (UINT8) (Sum - FileHeader->State);

-  //

-  // Checksum field of the file is not part of the header checksum.

-  //

-  Sum = (UINT8) (Sum - FileHeader->IntegrityCheck.Checksum.File);

-

-  return Sum;

-}

-

-EFI_STATUS

-SecFfsFindNextFile (

-  IN EFI_FV_FILETYPE             SearchType,

-  IN EFI_FIRMWARE_VOLUME_HEADER  *FwVolHeader,

-  IN OUT EFI_FFS_FILE_HEADER     **FileHeader

-  )

-/*++

-

-Routine Description:

-    Given the input file pointer, search for the next matching file in the

-    FFS volume as defined by SearchType. The search starts from FileHeader inside

-    the Firmware Volume defined by FwVolHeader.

-

-Arguments:

-    SearchType - Filter to find only files of this type.

-                 Type EFI_FV_FILETYPE_ALL causes no filtering to be done.

-    FwVolHeader - Pointer to the FV header of the volume to search.

-                  This parameter must point to a valid FFS volume.

-    FileHeader  - Pointer to the current file from which to begin searching.

-                  This pointer will be updated upon return to reflect the file

-                  found.

-

-Returns:

-    EFI_NOT_FOUND - No files matching the search criteria were found

-    EFI_SUCCESS

-

---*/

-{

-  EFI_FFS_FILE_HEADER *FfsFileHeader;

-  UINT32              FileLength;

-  UINT32              FileOccupiedSize;

-  UINT32              FileOffset;

-  UINT64              FvLength;

-  UINT8               ErasePolarity;

-  UINT8               FileState;

-

-  FvLength = FwVolHeader->FvLength;

-  if (FwVolHeader->Attributes & EFI_FVB_ERASE_POLARITY) {

-    ErasePolarity = 1;

-  } else {

-    ErasePolarity = 0;

-  }

-  //

-  // If FileHeader is not specified (NULL) start with the first file in the

-  // firmware volume.  Otherwise, start from the FileHeader.

-  //

-  if (*FileHeader == NULL) {

-    FfsFileHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) FwVolHeader + FwVolHeader->HeaderLength);

-  } else {

-    //

-    // Length is 24 bits wide so mask upper 8 bits

-    // FileLength is adjusted to FileOccupiedSize as it is 8 byte aligned.

-    //

-    FileLength        = *(UINT32 *) (*FileHeader)->Size & 0x00FFFFFF;

-    FileOccupiedSize  = GET_OCCUPIED_SIZE (FileLength, 8);

-    FfsFileHeader     = (EFI_FFS_FILE_HEADER *) ((UINT8 *) *FileHeader + FileOccupiedSize);

-  }

-

-  FileOffset = (UINT32) ((UINT8 *) FfsFileHeader - (UINT8 *) FwVolHeader);

-

-  while (FileOffset < (FvLength - sizeof (EFI_FFS_FILE_HEADER))) {

-    //

-    // Get FileState which is the highest bit of the State

-    //

-    FileState = GetFileState (ErasePolarity, FfsFileHeader);

-

-    switch (FileState) {

-

-    case EFI_FILE_HEADER_INVALID:

-      FileOffset += sizeof (EFI_FFS_FILE_HEADER);

-      FfsFileHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) FfsFileHeader + sizeof (EFI_FFS_FILE_HEADER));

-      break;

-

-    case EFI_FILE_DATA_VALID:

-    case EFI_FILE_MARKED_FOR_UPDATE:

-      if (CalculateHeaderChecksum (FfsFileHeader) == 0) {

-        FileLength        = *(UINT32 *) (FfsFileHeader->Size) & 0x00FFFFFF;

-        FileOccupiedSize  = GET_OCCUPIED_SIZE (FileLength, 8);

-

-        if ((SearchType == FfsFileHeader->Type) || (SearchType == EFI_FV_FILETYPE_ALL)) {

-

-          *FileHeader = FfsFileHeader;

-

-          return EFI_SUCCESS;

-        }

-

-        FileOffset += FileOccupiedSize;

-        FfsFileHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) FfsFileHeader + FileOccupiedSize);

-      } else {

-        return EFI_NOT_FOUND;

-      }

-      break;

-

-    case EFI_FILE_DELETED:

-      FileLength        = *(UINT32 *) (FfsFileHeader->Size) & 0x00FFFFFF;

-      FileOccupiedSize  = GET_OCCUPIED_SIZE (FileLength, 8);

-      FileOffset += FileOccupiedSize;

-      FfsFileHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) FfsFileHeader + FileOccupiedSize);

-      break;

-

-    default:

-      return EFI_NOT_FOUND;

-

-    }

-  }

-

-  return EFI_NOT_FOUND;

-}

-

-EFI_STATUS

-SecFfsFindSectionData (

-  IN EFI_SECTION_TYPE      SectionType,

-  IN EFI_FFS_FILE_HEADER   *FfsFileHeader,

-  IN OUT VOID              **SectionData

-  )

-/*++

-

-Routine Description:

-    Given the input file pointer, search for the next matching section in the

-    FFS volume.

-

-Arguments:

-    SearchType    - Filter to find only sections of this type.

-    FfsFileHeader - Pointer to the current file to search.

-    SectionData   - Pointer to the Section matching SectionType in FfsFileHeader.

-                     NULL if section not found

-

-Returns:

-    EFI_NOT_FOUND - No files matching the search criteria were found

-    EFI_SUCCESS

-

---*/

-{

-  UINT32                    FileSize;

-  EFI_COMMON_SECTION_HEADER *Section;

-  UINT32                    SectionLength;

-  UINT32                    ParsedLength;

-

-  //

-  // Size is 24 bits wide so mask upper 8 bits.

-  //    Does not include FfsFileHeader header size

-  // FileSize is adjusted to FileOccupiedSize as it is 8 byte aligned.

-  //

-  Section   = (EFI_COMMON_SECTION_HEADER *) (FfsFileHeader + 1);

-  FileSize  = *(UINT32 *) (FfsFileHeader->Size) & 0x00FFFFFF;

-  FileSize -= sizeof (EFI_FFS_FILE_HEADER);

-

-  *SectionData  = NULL;

-  ParsedLength  = 0;

-  while (ParsedLength < FileSize) {

-    if (Section->Type == SectionType) {

-      *SectionData = (VOID *) (Section + 1);

-      return EFI_SUCCESS;

-    }

-    //

-    // Size is 24 bits wide so mask upper 8 bits.

-    // SectionLength is adjusted it is 4 byte aligned.

-    // Go to the next section

-    //

-    SectionLength = *(UINT32 *) Section->Size & 0x00FFFFFF;

-    SectionLength = GET_OCCUPIED_SIZE (SectionLength, 4);

-

-    ParsedLength += SectionLength;

-    Section = (EFI_COMMON_SECTION_HEADER *) ((UINT8 *) Section + SectionLength);

-  }

-

-  return EFI_NOT_FOUND;

-}

-

-EFI_STATUS

-SecFfsFindPeiCore (

-  IN  EFI_FIRMWARE_VOLUME_HEADER  *FwVolHeader,

-  OUT VOID                        **Pe32Data

-  )

-/*++

-

-Routine Description:

-  Given the pointer to the Firmware Volume Header find the SEC

-  core and return it's PE32 image.

-

-Arguments:

-  FwVolHeader - Pointer to memory mapped FV

-  Pe32Data - Pointer to SEC PE32 iamge.

- 

-Returns:  

-  EFI_SUCCESS - Pe32Data is valid

-  other       - Failure

-

---*/

-{

-  EFI_STATUS          Status;

-  EFI_FFS_FILE_HEADER *FileHeader;

-  EFI_FV_FILETYPE     SearchType;

-

-  SearchType  = EFI_FV_FILETYPE_PEI_CORE;

-  FileHeader  = NULL;

-  do {

-    Status = SecFfsFindNextFile (SearchType, FwVolHeader, &FileHeader);

-    if (!EFI_ERROR (Status)) {

-      Status = SecFfsFindSectionData (EFI_SECTION_PE32, FileHeader, Pe32Data);

-      return Status;

-    }

-  } while (!EFI_ERROR (Status));

-

-  return Status;

-}

diff --git a/EdkNt32Pkg/Sec/SecMain.c b/EdkNt32Pkg/Sec/SecMain.c
deleted file mode 100644
index 4f668b1..0000000
--- a/EdkNt32Pkg/Sec/SecMain.c
+++ /dev/null
@@ -1,1236 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

-

-Module Name:

-

-  SecMain.c

-

-Abstract:

-  WinNt emulator of SEC phase. It's really a Win32 application, but this is

-  Ok since all the other modules for NT32 are NOT Win32 applications.

-

-  This program processes Windows environment variables and figures out

-  what the memory layout will be, how may FD's will be loaded and also

-  what the boot mode is.

-

-  The SEC registers a set of services with the SEC core. gPrivateDispatchTable

-  is a list of PPI's produced by the SEC that are availble for usage in PEI.

-

-  This code produces 128 K of temporary memory for the PEI stack by opening a

-  Windows file and mapping it directly to memory addresses.

-

-  The system.cmd script is used to set windows environment variables that drive

-  the configuration opitons of the SEC.

-

---*/

-

-#include "SecMain.h"

-#pragma warning(disable : 4996)

-

-//

-// Globals

-//

-EFI_PEI_PE_COFF_LOADER_PROTOCOL_INSTANCE  mPeiEfiPeiPeCoffLoaderInstance = {

-  {

-    SecNt32PeCoffGetImageInfo,

-    SecNt32PeCoffLoadImage,

-    SecNt32PeCoffRelocateImage,

-    SecNt32PeCoffUnloadimage

-  },

-  NULL

-};

-

-

-

-EFI_PEI_PE_COFF_LOADER_PROTOCOL           *gPeiEfiPeiPeCoffLoader = &mPeiEfiPeiPeCoffLoaderInstance.PeCoff;

-

-NT_PEI_LOAD_FILE_PPI                      mSecNtLoadFilePpi     = { SecWinNtPeiLoadFile };

-

-PEI_NT_AUTOSCAN_PPI                       mSecNtAutoScanPpi     = { SecWinNtPeiAutoScan };

-

-PEI_NT_THUNK_PPI                          mSecWinNtThunkPpi     = { SecWinNtWinNtThunkAddress };

-

-EFI_PEI_PROGRESS_CODE_PPI                 mSecStatusCodePpi     = { SecPeiReportStatusCode };

-

-NT_FWH_PPI                                mSecFwhInformationPpi = { SecWinNtFdAddress };

-

-

-EFI_PEI_PPI_DESCRIPTOR  gPrivateDispatchTable[] = {

-  {

-    EFI_PEI_PPI_DESCRIPTOR_PPI,

-    &gEfiPeiPeCoffLoaderGuid,

-    NULL

-  },

-  {

-    EFI_PEI_PPI_DESCRIPTOR_PPI,

-    &gNtPeiLoadFilePpiGuid,

-    &mSecNtLoadFilePpi

-  },

-  {

-    EFI_PEI_PPI_DESCRIPTOR_PPI,

-    &gPeiNtAutoScanPpiGuid,

-    &mSecNtAutoScanPpi

-  },

-  {

-    EFI_PEI_PPI_DESCRIPTOR_PPI,

-    &gPeiNtThunkPpiGuid,

-    &mSecWinNtThunkPpi

-  },

-  {

-    EFI_PEI_PPI_DESCRIPTOR_PPI,

-    &gEfiPeiStatusCodePpiGuid,

-    &mSecStatusCodePpi

-  },

-  {

-    EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,

-    &gNtFwhPpiGuid,

-    &mSecFwhInformationPpi

-  }

-};

-

-

-//

-// Default information about where the FD is located.

-//  This array gets filled in with information from EFI_FIRMWARE_VOLUMES

-//  EFI_FIRMWARE_VOLUMES is a Windows environment variable set by system.cmd.

-//  The number of array elements is allocated base on parsing

-//  EFI_FIRMWARE_VOLUMES and the memory is never freed.

-//

-UINTN                                     gFdInfoCount = 0;

-NT_FD_INFO                                *gFdInfo;

-

-//

-// Array that supports seperate memory rantes.

-//  The memory ranges are set in system.cmd via the EFI_MEMORY_SIZE variable.

-//  The number of array elements is allocated base on parsing

-//  EFI_MEMORY_SIZE and the memory is never freed.

-//

-UINTN                                     gSystemMemoryCount = 0;

-NT_SYSTEM_MEMORY                          *gSystemMemory;

-

-

-UINTN                   mPdbNameModHandleArraySize = 0;

-PDB_NAME_TO_MOD_HANDLE  *mPdbNameModHandleArray = NULL;

-

-

-

-

-INTN

-EFIAPI

-main (

-  IN  INTN  Argc,

-  IN  CHAR8 **Argv,

-  IN  CHAR8 **Envp

-  )

-/*++

-

-Routine Description:

-  Main entry point to SEC for WinNt. This is a Windows program

-

-Arguments:

-  Argc - Number of command line arguments

-  Argv - Array of command line argument strings

-  Envp - Array of environmemt variable strings

-

-Returns:

-  0 - Normal exit

-  1 - Abnormal exit

-

---*/

-{

-  EFI_STATUS            Status;

-  EFI_PHYSICAL_ADDRESS  InitialStackMemory;

-  UINT64                InitialStackMemorySize;

-  UINTN                 Index;

-  UINTN                 Index1;

-  UINTN                 Index2;

-  UINTN                 PeiIndex;

-  CHAR16                *FileName;

-  CHAR16                *FileNamePtr;

-  BOOLEAN               Done;

-  VOID                  *PeiCoreFile;

-  CHAR16                *MemorySizeStr;

-  CHAR16                *FirmwareVolumesStr;

-

-  MemorySizeStr      = (CHAR16 *)PcdGetPtr (PcdWinNtMemorySizeForSecMain);

-  FirmwareVolumesStr = (CHAR16 *)PcdGetPtr (PcdWinNtFirmwareVolume);

-

-  printf ("\nEDK SEC Main NT Emulation Environment from www.TianoCore.org\n");

-

-  //

-  // Make some Windows calls to Set the process to the highest priority in the

-  //  idle class. We need this to have good performance.

-  //

-  SetPriorityClass (GetCurrentProcess (), IDLE_PRIORITY_CLASS);

-  SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_HIGHEST);

-

-  //

-  // Allocate space for gSystemMemory Array

-  //

-  gSystemMemoryCount  = CountSeperatorsInString (MemorySizeStr, '!') + 1;

-  gSystemMemory       = calloc (gSystemMemoryCount, sizeof (NT_SYSTEM_MEMORY));

-  if (gSystemMemory == NULL) {

-    printf ("ERROR : Can not allocate memory for %s.  Exiting.\n", MemorySizeStr);

-    exit (1);

-  }

-  //

-  // Allocate space for gSystemMemory Array

-  //

-  gFdInfoCount  = CountSeperatorsInString (FirmwareVolumesStr, '!') + 1;

-  gFdInfo       = calloc (gFdInfoCount, sizeof (NT_FD_INFO));

-  if (gFdInfo == NULL) {

-    printf ("ERROR : Can not allocate memory for %s.  Exiting.\n", FirmwareVolumesStr);

-    exit (1);

-  }

-  //

-  // Setup Boot Mode. If BootModeStr == "" then BootMode = 0 (BOOT_WITH_FULL_CONFIGURATION)

-  //

-  printf ("  BootMode 0x%02x\n", FixedPcdGet32 (PcdWinNtBootMode));

-

-  //

-  // Open up a 128K file to emulate temp memory for PEI.

-  //  on a real platform this would be SRAM, or using the cache as RAM.

-  //  Set InitialStackMemory to zero so WinNtOpenFile will allocate a new mapping

-  //

-  InitialStackMemory      = 0;

-  InitialStackMemorySize  = 0x20000;

-  Status = WinNtOpenFile (

-            L"SecStack",

-            (UINT32) InitialStackMemorySize,

-            OPEN_ALWAYS,

-            &InitialStackMemory,

-            &InitialStackMemorySize

-            );

-  if (EFI_ERROR (Status)) {

-    printf ("ERROR : Can not open SecStack Exiting\n");

-    exit (1);

-  }

-

-  printf ("  SEC passing in %d bytes of temp RAM to PEI\n", InitialStackMemorySize);

-

-  //

-  // Open All the firmware volumes and remember the info in the gFdInfo global

-  //

-  FileNamePtr = (CHAR16 *)malloc (StrLen ((CHAR16 *)FirmwareVolumesStr) * sizeof(CHAR16));

-  if (FileNamePtr == NULL) {

-    printf ("ERROR : Can not allocate memory for firmware volume string\n");

-    exit (1);

-  }

-

-  StrCpy (FileNamePtr, (CHAR16*)FirmwareVolumesStr);

-

-  for (Done = FALSE, Index = 0, PeiIndex = 0, PeiCoreFile = NULL; !Done; Index++) {

-    FileName = FileNamePtr;

-    for (Index1 = 0; (FileNamePtr[Index1] != '!') && (FileNamePtr[Index1] != 0); Index1++)

-      ;

-    if (FileNamePtr[Index1] == 0) {

-      Done = TRUE;

-    } else {

-      FileNamePtr[Index1]  = '\0';

-      FileNamePtr = FileNamePtr + Index1 + 1;

-    }

-

-    //

-    // Open the FD and remmeber where it got mapped into our processes address space

-    //

-    Status = WinNtOpenFile (

-              FileName,

-              0,

-              OPEN_EXISTING,

-              &gFdInfo[Index].Address,

-              &gFdInfo[Index].Size

-              );

-    if (EFI_ERROR (Status)) {

-      printf ("ERROR : Can not open Firmware Device File %S (%r).  Exiting.\n", FileName, Status);

-      exit (1);

-    }

-

-    printf ("  FD loaded from");

-    //

-    // printf can't print filenames directly as the \ gets interperted as an

-    //  escape character.

-    //

-    for (Index2 = 0; FileName[Index2] != '\0'; Index2++) {

-      printf ("%c", FileName[Index2]);

-    }

-

-    if (PeiCoreFile == NULL) {

-      //

-      // Assume the beginning of the FD is an FV and look for the PEI Core.

-      // Load the first one we find.

-      //

-      Status = SecFfsFindPeiCore ((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) gFdInfo[Index].Address, &PeiCoreFile);

-      if (!EFI_ERROR (Status)) {

-        PeiIndex = Index;

-        printf (" contains SEC Core");

-      }

-    }

-

-    printf ("\n");

-  }

-  //

-  // Calculate memory regions and store the information in the gSystemMemory

-  //  global for later use. The autosizing code will use this data to

-  //  map this memory into the SEC process memory space.

-  //

-  for (Index = 0, Done = FALSE; !Done; Index++) {

-    //

-    // Save the size of the memory and make a Unicode filename SystemMemory00, ...

-    //

-    gSystemMemory[Index].Size = _wtoi (MemorySizeStr) * 0x100000;

-    _snwprintf (gSystemMemory[Index].FileName, NT_SYSTEM_MEMORY_FILENAME_SIZE, L"SystemMemory%02d", Index);

-

-    //

-    // Find the next region

-    //

-    for (Index1 = 0; MemorySizeStr[Index1] != '!' && MemorySizeStr[Index1] != 0; Index1++)

-      ;

-    if (MemorySizeStr[Index1] == 0) {

-      Done = TRUE;

-    }

-

-    MemorySizeStr = MemorySizeStr + Index1 + 1;

-  }

-

-  printf ("\n");

-

-  //

-  // Hand off to PEI Core

-  //

-  SecLoadFromCore ((UINTN) InitialStackMemory, (UINTN) InitialStackMemorySize, (UINTN) gFdInfo[0].Address, PeiCoreFile);

-

-  //

-  // If we get here, then the PEI Core returned. This is an error as PEI should

-  //  always hand off to DXE.

-  //

-  printf ("ERROR : PEI Core returned\n");

-  exit (1);

-}

-

-EFI_STATUS

-WinNtOpenFile (

-  IN  CHAR16                    *FileName,

-  IN  UINT32                    MapSize,

-  IN  DWORD                     CreationDisposition,

-  IN OUT  EFI_PHYSICAL_ADDRESS  *BaseAddress,

-  OUT UINT64                    *Length

-  )

-/*++

-

-Routine Description:

-  Opens and memory maps a file using WinNt services. If BaseAddress is non zero

-  the process will try and allocate the memory starting at BaseAddress.

-

-Arguments:

-  FileName            - The name of the file to open and map

-  MapSize             - The amount of the file to map in bytes

-  CreationDisposition - The flags to pass to CreateFile().  Use to create new files for

-                        memory emulation, and exiting files for firmware volume emulation

-  BaseAddress         - The base address of the mapped file in the user address space.

-                         If passed in as NULL the a new memory region is used.

-                         If passed in as non NULL the request memory region is used for

-                          the mapping of the file into the process space.

-  Length              - The size of the mapped region in bytes

-

-Returns:

-  EFI_SUCCESS      - The file was opened and mapped.

-  EFI_NOT_FOUND    - FileName was not found in the current directory

-  EFI_DEVICE_ERROR - An error occured attempting to map the opened file

-

---*/

-{

-  HANDLE  NtFileHandle;

-  HANDLE  NtMapHandle;

-  VOID    *VirtualAddress;

-  UINTN   FileSize;

-

-  //

-  // Use Win API to open/create a file

-  //

-  NtFileHandle = CreateFile (

-                  FileName,

-                  GENERIC_READ | GENERIC_WRITE,

-                  FILE_SHARE_READ,

-                  NULL,

-                  CreationDisposition,

-                  FILE_ATTRIBUTE_NORMAL,

-                  NULL

-                  );

-  if (NtFileHandle == INVALID_HANDLE_VALUE) {

-    return EFI_NOT_FOUND;

-  }

-  //

-  // Map the open file into a memory range

-  //

-  NtMapHandle = CreateFileMapping (

-                  NtFileHandle,

-                  NULL,

-                  PAGE_READWRITE,

-                  0,

-                  MapSize,

-                  NULL

-                  );

-  if (NtMapHandle == NULL) {

-    return EFI_DEVICE_ERROR;

-  }

-  //

-  // Get the virtual address (address in the emulator) of the mapped file

-  //

-  VirtualAddress = MapViewOfFileEx (

-                    NtMapHandle,

-                    FILE_MAP_ALL_ACCESS,

-                    0,

-                    0,

-                    MapSize,

-                    (LPVOID) (UINTN) *BaseAddress

-                    );

-  if (VirtualAddress == NULL) {

-    return EFI_DEVICE_ERROR;

-  }

-

-  if (MapSize == 0) {

-    //

-    // Seek to the end of the file to figure out the true file size.

-    //

-    FileSize = SetFilePointer (

-                NtFileHandle,

-                0,

-                NULL,

-                FILE_END

-                );

-    if (FileSize == -1) {

-      return EFI_DEVICE_ERROR;

-    }

-

-    *Length = (UINT64) FileSize;

-  } else {

-    *Length = (UINT64) MapSize;

-  }

-

-  *BaseAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) VirtualAddress;

-

-  return EFI_SUCCESS;

-}

-

-#define BYTES_PER_RECORD  512

-

-/**

-  Extracts ASSERT() information from a status code structure.

-

-  Converts the status code specified by CodeType, Value, and Data to the ASSERT()

-  arguments specified by Filename, Description, and LineNumber.  If CodeType is 

-  an EFI_ERROR_CODE, and CodeType has a severity of EFI_ERROR_UNRECOVERED, and 

-  Value has an operation mask of EFI_SW_EC_ILLEGAL_SOFTWARE_STATE, extract 

-  Filename, Description, and LineNumber from the optional data area of the 

-  status code buffer specified by Data.  The optional data area of Data contains 

-  a Null-terminated ASCII string for the FileName, followed by a Null-terminated 

-  ASCII string for the Description, followed by a 32-bit LineNumber.  If the 

-  ASSERT() information could be extracted from Data, then return TRUE.  

-  Otherwise, FALSE is returned.  

-

-  If Data is NULL, then ASSERT().

-  If Filename is NULL, then ASSERT().

-  If Description is NULL, then ASSERT().

-  If LineNumber is NULL, then ASSERT().

-

-  @param  CodeType     The type of status code being converted.

-  @param  Value        The status code value being converted.

-  @param  Data         Pointer to status code data buffer. 

-  @param  Filename     Pointer to the source file name that generated the ASSERT().

-  @param  Description  Pointer to the description of the ASSERT().

-  @param  LineNumber   Pointer to source line number that generated the ASSERT().

-

-  @retval  TRUE   The status code specified by CodeType, Value, and Data was 

-                  converted ASSERT() arguments specified by Filename, Description, 

-                  and LineNumber.

-  @retval  FALSE  The status code specified by CodeType, Value, and Data could 

-                  not be converted to ASSERT() arguments.

-

-**/

-STATIC

-BOOLEAN

-ReportStatusCodeExtractAssertInfo (

-  IN EFI_STATUS_CODE_TYPE        CodeType,

-  IN EFI_STATUS_CODE_VALUE       Value,  

-  IN CONST EFI_STATUS_CODE_DATA  *Data, 

-  OUT CHAR8                      **Filename,

-  OUT CHAR8                      **Description,

-  OUT UINT32                     *LineNumber

-  )

-{

-  EFI_DEBUG_ASSERT_DATA  *AssertData;

-

-  ASSERT (Data        != NULL);

-  ASSERT (Filename    != NULL);

-  ASSERT (Description != NULL);

-  ASSERT (LineNumber  != NULL);

-

-  if (((CodeType & EFI_STATUS_CODE_TYPE_MASK)      == EFI_ERROR_CODE) && 

-      ((CodeType & EFI_STATUS_CODE_SEVERITY_MASK)  == EFI_ERROR_UNRECOVERED) &&

-      ((Value    & EFI_STATUS_CODE_OPERATION_MASK) == EFI_SW_EC_ILLEGAL_SOFTWARE_STATE)) {

-    AssertData   = (EFI_DEBUG_ASSERT_DATA *)(Data + 1);

-    *Filename    = (CHAR8 *)(AssertData + 1);

-    *Description = *Filename + AsciiStrLen (*Filename) + 1;

-    *LineNumber  = AssertData->LineNumber;

-    return TRUE;

-  }

-  return FALSE;

-}

-

-EFI_STATUS

-EFIAPI

-SecPeiReportStatusCode (

-  IN EFI_PEI_SERVICES           **PeiServices,

-  IN EFI_STATUS_CODE_TYPE       CodeType,

-  IN EFI_STATUS_CODE_VALUE      Value,

-  IN UINT32                     Instance,

-  IN EFI_GUID                   * CallerId,

-  IN EFI_STATUS_CODE_DATA       * Data OPTIONAL

-  )

-/*++

-

-Routine Description:

-

-  This routine produces the ReportStatusCode PEI service. It's passed

-  up to the PEI Core via a PPI. T

-

-  This code currently uses the NT clib printf. This does not work the same way

-  as the EFI Print (), as %t, %g, %s as Unicode are not supported.

-

-Arguments:

-  (see EFI_PEI_REPORT_STATUS_CODE)

-

-Returns:

-  EFI_SUCCESS - Always return success

-

---*/

-// TODO:    PeiServices - add argument and description to function comment

-// TODO:    CodeType - add argument and description to function comment

-// TODO:    Value - add argument and description to function comment

-// TODO:    Instance - add argument and description to function comment

-// TODO:    CallerId - add argument and description to function comment

-// TODO:    Data - add argument and description to function comment

-{

-  CHAR8           *Format;

-  EFI_DEBUG_INFO  *DebugInfo;

-  VA_LIST         Marker;

-  CHAR8           PrintBuffer[BYTES_PER_RECORD * 2];

-  CHAR8           *Filename;

-  CHAR8           *Description;

-  UINT32          LineNumber;

-

-  if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) {

-    //

-    // This supports DEBUG () marcos

-    // Data format

-    //  EFI_STATUS_CODE_DATA

-    //  EFI_DEBUG_INFO

-    //

-    // The first 12 * UINT64 bytes of the string are really an

-    // arguement stack to support varargs on the Format string.

-    //

-    if (Data != NULL) {

-      DebugInfo = (EFI_DEBUG_INFO *) (Data + 1);

-      Marker    = (VA_LIST) (DebugInfo + 1);

-      Format    = (CHAR8 *) (((UINT64 *) Marker) + 12);

-

-      AsciiVSPrint (PrintBuffer, BYTES_PER_RECORD, Format, Marker);

-      printf (PrintBuffer);

-    } else {

-      printf ("DEBUG <null>\n");

-    }

-  }

-

-  if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) &&

-      ((CodeType & EFI_STATUS_CODE_SEVERITY_MASK) == EFI_ERROR_UNRECOVERED)

-      ) {

-    if (Data != NULL && ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber)) {

-      //

-      // Support ASSERT () macro

-      //

-      printf ("ASSERT %s(%d): %s\n", Filename, LineNumber, Description);

-    } else {

-      printf ("ASSERT <null>\n");

-    }

-    CpuBreakpoint ();

-  }

-

-  return EFI_SUCCESS;

-}

-

-

-VOID

-SecLoadFromCore (

-  IN  UINTN   LargestRegion,

-  IN  UINTN   LargestRegionSize,

-  IN  UINTN   BootFirmwareVolumeBase,

-  IN  VOID    *PeiCorePe32File

-  )

-/*++

-

-Routine Description:

-  This is the service to load the PEI Core from the Firmware Volume

-

-Arguments:

-  LargestRegion           - Memory to use for PEI.

-  LargestRegionSize       - Size of Memory to use for PEI

-  BootFirmwareVolumeBase  - Start of the Boot FV

-  PeiCorePe32File         - PEI Core PE32

-

-Returns:

-  Success means control is transfered and thus we should never return

-

---*/

-{

-  EFI_STATUS                  Status;

-  EFI_PHYSICAL_ADDRESS        TopOfMemory;

-  VOID                        *TopOfStack;

-  UINT64                      PeiCoreSize;

-  EFI_PHYSICAL_ADDRESS        PeiCoreEntryPoint;

-  EFI_PHYSICAL_ADDRESS        PeiImageAddress;

-  EFI_PEI_STARTUP_DESCRIPTOR  *PeiStartup;

-

-  //

-  // Compute Top Of Memory for Stack and PEI Core Allocations

-  //

-  TopOfMemory = LargestRegion + LargestRegionSize;

-

-  //

-  // Allocate 128KB for the Stack

-  //

-  TopOfStack  = (VOID *)((UINTN)TopOfMemory - sizeof (EFI_PEI_STARTUP_DESCRIPTOR) - CPU_STACK_ALIGNMENT);

-  TopOfStack  = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);

-  TopOfMemory = TopOfMemory - STACK_SIZE;

-

-  //

-  // Patch value in dispatch table values

-  //

-  gPrivateDispatchTable[0].Ppi = gPeiEfiPeiPeCoffLoader;

-

-  //

-  // Bind this information into the SEC hand-off state

-  //

-  PeiStartup = (EFI_PEI_STARTUP_DESCRIPTOR *) (UINTN) TopOfStack;

-  PeiStartup->DispatchTable      = (EFI_PEI_PPI_DESCRIPTOR *) &gPrivateDispatchTable;

-  PeiStartup->SizeOfCacheAsRam   = STACK_SIZE;

-  PeiStartup->BootFirmwareVolume = BootFirmwareVolumeBase;

-

-  //

-  // Load the PEI Core from a Firmware Volume

-  //

-  Status = SecWinNtPeiLoadFile (

-            PeiCorePe32File,

-            &PeiImageAddress,

-            &PeiCoreSize,

-            &PeiCoreEntryPoint

-            );

-  if (EFI_ERROR (Status)) {

-    return ;

-  }

-  //

-  // Transfer control to the PEI Core

-  //

-  SwitchStack (

-    (SWITCH_STACK_ENTRY_POINT) (UINTN) PeiCoreEntryPoint,

-    PeiStartup,

-    NULL,

-    TopOfStack

-    );

-  //

-  // If we get here, then the PEI Core returned.  This is an error

-  //

-  return ;

-}

-

-EFI_STATUS

-EFIAPI

-SecWinNtPeiAutoScan (

-  IN  UINTN                 Index,

-  OUT EFI_PHYSICAL_ADDRESS  *MemoryBase,

-  OUT UINT64                *MemorySize

-  )

-/*++

-

-Routine Description:

-  This service is called from Index == 0 until it returns EFI_UNSUPPORTED.

-  It allows discontiguous memory regions to be supported by the emulator.

-  It uses gSystemMemory[] and gSystemMemoryCount that were created by

-  parsing the Windows environment variable EFI_MEMORY_SIZE.

-  The size comes from the varaible and the address comes from the call to

-  WinNtOpenFile.

-

-Arguments:

-  Index      - Which memory region to use

-  MemoryBase - Return Base address of memory region

-  MemorySize - Return size in bytes of the memory region

-

-Returns:

-  EFI_SUCCESS - If memory region was mapped

-  EFI_UNSUPPORTED - If Index is not supported

-

---*/

-{

-  EFI_STATUS  Status;

-

-  if (Index >= gSystemMemoryCount) {

-    return EFI_UNSUPPORTED;

-  }

-

-  *MemoryBase = 0;

-  Status = WinNtOpenFile (

-            gSystemMemory[Index].FileName,

-            (UINT32) gSystemMemory[Index].Size,

-            OPEN_ALWAYS,

-            MemoryBase,

-            MemorySize

-            );

-

-  gSystemMemory[Index].Memory = *MemoryBase;

-

-  return Status;

-}

-

-VOID *

-EFIAPI

-SecWinNtWinNtThunkAddress (

-  VOID

-  )

-/*++

-

-Routine Description:

-  Since the SEC is the only Windows program in stack it must export

-  an interface to do Win API calls. That's what the WinNtThunk address

-  is for. gWinNt is initailized in WinNtThunk.c.

-

-Arguments:

-  InterfaceSize - sizeof (EFI_WIN_NT_THUNK_PROTOCOL);

-  InterfaceBase - Address of the gWinNt global

-

-Returns:

-  EFI_SUCCESS - Data returned

-

---*/

-{

-  return gWinNt;

-}

-

-

-EFI_STATUS

-EFIAPI

-SecWinNtPeiLoadFile (

-  IN  VOID                    *Pe32Data,

-  IN  EFI_PHYSICAL_ADDRESS    *ImageAddress,

-  IN  UINT64                  *ImageSize,

-  IN  EFI_PHYSICAL_ADDRESS    *EntryPoint

-  )

-/*++

-

-Routine Description:

-  Loads and relocates a PE/COFF image into memory.

-

-Arguments:

-  Pe32Data         - The base address of the PE/COFF file that is to be loaded and relocated

-  ImageAddress     - The base address of the relocated PE/COFF image

-  ImageSize        - The size of the relocated PE/COFF image

-  EntryPoint       - The entry point of the relocated PE/COFF image

-

-Returns:

-  EFI_SUCCESS   - The file was loaded and relocated

-  EFI_OUT_OF_RESOURCES - There was not enough memory to load and relocate the PE/COFF file

-

---*/

-{

-  EFI_STATUS                            Status;

-  PE_COFF_LOADER_IMAGE_CONTEXT          ImageContext;

-

-  ZeroMem (&ImageContext, sizeof (ImageContext));

-  ImageContext.Handle     = Pe32Data;

-

-  ImageContext.ImageRead  = (PE_COFF_LOADER_READ_FILE) SecImageRead;

-

-  Status                  = gPeiEfiPeiPeCoffLoader->GetImageInfo (gPeiEfiPeiPeCoffLoader, &ImageContext);

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-  //

-  // Allocate space in NT (not emulator) memory. Extra space is for alignment

-  //

-  ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) malloc ((UINTN) (ImageContext.ImageSize + (ImageContext.SectionAlignment * 2)));

-  if (ImageContext.ImageAddress == 0) {

-    return EFI_OUT_OF_RESOURCES;

-  }

-  //

-  // Align buffer on section boundry

-  //

-  ImageContext.ImageAddress += ImageContext.SectionAlignment;

-  ImageContext.ImageAddress &= ~(ImageContext.SectionAlignment - 1);

-

-  Status = gPeiEfiPeiPeCoffLoader->LoadImage (gPeiEfiPeiPeCoffLoader, &ImageContext);

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  Status = gPeiEfiPeiPeCoffLoader->RelocateImage (gPeiEfiPeiPeCoffLoader, &ImageContext);

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  //

-  // BugBug: Flush Instruction Cache Here when CPU Lib is ready

-  //

-

-  *ImageAddress = ImageContext.ImageAddress;

-  *ImageSize    = ImageContext.ImageSize;

-  *EntryPoint   = ImageContext.EntryPoint;

-

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-EFIAPI

-SecWinNtFdAddress (

-  IN     UINTN                 Index,

-  IN OUT EFI_PHYSICAL_ADDRESS  *FdBase,

-  IN OUT UINT64                *FdSize

-  )

-/*++

-

-Routine Description:

-  Return the FD Size and base address. Since the FD is loaded from a

-  file into Windows memory only the SEC will know it's address.

-

-Arguments:

-  Index  - Which FD, starts at zero.

-  FdSize - Size of the FD in bytes

-  FdBase - Start address of the FD. Assume it points to an FV Header

-

-Returns:

-  EFI_SUCCESS     - Return the Base address and size of the FV

-  EFI_UNSUPPORTED - Index does nto map to an FD in the system

-

---*/

-{

-  if (Index >= gFdInfoCount) {

-    return EFI_UNSUPPORTED;

-  }

-

-  *FdBase = gFdInfo[Index].Address;

-  *FdSize = gFdInfo[Index].Size;

-

-  if (*FdBase == 0 && *FdSize == 0) {

-    return EFI_UNSUPPORTED;

-  }

-

-  return EFI_SUCCESS;

-}

-

-EFI_STATUS

-EFIAPI

-SecImageRead (

-  IN     VOID    *FileHandle,

-  IN     UINTN   FileOffset,

-  IN OUT UINTN   *ReadSize,

-  OUT    VOID    *Buffer

-  )

-/*++

-

-Routine Description:

-  Support routine for the PE/COFF Loader that reads a buffer from a PE/COFF file

-

-Arguments:

-  FileHandle - The handle to the PE/COFF file

-  FileOffset - The offset, in bytes, into the file to read

-  ReadSize   - The number of bytes to read from the file starting at FileOffset

-  Buffer     - A pointer to the buffer to read the data into.

-

-Returns:

-  EFI_SUCCESS - ReadSize bytes of data were read into Buffer from the PE/COFF file starting at FileOffset

-

---*/

-{

-  CHAR8 *Destination8;

-  CHAR8 *Source8;

-  UINTN Length;

-

-  Destination8  = Buffer;

-  Source8       = (CHAR8 *) ((UINTN) FileHandle + FileOffset);

-  Length        = *ReadSize;

-  while (Length--) {

-    *(Destination8++) = *(Source8++);

-  }

-

-  return EFI_SUCCESS;

-}

-

-CHAR16 *

-AsciiToUnicode (

-  IN  CHAR8   *Ascii,

-  IN  UINTN   *StrLen OPTIONAL

-  )

-/*++

-

-Routine Description:

-  Convert the passed in Ascii string to Unicode.

-  Optionally return the length of the strings.

-

-Arguments:

-  Ascii   - Ascii string to convert

-  StrLen  - Length of string

-

-Returns:

-  Pointer to malloc'ed Unicode version of Ascii

-

---*/

-{

-  UINTN   Index;

-  CHAR16  *Unicode;

-

-  //

-  // Allocate a buffer for unicode string

-  //

-  for (Index = 0; Ascii[Index] != '\0'; Index++)

-    ;

-  Unicode = malloc ((Index + 1) * sizeof (CHAR16));

-  if (Unicode == NULL) {

-    return NULL;

-  }

-

-  for (Index = 0; Ascii[Index] != '\0'; Index++) {

-    Unicode[Index] = (CHAR16) Ascii[Index];

-  }

-

-  Unicode[Index] = '\0';

-

-  if (StrLen != NULL) {

-    *StrLen = Index;

-  }

-

-  return Unicode;

-}

-

-UINTN

-CountSeperatorsInString (

-  IN  const CHAR16   *String,

-  IN  CHAR16         Seperator

-  )

-/*++

-

-Routine Description:

-  Count the number of seperators in String

-

-Arguments:

-  String    - String to process

-  Seperator - Item to count

-

-Returns:

-  Number of Seperator in String

-

---*/

-{

-  UINTN Count;

-

-  for (Count = 0; *String != '\0'; String++) {

-    if (*String == Seperator) {

-      Count++;

-    }

-  }

-

-  return Count;

-}

-

-

-EFI_STATUS

-AddModHandle (

-  IN  PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext,

-  IN  VOID                                 *ModHandle

-  )

-/*++

-

-Routine Description:

-  Store the ModHandle in an array indexed by the Pdb File name.

-  The ModHandle is needed to unload the image. 

-

-Arguments:

-  ImageContext - Input data returned from PE Laoder Library. Used to find the 

-                 .PDB file name of the PE Image.

-  ModHandle    - Returned from LoadLibraryEx() and stored for call to 

-                 FreeLibrary().

-

-Returns:

-  EFI_SUCCESS - ModHandle was stored. 

-

---*/

-{

-  UINTN                   Index;

-  PDB_NAME_TO_MOD_HANDLE  *Array;

-  UINTN                   PreviousSize;

-

-

-  Array = mPdbNameModHandleArray;

-  for (Index = 0; Index < mPdbNameModHandleArraySize; Index++, Array++) {

-    if (Array->PdbPointer == NULL) {

-      //

-      // Make a copy of the stirng and store the ModHandle

-      //

-      Array->PdbPointer = malloc (strlen (ImageContext->PdbPointer) + 1);

-      ASSERT (Array->PdbPointer != NULL);

-

-      strcpy (Array->PdbPointer, ImageContext->PdbPointer);

-      Array->ModHandle = ModHandle;

-      return EFI_SUCCESS;

-    }

-  }

-  

-  //

-  // No free space in mPdbNameModHandleArray so grow it by 

-  // MAX_PDB_NAME_TO_MOD_HANDLE_ARRAY_SIZE entires. realloc will

-  // copy the old values to the new locaiton. But it does

-  // not zero the new memory area.

-  //

-  PreviousSize = mPdbNameModHandleArraySize * sizeof (PDB_NAME_TO_MOD_HANDLE);

-  mPdbNameModHandleArraySize += MAX_PDB_NAME_TO_MOD_HANDLE_ARRAY_SIZE;

-

-  mPdbNameModHandleArray = realloc (mPdbNameModHandleArray, mPdbNameModHandleArraySize * sizeof (PDB_NAME_TO_MOD_HANDLE));

-  if (mPdbNameModHandleArray == NULL) {

-    ASSERT (FALSE);

-    return EFI_OUT_OF_RESOURCES;

-  }

-  

-  memset (mPdbNameModHandleArray + PreviousSize, 0, MAX_PDB_NAME_TO_MOD_HANDLE_ARRAY_SIZE * sizeof (PDB_NAME_TO_MOD_HANDLE));

- 

-  return AddModHandle (ImageContext, ModHandle);

-}

-

-

-VOID *

-RemoveModeHandle (

-  IN  PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext

-  )

-/*++

-

-Routine Description:

-  Return the ModHandle and delete the entry in the array.

-

-Arguments:

-  ImageContext - Input data returned from PE Laoder Library. Used to find the 

-                 .PDB file name of the PE Image.

-

-Returns:

-  ModHandle - ModHandle assoicated with ImageContext is returned

-  NULL      - No ModHandle associated with ImageContext

-

---*/

-{

-  UINTN                   Index;

-  PDB_NAME_TO_MOD_HANDLE  *Array;

-

-  if (ImageContext->PdbPointer == NULL) {

-    //

-    // If no PDB pointer there is no ModHandle so return NULL

-    //

-    return NULL;

-  }

-

-  Array = mPdbNameModHandleArray;

-  for (Index = 0; Index < mPdbNameModHandleArraySize; Index++, Array++) {

-    if ((Array->PdbPointer != NULL) && (strcmp(Array->PdbPointer, ImageContext->PdbPointer) == 0)) {

-      //

-      // If you find a match return it and delete the entry

-      //

-      free (Array->PdbPointer);

-      Array->PdbPointer = NULL;

-      return Array->ModHandle;

-    }

-  }

-

-  return NULL;

-}

-

-

-

-EFI_STATUS

-EFIAPI

-SecNt32PeCoffGetImageInfo (

-  IN EFI_PEI_PE_COFF_LOADER_PROTOCOL          *This,

-  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext

-  )

-{

-  EFI_STATUS  Status;

-

-  Status = PeCoffLoaderGetImageInfo (ImageContext);

-  if (EFI_ERROR (Status)) {

-    return Status;

-  }

-

-  switch (ImageContext->ImageType) {

-

-  case EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION:

-    ImageContext->ImageCodeMemoryType = EfiLoaderCode;

-    ImageContext->ImageDataMemoryType = EfiLoaderData;

-    break;

-

-  case EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER:

-    ImageContext->ImageCodeMemoryType = EfiBootServicesCode;

-    ImageContext->ImageDataMemoryType = EfiBootServicesData;

-    break;

-

-  case EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER:

-  case EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER:

-    ImageContext->ImageCodeMemoryType = EfiRuntimeServicesCode;

-    ImageContext->ImageDataMemoryType = EfiRuntimeServicesData;

-    break;

-

-  default:

-    ImageContext->ImageError = IMAGE_ERROR_INVALID_SUBSYSTEM;

-    return RETURN_UNSUPPORTED;

-  }

-

-  return Status;

-}

-

-EFI_STATUS

-EFIAPI

-SecNt32PeCoffLoadImage (

-  IN EFI_PEI_PE_COFF_LOADER_PROTOCOL          *This,

-  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext

-  )

-{

-  EFI_STATUS  Status;

-

-  Status = PeCoffLoaderLoadImage (ImageContext);

-  return Status;

-}

-

-EFI_STATUS

-EFIAPI

-SecNt32PeCoffRelocateImage (

-  IN EFI_PEI_PE_COFF_LOADER_PROTOCOL          *This,

-  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext

-  )

-{

-  EFI_STATUS        Status;

-  VOID              *DllEntryPoint;

-  CHAR16            *DllFileName;

-  HMODULE           Library;

-  UINTN             Index;

-

-

-  Status = PeCoffLoaderRelocateImage (ImageContext);

-  if (EFI_ERROR (Status)) {

-    //

-    // We could not relocated the image in memory properly

-    //

-    return Status;

-  }

-

-  //

-  // If we load our own PE COFF images the Windows debugger can not source

-  //  level debug our code. If a valid PDB pointer exists usw it to load

-  //  the *.dll file as a library using Windows* APIs. This allows 

-  //  source level debug. The image is still loaded and reloaced

-  //  in the Framework memory space like on a real system (by the code above),

-  //  but the entry point points into the DLL loaded by the code bellow. 

-  //

-

-  DllEntryPoint = NULL;

-

-  //

-  // Load the DLL if it's not an EBC image.

-  //

-  if ((ImageContext->PdbPointer != NULL) &&

-      (ImageContext->Machine != EFI_IMAGE_MACHINE_EBC)) {

-    //

-    // Convert filename from ASCII to Unicode

-    //

-    DllFileName = AsciiToUnicode (ImageContext->PdbPointer, &Index);

-

-    //

-    // Check that we have a valid filename

-    //

-    if (Index < 5 || DllFileName[Index - 4] != '.') {

-      free (DllFileName);

-

-      //

-      // Never return an error if PeCoffLoaderRelocateImage() succeeded.

-      // The image will run, but we just can't source level debug. If we

-      // return an error the image will not run.

-      //

-      return EFI_SUCCESS;

-    }

-    //

-    // Replace .PDB with .DLL on the filename

-    //

-    DllFileName[Index - 3]  = 'D';

-    DllFileName[Index - 2]  = 'L';

-    DllFileName[Index - 1]  = 'L';

-

-    //

-    // Load the .DLL file into the user process's address space for source 

-    // level debug

-    //

-    Library = LoadLibraryEx (DllFileName, NULL, DONT_RESOLVE_DLL_REFERENCES);

-    if (Library != NULL) {

-      //

-      // InitializeDriver is the entry point we put in all our EFI DLL's. The

-      // DONT_RESOLVE_DLL_REFERENCES argument to LoadLIbraryEx() supresses the 

-      // normal DLL entry point of DllMain, and prevents other modules that are

-      // referenced in side the DllFileName from being loaded. There is no error 

-      // checking as the we can point to the PE32 image loaded by Tiano. This 

-      // step is only needed for source level debuging

-      //

-      DllEntryPoint = (VOID *) (UINTN) GetProcAddress (Library, "InitializeDriver");

-

-    }

-

-    if ((Library != NULL) && (DllEntryPoint != NULL)) {

-      AddModHandle (ImageContext, Library);

-      ImageContext->EntryPoint  = (EFI_PHYSICAL_ADDRESS) (UINTN) DllEntryPoint;

-      wprintf (L"LoadLibraryEx (%s,\n               NULL, DONT_RESOLVE_DLL_REFERENCES)\n", DllFileName);

-    } else {

-      wprintf (L"WARNING: No source level debug %s. \n", DllFileName);

-    }

-

-    free (DllFileName);

-  }

-

-  //

-  // Never return an error if PeCoffLoaderRelocateImage() succeeded.

-  // The image will run, but we just can't source level debug. If we

-  // return an error the image will not run.

-  //

-  return EFI_SUCCESS;

-}

-

-

-EFI_STATUS

-EFIAPI

-SecNt32PeCoffUnloadimage (

-  IN EFI_PEI_PE_COFF_LOADER_PROTOCOL      *This,

-  IN PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext

-  )

-{

-  VOID *ModHandle;

-

-  ModHandle = RemoveModeHandle (ImageContext);

-  if (ModHandle != NULL) {

-    FreeLibrary (ModHandle);

-  }

-  return EFI_SUCCESS;

-}

-

-VOID

-_ModuleEntryPoint (

-  VOID

-  )

-{

-}

-

-#pragma warning(default : 4996)

diff --git a/EdkNt32Pkg/Sec/SecMain.h b/EdkNt32Pkg/Sec/SecMain.h
deleted file mode 100644
index 7943b83..0000000
--- a/EdkNt32Pkg/Sec/SecMain.h
+++ /dev/null
@@ -1,570 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-

-Module Name:

-  SecMain.h

-

-Abstract:

-  Include file for Windows API based SEC

-

---*/

-

-#include <stdio.h>

-

-

-#define STACK_SIZE                0x20000      

-

-typedef struct {

-  EFI_PHYSICAL_ADDRESS  Address;

-  UINT64                Size;

-} NT_FD_INFO;

-

-#define NT_SYSTEM_MEMORY_FILENAME_SIZE  40

-

-typedef struct {

-  CHAR16                FileName[NT_SYSTEM_MEMORY_FILENAME_SIZE];

-  EFI_PHYSICAL_ADDRESS  Memory;

-  UINT64                Size;

-} NT_SYSTEM_MEMORY;

-

-

-#define MAX_PDB_NAME_TO_MOD_HANDLE_ARRAY_SIZE 0x100

-

-typedef struct {

-  CHAR8   *PdbPointer;

-  VOID    *ModHandle;

-} PDB_NAME_TO_MOD_HANDLE;

-

-

-

-

-EFI_STATUS

-EFIAPI

-SecWinNtPeiLoadFile (

-  VOID                  *Pe32Data,  // TODO: add IN/OUT modifier to Pe32Data

-  EFI_PHYSICAL_ADDRESS  *ImageAddress,  // TODO: add IN/OUT modifier to ImageAddress

-  UINT64                *ImageSize,  // TODO: add IN/OUT modifier to ImageSize

-  EFI_PHYSICAL_ADDRESS  *EntryPoint  // TODO: add IN/OUT modifier to EntryPoint

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Pe32Data      - TODO: add argument description

-  ImageAddress  - TODO: add argument description

-  ImageSize     - TODO: add argument description

-  EntryPoint    - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-SecWinNtPeiAutoScan (

-  IN  UINTN                 Index,

-  OUT EFI_PHYSICAL_ADDRESS  *MemoryBase,

-  OUT UINT64                *MemorySize

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Index       - TODO: add argument description

-  MemoryBase  - TODO: add argument description

-  MemorySize  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-VOID *

-EFIAPI

-SecWinNtWinNtThunkAddress (

-  VOID

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  InterfaceSize - TODO: add argument description

-  InterfaceBase - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-SecWinNtWinNtFwhAddress (

-  IN OUT UINT64                *FwhSize,

-  IN OUT EFI_PHYSICAL_ADDRESS  *FwhBase

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  FwhSize - TODO: add argument description

-  FwhBase - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-SecPeiReportStatusCode (

-  IN EFI_PEI_SERVICES         **PeiServices,

-  IN EFI_STATUS_CODE_TYPE     CodeType,

-  IN EFI_STATUS_CODE_VALUE    Value,

-  IN UINT32                   Instance,

-  IN EFI_GUID                 * CallerId,

-  IN EFI_STATUS_CODE_DATA     * Data OPTIONAL

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  PeiServices - TODO: add argument description

-  CodeType    - TODO: add argument description

-  Value       - TODO: add argument description

-  Instance    - TODO: add argument description

-  CallerId    - TODO: add argument description

-  Data        - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-INTN

-EFIAPI

-main (

-  IN  INTN  Argc,

-  IN  CHAR8 **Argv,

-  IN  CHAR8 **Envp

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Argc  - TODO: add argument description

-  Argv  - TODO: add argument description

-  Envp  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-WinNtOpenFile (

-  CHAR16                *FileName,

-  UINT32                MapSize,

-  DWORD                 CreationDispostion,

-  EFI_PHYSICAL_ADDRESS  *BaseAddress,

-  UINT64                *Length

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  FileName            - TODO: add argument description

-  MapSize             - TODO: add argument description

-  CreationDispostion  - TODO: add argument description

-  BaseAddress         - TODO: add argument description

-  Length              - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-VOID

-SecLoadFromCore (

-  IN  UINTN   LargestRegion,

-  IN  UINTN   LargestRegionSize,

-  IN  UINTN   BootFirmwareVolumeBase,

-  IN  VOID    *PeiCoreFile

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  LargestRegion           - TODO: add argument description

-  LargestRegionSize       - TODO: add argument description

-  BootFirmwareVolumeBase  - TODO: add argument description

-  PeiCoreFile             - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-SecLoadFile (

-  IN  VOID                    *Pe32Data,

-  IN  EFI_PHYSICAL_ADDRESS    *ImageAddress,

-  IN  UINT64                  *ImageSize,

-  IN  EFI_PHYSICAL_ADDRESS    *EntryPoint

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Pe32Data      - TODO: add argument description

-  ImageAddress  - TODO: add argument description

-  ImageSize     - TODO: add argument description

-  EntryPoint    - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-SecFfsFindPeiCore (

-  IN  EFI_FIRMWARE_VOLUME_HEADER  *FwVolHeader,

-  OUT VOID                        **Pe32Data

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  FwVolHeader - TODO: add argument description

-  Pe32Data    - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-SecFfsFindNextFile (

-  IN EFI_FV_FILETYPE             SearchType,

-  IN EFI_FIRMWARE_VOLUME_HEADER  *FwVolHeader,

-  IN OUT EFI_FFS_FILE_HEADER     **FileHeader

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  SearchType  - TODO: add argument description

-  FwVolHeader - TODO: add argument description

-  FileHeader  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-SecFfsFindSectionData (

-  IN EFI_SECTION_TYPE      SectionType,

-  IN EFI_FFS_FILE_HEADER   *FfsFileHeader,

-  IN OUT VOID              **SectionData

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  SectionType   - TODO: add argument description

-  FfsFileHeader - TODO: add argument description

-  SectionData   - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-SecWinNtPeCoffLoaderLoadAsDll (

-  IN CHAR8    *PdbFileName,

-  IN VOID     **ImageEntryPoint,

-  OUT VOID    **ModHandle

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  PdbFileName     - TODO: add argument description

-  ImageEntryPoint - TODO: add argument description

-  ModHandle       - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-SecWinNtPeCoffLoaderFreeLibrary (

-  OUT VOID    *ModHandle

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  ModHandle - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-SecWinNtFdAddress (

-  IN     UINTN                 Index,

-  IN OUT EFI_PHYSICAL_ADDRESS  *FdBase,

-  IN OUT UINT64                *FdSize

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Index   - TODO: add argument description

-  FdBase  - TODO: add argument description

-  FdSize  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-GetImageReadFunction (

-  IN PE_COFF_LOADER_IMAGE_CONTEXT          *ImageContext,

-  IN EFI_PHYSICAL_ADDRESS                  *TopOfMemory

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  ImageContext  - TODO: add argument description

-  TopOfMemory   - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-SecImageRead (

-  IN     VOID    *FileHandle,

-  IN     UINTN   FileOffset,

-  IN OUT UINTN   *ReadSize,

-  OUT    VOID    *Buffer

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  FileHandle  - TODO: add argument description

-  FileOffset  - TODO: add argument description

-  ReadSize    - TODO: add argument description

-  Buffer      - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-CHAR16                            *

-AsciiToUnicode (

-  IN  CHAR8   *Ascii,

-  IN  UINTN   *StrLen OPTIONAL

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  Ascii   - TODO: add argument description

-  StrLen  - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-UINTN

-CountSeperatorsInString (

-  IN  const CHAR16   *String,

-  IN  CHAR16   Seperator

-  )

-/*++

-

-Routine Description:

-

-  TODO: Add function description

-

-Arguments:

-

-  String    - TODO: add argument description

-  Seperator - TODO: add argument description

-

-Returns:

-

-  TODO: add return values

-

---*/

-;

-

-EFI_STATUS

-EFIAPI

-SecNt32PeCoffGetImageInfo (

-  IN EFI_PEI_PE_COFF_LOADER_PROTOCOL          *This,

-  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext

-  );

-

-EFI_STATUS

-EFIAPI

-SecNt32PeCoffLoadImage (

-  IN EFI_PEI_PE_COFF_LOADER_PROTOCOL          *This,

-  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext

-  );

-

-EFI_STATUS

-EFIAPI

-SecNt32PeCoffRelocateImage (

-  IN EFI_PEI_PE_COFF_LOADER_PROTOCOL          *This,

-  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext

-  );

-

-EFI_STATUS

-EFIAPI

-SecNt32PeCoffUnloadimage (

-  IN EFI_PEI_PE_COFF_LOADER_PROTOCOL      *This,

-  IN PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext

-  );

-

-

-typedef struct {

-  EFI_PEI_PE_COFF_LOADER_PROTOCOL PeCoff;

-  VOID                            *ModHandle;

-} EFI_PEI_PE_COFF_LOADER_PROTOCOL_INSTANCE;

-

-extern EFI_WIN_NT_THUNK_PROTOCOL  *gWinNt;

diff --git a/EdkNt32Pkg/Sec/SecMain.msa b/EdkNt32Pkg/Sec/SecMain.msa
deleted file mode 100644
index 28e8d15..0000000
--- a/EdkNt32Pkg/Sec/SecMain.msa
+++ /dev/null
@@ -1,112 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

-  <MsaHeader>

-    <ModuleName>SecMain</ModuleName>

-    <ModuleType>SEC</ModuleType>

-    <GuidValue>4b837b03-6587-4d19-b82b-edfad836c0a0</GuidValue>

-    <Version>1.0</Version>

-    <Abstract>Entry Point of NT32 Emulator</Abstract>

-    <Description>Main executable file of NT32 Emulator that loads PEI core after initialization finished.</Description>

-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>

-    <License>All rights reserved. This program and the accompanying materials

-      are licensed and made available under the terms and conditions of the BSD License

-      which accompanies this distribution.  The full text of the license may be found at

-      http://opensource.org/licenses/bsd-license.php

-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>

-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>

-  </MsaHeader>

-  <ModuleDefinitions>

-    <SupportedArchitectures>IA32</SupportedArchitectures>

-    <BinaryModule>false</BinaryModule>

-    <OutputFileBasename>SecMain</OutputFileBasename>

-  </ModuleDefinitions>

-  <LibraryClassDefinitions>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>PeCoffLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>BaseMemoryLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>PrintLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>PcdLib</Keyword>

-    </LibraryClass>

-    <LibraryClass Usage="ALWAYS_CONSUMED">

-      <Keyword>DebugLib</Keyword>

-    </LibraryClass>

-  </LibraryClassDefinitions>

-  <SourceFiles>

-    <Filename ToolCode="DUMMY">SecMain_build.xml</Filename>

-    <Filename>SecMain.c</Filename>

-    <Filename>FwVol.c</Filename>

-    <Filename>WinNtThunk.c</Filename>

-    <Filename>SecMain.h</Filename>

-  </SourceFiles>

-  <PackageDependencies>

-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-    <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>

-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>

-  </PackageDependencies>

-  <PPIs>

-    <Ppi Usage="ALWAYS_PRODUCED">

-      <PpiCName>gPeiNtThunkPpiGuid</PpiCName>

-    </Ppi>

-    <Ppi Usage="ALWAYS_PRODUCED">

-      <PpiCName>gPeiNtAutoScanPpiGuid</PpiCName>

-    </Ppi>

-    <Ppi Usage="ALWAYS_PRODUCED">

-      <PpiCName>gNtFwhPpiGuid</PpiCName>

-    </Ppi>

-    <Ppi Usage="ALWAYS_PRODUCED">

-      <PpiCName>gEfiPeiStatusCodePpiGuid</PpiCName>

-    </Ppi>

-    <Ppi Usage="ALWAYS_PRODUCED">

-      <PpiCName>gNtPeiLoadFilePpiGuid</PpiCName>

-    </Ppi>

-  </PPIs>

-  <Guids>

-    <GuidCNames Usage="ALWAYS_PRODUCED">

-      <GuidCName>gEfiPeiPeCoffLoaderGuid</GuidCName>

-    </GuidCNames>

-  </Guids>

-  <Externs>

-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>

-  </Externs>

-  <PcdCoded>

-    <PcdEntry PcdItemType="DYNAMIC">

-      <C_Name>PcdWinNtMemorySizeForSecMain</C_Name>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <HelpText>This PCD defines the memory size of simulated machine. Simulator will allocate

-        the size of PcdWinNtMemorySizeForSecMain in windows platform.</HelpText>

-    </PcdEntry>

-    <PcdEntry PcdItemType="DYNAMIC">

-      <C_Name>PcdWinNtFirmwareVolume</C_Name>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <HelpText>This PCD defines the FD file windows path string. Simulator will load the FD file and execute.</HelpText>

-    </PcdEntry>

-    <PcdEntry PcdItemType="FIXED_AT_BUILD">

-      <C_Name>PcdWinNtBootMode</C_Name>

-      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>

-      <HelpText>This PCD defines the boot mode for simualtor.

-        The boot mode can be set as following value:

-          0x0: Boot with full configuration.

-          0x1: Boot with minimal configuration.

-          0x2: Boot assume no configuration changes.

-          0x3: Boot with full configuration plus diagnostics.

-          0x4: Boot with default settings.

-          0x5: Boot on S4 resume.

-          0x6: Boot on S5 resume.

-          0x10: Boot on S2 resume.

-          0x11: Boot on S3 resume.

-          0x12: Boot on flash update.

-          0x20: Boot in reovery mode.</HelpText>

-    </PcdEntry>

-  </PcdCoded>

-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Sec/SecMain_build.xml b/EdkNt32Pkg/Sec/SecMain_build.xml
deleted file mode 100644
index fc26a10..0000000
--- a/EdkNt32Pkg/Sec/SecMain_build.xml
+++ /dev/null
@@ -1,141 +0,0 @@
-<?xml version="1.0" ?>

-<!--

-Copyright (c) 2006, Intel Corporation

-All rights reserved. This program and the accompanying materials

-are licensed and made available under the terms and conditions of the BSD License

-which accompanies this distribution.  The full text of the license may be found at

-http://opensource.org/licenses/bsd-license.php

-

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

--->

-<project name="SecMain" default="main" basedir="." >

-  <!-- Apply external ANT task -->

-  <taskdef resource="frameworktasks.tasks" /> 

-  <taskdef resource="cpptasks.tasks" /> 

-  <typedef resource="cpptasks.types" /> 

-  <taskdef resource="net/sf/antcontrib/antlib.xml" />

-  <property environment="env" />

-  <!-- All Properties --> 

-  <property name="BASE_NAME" value="SecMain" /> 

-  

-  <!-- Default target --> 

-  <target name="main" depends="libraries, sourcefiles, sections, output" /> 

-  <!-- Compile all dependency Library instances. --> 

-

-  <target name="libraries">

-    <GenBuild type="build">

-      <property name="ARCH" value="${ARCH}"/>

-      <property name="MODULE_GUID" value="27d67720-ea68-48ae-93da-a3a074c90e30"/>

-      <property name="MODULE_VERSION" value=""/>

-      <property name="PLATFORM" value="${PLATFORM}"/>

-      <property name="PACKAGE_GUID" value="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      <property name="PACKAGE_VERSION" value=""/>

-    </GenBuild>

-    <GenBuild type="build">

-      <property name="ARCH" value="${ARCH}"/>

-      <property name="MODULE_GUID" value="fd44e603-002a-4b29-9f5f-529e815b6165"/>

-      <property name="MODULE_VERSION" value=""/>

-      <property name="PLATFORM" value="${PLATFORM}"/>

-      <property name="PACKAGE_GUID" value="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      <property name="PACKAGE_VERSION" value=""/>

-    </GenBuild>

-    <GenBuild type="build">

-      <property name="ARCH" value="${ARCH}"/>

-      <property name="MODULE_GUID" value="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3"/>

-      <property name="MODULE_VERSION" value=""/>

-      <property name="PLATFORM" value="${PLATFORM}"/>

-      <property name="PACKAGE_GUID" value="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      <property name="PACKAGE_VERSION" value=""/>

-    </GenBuild>

-    <GenBuild type="build">

-      <property name="ARCH" value="${ARCH}"/>

-      <property name="MODULE_GUID" value="556f5d10-7309-4af4-b80a-8196bd60946f"/>

-      <property name="MODULE_VERSION" value=""/>

-      <property name="PLATFORM" value="${PLATFORM}"/>

-      <property name="PACKAGE_GUID" value="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      <property name="PACKAGE_VERSION" value=""/>

-    </GenBuild>

-    <GenBuild type="build">

-      <property name="ARCH" value="${ARCH}"/>

-      <property name="MODULE_GUID" value="9ba1d976-0624-41a3-8650-28165e8d9ae8"/>

-      <property name="MODULE_VERSION" value=""/>

-      <property name="PLATFORM" value="${PLATFORM}"/>

-      <property name="PACKAGE_GUID" value="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

-      <property name="PACKAGE_VERSION" value=""/>

-    </GenBuild>

-  </target>

-  <target name="sourcefiles">

-      <Build_Init>

-        <EXTRA.INC>

-          <includepath path="${INCLUDE_PATHS}"/>

-        </EXTRA.INC>

-      </Build_Init>

-      <Build_AUTOGEN FILEEXT="c" FILENAME="AutoGen" FILEPATH=".">

-         <EXTRA.INC>

-            <includepath path="${INCLUDE_PATHS}"/>

-         </EXTRA.INC>

-       </Build_AUTOGEN>

-      <Build_CCode FILEEXT="c" FILENAME="FwVol" FILEPATH=".">

-         <EXTRA.INC>

-            <includepath path="${INCLUDE_PATHS}"/>

-         </EXTRA.INC>

-      </Build_CCode>

-      <Build_CCode FILEEXT="c" FILENAME="WinNtThunk" FILEPATH=".">

-         <EXTRA.INC>

-            <includepath path="${INCLUDE_PATHS}"/>

-         </EXTRA.INC>

-      </Build_CCode>

-      <Build_CCode FILEEXT="c" FILENAME="SecMain" FILEPATH=".">

-         <EXTRA.INC>

-            <includepath path="${INCLUDE_PATHS}"/>

-         </EXTRA.INC>

-      </Build_CCode>

-    </target>

-

-    <target name="sections" />

-

-    <target name="output" >

-      <if>

-        <available type="file" file="${DEST_DIR_OUTPUT}/AutoGen.h.obj"/>

-        <then>

-          <var name="SLINK_FLAGS" value="${SLINK_FLAGS} ${DEST_DIR_OUTPUT}/AutoGen.h.obj"/>

-        </then>

-      </if>

-      <OnDependency>

-        <sourcefiles>

-          <fileset dir="${DEST_DIR_OUTPUT}" includes="${OBJECTS}" />

-          <file list="${LIBS}"/>

-        </sourcefiles>

-        <targetfiles>

-          <file name="${BIN_DIR}\SecMain.exe"/>

-        </targetfiles>

-        

-        <sequential>

-          <cc userdefine="on">

-            <command type="SLINK" cmd="${SLINK}" family="${SLINK_FAMILY}"

-                outputFile="${DEST_DIR_OUTPUT}/SecMainLocal.lib" dpath="${SLINK_DPATH}">

-                

-              <argument value="${SLINK_FLAGS}"/>

-

-              <fileset dir="${DEST_DIR_OUTPUT}" includes="${OBJECTS}"/>

-            </command>

-          </cc>

-

-          <var name="LIBS" value="${LIBS} ${DEST_DIR_OUTPUT}/SecMainLocal.lib" />

-         

-          <shellscript shell="cmd.exe" tmpsuffix=".cmd" >

-            <arg line="/q"/>

-            <arg line="/c"/>

-            <arg line="call"/>

-            PATH ${DLINK_DPATH};%path%

-            "${DLINK}" /LIBPATH:"${env.MSVCDir}\Lib" /LIBPATH:"${env.MSVCDir}\PlatformSdk\Lib" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib ${LIBS} /base:0x10000000 /out:${BIN_DIR}\SecMain.exe /pdb:${DEST_DIR_DEBUG}\SecMain.pdb

-          </shellscript>

-        </sequential>

-      </OnDependency>

-  </target>

-  

-  <target name="clean" ></target>

-

-  <target name="cleanAll"></target>

-</project>

diff --git a/EdkNt32Pkg/Sec/WinNtThunk.c b/EdkNt32Pkg/Sec/WinNtThunk.c
deleted file mode 100644
index 2832e13..0000000
--- a/EdkNt32Pkg/Sec/WinNtThunk.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*++

-

-Copyright (c) 2006, Intel Corporation                                                         

-All rights reserved. This program and the accompanying materials                          

-are licensed and made available under the terms and conditions of the BSD License         

-which accompanies this distribution.  The full text of the license may be found at        

-http://opensource.org/licenses/bsd-license.php                                            

-                                                                                          

-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

-

-Module Name:

-

-  WinNtThunk.c

-

-Abstract:

-

-  Since the SEC is the only windows program in our emulation we 

-  must use a Tiano mechanism to export Win32 APIs to other modules.

-  This is the role of the EFI_WIN_NT_THUNK_PROTOCOL.

-

-  The mWinNtThunkTable exists so that a change to EFI_WIN_NT_THUNK_PROTOCOL

-  will cause an error in initializing the array if all the member functions

-  are not added. It looks like adding a element to end and not initializing

-  it may cause the table to be initaliized with the members at the end being

-  set to zero. This is bad as jumping to zero will case the NT32 to crash.

-  

-  All the member functions in mWinNtThunkTable are Win32

-  API calls, so please reference Microsoft documentation. 

-

-

-  gWinNt is a a public exported global that contains the initialized

-  data.

-

---*/

-

-#include "SecMain.h"

-

-//

-// This pragma is needed for all the DLL entry points to be asigned to the array.

-//  if warning 4232 is not dissabled a warning will be generated as a DLL entry

-//  point could be modified dynamically. The SEC does not do that, so we must

-//  disable the warning so we can compile the SEC. The previous method was to

-//  asign each element in code. The disadvantage to that approach is it's harder

-//  to tell if all the elements have been initailized properly.

-//

-#pragma warning(disable : 4232)

-#pragma warning(disable : 4996)

-

-EFI_WIN_NT_THUNK_PROTOCOL mWinNtThunkTable = {

-  EFI_WIN_NT_THUNK_PROTOCOL_SIGNATURE,

-  GetProcAddress,

-  GetTickCount,

-  LoadLibraryEx,

-  FreeLibrary,

-  SetPriorityClass,

-  SetThreadPriority,

-  Sleep,

-  SuspendThread,

-  GetCurrentThread,

-  GetCurrentThreadId,

-  GetCurrentProcess,

-  CreateThread,

-  TerminateThread,

-  SendMessage,

-  ExitThread,

-  ResumeThread,

-  DuplicateHandle,

-  InitializeCriticalSection,

-  EnterCriticalSection,

-  LeaveCriticalSection,

-  DeleteCriticalSection,

-  TlsAlloc,

-  TlsFree,

-  TlsSetValue,

-  TlsGetValue,

-  CreateSemaphore,

-  WaitForSingleObject,

-  ReleaseSemaphore,

-  CreateConsoleScreenBuffer,

-  FillConsoleOutputAttribute,

-  FillConsoleOutputCharacter,

-  GetConsoleCursorInfo,

-  GetNumberOfConsoleInputEvents,

-  PeekConsoleInput,

-  ScrollConsoleScreenBuffer,

-  ReadConsoleInput,

-  SetConsoleActiveScreenBuffer,

-  SetConsoleCursorInfo,

-  SetConsoleCursorPosition,

-  SetConsoleScreenBufferSize,

-  SetConsoleTitleW,

-  WriteConsoleInput,

-  WriteConsoleOutput,

-  CreateFile,

-  DeviceIoControl,

-  CreateDirectory,

-  RemoveDirectory,

-  GetFileAttributes,

-  SetFileAttributes,

-  CreateFileMapping,

-  CloseHandle,

-  DeleteFile,

-  FindFirstFile,

-  FindNextFile,

-  FindClose,

-  FlushFileBuffers,

-  GetEnvironmentVariable,

-  GetLastError,

-  SetErrorMode,

-  GetStdHandle,

-  MapViewOfFileEx,

-  ReadFile,

-  SetEndOfFile,

-  SetFilePointer,

-  WriteFile,

-  GetFileInformationByHandle,

-  GetDiskFreeSpace,

-  GetDiskFreeSpaceEx,

-  MoveFile,

-  SetFileTime,

-  SystemTimeToFileTime,

-  FileTimeToLocalFileTime,

-  FileTimeToSystemTime,

-  GetSystemTime,

-  SetSystemTime,

-  GetLocalTime,

-  SetLocalTime,

-  GetTimeZoneInformation,

-  SetTimeZoneInformation,

-  timeSetEvent,

-  timeKillEvent,

-  ClearCommError,

-  EscapeCommFunction,

-  GetCommModemStatus,

-  GetCommState,

-  SetCommState,

-  PurgeComm,

-  SetCommTimeouts,

-  ExitProcess,

-  _snwprintf,

-  GetDesktopWindow,

-  GetForegroundWindow,

-  CreateWindowEx,

-  ShowWindow,

-  UpdateWindow,

-  DestroyWindow,

-  InvalidateRect,

-  GetWindowDC,

-  GetClientRect,

-  AdjustWindowRect,

-  SetDIBitsToDevice,

-  BitBlt,

-  GetDC,

-  ReleaseDC,

-  RegisterClassEx,

-  UnregisterClass,

-  BeginPaint,

-  EndPaint,

-  PostQuitMessage,

-  DefWindowProc,

-  LoadIcon,

-  LoadCursor,

-  GetStockObject,

-  SetViewportOrgEx,

-  SetWindowOrgEx,

-  MoveWindow,

-  GetWindowRect,

-  GetMessage,

-  TranslateMessage,

-  DispatchMessage,

-  GetProcessHeap,

-  HeapAlloc,

-  HeapFree

-};

-

-#pragma warning(default : 4996)

-#pragma warning(default : 4232)

-

-EFI_WIN_NT_THUNK_PROTOCOL *gWinNt = &mWinNtThunkTable;