Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Arm/ProcessorBind.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Arm/ProcessorBind.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Arm/ProcessorBind.h	(revision 58459)
@@ -2,5 +2,5 @@
   Processor or Compiler specific defines and types for ARM.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
   Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
   This program and the accompanying materials                          
@@ -31,5 +31,5 @@
 #if _MSC_EXTENSIONS 
   //
-  // use Microsoft* C complier dependent interger width types 
+  // use Microsoft* C complier dependent integer width types 
   //
   typedef unsigned __int64    UINT64;
@@ -43,5 +43,5 @@
   typedef unsigned char       UINT8;
   typedef char                CHAR8;
-  typedef char                INT8;
+  typedef signed char         INT8;
 #else
   //
@@ -59,5 +59,5 @@
   typedef unsigned char       UINT8;
   typedef char                CHAR8;
-  typedef char                INT8;
+  typedef signed char         INT8;
 #endif
 
@@ -92,4 +92,10 @@
 ///
 #define MAX_ADDRESS  0xFFFFFFFF
+
+///
+/// Maximum legal ARM INTN and UINTN values.
+///
+#define MAX_INTN   ((INTN)0x7FFFFFFF)
+#define MAX_UINTN  ((UINTN)0xFFFFFFFF)
 
 ///
@@ -153,4 +159,8 @@
 #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
 
+#ifndef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__
+#endif
+
 #endif
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Base.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Base.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Base.h	(revision 58459)
@@ -7,5 +7,5 @@
   be used to implement base modules.
 
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
 This program and the accompanying materials
@@ -80,19 +80,18 @@
 
 //
-// For symbol name in GNU assembly code, an extra "_" is necessary
-//
-#if defined(__GNUC__)
-  ///
-  /// Private worker functions for ASM_PFX()
-  ///
-  #define _CONCATENATE(a, b)  __CONCATENATE(a, b)
-  #define __CONCATENATE(a, b) a ## b
-
-  ///
-  /// The __USER_LABEL_PREFIX__ macro predefined by GNUC represents the prefix
-  /// on symbols in assembly language.
-  ///
-  #define ASM_PFX(name) _CONCATENATE (__USER_LABEL_PREFIX__, name)
-#endif
+// For symbol name in assembly code, an extra "_" is sometimes necessary
+//
+
+///
+/// Private worker functions for ASM_PFX()
+///
+#define _CONCATENATE(a, b)  __CONCATENATE(a, b)
+#define __CONCATENATE(a, b) a ## b
+
+///
+/// The __USER_LABEL_PREFIX__ macro predefined by GNUC represents the prefix
+/// on symbols in assembly language.
+///
+#define ASM_PFX(name) _CONCATENATE (__USER_LABEL_PREFIX__, name)
 
 #if __APPLE__
@@ -207,4 +206,15 @@
 #define NULL  ((VOID *) 0)
 
+///
+/// Maximum values for common UEFI Data Types
+///
+#define MAX_INT8    ((INT8)0x7F)
+#define MAX_UINT8   ((UINT8)0xFF)
+#define MAX_INT16   ((INT16)0x7FFF)
+#define MAX_UINT16  ((UINT16)0xFFFF)
+#define MAX_INT32   ((INT32)0x7FFFFFFF)
+#define MAX_UINT32  ((UINT32)0xFFFFFFFF)
+#define MAX_INT64   ((INT64)0x7FFFFFFFFFFFFFFFULL)
+#define MAX_UINT64  ((UINT64)0xFFFFFFFFFFFFFFFFULL)
 
 #define  BIT0     0x00000001
@@ -456,4 +466,9 @@
 #define VA_END(Marker)                ((void)0)
 
+// For some ARM RVCT compilers, __va_copy is not defined
+#ifndef __va_copy
+  #define __va_copy(dest, src) ((void)((dest) = (src)))
+#endif
+
 #define VA_COPY(Dest, Start)          __va_copy (Dest, Start)
 
@@ -1002,4 +1017,45 @@
     (SIGNATURE_32 (A, B, C, D) | ((UINT64) (SIGNATURE_32 (E, F, G, H)) << 32))
 
+#if defined(_MSC_EXTENSIONS) && !defined (MDE_CPU_EBC)
+  #pragma intrinsic(_ReturnAddress)
+  /**
+    Get the return address of the calling funcation.
+
+    Based on intrinsic function _ReturnAddress that provides the address of
+    the instruction in the calling function that will be executed after
+    control returns to the caller.
+
+    @param L    Return Level.
+
+    @return The return address of the calling funcation or 0 if L != 0.
+
+  **/
+  #define RETURN_ADDRESS(L)     ((L == 0) ? _ReturnAddress() : (VOID *) 0)
+#elif defined(__GNUC__)
+  void * __builtin_return_address (unsigned int level);
+  /**
+    Get the return address of the calling funcation.
+
+    Based on built-in Function __builtin_return_address that returns
+    the return address of the current function, or of one of its callers.
+
+    @param L    Return Level.
+
+    @return The return address of the calling funcation.
+
+  **/
+  #define RETURN_ADDRESS(L)     __builtin_return_address (L)
+#else
+  /**
+    Get the return address of the calling funcation.
+
+    @param L    Return Level.
+
+    @return 0 as compilers don't support this feature.
+
+  **/
+  #define RETURN_ADDRESS(L)     ((VOID *) 0)
 #endif
 
+#endif
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ebc/ProcessorBind.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ebc/ProcessorBind.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ebc/ProcessorBind.h	(revision 58459)
@@ -5,5 +5,5 @@
   specific functions in this file.
 
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -31,5 +31,5 @@
 /// 1-byte signed value
 ///
-typedef char                  INT8;
+typedef signed char           INT8;
 ///
 /// Logical Boolean.  1-byte value containing 0 for FALSE or a 1 for TRUE.  Other
@@ -105,4 +105,10 @@
 
 ///
+/// Maximum legal EBC INTN and UINTN values.
+///
+#define MAX_UINTN  ((UINTN) ~0)
+#define MAX_INTN   ((INTN)~MAX_BIT)
+
+///
 /// The stack alignment required for EBC
 ///
@@ -133,4 +139,8 @@
 #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
 
+#ifndef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__
+#endif
+
 #endif 
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Guid/Cper.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Guid/Cper.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Guid/Cper.h	(revision 58459)
@@ -2,5 +2,5 @@
   GUIDs and definitions used for Common Platform Error Record.
 
-  Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -12,5 +12,5 @@
 
   @par Revision Reference:
-  GUIDs introduced from UEFI 2.1 Specification.
+  GUIDs introduced from UEFI 2.3.1 Specification.
 
 **/
@@ -21,5 +21,5 @@
 #pragma pack(1)
 
-#define EFI_ERROR_RECORD_SIGNATURE_START   EFI_SIGNATURE_32('C', 'P', 'E', 'R')
+#define EFI_ERROR_RECORD_SIGNATURE_START   SIGNATURE_32('C', 'P', 'E', 'R')
 #define EFI_ERROR_RECORD_SIGNATURE_END     0xFFFFFFFF
 
@@ -210,5 +210,4 @@
   UINT8                  Resv1;
   UINT32                 SectionFlags;
-  UINT8                  Resv2[3];
   EFI_GUID               SectionType;
   EFI_GUID               FruId;
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Guid/EventGroup.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Guid/EventGroup.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Guid/EventGroup.h	(revision 58459)
@@ -1,6 +1,6 @@
 /** @file
-  GUIDs for gBS->CreateEventEx Event Groups. Defined in UEFI spec 2.0 and PI 1.2.
+  GUIDs for gBS->CreateEventEx Event Groups. Defined in UEFI spec 2.0 and PI 1.2.1.
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -45,3 +45,8 @@
 extern EFI_GUID gEfiEventDxeDispatchGuid;
 
+#define EFI_END_OF_DXE_EVENT_GROUP_GUID \
+  { 0x2ce967a, 0xdd7e, 0x4ffc, { 0x9e, 0xe7, 0x81, 0xc, 0xf0, 0x47, 0x8, 0x80 } }
+
+extern EFI_GUID gEfiEndOfDxeEventGroupGuid;
+
 #endif
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Guid/GlobalVariable.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Guid/GlobalVariable.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Guid/GlobalVariable.h	(revision 58459)
@@ -2,5 +2,5 @@
   GUID for EFI (NVRAM) Variables.
 
-  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -25,3 +25,162 @@
 extern EFI_GUID gEfiGlobalVariableGuid;
 
+//
+// Follow UEFI 2.4 spec:
+// To prevent name collisions with possible future globally defined variables,
+// other internal firmware data variables that are not defined here must be
+// saved with a unique VendorGuid other than EFI_GLOBAL_VARIABLE or
+// any other GUID defined by the UEFI Specification. Implementations must
+// only permit the creation of variables with a UEFI Specification-defined
+// VendorGuid when these variables are documented in the UEFI Specification.
+//
+// Note: except the globally defined variables defined below, the spec also defines
+// L"Boot####"      - A boot load option.
+// L"Driver####"    - A driver load option.
+// L"Key####"       - Describes hot key relationship with a Boot#### load option.
+// The attribute for them is NV+BS+RT, #### is a printed hex value, and no 0x or h
+// is included in the hex value. They can not be expressed as a #define like other globally
+// defined variables, it is because we can not list the Boot0000, Boot0001, etc one by one.
+//
+
+///
+/// The language codes that the firmware supports. This value is deprecated.
+/// Its attribute is BS+RT.
+///
+#define EFI_LANG_CODES_VARIABLE_NAME                L"LangCodes"
+///
+/// The language code that the system is configured for. This value is deprecated.
+/// Its attribute is NV+BS+RT.
+///
+#define EFI_LANG_VARIABLE_NAME                      L"Lang"
+///
+/// The firmware's boot managers timeout, in seconds, before initiating the default boot selection.
+/// Its attribute is NV+BS+RT.
+///
+#define EFI_TIME_OUT_VARIABLE_NAME                  L"Timeout"
+///
+/// The language codes that the firmware supports.
+/// Its attribute is BS+RT.
+///
+#define EFI_PLATFORM_LANG_CODES_VARIABLE_NAME       L"PlatformLangCodes"
+///
+/// The language code that the system is configured for.
+/// Its attribute is NV+BS+RT.
+///
+#define EFI_PLATFORM_LANG_VARIABLE_NAME             L"PlatformLang"
+///
+/// The device path of the default input/output/error output console.
+/// Its attribute is NV+BS+RT.
+///
+#define EFI_CON_IN_VARIABLE_NAME                    L"ConIn"
+#define EFI_CON_OUT_VARIABLE_NAME                   L"ConOut"
+#define EFI_ERR_OUT_VARIABLE_NAME                   L"ErrOut"
+///
+/// The device path of all possible input/output/error output devices.
+/// Its attribute is BS+RT.
+///
+#define EFI_CON_IN_DEV_VARIABLE_NAME                L"ConInDev"
+#define EFI_CON_OUT_DEV_VARIABLE_NAME               L"ConOutDev"
+#define EFI_ERR_OUT_DEV_VARIABLE_NAME               L"ErrOutDev"
+///
+/// The ordered boot option load list.
+/// Its attribute is NV+BS+RT.
+///
+#define EFI_BOOT_ORDER_VARIABLE_NAME                L"BootOrder"
+///
+/// The boot option for the next boot only.
+/// Its attribute is NV+BS+RT.
+///
+#define EFI_BOOT_NEXT_VARIABLE_NAME                 L"BootNext"
+///
+/// The boot option that was selected for the current boot.
+/// Its attribute is BS+RT.
+///
+#define EFI_BOOT_CURRENT_VARIABLE_NAME              L"BootCurrent"
+///
+/// The types of boot options supported by the boot manager. Should be treated as read-only.
+/// Its attribute is BS+RT.
+///
+#define EFI_BOOT_OPTION_SUPPORT_VARIABLE_NAME       L"BootOptionSupport"
+///
+/// The ordered driver load option list.
+/// Its attribute is NV+BS+RT.
+///
+#define EFI_DRIVER_ORDER_VARIABLE_NAME              L"DriverOrder"
+///
+/// Identifies the level of hardware error record persistence
+/// support implemented by the platform. This variable is
+/// only modified by firmware and is read-only to the OS.
+/// Its attribute is NV+BS+RT.
+///
+#define EFI_HW_ERR_REC_SUPPORT_VARIABLE_NAME        L"HwErrRecSupport"
+///
+/// Whether the system is operating in setup mode (1) or not (0).
+/// All other values are reserved. Should be treated as read-only.
+/// Its attribute is BS+RT.
+///
+#define EFI_SETUP_MODE_NAME                         L"SetupMode"
+///
+/// The Key Exchange Key Signature Database.
+/// Its attribute is NV+BS+RT+AT.
+///
+#define EFI_KEY_EXCHANGE_KEY_NAME                   L"KEK"
+///
+/// The public Platform Key.
+/// Its attribute is NV+BS+RT+AT.
+///
+#define EFI_PLATFORM_KEY_NAME                       L"PK"
+///
+/// Array of GUIDs representing the type of signatures supported
+/// by the platform firmware. Should be treated as read-only.
+/// Its attribute is BS+RT.
+///
+#define EFI_SIGNATURE_SUPPORT_NAME                  L"SignatureSupport"
+///
+/// Whether the platform firmware is operating in Secure boot mode (1) or not (0).
+/// All other values are reserved. Should be treated as read-only.
+/// Its attribute is BS+RT.
+///
+#define EFI_SECURE_BOOT_MODE_NAME                   L"SecureBoot"
+///
+/// The OEM's default Key Exchange Key Signature Database. Should be treated as read-only.
+/// Its attribute is BS+RT.
+///
+#define EFI_KEK_DEFAULT_VARIABLE_NAME               L"KEKDefault"
+///
+/// The OEM's default public Platform Key. Should be treated as read-only.
+/// Its attribute is BS+RT.
+///
+#define EFI_PK_DEFAULT_VARIABLE_NAME                L"PKDefault"
+///
+/// The OEM's default secure boot signature store. Should be treated as read-only.
+/// Its attribute is BS+RT.
+///
+#define EFI_DB_DEFAULT_VARIABLE_NAME                L"dbDefault"
+///
+/// The OEM's default secure boot blacklist signature store. Should be treated as read-only.
+/// Its attribute is BS+RT.
+///
+#define EFI_DBX_DEFAULT_VARIABLE_NAME               L"dbxDefault"
+///
+/// The OEM's default secure boot timestamp signature store. Should be treated as read-only.
+/// Its attribute is BS+RT.
+///
+#define EFI_DBT_DEFAULT_VARIABLE_NAME               L"dbtDefault"
+///
+/// Allows the firmware to indicate supported features and actions to the OS.
+/// Its attribute is BS+RT.
+///
+#define EFI_OS_INDICATIONS_SUPPORT_VARIABLE_NAME    L"OsIndicationsSupported"
+///
+/// Allows the OS to request the firmware to enable certain features and to take certain actions.
+/// Its attribute is NV+BS+RT.
+///
+#define EFI_OS_INDICATIONS_VARIABLE_NAME            L"OsIndications"
+///
+/// Whether the system is configured to use only vendor provided
+/// keys or not. Should be treated as read-only.
+/// Its attribute is BS+RT.
+///
+#define EFI_VENDOR_KEYS_VARIABLE_NAME               L"VendorKeys"
+
 #endif
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Guid/ImageAuthentication.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Guid/ImageAuthentication.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Guid/ImageAuthentication.h	(revision 58459)
@@ -1,7 +1,6 @@
 /** @file
-  Platform Key, Key Exchange Key, and Image signature database are defined 
-  for the signed image validation.
-
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+  Image signature database are defined for the signed image validation.
+
+  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -36,33 +35,10 @@
 ///
 #define EFI_IMAGE_SECURITY_DATABASE1      L"dbx"
+
 #define SECURE_BOOT_MODE_ENABLE           1
 #define SECURE_BOOT_MODE_DISABLE          0
 #define SETUP_MODE                        1
 #define USER_MODE                         0
-///
-/// Globally "SetupMode" variable to specify whether the system is currently operating 
-/// in setup mode (1) or not (0). All other values are reserved.
-///
-#define EFI_SETUP_MODE_NAME               L"SetupMode"
-///
-/// Globally "PK" variable for the Platform Key Signature Database.
-///
-#define EFI_PLATFORM_KEY_NAME             L"PK"
-///
-/// Globally "KEK" variable for the Key Exchange Key Signature Database.
-///
-#define EFI_KEY_EXCHANGE_KEY_NAME         L"KEK"
-///
-/// Globally "SignatureSupport" variable returns an array of GUIDs, 
-/// with each GUID representing a type of signature which the platform 
-/// firmware supports for images and other data.
-///
-#define EFI_SIGNATURE_SUPPORT_NAME        L"SignatureSupport"
-
-///
-/// Globally "SecureBoot" variable to specify whether the platform firmware 
-/// is operating in Secure boot mode (1) or not (0). All other values are reserved.
-///
-#define EFI_SECURE_BOOT_MODE_NAME         L"SecureBoot"
+
 
 //***********************************************************************
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Guid/StatusCodeDataTypeId.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Guid/StatusCodeDataTypeId.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Guid/StatusCodeDataTypeId.h	(revision 58459)
@@ -2,5 +2,5 @@
   GUID used to identify id for the caller who is initiating the Status Code.
 
-  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -149,10 +149,10 @@
   EFI_STATUS_CODE_DATA                 DataHeader;
   ///
-  /// The device path to the controller or the hardware device. Note that this parameter is a
-  /// variable-length device path structure and not a pointer to such a structure. This
-  /// structure is populated only if it is a physical device. For virtual devices, the Size
-  /// field in DataHeader is set to zero and this field is not populated.
-  ///
-  UINT8                                *DevicePath;
+  /// The device path to the controller or the hardware device. Note that this parameter is a 
+  /// variable-length device path structure and not a pointer to such a structure. This structure is
+  /// populated only if it is a physical device. For virtual devices, the Size field in DataHeader
+  /// is set to zero and this field is not populated.
+  ///
+  //  EFI_DEVICE_PATH_PROTOCOL         DevicePath;
 } EFI_DEVICE_PATH_EXTENDED_DATA;
 
@@ -224,19 +224,19 @@
   UINT16                             AllocResSize;
   ///
-  /// The device path to the controller or the hardware device that did not get the requested
-  /// resources. Note that this parameter is the variable-length device path structure and not
-  /// a pointer to this structure.
-  ///
-  UINT8                              *DevicePath;
+  /// The device path to the controller or the hardware device that did not get the requested 
+  /// resources. Note that this parameter is the variable-length device path structure and not 
+  /// a pointer to this structure. 
+  ///
+  //  EFI_DEVICE_PATH_PROTOCOL       DevicePath;
   ///
   /// The requested resources in the format of an ACPI 2.0 resource descriptor. This
   /// parameter is not a pointer; it is the complete resource descriptor.
   ///
-  UINT8                              *ReqRes;
-  ///
-  /// The allocated resources in the format of an ACPI 2.0 resource descriptor. This
+  //  UINT8                          ReqRes[];
+  ///
+  /// The allocated resources in the format of an ACPI 2.0 resource descriptor. This 
   /// parameter is not a pointer; it is the complete resource descriptor.
   ///
-  UINT8                              *AllocRes;
+  //  UINT8                          AllocRes[];
 } EFI_RESOURCE_ALLOC_FAILURE_ERROR_DATA;
 
@@ -753,9 +753,9 @@
   UINT16                         DevicePathSize;
   ///
-  /// Matches the RemainingDevicePath parameter being passed to the Start() 
-  /// function. Note that this parameter is the variable-length device path and not a pointer 
+  /// Matches the RemainingDevicePath parameter being passed to the Start() function. 
+  /// Note that this parameter is the variable-length device path and not a pointer 
   /// to the device path.
   ///  
-  UINT8                          *RemainingDevicePath;
+  //  EFI_DEVICE_PATH_PROTOCOL   RemainingDevicePath;
 } EFI_STATUS_CODE_START_EXTENDED_DATA;
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Guid/WinCertificate.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Guid/WinCertificate.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Guid/WinCertificate.h	(revision 58459)
@@ -2,5 +2,5 @@
   GUID for UEFI WIN_CERTIFICATE structure. 
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -75,5 +75,5 @@
   ///
   /// This is the standard WIN_CERTIFICATE header, where
-  /// wCertificateType is set to WIN_CERT_TYPE_UEFI_GUID. 
+  /// wCertificateType is set to WIN_CERT_TYPE_EFI_GUID. 
   ///                         
   WIN_CERTIFICATE   Hdr;
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ia32/ProcessorBind.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ia32/ProcessorBind.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ia32/ProcessorBind.h	(revision 58459)
@@ -2,5 +2,5 @@
   Processor or Compiler specific defines and types for IA-32 architecture.
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -94,4 +94,24 @@
 #pragma warning ( disable : 4206 )
 
+#if _MSC_VER == 1800
+
+//
+// Disable these warnings for VS2013.
+//
+
+//
+// This warning is for potentially uninitialized local variable, and it may cause false 
+// positive issues in VS2013 build
+//
+#pragma warning ( disable : 4701 )
+  
+//
+// This warning is for potentially uninitialized local pointer variable, and it may cause 
+// false positive issues in VS2013 build
+//
+#pragma warning ( disable : 4703 )
+  
+#endif
+
 #endif
 
@@ -148,5 +168,5 @@
   /// 1-byte signed value.
   ///
-  typedef char                INT8;
+  typedef signed char         INT8;
 #else  
   ///
@@ -195,5 +215,5 @@
   /// 1-byte signed value
   ///
-  typedef char                INT8;
+  typedef signed char         INT8;
 #endif
 
@@ -226,4 +246,10 @@
 ///
 #define MAX_ADDRESS   0xFFFFFFFF
+
+///
+/// Maximum legal IA-32 INTN and UINTN values.
+///
+#define MAX_INTN   ((INTN)0x7FFFFFFF)
+#define MAX_UINTN  ((UINTN)0xFFFFFFFF)
 
 ///
@@ -279,4 +305,8 @@
 #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
 
-#endif
-
+#ifndef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__ _
+#endif
+
+#endif
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/Acpi.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/Acpi.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/Acpi.h	(revision 58459)
@@ -3,5 +3,5 @@
   consumed by drivers that do not care about ACPI versions.
 
-  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -17,5 +17,5 @@
 #define _ACPI_H_
 
-#include <IndustryStandard/Acpi50.h>
+#include <IndustryStandard/Acpi60.h>
 
 #endif
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/Acpi50.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/Acpi50.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/Acpi50.h	(revision 58459)
@@ -1,6 +1,7 @@
 /** @file   
-  ACPI 5.0 definitions from the ACPI Specification Revision 5.0 December 6, 2011
-
-  Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
+  ACPI 5.0 definitions from the ACPI Specification Revision 5.0a November 13, 2013.
+
+  Copyright (c) 2014 Hewlett-Packard Development Company, L.P.<BR>
+  Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -161,5 +162,6 @@
 #define EFI_ACPI_5_0_EMBEDDED_CONTROLLER        3
 #define EFI_ACPI_5_0_SMBUS                      4
-#define EFI_ACPI_5_0_FUNCTIONAL_FIXED_HARDWARE  0x7F
+#define EFI_ACPI_5_0_PLATFORM_COMMUNICATION_CHANNEL  0x0A
+#define EFI_ACPI_5_0_FUNCTIONAL_FIXED_HARDWARE       0x7F
 
 //
@@ -1009,4 +1011,6 @@
 typedef struct {
   EFI_ACPI_5_0_PMMT_COMMON_MEMORY_AGGREGATOR_DEVICE_STRUCTURE  Header;
+  UINT16                                                       SocketIdentifier;
+  UINT16                                                       Reserved;
 //EFI_ACPI_5_0_PMMT_MEMORY_CONTROLLER_MEMORY_AGGREGATOR_DEVICE_STRUCTURE  MemoryController[];
 } EFI_ACPI_5_0_PMMT_SOCKET_MEMORY_AGGREGATOR_DEVICE_STRUCTURE;
@@ -1093,6 +1097,8 @@
 /// BGRT Status
 ///
-#define EFI_ACPI_5_0_BGRT_STATUS_INVALID  0x00
-#define EFI_ACPI_5_0_BGRT_STATUS_VALID    0x01
+#define EFI_ACPI_5_0_BGRT_STATUS_NOT_DISPLAYED 0x00
+#define EFI_ACPI_5_0_BGRT_STATUS_DISPLAYED     0x01
+#define EFI_ACPI_5_0_BGRT_STATUS_INVALID       EFI_ACPI_5_0_BGRT_STATUS_NOT_DISPLAYED
+#define EFI_ACPI_5_0_BGRT_STATUS_VALID         EFI_ACPI_5_0_BGRT_STATUS_DISPLAYED
 
 ///
@@ -1796,6 +1802,5 @@
   EFI_ACPI_DESCRIPTION_HEADER Header;
   UINT32                      Flags;
-  UINT32                      NominalLatency;
-  UINT32                      Reserved;
+  UINT64                      Reserved;
 } EFI_ACPI_5_0_PLATFORM_COMMUNICATION_CHANNEL_TABLE_HEADER;
 
@@ -1854,5 +1859,6 @@
   UINT8                                    SciDoorbell:1;
   UINT8                                    Error:1;
-  UINT8                                    Reserved:5;
+  UINT8                                    PlatformNotification:1;
+  UINT8                                    Reserved:4;
   UINT8                                    Reserved1;
 } EFI_ACPI_5_0_PCCT_GENERIC_SHARED_MEMORY_REGION_STATUS;
@@ -2019,4 +2025,9 @@
 
 ///
+/// "DRTM" Dynamic Root of Trust for Measurement Table
+///
+#define EFI_ACPI_5_0_DYNAMIC_ROOT_OF_TRUST_FOR_MEASUREMENT_TABLE_SIGNATURE  SIGNATURE_32('D', 'R', 'T', 'M')
+
+///
 /// "ETDT" Event Timer Description Table
 ///
@@ -2084,7 +2095,8 @@
 
 ///
-/// "WAET" Windows ACPI Enlightenment Table
-///
-#define EFI_ACPI_5_0_WINDOWS_ACPI_ENLIGHTENMENT_TABLE_SIGNATURE  SIGNATURE_32('W', 'A', 'E', 'T')
+/// "WAET" Windows ACPI Emulated Devices Table
+///
+#define EFI_ACPI_5_0_WINDOWS_ACPI_EMULATED_DEVICES_TABLE_SIGNATURE  SIGNATURE_32('W', 'A', 'E', 'T')
+#define EFI_ACPI_5_0_WINDOWS_ACPI_ENLIGHTENMENT_TABLE_SIGNATURE  EFI_ACPI_5_0_WINDOWS_ACPI_EMULATED_DEVICES_TABLE_SIGNATURE
 
 ///
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/Atapi.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/Atapi.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/Atapi.h	(revision 58459)
@@ -3,5 +3,5 @@
   that dealing with ATA/ATAPI interface.
 
-Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -103,5 +103,5 @@
   UINT16  field_validity;     
   UINT16  obsolete_54_58[5];     
-  UINT16  multi_sector_setting;     
+  UINT16  multi_sector_setting;
   UINT16  user_addressable_sectors_lo; 
   UINT16  user_addressable_sectors_hi; 
@@ -113,7 +113,12 @@
   UINT16  min_pio_cycle_time_without_flow_control; 
   UINT16  min_pio_cycle_time_with_flow_control; 
-  UINT16  reserved_69_74[6]; 
+  UINT16  additional_supported;                    ///< word 69
+  UINT16  reserved_70;
+  UINT16  reserved_71_74[4];                       ///< Reserved for IDENTIFY PACKET DEVICE cmd.
   UINT16  queue_depth;     
-  UINT16  reserved_76_79[4];                       ///< Reserved for Serial ATA.
+  UINT16  serial_ata_capabilities;
+  UINT16  reserved_77;                             ///< Reserved for Serial ATA
+  UINT16  serial_ata_features_supported;
+  UINT16  serial_ata_features_enabled;
   UINT16  major_version_no; 
   UINT16  minor_version_no; 
@@ -130,5 +135,5 @@
   UINT16  master_password_identifier;
   UINT16  hardware_configuration_test_result;
-  UINT16  acoustic_management_value;
+  UINT16  obsolete_94;
   UINT16  stream_minimum_request_size;
   UINT16  streaming_transfer_time_for_dma;
@@ -137,5 +142,5 @@
   UINT16  maximum_lba_for_48bit_addressing[4];     ///< word 100~103
   UINT16  streaming_transfer_time_for_pio;
-  UINT16  reserved_105;
+  UINT16  max_no_of_512byte_blocks_per_data_set_cmd;
   UINT16  phy_logic_sector_support;                ///< word 106
   UINT16  interseek_delay_for_iso7779;
@@ -152,5 +157,9 @@
   UINT16  vendor_specific_129_159[31]; 
   UINT16  cfa_power_mode;                          ///< word 160
-  UINT16  reserved_for_compactflash_161_175[15];
+  UINT16  reserved_for_compactflash_161_167[7];
+  UINT16  device_nominal_form_factor;
+  UINT16  is_data_set_cmd_supported;
+  CHAR8   additional_product_identifier[8];
+  UINT16  reserved_174_175[2];
   CHAR8   media_serial_number[60];                 ///< word 176~205
   UINT16  sct_command_transport;                   ///< word 206
@@ -162,6 +171,6 @@
   UINT16  nv_cache_size_in_logical_block_lsw;      ///< word 215
   UINT16  nv_cache_size_in_logical_block_msw;      ///< word 216
-  UINT16  nv_cache_read_speed;
-  UINT16  nv_cache_write_speed;
+  UINT16  nominal_media_rotation_rate;
+  UINT16  reserved_218;
   UINT16  nv_cache_options;                        ///< word 219
   UINT16  write_read_verify_mode;                  ///< word 220
@@ -169,5 +178,6 @@
   UINT16  transport_major_revision_number;
   UINT16  transport_minor_revision_number;
-  UINT16  reserved_224_233[10];
+  UINT16  reserved_224_229[6];
+  UINT64  extended_no_of_addressable_sectors;
   UINT16  min_number_per_download_microcode_mode3; ///< word 234
   UINT16  max_number_per_download_microcode_mode3; ///< word 235
@@ -207,6 +217,9 @@
   UINT16  obsolete_71_72[2];
   UINT16  reserved_73_74[2];
-  UINT16  queue_depth;
-  UINT16  reserved_76_79[4];
+  UINT16  obsolete_75;
+  UINT16  serial_ata_capabilities;
+  UINT16  reserved_77;                             ///< Reserved for Serial ATA
+  UINT16  serial_ata_features_supported;
+  UINT16  serial_ata_features_enabled;
   UINT16  major_version_no;                        ///< word 80
   UINT16  minor_version_no;                        ///< word 81
@@ -220,19 +233,24 @@
   UINT16  time_required_for_sec_erase;             ///< word 89
   UINT16  time_required_for_enhanced_sec_erase;    ///< word 90
-  UINT16  reserved_91;
+  UINT16  advanced_power_management_level;
   UINT16  master_pwd_revison_code;
   UINT16  hardware_reset_result;                   ///< word 93
-  UINT16  current_auto_acoustic_mgmt_value;
+  UINT16  obsolete_94;
   UINT16  reserved_95_107[13];
   UINT16  world_wide_name[4];                      ///< word 108~111
   UINT16  reserved_for_128bit_wwn_112_115[4];
-  UINT16  reserved_116_124[9];
+  UINT16  reserved_116_118[3];  
+  UINT16  command_and_feature_sets_supported;      ///< word 119
+  UINT16  command_and_feature_sets_supported_enabled;
+  UINT16  reserved_121_124[4];
   UINT16  atapi_byte_count_0_behavior;             ///< word 125
-  UINT16  obsolete_126;
-  UINT16  removable_media_status_notification_support;
+  UINT16  obsolete_126_127[2];
   UINT16  security_status;
-  UINT16  reserved_129_160[32];
-  UINT16  cfa_reserved_161_175[15];
-  UINT16  reserved_176_254[79];
+  UINT16  reserved_129_159[31];
+  UINT16  cfa_reserved_160_175[16];
+  UINT16  reserved_176_221[46];
+  UINT16  transport_major_version;
+  UINT16  transport_minor_version;
+  UINT16  reserved_224_254[31];
   UINT16  integrity_word;
 } ATAPI_IDENTIFY_DATA;
@@ -473,4 +491,16 @@
 #define ATA_CMD_READ_10                     0x28   ///< defined in ATAPI Removable Rewritable Media Devcies
 #define ATA_CMD_WRITE_10                    0x2A   ///< defined in ATAPI Removable Rewritable Media Devcies
+#define ATA_CMD_READ_12                     0xA8   ///< defined in ATAPI Removable Rewritable Media Devcies
+#define ATA_CMD_WRITE_12                    0xAA   ///< defined in ATAPI Removable Rewritable Media Devcies
+#define ATA_CMD_START_STOP_UNIT             0x1B   ///< defined in ATAPI Removable Rewritable Media Devcies
+///
+/// Start/Stop and Eject Operations
+///
+///@{
+#define   ATA_CMD_SUBOP_STOP_DISC           0x00   ///< Stop the Disc
+#define   ATA_CMD_SUBOP_START_DISC          0x01   ///< Start the Disc and acquire the format type
+#define   ATA_CMD_SUBOP_EJECT_DISC          0x02   ///< Eject the Disc if possible
+#define   ATA_CMD_SUBOP_CLOSE_TRAY          0x03   ///< Load the Disc (Close Tray)
+///@}
 
 //
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/IScsiBootFirmwareTable.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/IScsiBootFirmwareTable.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/IScsiBootFirmwareTable.h	(revision 58459)
@@ -3,5 +3,5 @@
   iSCSI Boot Firmware Table(iBFT) as Defined in ACPI 3.0b Specification. 
   
-  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -158,4 +158,8 @@
 #define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_FLAG_RADIUS_RCHAP     BIT3
 
+#define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_CHAP_TYPE_NO_CHAP        0
+#define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_CHAP_TYPE_CHAP           1
+#define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_CHAP_TYPE_MUTUAL_CHAP    2
+
 #pragma pack()
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/Pal.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/Pal.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/Pal.h	(revision 58459)
@@ -2,5 +2,5 @@
   Main PAL API's defined in Intel Itanium Architecture Software Developer's Manual.
 
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -992,5 +992,5 @@
   UINT64  ThreadsPerCore:8;                 ///< Number of threads per core.
   UINT64  Reserved1:8;
-  UINT64  CoresPerProcessor;                ///< Total number of cores on this
+  UINT64  CoresPerProcessor:8;              ///< Total number of cores on this
                                             ///< physical processor package.
   UINT64  Reserved2:8;
@@ -2709,7 +2709,8 @@
                                     ///<  Error structure hierarchy level-4
                                     ///<  All other values are reserved.
-                                    ///<  Reserved 63:16 Reserved
-
-  UINT64  Reserved:48;
+
+  UINT64  Reserved:32;              ///< Reserved 47:16 Reserved
+
+  UINT64  ImplSpec:16;              ///< Bit63:48, Processor specific error injection capabilities.
 } PAL_MC_ERROR_TYPE_INFO;
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/Pci.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/Pci.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/Pci.h	(revision 58459)
@@ -2,5 +2,5 @@
   Support for the latest PCI standard.
 
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -11,7 +11,4 @@
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.                                            
 
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             
-
 **/
 
@@ -21,4 +18,6 @@
 #include <IndustryStandard/Pci30.h>
 #include <IndustryStandard/PciExpress21.h>
+#include <IndustryStandard/PciExpress30.h>
+#include <IndustryStandard/PciCodeId.h>
 
 #endif
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/Pci22.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/Pci22.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/Pci22.h	(revision 58459)
@@ -7,5 +7,8 @@
     PC Card Standard, 8.0
 
-  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+  
+
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -220,5 +223,5 @@
 #define     PCI_IF_16650_MODEM            0x03
 #define     PCI_IF_16750_MODEM            0x04
-#define   PCI_SUBCLASS_SCC_OTHER          0x80
+#define   PCI_SUBCLASS_SCC_OTHER        0x80
 
 #define PCI_CLASS_SYSTEM_PERIPHERAL   0x08
@@ -239,5 +242,5 @@
 #define   PCI_SUBCLASS_RTC              0x03
 #define     PCI_IF_GENERIC_RTC            0x00
-#define     PCI_IF_ISA_RTC                0x00
+#define     PCI_IF_ISA_RTC                0x01
 #define   PCI_SUBCLASS_PNP_CONTROLLER   0x04    ///< HotPlug Controller
 #define   PCI_SUBCLASS_PERIPHERAL_OTHER 0x80
@@ -250,8 +253,10 @@
 #define   PCI_SUBCLASS_GAMEPORT         0x04
 #define     PCI_IF_GAMEPORT               0x00
-#define     PCI_IF_GAMEPORT1              0x01
+#define     PCI_IF_GAMEPORT1              0x10
 #define   PCI_SUBCLASS_INPUT_OTHER      0x80
 
 #define PCI_CLASS_DOCKING_STATION     0x0A
+#define   PCI_SUBCLASS_DOCKING_GENERIC  0x00
+#define   PCI_SUBCLASS_DOCKING_OTHER    0x80
 
 #define PCI_CLASS_PROCESSOR           0x0B
@@ -281,5 +286,5 @@
 #define   PCI_SUBCLASS_IRDA             0x00
 #define   PCI_SUBCLASS_IR               0x01
-#define   PCI_SUBCLASS_RF               0x02
+#define   PCI_SUBCLASS_RF               0x10
 #define   PCI_SUBCLASS_WIRELESS_OTHER   0x80
 
@@ -654,4 +659,40 @@
 
 ///
+/// PMC - Power Management Capabilities
+/// Section 3.2.3, PCI Power Management Interface Specifiction, Revision 1.2
+///
+typedef union {
+  struct {
+    UINT16 Version : 3;
+    UINT16 PmeClock : 1;
+    UINT16 : 1;
+    UINT16 DeviceSpecificInitialization : 1;
+    UINT16 AuxCurrent : 3;
+    UINT16 D1Support : 1;
+    UINT16 D2Support : 1;
+    UINT16 PmeSupport : 5;
+  } Bits;
+  UINT16 Data;
+} EFI_PCI_PMC;
+
+#define EFI_PCI_PMC_D3_COLD_MASK    (BIT15)
+
+///
+/// PMCSR - Power Management Control/Status
+/// Section 3.2.4, PCI Power Management Interface Specifiction, Revision 1.2
+///
+typedef union {
+  struct {
+    UINT16 PowerState : 2;
+    UINT16 : 6;
+    UINT16 PmeEnable : 1;
+    UINT16 DataSelect : 4;
+    UINT16 DataScale : 2;
+    UINT16 PmeStatus : 1;
+  } Bits;
+  UINT16 Data;
+} EFI_PCI_PMCSR;
+
+///
 /// A.G.P Capability
 /// Section 6.1.4, Accelerated Graphics Port Interface Specification, Revision 1.0
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/Pci23.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/Pci23.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/Pci23.h	(revision 58459)
@@ -2,5 +2,5 @@
   Support for PCI 2.3 standard.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -28,4 +28,30 @@
 
 ///
+/// PCI_CLASS_NETWORK, Base Class 02h.
+///
+///@{
+#define PCI_CLASS_NETWORK_WORLDFIP              0x05
+#define PCI_CLASS_NETWORK_PICMG_MULTI_COMPUTING 0x06
+///@}
+
+///
+/// PCI_CLASS_BRIDGE, Base Class 06h.
+///
+///@{
+#define PCI_CLASS_BRIDGE_SEMI_TRANSPARENT_P2P        0x09
+#define   PCI_IF_BRIDGE_SEMI_TRANSPARENT_P2P_PRIMARY   0x40
+#define   PCI_IF_BRIDGE_SEMI_TRANSPARENT_P2P_SECONDARY 0x80
+#define PCI_CLASS_BRIDGE_INFINIBAND_TO_PCI           0x0A
+///@}
+
+///
+/// PCI_CLASS_SCC, Base Class 07h.
+///
+///@{
+#define PCI_SUBCLASS_GPIB          0x04
+#define PCI_SUBCLASS_SMART_CARD    0x05
+///@}
+
+///
 /// PCI_CLASS_SERIAL, Base Class 0Ch.
 ///
@@ -33,4 +59,27 @@
 #define   PCI_IF_EHCI                      0x20
 #define PCI_CLASS_SERIAL_IB              0x06
+#define PCI_CLASS_SERIAL_IPMI            0x07
+#define   PCI_IF_IPMI_SMIC                 0x00
+#define   PCI_IF_IPMI_KCS                  0x01 ///< Keyboard Controller Style
+#define   PCI_IF_IPMI_BT                   0x02 ///< Block Transfer
+#define PCI_CLASS_SERIAL_SERCOS          0x08
+#define PCI_CLASS_SERIAL_CANBUS          0x09
+///@}
+
+///
+/// PCI_CLASS_WIRELESS, Base Class 0Dh.
+///
+///@{
+#define PCI_SUBCLASS_BLUETOOTH    0x11
+#define PCI_SUBCLASS_BROADBAND    0x12
+///@}
+
+///
+/// PCI_CLASS_DPIO, Base Class 11h.
+///
+///@{
+#define PCI_SUBCLASS_PERFORMANCE_COUNTERS          0x01
+#define PCI_SUBCLASS_COMMUNICATION_SYNCHRONIZATION 0x10
+#define PCI_SUBCLASS_MANAGEMENT_CARD               0x20
 ///@}
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/Pci30.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/Pci30.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/Pci30.h	(revision 58459)
@@ -2,5 +2,5 @@
   Support for PCI 3.0 standard.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -20,11 +20,21 @@
 
 ///
-/// Definitions of PCI class bytes and manipulation macros.
+/// PCI_CLASS_MASS_STORAGE, Base Class 01h.
 ///
+///@{
 #define PCI_CLASS_MASS_STORAGE_SATADPA   0x06
 #define   PCI_IF_MASS_STORAGE_SATA         0x00
 #define   PCI_IF_MASS_STORAGE_AHCI         0x01
+///@}
 
-/**  
+///
+/// PCI_CLASS_WIRELESS, Base Class 0Dh.
+///
+///@{
+#define PCI_SUBCLASS_ETHERNET_80211A    0x20
+#define PCI_SUBCLASS_ETHERNET_80211B    0x21
+///@}
+
+/**
   Macro that checks whether device is a SATA controller.
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/PciExpress21.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/PciExpress21.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/PciExpress21.h	(revision 58459)
@@ -2,5 +2,5 @@
   Support for the latest PCI standard.
 
-  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -71,3 +71,221 @@
 #define EFI_PCIE_CAPABILITY_ID_SRIOV_VF_MIGRATION_STATE         0x3C
 
+typedef struct {
+  UINT32 CapabilityId:16;
+  UINT32 CapabilityVersion:4;
+  UINT32 NextCapabilityOffset:12;
+} PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER;
+
+#define PCI_EXP_EXT_HDR PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER
+
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_ADVANCED_ERROR_REPORTING_ID   0x0001
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_ADVANCED_ERROR_REPORTING_VER1 0x1
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_ADVANCED_ERROR_REPORTING_VER2 0x2
+
+typedef struct {
+  PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER  Header;
+  UINT32                                    UncorrectableErrorStatus;
+  UINT32                                    UncorrectableErrorMask;
+  UINT32                                    UncorrectableErrorSeverity;
+  UINT32                                    CorrectableErrorStatus;
+  UINT32                                    CorrectableErrorMask;
+  UINT32                                    AdvancedErrorCapabilitiesAndControl;
+  UINT32                                    HeaderLog;
+  UINT32                                    RootErrorCommand;
+  UINT32                                    RootErrorStatus;
+  UINT16                                    ErrorSourceIdentification;
+  UINT16                                    CorrectableErrorSourceIdentification;
+  UINT32                                    TlpPrefixLog[4];
+} PCI_EXPRESS_EXTENDED_CAPABILITIES_ADVANCED_ERROR_REPORTING;
+
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_VIRTUAL_CHANNEL_ID    0x0002
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_VIRTUAL_CHANNEL_MFVC  0x0009
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_VIRTUAL_CHANNEL_VER1  0x1
+
+typedef struct {
+  UINT32                                    VcResourceCapability:24;
+  UINT32                                    PortArbTableOffset:8;
+  UINT32                                    VcResourceControl;
+  UINT16                                    Reserved1;
+  UINT16                                    VcResourceStatus;
+} PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_VC;
+
+typedef struct {
+  PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER              Header;
+  UINT32                                                ExtendedVcCount:3;
+  UINT32                                                PortVcCapability1:29;
+  UINT32                                                PortVcCapability2:24;
+  UINT32                                                VcArbTableOffset:8;
+  UINT16                                                PortVcControl;
+  UINT16                                                PortVcStatus;
+  PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_VC  Capability[1];
+} PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_CAPABILITY;
+
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_SERIAL_NUMBER_ID    0x0003
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_SERIAL_NUMBER_VER1  0x1
+
+typedef struct {
+  PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER  Header;
+  UINT64                                    SerialNumber;
+} PCI_EXPRESS_EXTENDED_CAPABILITIES_SERIAL_NUMBER;
+
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_DECLARATION_ID   0x0005
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_DECLARATION_VER1 0x1
+
+typedef struct {
+  PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER  Header;
+  UINT32                                    ElementSelfDescription;
+  UINT32                                    Reserved;
+  UINT32                                    LinkEntry[1];
+} PCI_EXPRESS_EXTENDED_CAPABILITIES_LINK_DECLARATION;
+
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_DECLARATION_GET_LINK_COUNT(LINK_DECLARATION) (UINT8)(((LINK_DECLARATION->ElementSelfDescription)&0x0000ff00)>>8)
+
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_CONTROL_ID   0x0006
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_CONTROL_VER1 0x1
+
+typedef struct {
+  PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER  Header;
+  UINT32                                    RootComplexLinkCapabilities;
+  UINT16                                    RootComplexLinkControl;
+  UINT16                                    RootComplexLinkStatus;
+} PCI_EXPRESS_EXTENDED_CAPABILITIES_INTERNAL_LINK_CONTROL;
+
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_POWER_BUDGETING_ID   0x0004
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_POWER_BUDGETING_VER1 0x1
+
+typedef struct {
+  PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER  Header;
+  UINT32                                    DataSelect:8;
+  UINT32                                    Reserved:24;
+  UINT32                                    Data;
+  UINT32                                    PowerBudgetCapability:1;
+  UINT32                                    Reserved2:7;
+  UINT32                                    Reserved3:24;
+} PCI_EXPRESS_EXTENDED_CAPABILITIES_POWER_BUDGETING;
+
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_ACS_EXTENDED_ID   0x000D
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_ACS_EXTENDED_VER1 0x1
+
+typedef struct {
+  PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER  Header;
+  UINT16                                    AcsCapability;
+  UINT16                                    AcsControl;
+  UINT8                                     EgressControlVectorArray[1];
+} PCI_EXPRESS_EXTENDED_CAPABILITIES_ACS_EXTENDED;
+
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_ACS_EXTENDED_GET_EGRES_CONTROL(ACS_EXTENDED) (UINT8)(((ACS_EXTENDED->AcsCapability)&0x00000020))
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_ACS_EXTENDED_GET_EGRES_VECTOR_SIZE(ACS_EXTENDED) (UINT8)(((ACS_EXTENDED->AcsCapability)&0x0000FF00))
+
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION_ID   0x0007
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION_VER1 0x1
+
+typedef struct {
+  PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER  Header;
+  UINT32                                    AssociationBitmap;
+} PCI_EXPRESS_EXTENDED_CAPABILITIES_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION;
+
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_MULTI_FUNCTION_VIRTUAL_CHANNEL_ID    0x0008
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_MULTI_FUNCTION_VIRTUAL_CHANNEL_VER1  0x1
+
+typedef PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_CAPABILITY PCI_EXPRESS_EXTENDED_CAPABILITIES_MULTI_FUNCTION_VIRTUAL_CHANNEL_CAPABILITY;
+
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_VENDOR_SPECIFIC_ID   0x000B
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_VENDOR_SPECIFIC_VER1 0x1
+
+typedef struct {
+  PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER  Header;
+  UINT32                                    VendorSpecificHeader;
+  UINT8                                     VendorSpecific[1];
+} PCI_EXPRESS_EXTENDED_CAPABILITIES_VENDOR_SPECIFIC;
+
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_VENDOR_SPECIFIC_GET_SIZE(VENDOR) (UINT16)(((VENDOR->VendorSpecificHeader)&0xFFF00000)>>20)
+
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_RCRB_HEADER_ID   0x000A
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_RCRB_HEADER_VER1 0x1
+
+typedef struct {
+  PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER  Header;
+  UINT16                                    VendorId;
+  UINT16                                    DeviceId;
+  UINT32                                    RcrbCapabilities;
+  UINT32                                    RcrbControl;
+  UINT32                                    Reserved;
+} PCI_EXPRESS_EXTENDED_CAPABILITIES_RCRB_HEADER;
+
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_MULTICAST_ID   0x0012
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_MULTICAST_VER1 0x1
+
+typedef struct {
+  PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER  Header;
+  UINT16                                    MultiCastCapability;
+  UINT16                                    MulticastControl;
+  UINT64                                    McBaseAddress;
+  UINT64                                    McReceiveAddress;
+  UINT64                                    McBlockAll;
+  UINT64                                    McBlockUntranslated;
+  UINT64                                    McOverlayBar;
+} PCI_EXPRESS_EXTENDED_CAPABILITIES_MULTICAST;
+
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_RESIZABLE_BAR_ID    0x0015
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_RESIZABLE_BAR_VER1  0x1
+
+typedef struct {
+  UINT32                                                 ResizableBarCapability;
+  UINT16                                                 ResizableBarControl;
+  UINT16                                                 Reserved;
+} PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_ENTRY;
+
+typedef struct {
+  PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER               Header;
+  PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_ENTRY  Capability[1];
+} PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR;
+
+#define GET_NUMBER_RESIZABLE_BARS(x) (((x->Capability[0].ResizableBarControl) & 0xE0) >> 5)
+
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_ARI_CAPABILITY_ID    0x000E
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_ARI_CAPABILITY_VER1  0x1
+
+typedef struct {
+  PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER                Header;
+  UINT16                                                  AriCapability;
+  UINT16                                                  AriControl;
+} PCI_EXPRESS_EXTENDED_CAPABILITIES_ARI_CAPABILITY;
+
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_DYNAMIC_POWER_ALLOCATION_ID    0x0016
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_DYNAMIC_POWER_ALLOCATION_VER1  0x1
+
+typedef struct {
+  PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER                Header;
+  UINT32                                                  DpaCapability;
+  UINT32                                                  DpaLatencyIndicator;
+  UINT16                                                  DpaStatus;
+  UINT16                                                  DpaControl;
+  UINT8                                                   DpaPowerAllocationArray[1];
+} PCI_EXPRESS_EXTENDED_CAPABILITIES_DYNAMIC_POWER_ALLOCATION;
+
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_DYNAMIC_POWER_ALLOCATION_GET_SUBSTATE_MAX(POWER) (UINT16)(((POWER->DpaCapability)&0x0000000F))
+
+
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_LATENCE_TOLERANCE_REPORTING_ID    0x0018
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_LATENCE_TOLERANCE_REPORTING_VER1  0x1
+
+typedef struct {
+  PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER                Header;
+  UINT16                                                  MaxSnoopLatency;
+  UINT16                                                  MaxNoSnoopLatency;
+} PCI_EXPRESS_EXTENDED_CAPABILITIES_LATENCE_TOLERANCE_REPORTING;
+
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_TPH_ID    0x0017
+#define PCI_EXPRESS_EXTENDED_CAPABILITY_TPH_VER1  0x1
+
+typedef struct {
+  PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER                Header;
+  UINT32                                                  TphRequesterCapability;
+  UINT32                                                  TphRequesterControl;
+  UINT16                                                  TphStTable[1];
+} PCI_EXPRESS_EXTENDED_CAPABILITIES_TPH;
+
+#define GET_TPH_TABLE_SIZE(x) ((x->TphRequesterCapability & 0x7FF0000)>>16) * sizeof(UINT16)
+
 #endif
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/PeImage.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/PeImage.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/PeImage.h	(revision 58459)
@@ -5,5 +5,5 @@
 
   This file is coded to the Visual Studio, Microsoft Portable Executable and 
-  Common Object File Format Specification, Revision 8.0 - May 16, 2006. 
+  Common Object File Format Specification, Revision 8.3 - February 6, 2013.
   This file also includes some definitions in PI Specification, Revision 1.0.
 
@@ -40,4 +40,5 @@
 #define IMAGE_FILE_MACHINE_X64             0x8664
 #define IMAGE_FILE_MACHINE_ARMTHUMB_MIXED  0x01c2
+#define IMAGE_FILE_MACHINE_ARM64           0xAA64
 
 //
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/SerialPortConsoleRedirectionTable.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/SerialPortConsoleRedirectionTable.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/SerialPortConsoleRedirectionTable.h	(revision 58459)
@@ -3,5 +3,5 @@
   http://www.microsoft.com/whdc/system/platform/server/spcr.mspx
     
-  Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -97,6 +97,6 @@
 #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_9600         3
 #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_19200        4
-#define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_57600        5
-#define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_115200       6
+#define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_57600        6
+#define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_115200       7
 
 //
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/SmBios.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/SmBios.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/SmBios.h	(revision 58459)
@@ -1,6 +1,6 @@
 /** @file
-  Industry Standard Definitions of SMBIOS Table Specification v2.7.1
-
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+  Industry Standard Definitions of SMBIOS Table Specification v3.0.0.
+
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -72,4 +72,17 @@
   UINT8   SmbiosBcdRevision;
 } SMBIOS_TABLE_ENTRY_POINT;
+
+typedef struct {
+  UINT8   AnchorString[5];
+  UINT8   EntryPointStructureChecksum;
+  UINT8   EntryPointLength;
+  UINT8   MajorVersion;
+  UINT8   MinorVersion;
+  UINT8   DocRev;
+  UINT8   EntryPointRevision;
+  UINT8   Reserved;
+  UINT32  TableMaximumSize;
+  UINT64  TableAddress;
+} SMBIOS_TABLE_3_0_ENTRY_POINT;
 
 ///
@@ -302,5 +315,8 @@
   MiscChassisAdvancedTCA              = 0x1B,
   MiscChassisBlade                    = 0x1C,
-  MiscChassisBladeEnclosure           = 0x1D
+  MiscChassisBladeEnclosure           = 0x1D,
+  MiscChassisTablet                   = 0x1E,
+  MiscChassisConvertible              = 0x1F,
+  MiscChassisDetachable               = 0x20
 } MISC_CHASSIS_TYPE;
 
@@ -423,5 +439,6 @@
   ProcessorFamilyIntelCoreSoloMobile    = 0x2A,
   ProcessorFamilyIntelAtom              = 0x2B,
-  ProcessorFamilyAlpha3                 = 0x30,
+  ProcessorFamilyIntelCoreM             = 0x2C,
+  ProcessorFamilyAlpha                  = 0x30,
   ProcessorFamilyAlpha21064             = 0x31,
   ProcessorFamilyAlpha21066             = 0x32,
@@ -438,4 +455,5 @@
   ProcessorFamilyAmdOpteron6200Series   = 0x3D,
   ProcessorFamilyAmdOpteron4200Series   = 0x3E,
+  ProcessorFamilyAmdFxSeries            = 0x3F,
   ProcessorFamilyMips                   = 0x40,
   ProcessorFamilyMIPSR4000              = 0x41,
@@ -446,6 +464,12 @@
   ProcessorFamilyAmdCSeries             = 0x46,
   ProcessorFamilyAmdESeries             = 0x47,
-  ProcessorFamilyAmdSSeries             = 0x48,
+  ProcessorFamilyAmdASeries             = 0x48,    ///< SMBIOS spec 2.8.0 updated the name
   ProcessorFamilyAmdGSeries             = 0x49,
+  ProcessorFamilyAmdZSeries             = 0x4A,
+  ProcessorFamilyAmdRSeries             = 0x4B,
+  ProcessorFamilyAmdOpteron4300         = 0x4C,
+  ProcessorFamilyAmdOpteron6300         = 0x4D,
+  ProcessorFamilyAmdOpteron3300         = 0x4E,
+  ProcessorFamilyAmdFireProSeries       = 0x4F,
   ProcessorFamilySparc                  = 0x50,
   ProcessorFamilySuperSparc             = 0x51,
@@ -454,5 +478,5 @@
   ProcessorFamilyUltraSparc             = 0x54,
   ProcessorFamilyUltraSparcII           = 0x55,
-  ProcessorFamilyUltraSparcIIi          = 0x56,
+  ProcessorFamilyUltraSparcIii          = 0x56,
   ProcessorFamilyUltraSparcIII          = 0x57,
   ProcessorFamilyUltraSparcIIIi         = 0x58,
@@ -463,4 +487,7 @@
   ProcessorFamily68020                  = 0x64,
   ProcessorFamily68030                  = 0x65,
+  ProcessorFamilyAmdAthlonX4QuadCore    = 0x66,
+  ProcessorFamilyAmdOpteronX1000Series  = 0x67,
+  ProcessorFamilyAmdOpteronX2000Series  = 0x68,
   ProcessorFamilyHobbit                 = 0x70,
   ProcessorFamilyCrusoeTM5000           = 0x78,
@@ -518,5 +545,5 @@
   ProcessorFamilyIntelPentiumD          = 0xBB,
   ProcessorFamilyIntelPentiumEx         = 0xBC,
-  ProcessorFamilyIntelCoreSolo          = 0xBD,  ///< SMBIOS spec 2.6 correct this value
+  ProcessorFamilyIntelCoreSolo          = 0xBD,  ///< SMBIOS spec 2.6 updated this value
   ProcessorFamilyReserved               = 0xBE,
   ProcessorFamilyIntelCore2             = 0xBF,
@@ -533,5 +560,5 @@
   ProcessorFamilyG5                     = 0xCA,
   ProcessorFamilyG6                     = 0xCB,
-  ProcessorFamilyzArchitectur           = 0xCC,
+  ProcessorFamilyzArchitecture          = 0xCC,
   ProcessorFamilyIntelCoreI5            = 0xCD,
   ProcessorFamilyIntelCoreI3            = 0xCE,
@@ -550,4 +577,6 @@
   ProcessorFamilyMultiCoreIntelXeon7Series    = 0xDF,
   ProcessorFamilyMultiCoreIntelXeon3400Series = 0xE0,
+  ProcessorFamilyAmdOpteron3000Series         = 0xE4,
+  ProcessorFamilyAmdSempronII                 = 0xE5,
   ProcessorFamilyEmbeddedAmdOpteronQuadCore   = 0xE6,
   ProcessorFamilyAmdPhenomTripleCore          = 0xE7,
@@ -565,4 +594,20 @@
   ProcessorFamilyReserved1              = 0xFF
 } PROCESSOR_FAMILY_DATA;
+
+///
+/// Processor Information2 - Processor Family2.
+///
+typedef enum {
+  ProcessorFamilySH3                   = 0x0104,
+  ProcessorFamilySH4                   = 0x0105,
+  ProcessorFamilyARM                   = 0x0118,
+  ProcessorFamilyStrongARM             = 0x0119,
+  ProcessorFamily6x86                  = 0x012C,
+  ProcessorFamilyMediaGX               = 0x012D,
+  ProcessorFamilyMII                   = 0x012E,
+  ProcessorFamilyWinChip               = 0x0140,
+  ProcessorFamilyDSP                   = 0x015E,
+  ProcessorFamilyVideoProcessor        = 0x01F4
+} PROCESSOR_FAMILY2_DATA;
 
 ///
@@ -617,5 +662,5 @@
   ProcessorUpgradeSocketBGA1023 = 0x22,
   ProcessorUpgradeSocketBGA1224 = 0x23,
-  ProcessorUpgradeSocketBGA1155 = 0x24,
+  ProcessorUpgradeSocketLGA1155 = 0x24,  ///< SMBIOS spec 2.8.0 updated the name
   ProcessorUpgradeSocketLGA1356 = 0x25,
   ProcessorUpgradeSocketLGA2011 = 0x26,
@@ -623,5 +668,11 @@
   ProcessorUpgradeSocketFS2     = 0x28,
   ProcessorUpgradeSocketFM1     = 0x29,
-  ProcessorUpgradeSocketFM2     = 0x2A
+  ProcessorUpgradeSocketFM2     = 0x2A,
+  ProcessorUpgradeSocketLGA2011_3 = 0x2B,
+  ProcessorUpgradeSocketLGA1356_3 = 0x2C,
+  ProcessorUpgradeSocketLGA1150   = 0x2D,
+  ProcessorUpgradeSocketBGA1168   = 0x2E,
+  ProcessorUpgradeSocketBGA1234   = 0x2F,
+  ProcessorUpgradeSocketBGA1364   = 0x30
 } PROCESSOR_UPGRADE;
 
@@ -719,4 +770,10 @@
   //
   UINT16                ProcessorFamily2;
+  //
+  // Add for smbios 3.0
+  //
+  UINT16                CoreCount2;
+  UINT16                EnabledCoreCount2;
+  UINT16                ThreadCount2;
 } SMBIOS_TABLE_TYPE4;
 
@@ -1052,5 +1109,18 @@
   SlotTypeAgp4X                        = 0x11,
   SlotTypePciX                         = 0x12,
-  SlotTypeAgp4x                        = 0x13,
+  SlotTypeAgp8X                        = 0x13,
+  SlotTypeM2Socket1_DP                 = 0x14,
+  SlotTypeM2Socket1_SD                 = 0x15,
+  SlotTypeM2Socket2                    = 0x16,
+  SlotTypeM2Socket3                    = 0x17,
+  SlotTypeMxmTypeI                     = 0x18,
+  SlotTypeMxmTypeII                    = 0x19,
+  SlotTypeMxmTypeIIIStandard           = 0x1A,
+  SlotTypeMxmTypeIIIHe                 = 0x1B,
+  SlotTypeMxmTypeIV                    = 0x1C,
+  SlotTypeMxm30TypeA                   = 0x1D,
+  SlotTypeMxm30TypeB                   = 0x1E,
+  SlotTypePciExpressGen2Sff_8639       = 0x1F,
+  SlotTypePciExpressGen3Sff_8639       = 0x20,
   SlotTypePC98C20                      = 0xA0,
   SlotTypePC98C24                      = 0xA1,
@@ -1451,5 +1521,10 @@
   MemoryTypeDdr2FbDimm                     = 0x14,
   MemoryTypeDdr3                           = 0x18,
-  MemoryTypeFbd2                           = 0x19
+  MemoryTypeFbd2                           = 0x19,
+  MemoryTypeDdr4                           = 0x1A,
+  MemoryTypeLpddr                          = 0x1B,
+  MemoryTypeLpddr2                         = 0x1C,
+  MemoryTypeLpddr3                         = 0x1D,
+  MemoryTypeLpddr4                         = 0x1E
 } MEMORY_DEVICE_TYPE;
 
@@ -1470,5 +1545,5 @@
   UINT16    Registered      :1;
   UINT16    Unbuffered      :1;
-  UINT16    Reserved1       :1;
+  UINT16    LrDimm          :1;
 } MEMORY_DEVICE_TYPE_DETAIL;
 
@@ -1509,4 +1584,10 @@
   UINT32                    ExtendedSize;
   UINT16                    ConfiguredMemoryClockSpeed;
+  //
+  // Add for smbios 2.8.0
+  //
+  UINT16                    MinimumVoltage;
+  UINT16                    MaximumVoltage;
+  UINT16                    ConfiguredVoltage;
 } SMBIOS_TABLE_TYPE17;
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/UefiTcgPlatform.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/UefiTcgPlatform.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/IndustryStandard/UefiTcgPlatform.h	(revision 58459)
@@ -2,5 +2,5 @@
   TCG EFI Platform Definition in TCG_EFI_Platform_1_20_Final
 
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -26,4 +26,6 @@
 #define EV_S_CRTM_CONTENTS          ((TCG_EVENTTYPE) 0x00000007)
 #define EV_S_CRTM_VERSION           ((TCG_EVENTTYPE) 0x00000008)
+#define EV_CPU_MICROCODE            ((TCG_EVENTTYPE) 0x00000009)
+#define EV_TABLE_OF_DEVICES         ((TCG_EVENTTYPE) 0x0000000B)
 
 //
@@ -51,4 +53,23 @@
 #define EFI_EXIT_BOOT_SERVICES_SUCCEEDED    \
   "Exit Boot Services Returned with Success"
+
+
+#define EV_POSTCODE_INFO_POST_CODE    "POST CODE"
+#define POST_CODE_STR_LEN             (sizeof(EV_POSTCODE_INFO_POST_CODE) - 1)
+
+#define EV_POSTCODE_INFO_SMM_CODE     "SMM CODE"
+#define SMM_CODE_STR_LEN              (sizeof(EV_POSTCODE_INFO_SMM_CODE) - 1)
+
+#define EV_POSTCODE_INFO_ACPI_DATA    "ACPI DATA"
+#define ACPI_DATA_LEN                 (sizeof(EV_POSTCODE_INFO_ACPI_DATA) - 1)
+
+#define EV_POSTCODE_INFO_BIS_CODE     "BIS CODE"
+#define BIS_CODE_LEN                  (sizeof(EV_POSTCODE_INFO_BIS_CODE) - 1)
+
+#define EV_POSTCODE_INFO_UEFI_PI      "UEFI PI"
+#define UEFI_PI_LEN                   (sizeof(EV_POSTCODE_INFO_UEFI_PI) - 1)
+
+#define EV_POSTCODE_INFO_OPROM        "Embedded Option ROM"
+#define OPROM_LEN                     (sizeof(EV_POSTCODE_INFO_OPROM) - 1)
 
 //
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ipf/ProcessorBind.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ipf/ProcessorBind.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ipf/ProcessorBind.h	(revision 58459)
@@ -2,5 +2,5 @@
   Processor or Compiler specific defines and types for Intel Itanium(TM) processors.
 
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available 
 under the terms and conditions of the BSD License which accompanies this
@@ -157,5 +157,5 @@
   /// 1-byte signed value.
   ///
-  typedef char                INT8;
+  typedef signed char         INT8;
 #else
   ///
@@ -204,5 +204,5 @@
   /// 1-byte signed value.
   ///
-  typedef char                INT8;
+  typedef signed char         INT8;
 #endif
 
@@ -236,4 +236,10 @@
 ///
 #define MAX_ADDRESS   0xFFFFFFFFFFFFFFFFULL
+
+///
+/// Maximum legal Itanium-based INTN and UINTN values.
+///
+#define MAX_INTN   ((INTN)0x7FFFFFFFFFFFFFFFULL)
+#define MAX_UINTN  ((UINTN)0xFFFFFFFFFFFFFFFFULL)
 
 ///
@@ -300,4 +306,8 @@
 #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(((EFI_PLABEL *)(FunctionPointer))->EntryPoint)
 
-#endif
-
+#ifndef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__
+#endif
+
+#endif
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/BaseLib.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/BaseLib.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/BaseLib.h	(revision 58459)
@@ -3,5 +3,5 @@
   functions, and CPU architecture-specific functions.
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
 This program and the accompanying materials
@@ -147,9 +147,344 @@
 #endif  // defined (MDE_CPU_ARM)
 
+#if defined (MDE_CPU_AARCH64)
+typedef struct {
+  // GP regs
+  UINT64    X19;
+  UINT64    X20;
+  UINT64    X21;
+  UINT64    X22;
+  UINT64    X23;
+  UINT64    X24;
+  UINT64    X25;
+  UINT64    X26;
+  UINT64    X27;
+  UINT64    X28;
+  UINT64    FP;
+  UINT64    LR;
+  UINT64    IP0;
+
+  // FP regs
+  UINT64    D8;
+  UINT64    D9;
+  UINT64    D10;
+  UINT64    D11;
+  UINT64    D12;
+  UINT64    D13;
+  UINT64    D14;
+  UINT64    D15;
+} BASE_LIBRARY_JUMP_BUFFER;
+
+#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 8
+
+#endif  // defined (MDE_CPU_AARCH64)
+
+
 //
 // String Services
 //
 
-/**
+
+/**
+  Returns the length of a Null-terminated Unicode string.
+
+  If String is not aligned on a 16-bit boundary, then ASSERT().
+
+  @param  String   A pointer to a Null-terminated Unicode string.
+  @param  MaxSize  The maximum number of Destination Unicode
+                   char, including terminating null char.
+
+  @retval 0        If String is NULL.
+  @retval MaxSize  If there is no null character in the first MaxSize characters of String.
+  @return The number of characters that percede the terminating null character.
+
+**/
+UINTN
+EFIAPI
+StrnLenS (
+  IN CONST CHAR16              *String,
+  IN UINTN                     MaxSize
+  );
+
+/**
+  Copies the string pointed to by Source (including the terminating null char)
+  to the array pointed to by Destination.
+
+  If Destination is not aligned on a 16-bit boundary, then ASSERT().
+  If Source is not aligned on a 16-bit boundary, then ASSERT().
+
+  @param  Destination              A pointer to a Null-terminated Unicode string.
+  @param  DestMax                  The maximum number of Destination Unicode
+                                   char, including terminating null char.
+  @param  Source                   A pointer to a Null-terminated Unicode string.
+
+  @retval RETURN_SUCCESS           String is copied.
+  @retval RETURN_BUFFER_TOO_SMALL  If DestMax is NOT greater than StrLen(Source).
+  @retval RETURN_INVALID_PARAMETER If Destination is NULL.
+                                   If Source is NULL.
+                                   If PcdMaximumUnicodeStringLength is not zero,
+                                    and DestMax is greater than 
+                                    PcdMaximumUnicodeStringLength.
+                                   If DestMax is 0.
+  @retval RETURN_ACCESS_DENIED     If Source and Destination overlap.
+**/
+RETURN_STATUS
+EFIAPI
+StrCpyS (
+  OUT CHAR16       *Destination,
+  IN  UINTN        DestMax,
+  IN  CONST CHAR16 *Source
+  );
+
+/**
+  Copies not more than Length successive char from the string pointed to by
+  Source to the array pointed to by Destination. If no null char is copied from
+  Source, then Destination[Length] is always set to null.
+
+  If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT().
+  If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT().
+
+  @param  Destination              A pointer to a Null-terminated Unicode string.
+  @param  DestMax                  The maximum number of Destination Unicode
+                                   char, including terminating null char.
+  @param  Source                   A pointer to a Null-terminated Unicode string.
+  @param  Length                   The maximum number of Unicode characters to copy.
+
+  @retval RETURN_SUCCESS           String is copied.
+  @retval RETURN_BUFFER_TOO_SMALL  If DestMax is NOT greater than 
+                                   MIN(StrLen(Source), Length).
+  @retval RETURN_INVALID_PARAMETER If Destination is NULL.
+                                   If Source is NULL.
+                                   If PcdMaximumUnicodeStringLength is not zero,
+                                    and DestMax is greater than 
+                                    PcdMaximumUnicodeStringLength.
+                                   If DestMax is 0.
+  @retval RETURN_ACCESS_DENIED     If Source and Destination overlap.
+**/
+RETURN_STATUS
+EFIAPI
+StrnCpyS (
+  OUT CHAR16       *Destination,
+  IN  UINTN        DestMax,
+  IN  CONST CHAR16 *Source,
+  IN  UINTN        Length
+  );
+
+/**
+  Appends a copy of the string pointed to by Source (including the terminating
+  null char) to the end of the string pointed to by Destination.
+
+  If Destination is not aligned on a 16-bit boundary, then ASSERT().
+  If Source is not aligned on a 16-bit boundary, then ASSERT().
+
+  @param  Destination              A pointer to a Null-terminated Unicode string.
+  @param  DestMax                  The maximum number of Destination Unicode
+                                   char, including terminating null char.
+  @param  Source                   A pointer to a Null-terminated Unicode string.
+
+  @retval RETURN_SUCCESS           String is appended.
+  @retval RETURN_BAD_BUFFER_SIZE   If DestMax is NOT greater than 
+                                   StrLen(Destination).
+  @retval RETURN_BUFFER_TOO_SMALL  If (DestMax - StrLen(Destination)) is NOT
+                                   greater than StrLen(Source).
+  @retval RETURN_INVALID_PARAMETER If Destination is NULL.
+                                   If Source is NULL.
+                                   If PcdMaximumUnicodeStringLength is not zero,
+                                    and DestMax is greater than 
+                                    PcdMaximumUnicodeStringLength.
+                                   If DestMax is 0.
+  @retval RETURN_ACCESS_DENIED     If Source and Destination overlap.
+**/
+RETURN_STATUS
+EFIAPI
+StrCatS (
+  IN OUT CHAR16       *Destination,
+  IN     UINTN        DestMax,
+  IN     CONST CHAR16 *Source
+  );
+
+/**
+  Appends not more than Length successive char from the string pointed to by
+  Source to the end of the string pointed to by Destination. If no null char is
+  copied from Source, then Destination[StrLen(Destination) + Length] is always
+  set to null.
+
+  If Destination is not aligned on a 16-bit boundary, then ASSERT().
+  If and Source is not aligned on a 16-bit boundary, then ASSERT().
+
+  @param  Destination              A pointer to a Null-terminated Unicode string.
+  @param  DestMax                  The maximum number of Destination Unicode
+                                   char, including terminating null char.
+  @param  Source                   A pointer to a Null-terminated Unicode string.
+  @param  Length                   The maximum number of Unicode characters to copy.
+
+  @retval RETURN_SUCCESS           String is appended.
+  @retval RETURN_BAD_BUFFER_SIZE   If DestMax is NOT greater than
+                                   StrLen(Destination).
+  @retval RETURN_BUFFER_TOO_SMALL  If (DestMax - StrLen(Destination)) is NOT
+                                   greater than MIN(StrLen(Source), Length).
+  @retval RETURN_INVALID_PARAMETER If Destination is NULL.
+                                   If Source is NULL.
+                                   If PcdMaximumUnicodeStringLength is not zero,
+                                    and DestMax is greater than 
+                                    PcdMaximumUnicodeStringLength.
+                                   If DestMax is 0.
+  @retval RETURN_ACCESS_DENIED     If Source and Destination overlap.
+**/
+RETURN_STATUS
+EFIAPI
+StrnCatS (
+  IN OUT CHAR16       *Destination,
+  IN     UINTN        DestMax,
+  IN     CONST CHAR16 *Source,
+  IN     UINTN        Length
+  );
+
+/**
+  Returns the length of a Null-terminated Ascii string.
+
+  @param  String   A pointer to a Null-terminated Ascii string.
+  @param  MaxSize  The maximum number of Destination Ascii
+                   char, including terminating null char.
+
+  @retval 0        If String is NULL.
+  @retval MaxSize  If there is no null character in the first MaxSize characters of String.
+  @return The number of characters that percede the terminating null character.
+
+**/
+UINTN
+EFIAPI
+AsciiStrnLenS (
+  IN CONST CHAR8               *String,
+  IN UINTN                     MaxSize
+  );
+
+/**
+  Copies the string pointed to by Source (including the terminating null char)
+  to the array pointed to by Destination.
+
+  @param  Destination              A pointer to a Null-terminated Ascii string.
+  @param  DestMax                  The maximum number of Destination Ascii
+                                   char, including terminating null char.
+  @param  Source                   A pointer to a Null-terminated Ascii string.
+
+  @retval RETURN_SUCCESS           String is copied.
+  @retval RETURN_BUFFER_TOO_SMALL  If DestMax is NOT greater than StrLen(Source).
+  @retval RETURN_INVALID_PARAMETER If Destination is NULL.
+                                   If Source is NULL.
+                                   If PcdMaximumAsciiStringLength is not zero,
+                                    and DestMax is greater than 
+                                    PcdMaximumAsciiStringLength.
+                                   If DestMax is 0.
+  @retval RETURN_ACCESS_DENIED     If Source and Destination overlap.
+**/
+RETURN_STATUS
+EFIAPI
+AsciiStrCpyS (
+  OUT CHAR8        *Destination,
+  IN  UINTN        DestMax,
+  IN  CONST CHAR8  *Source
+  );
+
+/**
+  Copies not more than Length successive char from the string pointed to by
+  Source to the array pointed to by Destination. If no null char is copied from
+  Source, then Destination[Length] is always set to null.
+
+  @param  Destination              A pointer to a Null-terminated Ascii string.
+  @param  DestMax                  The maximum number of Destination Ascii
+                                   char, including terminating null char.
+  @param  Source                   A pointer to a Null-terminated Ascii string.
+  @param  Length                   The maximum number of Ascii characters to copy.
+
+  @retval RETURN_SUCCESS           String is copied.
+  @retval RETURN_BUFFER_TOO_SMALL  If DestMax is NOT greater than 
+                                   MIN(StrLen(Source), Length).
+  @retval RETURN_INVALID_PARAMETER If Destination is NULL.
+                                   If Source is NULL.
+                                   If PcdMaximumAsciiStringLength is not zero,
+                                    and DestMax is greater than 
+                                    PcdMaximumAsciiStringLength.
+                                   If DestMax is 0.
+  @retval RETURN_ACCESS_DENIED     If Source and Destination overlap.
+**/
+RETURN_STATUS
+EFIAPI
+AsciiStrnCpyS (
+  OUT CHAR8        *Destination,
+  IN  UINTN        DestMax,
+  IN  CONST CHAR8  *Source,
+  IN  UINTN        Length
+  );
+
+/**
+  Appends a copy of the string pointed to by Source (including the terminating
+  null char) to the end of the string pointed to by Destination.
+
+  @param  Destination              A pointer to a Null-terminated Ascii string.
+  @param  DestMax                  The maximum number of Destination Ascii
+                                   char, including terminating null char.
+  @param  Source                   A pointer to a Null-terminated Ascii string.
+
+  @retval RETURN_SUCCESS           String is appended.
+  @retval RETURN_BAD_BUFFER_SIZE   If DestMax is NOT greater than 
+                                   StrLen(Destination).
+  @retval RETURN_BUFFER_TOO_SMALL  If (DestMax - StrLen(Destination)) is NOT
+                                   greater than StrLen(Source).
+  @retval RETURN_INVALID_PARAMETER If Destination is NULL.
+                                   If Source is NULL.
+                                   If PcdMaximumAsciiStringLength is not zero,
+                                    and DestMax is greater than 
+                                    PcdMaximumAsciiStringLength.
+                                   If DestMax is 0.
+  @retval RETURN_ACCESS_DENIED     If Source and Destination overlap.
+**/
+RETURN_STATUS
+EFIAPI
+AsciiStrCatS (
+  IN OUT CHAR8        *Destination,
+  IN     UINTN        DestMax,
+  IN     CONST CHAR8  *Source
+  );
+
+/**
+  Appends not more than Length successive char from the string pointed to by
+  Source to the end of the string pointed to by Destination. If no null char is
+  copied from Source, then Destination[StrLen(Destination) + Length] is always
+  set to null.
+
+  @param  Destination              A pointer to a Null-terminated Ascii string.
+  @param  DestMax                  The maximum number of Destination Ascii
+                                   char, including terminating null char.
+  @param  Source                   A pointer to a Null-terminated Ascii string.
+  @param  Length                   The maximum number of Ascii characters to copy.
+
+  @retval RETURN_SUCCESS           String is appended.
+  @retval RETURN_BAD_BUFFER_SIZE   If DestMax is NOT greater than
+                                   StrLen(Destination).
+  @retval RETURN_BUFFER_TOO_SMALL  If (DestMax - StrLen(Destination)) is NOT
+                                   greater than MIN(StrLen(Source), Length).
+  @retval RETURN_INVALID_PARAMETER If Destination is NULL.
+                                   If Source is NULL.
+                                   If PcdMaximumAsciiStringLength is not zero,
+                                    and DestMax is greater than 
+                                    PcdMaximumAsciiStringLength.
+                                   If DestMax is 0.
+  @retval RETURN_ACCESS_DENIED     If Source and Destination overlap.
+**/
+RETURN_STATUS
+EFIAPI
+AsciiStrnCatS (
+  IN OUT CHAR8        *Destination,
+  IN     UINTN        DestMax,
+  IN     CONST CHAR8  *Source,
+  IN     UINTN        Length
+  );
+
+
+#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
+
+/**
+  [ATTENTION] This function will be deprecated for security reason.
+
   Copies one Null-terminated Unicode string to another Null-terminated Unicode
   string and returns the new Unicode string.
@@ -183,4 +518,6 @@
 
 /**
+  [ATTENTION] This function will be deprecated for security reason.
+
   Copies up to a specified length from one Null-terminated Unicode string to 
   another Null-terminated Unicode string and returns the new Unicode string.
@@ -219,5 +556,5 @@
   IN      UINTN                     Length
   );
-
+#endif
 
 /**
@@ -347,5 +684,9 @@
 
 
-/**
+#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
+
+/**
+  [ATTENTION] This function will be deprecated for security reason.
+
   Concatenates one Null-terminated Unicode string to another Null-terminated
   Unicode string, and returns the concatenated Unicode string.
@@ -388,4 +729,6 @@
 
 /**
+  [ATTENTION] This function will be deprecated for security reason.
+
   Concatenates up to a specified length one Null-terminated Unicode to the end 
   of another Null-terminated Unicode string, and returns the concatenated 
@@ -432,4 +775,5 @@
   IN      UINTN                     Length
   );
+#endif
 
 /**
@@ -670,5 +1014,9 @@
 
 
-/**
+#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
+
+/**
+  [ATTENTION] This function will be deprecated for security reason.
+
   Copies one Null-terminated ASCII string to another Null-terminated ASCII
   string and returns the new ASCII string.
@@ -700,4 +1048,6 @@
 
 /**
+  [ATTENTION] This function will be deprecated for security reason.
+
   Copies up to a specified length one Null-terminated ASCII string to another 
   Null-terminated ASCII string and returns the new ASCII string.
@@ -733,5 +1083,5 @@
   IN      UINTN                     Length
   );
-
+#endif
 
 /**
@@ -893,5 +1243,9 @@
 
 
-/**
+#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
+
+/**
+  [ATTENTION] This function will be deprecated for security reason.
+
   Concatenates one Null-terminated ASCII string to another Null-terminated
   ASCII string, and returns the concatenated ASCII string.
@@ -929,4 +1283,6 @@
 
 /**
+  [ATTENTION] This function will be deprecated for security reason.
+
   Concatenates up to a specified length one Null-terminated ASCII string to 
   the end of another Null-terminated ASCII string, and returns the 
@@ -971,5 +1327,5 @@
   IN      UINTN                     Length
   );
-
+#endif
 
 /**
@@ -1292,5 +1648,5 @@
   If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
   InitializeListHead(), then ASSERT().
-  If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number
+  If PcdMaximumLinkedListLength is not zero, and prior to insertion the number
   of nodes in ListHead, including the ListHead node, is greater than or
   equal to PcdMaximumLinkedListLength, then ASSERT().
@@ -1322,5 +1678,5 @@
   If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or 
   InitializeListHead(), then ASSERT().
-  If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number
+  If PcdMaximumLinkedListLength is not zero, and prior to insertion the number
   of nodes in ListHead, including the ListHead node, is greater than or
   equal to PcdMaximumLinkedListLength, then ASSERT().
@@ -1351,5 +1707,5 @@
   If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or 
   InitializeListHead(), then ASSERT().
-  If PcdMaximumLinkedListLenth is not zero, and the number of nodes
+  If PcdMaximumLinkedListLength is not zero, and the number of nodes
   in List, including the List node, is greater than or equal to
   PcdMaximumLinkedListLength, then ASSERT().
@@ -1358,5 +1714,5 @@
 
   @return The first node of a doubly linked list.
-  @retval NULL  The list is empty.
+  @retval List  The list is empty.
 
 **/
@@ -1379,6 +1735,6 @@
   If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or 
   InitializeListHead(), then ASSERT().
-  If PcdMaximumLinkedListLenth is not zero, and List contains more than
-  PcdMaximumLinkedListLenth nodes, then ASSERT().
+  If PcdMaximumLinkedListLength is not zero, and List contains more than
+  PcdMaximumLinkedListLength nodes, then ASSERT().
   If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().
 
@@ -1408,6 +1764,6 @@
   If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or 
   InitializeListHead(), then ASSERT().
-  If PcdMaximumLinkedListLenth is not zero, and List contains more than
-  PcdMaximumLinkedListLenth nodes, then ASSERT().
+  If PcdMaximumLinkedListLength is not zero, and List contains more than
+  PcdMaximumLinkedListLength nodes, then ASSERT().
   If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().
  
@@ -1435,5 +1791,5 @@
   If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or 
   InitializeListHead(), then ASSERT().
-  If PcdMaximumLinkedListLenth is not zero, and the number of nodes
+  If PcdMaximumLinkedListLength is not zero, and the number of nodes
   in List, including the List node, is greater than or equal to
   PcdMaximumLinkedListLength, then ASSERT().
@@ -1465,5 +1821,5 @@
   If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(), 
   then ASSERT().
-  If PcdMaximumLinkedListLenth is not zero, and the number of nodes
+  If PcdMaximumLinkedListLength is not zero, and the number of nodes
   in List, including the List node, is greater than or equal to
   PcdMaximumLinkedListLength, then ASSERT().
@@ -1497,5 +1853,5 @@
   If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
   InitializeListHead(), then ASSERT().
-  If PcdMaximumLinkedListLenth is not zero, and the number of nodes
+  If PcdMaximumLinkedListLength is not zero, and the number of nodes
   in List, including the List node, is greater than or equal to
   PcdMaximumLinkedListLength, then ASSERT().
@@ -2344,4 +2700,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -2377,4 +2734,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -2410,4 +2768,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -2444,4 +2803,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -2506,4 +2867,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -2539,4 +2901,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -2572,4 +2935,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -2606,4 +2970,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -2668,4 +3034,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -2701,4 +3068,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -2734,4 +3102,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -2768,4 +3137,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -2830,4 +3201,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -2863,4 +3235,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -2896,4 +3269,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -2930,4 +3304,6 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -5381,4 +5757,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Index     The 32-bit MSR index to write.
@@ -5417,4 +5794,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Index     The 32-bit MSR index to write.
@@ -5453,4 +5831,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Index     The 32-bit MSR index to write.
@@ -5491,4 +5870,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Index     The 32-bit MSR index to write.
@@ -5685,4 +6066,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Index     The 32-bit MSR index to write.
@@ -5721,4 +6103,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Index     The 32-bit MSR index to write.
@@ -5757,4 +6140,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Index     The 32-bit MSR index to write.
@@ -5794,4 +6178,6 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Index     The 32-bit MSR index to write.
@@ -7123,5 +7509,5 @@
 EFIAPI
 AsmPrepareThunk16 (
-  OUT     THUNK_CONTEXT             *ThunkContext
+  IN OUT  THUNK_CONTEXT             *ThunkContext
   );
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/DebugLib.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/DebugLib.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/DebugLib.h	(revision 58459)
@@ -9,5 +9,5 @@
   defined, then debug and assert related macros wrapped by it are the NULL implementations.
 
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under
 the terms and conditions of the BSD License that accompanies this distribution.
@@ -221,6 +221,20 @@
   );
 
-
-/**
+/**
+  Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
+
+  This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
+
+  @retval  TRUE    Current ErrorLevel is supported.
+  @retval  FALSE   Current ErrorLevel is not supported.
+
+**/
+BOOLEAN
+EFIAPI
+DebugPrintLevelEnabled (
+  IN  CONST UINTN        ErrorLevel
+  );
+
+/**  
   Internal worker macro that calls DebugAssert().
 
@@ -239,4 +253,6 @@
   This macro calls DebugPrint() passing in the debug error level, a format
   string, and a variable argument list.
+  __VA_ARGS__ is not supported by ECB compiler, Microsoft Visual Studio .NET 2003
+  and Microsoft Windows Server 2003 Driver Development Kit (Microsoft WINDDK) version 3790.1830.
 
   @param  Expression  Expression containing an error level, a format string,
@@ -244,6 +260,16 @@
 
 **/
+
+#if !defined(MDE_CPU_EBC) && (!defined (_MSC_VER) || _MSC_VER >= 1400)
+  #define _DEBUG_PRINT(PrintLevel, ...)              \
+    do {                                             \
+      if (DebugPrintLevelEnabled (PrintLevel)) {     \
+        DebugPrint (PrintLevel, ##__VA_ARGS__);      \
+      }                                              \
+    } while (FALSE)
+  #define _DEBUG(Expression)   _DEBUG_PRINT Expression
+#else
 #define _DEBUG(Expression)   DebugPrint Expression
-
+#endif
 
 /**
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/DevicePathLib.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/DevicePathLib.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/DevicePathLib.h	(revision 58459)
@@ -5,5 +5,5 @@
   EFI_DEVICE_PATH_PROTOCOL structures.
 
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -22,4 +22,26 @@
 
 /**
+  Determine whether a given device path is valid.
+  If DevicePath is NULL, then ASSERT().
+
+  @param  DevicePath  A pointer to a device path data structure.
+  @param  MaxSize     The maximum size of the device path data structure.
+
+  @retval TRUE        DevicePath is valid.
+  @retval FALSE       The length of any node node in the DevicePath is less
+                      than sizeof (EFI_DEVICE_PATH_PROTOCOL).
+  @retval FALSE       If MaxSize is not zero, the size of the DevicePath
+                      exceeds MaxSize.
+  @retval FALSE       If PcdMaximumDevicePathNodeCount is not zero, the node
+                      count of the DevicePath exceeds PcdMaximumDevicePathNodeCount.
+**/
+BOOLEAN
+EFIAPI
+IsDevicePathValid (
+  IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+  IN       UINTN                    MaxSize
+  );
+
+/**
   Returns the Type field of a device path node.
 
@@ -124,5 +146,6 @@
 
   Determines if a device path node specified by Node is an end node of an entire device path.
-  If Node represents the end of an entire device path, then TRUE is returned.  Otherwise, FALSE is returned.
+  If Node represents the end of an entire device path, then TRUE is returned.
+  Otherwise, FALSE is returned.
 
   If Node is NULL, then ASSERT().
@@ -144,5 +167,6 @@
 
   Determines if a device path node specified by Node is an end node of a device path instance.
-  If Node represents the end of a device path instance, then TRUE is returned.  Otherwise, FALSE is returned.
+  If Node represents the end of a device path instance, then TRUE is returned.
+  Otherwise, FALSE is returned.
 
   If Node is NULL, then ASSERT().
@@ -170,4 +194,5 @@
   If Node is NULL, then ASSERT().
   If NodeLength >= 0x10000, then ASSERT().
+  If NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL), then ASSERT().
 
   @param  Node      A pointer to a device path node data structure.
@@ -209,11 +234,12 @@
   Returns the size of a device path in bytes.
 
-  This function returns the size, in bytes, of the device path data structure specified by
-  DevicePath including the end of device path node.  If DevicePath is NULL, then 0 is returned.
-
-  @param  DevicePath                 A pointer to a device path data structure.
-  
-  @retval 0       DevicePath is NULL.
-  @retval Others  The size of a device path in bytes.
+  This function returns the size, in bytes, of the device path data structure 
+  specified by DevicePath including the end of device path node.
+  If DevicePath is NULL or invalid, then 0 is returned.
+
+  @param  DevicePath  A pointer to a device path data structure.
+
+  @retval 0           If DevicePath is NULL or invalid.
+  @retval Others      The size of a device path in bytes.
 
 **/
@@ -236,5 +262,5 @@
   @param  DevicePath                 A pointer to a device path data structure.
 
-  @retval NULL    DevicePath is NULL.
+  @retval NULL    DevicePath is NULL or invalid.
   @retval Others  A pointer to the duplicated device path.
   
@@ -264,4 +290,5 @@
   
   @retval NULL      If there is not enough memory for the newly allocated buffer.
+  @retval NULL      If FirstDevicePath or SecondDevicePath is invalid.
   @retval Others    A pointer to the new device path if success.
                     Or a copy an end-of-device-path if both FirstDevicePath and SecondDevicePath are NULL.
@@ -317,4 +344,5 @@
   If DevicePath is NULL, then a copy if DevicePathInstance is returned.
   If DevicePathInstance is NULL, then NULL is returned.
+  If DevicePath or DevicePathInstance is invalid, then NULL is returned.
   If there is not enough memory to allocate space for the new device path, then NULL is returned.  
   The memory is allocated from EFI boot services memory. It is the responsibility of the caller to
@@ -342,4 +370,5 @@
   to hold the size of the device path instance copy.
   If DevicePath is NULL, then NULL is returned.
+  If DevicePath points to a invalid device path, then NULL is returned.
   If there is not enough memory to allocate space for the new device path, then NULL is returned.  
   The memory is allocated from EFI boot services memory. It is the responsibility of the caller to
@@ -395,10 +424,11 @@
 
   This function returns TRUE if the device path specified by DevicePath is multi-instance.
-  Otherwise, FALSE is returned.  If DevicePath is NULL, then FALSE is returned.
+  Otherwise, FALSE is returned.
+  If DevicePath is NULL or invalid, then FALSE is returned.
 
   @param  DevicePath                 A pointer to a device path data structure.
 
   @retval  TRUE                      DevicePath is multi-instance.
-  @retval  FALSE                     DevicePath is not multi-instance, or DevicePath is NULL.
+  @retval  FALSE                     DevicePath is not multi-instance, or DevicePath is NULL or invalid.
 
 **/
@@ -454,3 +484,83 @@
   );
 
+/**
+  Converts a device path to its text representation.
+
+  @param DevicePath      A Pointer to the device to be converted.
+  @param DisplayOnly     If DisplayOnly is TRUE, then the shorter text representation
+                         of the display node is used, where applicable. If DisplayOnly
+                         is FALSE, then the longer text representation of the display node
+                         is used.
+  @param AllowShortcuts  If AllowShortcuts is TRUE, then the shortcut forms of text
+                         representation for a device node can be used, where applicable.
+
+  @return A pointer to the allocated text representation of the device path or
+          NULL if DeviceNode is NULL or there was insufficient memory.
+
+**/
+CHAR16 *
+EFIAPI
+ConvertDevicePathToText (
+  IN CONST EFI_DEVICE_PATH_PROTOCOL   *DevicePath,
+  IN BOOLEAN                          DisplayOnly,
+  IN BOOLEAN                          AllowShortcuts
+  );
+
+/**
+  Converts a device node to its string representation.
+
+  @param DeviceNode        A Pointer to the device node to be converted.
+  @param DisplayOnly       If DisplayOnly is TRUE, then the shorter text representation
+                           of the display node is used, where applicable. If DisplayOnly
+                           is FALSE, then the longer text representation of the display node
+                           is used.
+  @param AllowShortcuts    If AllowShortcuts is TRUE, then the shortcut forms of text
+                           representation for a device node can be used, where applicable.
+
+  @return A pointer to the allocated text representation of the device node or NULL if DeviceNode
+          is NULL or there was insufficient memory.
+
+**/
+CHAR16 *
+EFIAPI
+ConvertDeviceNodeToText (
+  IN CONST EFI_DEVICE_PATH_PROTOCOL  *DeviceNode,
+  IN BOOLEAN                         DisplayOnly,
+  IN BOOLEAN                         AllowShortcuts
+  );
+
+/**
+  Convert text to the binary representation of a device node.
+
+  @param TextDeviceNode  TextDeviceNode points to the text representation of a device
+                         node. Conversion starts with the first character and continues
+                         until the first non-device node character.
+
+  @return A pointer to the EFI device node or NULL if TextDeviceNode is NULL or there was
+          insufficient memory or text unsupported.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+EFIAPI
+ConvertTextToDeviceNode (
+  IN CONST CHAR16 *TextDeviceNode
+  );
+
+/**
+  Convert text to the binary representation of a device path.
+
+  @param TextDevicePath  TextDevicePath points to the text representation of a device
+                         path. Conversion starts with the first character and continues
+                         until the first non-device node character.
+
+  @return A pointer to the allocated device path or NULL if TextDeviceNode is NULL or
+          there was insufficient memory.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+EFIAPI
+ConvertTextToDevicePath (
+  IN CONST CHAR16 *TextDevicePath
+  );
+
 #endif
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/DxeServicesLib.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/DxeServicesLib.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/DxeServicesLib.h	(revision 58459)
@@ -3,5 +3,5 @@
   These functions help access data from sections of FFS files or from file path.
 
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -236,5 +236,5 @@
   Allocate memory to store the found image. The caller is responsible to free memory.
 
-  If File is NULL, then NULL is returned.
+  If FilePath is NULL, then NULL is returned.
   If FileSize is NULL, then NULL is returned.
   If AuthenticationStatus is NULL, then NULL is returned.
@@ -249,8 +249,7 @@
                                         the file buffer.
   @param[out]      FileSize             Pointer to the size of the abstracted file buffer.
-  @param[out]      AuthenticationStatus Pointer to a caller-allocated UINT32 in which the authentication
-                                        status is returned.
-
-  @retval NULL   File is NULL, or FileSize is NULL, or the file can't be found.
+  @param[out]      AuthenticationStatus Pointer to the authentication status.
+
+  @retval NULL   FilePath is NULL, or FileSize is NULL, or AuthenticationStatus is NULL, or the file can't be found.
   @retval other  The abstracted file buffer. The caller is responsible to free memory.
 **/
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/HobLib.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/HobLib.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/HobLib.h	(revision 58459)
@@ -9,5 +9,5 @@
   independent and can be relocated easily to different memory memory locations.
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
@@ -186,4 +186,30 @@
 
 /**
+  Builds a HOB that describes a chunk of system memory with Owner GUID.
+
+  This function builds a HOB that describes a chunk of system memory.
+  It can only be invoked during PEI phase;
+  for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
+  
+  If there is no additional space for HOB creation, then ASSERT().
+
+  @param  ResourceType        The type of resource described by this HOB.
+  @param  ResourceAttribute   The resource attributes of the memory described by this HOB.
+  @param  PhysicalStart       The 64 bit physical address of memory described by this HOB.
+  @param  NumberOfBytes       The length of the memory described by this HOB in bytes.
+  @param  OwnerGUID           GUID for the owner of this resource.
+
+**/
+VOID
+EFIAPI
+BuildResourceDescriptorWithOwnerHob (
+  IN EFI_RESOURCE_TYPE            ResourceType,
+  IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
+  IN EFI_PHYSICAL_ADDRESS         PhysicalStart,
+  IN UINT64                       NumberOfBytes,
+  IN EFI_GUID                     *OwnerGUID
+  );
+
+/**
   Builds a HOB that describes a chunk of system memory.
 
@@ -221,5 +247,6 @@
   If Guid is NULL, then ASSERT().
   If there is no additional space for HOB creation, then ASSERT().
-  If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
+  If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
+  HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.
 
   @param  Guid          The GUID to tag the customized HOB.
@@ -251,5 +278,6 @@
   If Data is NULL and DataLength > 0, then ASSERT().
   If there is no additional space for HOB creation, then ASSERT().
-  If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
+  If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
+  HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.
 
   @param  Guid          The GUID to tag the customized HOB.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/IoLib.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/IoLib.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/IoLib.h	(revision 58459)
@@ -2,5 +2,5 @@
   Provide services to access I/O Ports and MMIO registers.
 
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
@@ -193,4 +193,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -227,4 +228,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -261,4 +263,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -297,4 +300,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -486,4 +491,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -521,4 +527,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -556,4 +563,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -593,4 +601,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -782,4 +792,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -817,4 +828,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -852,4 +864,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -889,4 +902,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1078,4 +1093,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1113,4 +1129,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1148,4 +1165,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1185,4 +1203,6 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1367,4 +1387,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -1402,4 +1423,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -1437,4 +1459,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -1473,4 +1496,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -1661,4 +1686,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -1697,4 +1723,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -1733,4 +1760,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -1770,4 +1798,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -1958,4 +1988,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -1994,4 +2025,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -2030,4 +2062,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -2067,4 +2100,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -2253,4 +2288,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -2289,4 +2325,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -2325,4 +2362,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -2362,4 +2400,6 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/MemoryAllocationLib.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/MemoryAllocationLib.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/MemoryAllocationLib.h	(revision 58459)
@@ -7,5 +7,5 @@
   much easier to port algorithms from phase to phase. 
   
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
@@ -111,4 +111,5 @@
   
   If Alignment is not a power of two and Alignment is not zero, then ASSERT().
+  If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
 
   @param  Pages                 The number of 4 KB pages to allocate.
@@ -135,4 +136,5 @@
   
   If Alignment is not a power of two and Alignment is not zero, then ASSERT().
+  If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
 
   @param  Pages                 The number of 4 KB pages to allocate.
@@ -159,4 +161,5 @@
   
   If Alignment is not a power of two and Alignment is not zero, then ASSERT().
+  If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
 
   @param  Pages                 The number of 4 KB pages to allocate.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PcdLib.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PcdLib.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PcdLib.h	(revision 58459)
@@ -15,5 +15,5 @@
   PatchPcdGetXX(), and PatchPcdSetXX().
 
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
@@ -440,4 +440,6 @@
   If TokenName is not a valid token in the token space, then the module will not build.
 
+  If the set operation was not correctly performed, then ASSERT().
+
   @param   TokenName  The name of the PCD token to retrieve a current value for.
   @param   Value      The 8-bit value to set.
@@ -455,4 +457,6 @@
   If TokenName is not a valid token in the token space, then the module will not build.
 
+  If the set operation was not correctly performed, then ASSERT().
+
   @param   TokenName  The name of the PCD token to retrieve a current value for.
   @param   Value      The 16-bit value to set.
@@ -469,4 +473,6 @@
   Sets the 32-bit value for the token specified by TokenName. Value is returned.
   If TokenName is not a valid token in the token space, then the module will not build.
+
+  If the set operation was not correctly performed, then ASSERT().
 
   @param   TokenName  The name of the PCD token to retrieve a current value for.
@@ -502,5 +508,5 @@
   to indicate that the set operation was not actually performed.  If SizeOfBuffer 
   is set to MAX_ADDRESS, then SizeOfBuffer must be set to the maximum size supported 
-  by TokenName and NULL must be returned.
+  by TokenName and NULL must be returned, or ASSERT() if the set operation was not corretly performed.
   If TokenName is not a valid token in the token space, then the module will not build.
   
@@ -524,4 +530,6 @@
   If TokenName is not a valid token in the token space, then the module will not build.
 
+  If the set operation was not correctly performed, then ASSERT().
+
   @param   TokenName      The name of the PCD token to set the current value for.
   @param   Buffer         The Boolean value to set.
@@ -532,4 +540,18 @@
 #define PcdSetBool(TokenName, Value)        _PCD_SET_MODE_BOOL_##TokenName  ((Value))
 
+
+/**
+  Retrieves a token number based on a GUID and a token name.
+
+  Returns the token number for the token specified by Guid and TokenName.
+
+  @param   Guid        Pointer to a 128-bit unique value that designates 
+                       which namespace to retrieve a value from.
+  @param   TokenName   The name of the PCD token to retrieve a current value for.                 
+
+  @return  Return the token number.
+
+**/
+#define PcdTokenEx(Guid,TokenName)  _PCD_TOKEN_EX_##TokenName(Guid)
 
 /**
@@ -549,6 +571,5 @@
 
 **/
-#define PcdGetEx8(Guid, TokenName)          LibPcdGetEx8    ((Guid), _PCD_TOKEN_##TokenName)
-
+#define PcdGetEx8(Guid, TokenName)          LibPcdGetEx8 ((Guid), PcdTokenEx(Guid,TokenName))
 
 /**
@@ -568,5 +589,5 @@
 
 **/
-#define PcdGetEx16(Guid, TokenName)         LibPcdGetEx16   ((Guid), _PCD_TOKEN_##TokenName)
+#define PcdGetEx16(Guid, TokenName)         LibPcdGetEx16 ((Guid), PcdTokenEx(Guid,TokenName))
 
 
@@ -587,5 +608,5 @@
 
 **/
-#define PcdGetEx32(Guid, TokenName)         LibPcdGetEx32   ((Guid), _PCD_TOKEN_##TokenName)
+#define PcdGetEx32(Guid, TokenName)         LibPcdGetEx32 ((Guid), PcdTokenEx(Guid,TokenName))
 
 
@@ -606,5 +627,5 @@
 
 **/
-#define PcdGetEx64(Guid, TokenName)         LibPcdGetEx64   ((Guid), _PCD_TOKEN_##TokenName)
+#define PcdGetEx64(Guid, TokenName)         LibPcdGetEx64 ((Guid), PcdTokenEx(Guid,TokenName))
 
 
@@ -625,5 +646,5 @@
 
 **/
-#define PcdGetExPtr(Guid, TokenName)        LibPcdGetExPtr  ((Guid), _PCD_TOKEN_##TokenName)
+#define PcdGetExPtr(Guid, TokenName)        LibPcdGetExPtr ((Guid), PcdTokenEx(Guid,TokenName))
 
 
@@ -644,5 +665,5 @@
 
 **/
-#define PcdGetExBool(Guid, TokenName)       LibPcdGetExBool ((Guid), _PCD_TOKEN_##TokenName)
+#define PcdGetExBool(Guid, TokenName)       LibPcdGetExBool  ((Guid), PcdTokenEx(Guid,TokenName))
 
 
@@ -655,4 +676,5 @@
 
   If Guid is NULL, then ASSERT().
+  If the set operation was not correctly performed, then ASSERT().
 
   @param   Guid        Pointer to a 128-bit unique value that designates 
@@ -664,5 +686,5 @@
 
 **/
-#define PcdSetEx8(Guid, TokenName, Value)   LibPcdSetEx8   ((Guid), _PCD_TOKEN_##TokenName, (Value))
+#define PcdSetEx8(Guid, TokenName, Value)   LibPcdSetEx8   ((Guid), PcdTokenEx(Guid,TokenName), (Value))
 
 
@@ -675,4 +697,5 @@
 
   If Guid is NULL, then ASSERT().
+  If the set operation was not correctly performed, then ASSERT().
 
   @param   Guid        Pointer to a 128-bit unique value that designates 
@@ -684,5 +707,5 @@
 
 **/
-#define PcdSetEx16(Guid, TokenName, Value)  LibPcdSetEx16  ((Guid), _PCD_TOKEN_##TokenName, (Value))
+#define PcdSetEx16(Guid, TokenName, Value)  LibPcdSetEx16  ((Guid), PcdTokenEx(Guid,TokenName), (Value))
 
 
@@ -695,4 +718,5 @@
 
   If Guid is NULL, then ASSERT().
+  If the set operation was not correctly performed, then ASSERT().
 
   @param   Guid        Pointer to a 128-bit unique value that designates 
@@ -704,5 +728,5 @@
 
 **/
-#define PcdSetEx32(Guid, TokenName, Value)  LibPcdSetEx32  ((Guid), _PCD_TOKEN_##TokenName, (Value))
+#define PcdSetEx32(Guid, TokenName, Value)  LibPcdSetEx32  ((Guid), PcdTokenEx(Guid,TokenName), (Value))
 
 
@@ -715,4 +739,5 @@
 
   If Guid is NULL, then ASSERT().
+  If the set operation was not correctly performed, then ASSERT().
 
   @param   Guid        Pointer to a 128-bit unique value that designates 
@@ -724,5 +749,5 @@
 
 **/
-#define PcdSetEx64(Guid, TokenName, Value)  LibPcdSetEx64  ((Guid), _PCD_TOKEN_##TokenName, (Value))
+#define PcdSetEx64(Guid, TokenName, Value)  LibPcdSetEx64  ((Guid), PcdTokenEx(Guid,TokenName), (Value))
 
 
@@ -735,5 +760,5 @@
   NULL to indicate that the set operation was not actually performed. If SizeOfBuffer 
   is set to MAX_ADDRESS, then SizeOfBuffer must be set to the maximum size supported by
-  Guid and TokenName and NULL must be returned.
+  Guid and TokenName and NULL must be returned, or ASSERT() if the set operation was not corretly performed.
   If TokenName is not a valid token in the token space specified by Guid, 
   then the module will not build.
@@ -753,5 +778,5 @@
 **/
 #define PcdSetExPtr(Guid, TokenName, SizeOfBuffer, Buffer) \
-                                            LibPcdSetExPtr ((Guid), _PCD_TOKEN_##TokenName, (SizeOfBuffer), (Buffer))
+                                            LibPcdSetExPtr ((Guid), PcdTokenEx(Guid,TokenName), (SizeOfBuffer), (Buffer))
 
 
@@ -764,4 +789,5 @@
 
   If Guid is NULL, then ASSERT().
+  If the set operation was not correctly performed, then ASSERT().
 
   @param   Guid           Pointer to a 128-bit unique value that designates 
@@ -774,5 +800,5 @@
 **/                                         
 #define PcdSetExBool(Guid, TokenName, Value) \
-                                            LibPcdSetExBool((Guid), _PCD_TOKEN_##TokenName, (Value))
+                                            LibPcdSetExBool((Guid), PcdTokenEx(Guid,TokenName), (Value))
 
 
@@ -1069,5 +1095,7 @@
   Sets the 8-bit value for the token specified by TokenNumber 
   to the value specified by Value.  Value is returned.
-  
+
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  TokenNumber   The PCD token number to set a current value for.
   @param[in]  Value         The 8-bit value to set.
@@ -1089,5 +1117,7 @@
   Sets the 16-bit value for the token specified by TokenNumber 
   to the value specified by Value.  Value is returned.
-  
+
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  TokenNumber   The PCD token number to set a current value for.
   @param[in]  Value         The 16-bit value to set.
@@ -1109,5 +1139,7 @@
   Sets the 32-bit value for the token specified by TokenNumber 
   to the value specified by Value.  Value is returned.
-  
+
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  TokenNumber   The PCD token number to set a current value for.
   @param[in]  Value         The 32-bit value to set.
@@ -1129,5 +1161,7 @@
   Sets the 64-bit value for the token specified by TokenNumber 
   to the value specified by Value.  Value is returned.
-  
+
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  TokenNumber   The PCD token number to set a current value for.
   @param[in]  Value         The 64-bit value to set.
@@ -1151,5 +1185,6 @@
   If SizeOfBuffer is greater than the maximum size support by TokenNumber, 
   then set SizeOfBuffer to the maximum size supported by TokenNumber and 
-  return NULL to indicate that the set operation was not actually performed.  
+  return NULL to indicate that the set operation was not actually performed,
+  or ASSERT() if the set operation was not corretly performed.
 
   If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the 
@@ -1180,5 +1215,7 @@
   Sets the Boolean value for the token specified by TokenNumber 
   to the value specified by Value.  Value is returned.
-  
+
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  TokenNumber   The PCD token number to set a current value for.
   @param[in]  Value         The boolean value to set.
@@ -1200,7 +1237,8 @@
   Sets the 8-bit value for the token specified by TokenNumber and 
   Guid to the value specified by Value. Value is returned.
-  
-  If Guid is NULL, then ASSERT().
-  
+
+  If Guid is NULL, then ASSERT().
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  Guid          Pointer to a 128-bit unique value that 
                             designates which namespace to set a value from.
@@ -1225,7 +1263,8 @@
   Sets the 16-bit value for the token specified by TokenNumber and 
   Guid to the value specified by Value. Value is returned.
-  
-  If Guid is NULL, then ASSERT().
-  
+
+  If Guid is NULL, then ASSERT().
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  Guid          Pointer to a 128-bit unique value that 
                             designates which namespace to set a value from.
@@ -1250,7 +1289,8 @@
   Sets the 32-bit value for the token specified by TokenNumber and 
   Guid to the value specified by Value. Value is returned.
-  
-  If Guid is NULL, then ASSERT().
-  
+
+  If Guid is NULL, then ASSERT().
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  Guid          Pointer to a 128-bit unique value that 
                             designates which namespace to set a value from.
@@ -1275,6 +1315,8 @@
   Sets the 64-bit value for the token specified by TokenNumber and 
   Guid to the value specified by Value. Value is returned.
-  If Guid is NULL, then ASSERT().
-  
+
+  If Guid is NULL, then ASSERT().
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  Guid          Pointer to a 128-bit unique value that 
                             designates which namespace to set a value from.
@@ -1301,5 +1343,5 @@
   the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size 
   supported by TokenNumber and return NULL to indicate that the set operation 
-  was not actually performed. 
+  was not actually performed, or ASSERT() if the set operation was not corretly performed.
   
   If Guid is NULL, then ASSERT().
@@ -1331,7 +1373,8 @@
   Sets the Boolean value for the token specified by TokenNumber and 
   Guid to the value specified by Value. Value is returned.
-  
-  If Guid is NULL, then ASSERT().
-  
+
+  If Guid is NULL, then ASSERT().
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  Guid          Pointer to a 128-bit unique value that 
                             designates which namespace to set a value from.
@@ -1504,3 +1547,88 @@
   );
 
+typedef enum {
+  PCD_TYPE_8,
+  PCD_TYPE_16,
+  PCD_TYPE_32,
+  PCD_TYPE_64,
+  PCD_TYPE_BOOL,
+  PCD_TYPE_PTR
+} PCD_TYPE;
+
+typedef struct {
+  ///
+  /// The returned information associated with the requested TokenNumber. If
+  /// TokenNumber is 0, then PcdType is set to PCD_TYPE_8.
+  ///
+  PCD_TYPE          PcdType;
+  ///
+  /// The size of the data in bytes associated with the TokenNumber specified. If
+  /// TokenNumber is 0, then PcdSize is set 0.
+  ///
+  UINTN             PcdSize;
+  ///
+  /// The null-terminated ASCII string associated with a given token. If the
+  /// TokenNumber specified was 0, then this field corresponds to the null-terminated
+  /// ASCII string associated with the token's namespace Guid. If NULL, there is no
+  /// name associated with this request.
+  ///
+  CHAR8             *PcdName;
+} PCD_INFO;
+
+
+/**
+  Retrieve additional information associated with a PCD token.
+
+  This includes information such as the type of value the TokenNumber is associated with as well as possible
+  human readable name that is associated with the token.
+
+  If TokenNumber is not in the default token space specified, then ASSERT().
+
+  @param[in]    TokenNumber The PCD token number.
+  @param[out]   PcdInfo     The returned information associated with the requested TokenNumber.
+                            The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
+**/
+VOID
+EFIAPI
+LibPcdGetInfo (
+  IN        UINTN           TokenNumber,
+  OUT       PCD_INFO        *PcdInfo
+  );
+
+/**
+  Retrieve additional information associated with a PCD token.
+
+  This includes information such as the type of value the TokenNumber is associated with as well as possible
+  human readable name that is associated with the token.
+
+  If TokenNumber is not in the token space specified by Guid, then ASSERT().
+
+  @param[in]    Guid        The 128-bit unique value that designates the namespace from which to extract the value.
+  @param[in]    TokenNumber The PCD token number.
+  @param[out]   PcdInfo     The returned information associated with the requested TokenNumber.
+                            The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
+**/
+VOID
+EFIAPI
+LibPcdGetInfoEx (
+  IN CONST  GUID            *Guid,
+  IN        UINTN           TokenNumber,
+  OUT       PCD_INFO        *PcdInfo
+  );
+
+/**
+  Retrieve the currently set SKU Id.
+
+  If the sku id got >= PCD_MAX_SKU_ID, then ASSERT().
+
+  @return   The currently set SKU Id. If the platform has not set at a SKU Id, then the
+            default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU
+            Id is returned.
+**/
+UINTN
+EFIAPI
+LibPcdGetSku (
+  VOID
+  );
+
 #endif
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PciCf8Lib.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PciCf8Lib.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PciCf8Lib.h	(revision 58459)
@@ -6,5 +6,5 @@
   access to PCI Segment #0.
 
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
@@ -244,4 +244,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -280,4 +281,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -316,4 +318,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -354,4 +357,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -559,4 +564,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -596,4 +602,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -633,4 +640,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -672,4 +680,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -877,4 +887,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -914,4 +925,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -951,4 +963,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -990,4 +1003,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PciExpressLib.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PciExpressLib.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PciExpressLib.h	(revision 58459)
@@ -6,5 +6,5 @@
   is defined by PcdPciExpressBaseAddress.
 
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
@@ -236,4 +236,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -271,4 +272,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -306,4 +308,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -343,4 +346,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -541,4 +546,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -577,4 +583,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -613,4 +620,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -651,4 +659,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -849,4 +859,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -885,4 +896,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -921,4 +933,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -959,4 +972,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PciLib.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PciLib.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PciLib.h	(revision 58459)
@@ -11,5 +11,5 @@
   explicit access methods.
 
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
@@ -237,4 +237,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -272,4 +273,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -307,4 +309,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -344,4 +347,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -542,4 +547,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -578,4 +584,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -614,4 +621,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -652,4 +660,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -850,4 +860,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -886,4 +897,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -922,4 +934,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -960,4 +973,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PciSegmentLib.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PciSegmentLib.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PciSegmentLib.h	(revision 58459)
@@ -24,5 +24,5 @@
   accesses when PCI Segments other than Segment #0 must be accessed.  
 
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
@@ -244,4 +244,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -279,4 +280,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -314,4 +316,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -351,4 +354,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -540,4 +545,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -570,4 +576,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -606,4 +613,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   Address that encodes the PCI Segment, Bus, Device, Function, and Register.
@@ -643,4 +651,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -829,4 +839,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -864,4 +875,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -899,5 +911,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
-  
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -937,4 +949,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PeCoffLib.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PeCoffLib.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PeCoffLib.h	(revision 58459)
@@ -6,5 +6,5 @@
   and can be ported easily to any environment.
   
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under
 the terms and conditions of the BSD License that accompanies this distribution.
@@ -35,4 +35,5 @@
 #define IMAGE_ERROR_FAILED_RELOCATION            9
 #define IMAGE_ERROR_FAILED_ICACHE_FLUSH          10
+#define IMAGE_ERROR_UNSUPPORTED                  11
 
 /**
@@ -60,7 +61,7 @@
   @param  Buffer          Output buffer that contains the data read from the PE/COFF image.
   
-  @retval RETURN_SUCCESS            The specified portion of the PE/COFF image was
-                                    read and the size
-  @retval RETURN_DEVICE_ERROR       The specified portion of the PE/COFF image
+  @retval RETURN_SUCCESS            The specified portion of the PE/COFF image was 
+                                    read and the size return in ReadSize.
+  @retval RETURN_DEVICE_ERROR       The specified portion of the PE/COFF image 
                                     could not be read due to a device error.
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PeiServicesLib.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PeiServicesLib.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PeiServicesLib.h	(revision 58459)
@@ -222,4 +222,28 @@
 
 /**
+  This service enables PEIMs to discover sections of a given instance and type within a valid FFS file.
+
+  @param  SectionType           The value of the section type to find.
+  @param  SectionInstance       Section instance to find.
+  @param  FileHandle            A pointer to the file header that contains the set 
+                                of sections to be searched.
+  @param  SectionData           A pointer to the discovered section, if successful.
+  @param  AuthenticationStatus  A pointer to the authentication status for this section.
+
+  @retval EFI_SUCCESS           The section was found.
+  @retval EFI_NOT_FOUND         The section was not found.
+
+**/
+EFI_STATUS
+EFIAPI
+PeiServicesFfsFindSectionData3 (
+  IN EFI_SECTION_TYPE           SectionType,
+  IN UINTN                      SectionInstance,
+  IN EFI_PEI_FILE_HANDLE        FileHandle,
+  OUT VOID                      **SectionData,
+  OUT UINT32                    *AuthenticationStatus
+  );
+
+/**
   This service enables PEIMs to register the permanent memory configuration
   that has been initialized with the PEI Foundation.
@@ -347,4 +371,29 @@
   IN CONST  EFI_PEI_FILE_HANDLE   FileHandle,
   OUT EFI_FV_FILE_INFO            *FileInfo
+  );
+
+/**
+  This service is a wrapper for the PEI Service FfsGetFileInfo2(), except the pointer to the PEI Services
+  Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface
+  Specification for details.
+
+  @param FileHandle   Handle of the file.
+
+  @param FileInfo     Upon exit, points to the file's
+                      information.
+
+  @retval EFI_SUCCESS             File information returned.
+  
+  @retval EFI_INVALID_PARAMETER   If FileHandle does not
+                                  represent a valid file.
+  
+  @retval EFI_INVALID_PARAMETER   If FileInfo is NULL.
+  
+**/
+EFI_STATUS
+EFIAPI
+PeiServicesFfsGetFileInfo2 (
+  IN CONST  EFI_PEI_FILE_HANDLE   FileHandle,
+  OUT EFI_FV_FILE_INFO2           *FileInfo
   );
 
@@ -432,3 +481,44 @@
   );
 
+/**
+  Install a EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI instance so the PEI Core will be notified about a new firmware volume.
+
+  This function allocates, initializes, and installs a new EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI using
+  the parameters passed in to initialize the fields of the EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI instance.
+  If the resources can not be allocated for EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI, then ASSERT().
+  If the EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI can not be installed, then ASSERT().
+
+  @param  FvFormat             Unique identifier of the format of the memory-mapped
+                               firmware volume.  This parameter is optional and
+                               may be NULL.  If NULL is specified, the
+                               EFI_FIRMWARE_FILE_SYSTEM2_GUID format is assumed.
+  @param  FvInfo               Points to a buffer which allows the
+                               EFI_PEI_FIRMWARE_VOLUME_PPI to process the volume.
+                               The format of this buffer is specific to the FvFormat.
+                               For memory-mapped firmware volumes, this typically
+                               points to the first byte of the firmware volume.
+  @param  FvInfoSize           The size, in bytes, of FvInfo. For memory-mapped
+                               firmware volumes, this is typically the size of
+                               the firmware volume.
+  @param  ParentFvName         If the new firmware volume originated from a file
+                               in a different firmware volume, then this parameter
+                               specifies the GUID name of the originating firmware
+                               volume. Otherwise, this parameter must be NULL.
+  @param  ParentFileName       If the new firmware volume originated from a file
+                               in a different firmware volume, then this parameter
+                               specifies the GUID file name of the originating
+                               firmware file. Otherwise, this parameter must be NULL.
+  @param  AuthenticationStatus Authentication Status
+**/
+VOID
+EFIAPI
+PeiServicesInstallFvInfo2Ppi (
+  IN CONST EFI_GUID                *FvFormat, OPTIONAL
+  IN CONST VOID                    *FvInfo,
+  IN       UINT32                  FvInfoSize,
+  IN CONST EFI_GUID                *ParentFvName, OPTIONAL
+  IN CONST EFI_GUID                *ParentFileName, OPTIONAL
+  IN       UINT32                  AuthenticationStatus
+  );
+
 #endif
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PeiServicesTablePointerLib.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PeiServicesTablePointerLib.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PeiServicesTablePointerLib.h	(revision 58459)
@@ -2,5 +2,5 @@
   Provides a service to retrieve a pointer to the PEI Services Table.
 
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
@@ -51,4 +51,24 @@
   );
 
+/**
+  Perform CPU specific actions required to migrate the PEI Services Table 
+  pointer from temporary RAM to permanent RAM.
+
+  For IA32 CPUs, the PEI Services Table pointer is stored in the 4 bytes 
+  immediately preceding the Interrupt Descriptor Table (IDT) in memory.
+  For X64 CPUs, the PEI Services Table pointer is stored in the 8 bytes 
+  immediately preceding the Interrupt Descriptor Table (IDT) in memory.
+  For Itanium and ARM CPUs, a the PEI Services Table Pointer is stored in
+  a dedicated CPU register.  This means that there is no memory storage 
+  associated with storing the PEI Services Table pointer, so no additional 
+  migration actions are required for Itanium or ARM CPUs.
+
+**/
+VOID
+EFIAPI
+MigratePeiServicesTablePointer (
+  VOID
+  );
+
 #endif
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PerformanceLib.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PerformanceLib.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PerformanceLib.h	(revision 58459)
@@ -2,5 +2,5 @@
   Provides services to log the execution times and retrieve them later.
 
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
@@ -60,5 +60,4 @@
   If the record is found and TimeStamp is zero, then this function reads
   the current time stamp and adds that time stamp value to the record as the end time.
-  If this function is called multiple times for the same record, then the end time is overwritten.
 
   @param  Handle                  Pointer to environment specific context used
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PrintLib.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PrintLib.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/PrintLib.h	(revision 58459)
@@ -3,5 +3,5 @@
   Unicode and ASCII strings are supported.
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -47,6 +47,6 @@
         If 0 is also specified, then 0 is ignored.
     - L, l
-      - The number being printed is a UINT64.  Only valid for types X, x, and d.
-        If this flag is not specified, then the number being printed is a int.
+      - The number being printed is size UINT64.  Only valid for types X, x, and d.
+        If this flag is not specified, then the number being printed is size int.
     - NOTE: All invalid flags are ignored.
 
@@ -79,18 +79,18 @@
         using this type too by making sure bits 8..15 of the argument are set to 0.
     - x
-      - The argument is a hexadecimal number.  The characters used are 0..9 and 
+      - The argument is an unsigned hexadecimal number.  The characters used are 0..9 and 
         A..F.  If the flag 'L' is not specified, then the argument is assumed 
-        to be an int.  This does not follow ANSI C.
+        to be size int.  This does not follow ANSI C.
     - X
-      - The argument is a hexadecimal number and the number is padded with 
+      - The argument is an unsigned hexadecimal number and the number is padded with 
         zeros.  This is equivalent to a format string of "0x". If the flag 
-        'L' is not specified, then the argument is assumed to be an int.  
+        'L' is not specified, then the argument is assumed to be size int.  
         This does not follow ANSI C.
     - d
-      - The argument is a decimal number.  If the flag 'L' is not specified, 
-        then the argument is assumed to be an int.  
+      - The argument is a signed decimal number.  If the flag 'L' is not specified, 
+        then the argument is assumed to be size int.  
     - p
-      - The argument is a pointer that is a (VOID *), and it is printed as a 
-        hexadecimal number  The characters used are 0..9 and A..F.
+      - The argument is a pointer that is a (VOID *), and it is printed as an 
+        unsigned hexadecimal number  The characters used are 0..9 and A..F.
     - a
       - The argument is a pointer to an ASCII string.  
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/S3BootScriptLib.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/S3BootScriptLib.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/S3BootScriptLib.h	(revision 58459)
@@ -6,5 +6,5 @@
   APIs cannot be used if the underlying firmware is Framework and not PI.
 
-  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
@@ -282,5 +282,5 @@
 
 /**
-  Adds a record for an execution stall on the processor into a specified boot script table.
+  Adds a record for dispatching specified arbitrary code into a specified boot script table.
 
   @param[in] EntryPoint   The entry point of the code to be dispatched.
@@ -317,5 +317,10 @@
   Adds a record for memory reads of the memory location and continues when the exit 
   criteria is satisfied, or after a defined duration.
-  
+
+  Please aware, below interface is different with PI specification, Vol 5:
+  EFI_S3_SAVE_STATE_PROTOCOL.Write() for EFI_BOOT_SCRIPT_MEM_POLL_OPCODE.
+  "Duration" below is microseconds, while "Delay" in PI specification means
+  the number of 100ns units to poll.
+
   @param[in] Width       The width of the memory operations.
   @param[in] Address     The base address of the memory operations.
@@ -349,5 +354,4 @@
   @param[in] Information        Information to be logged in the boot scrpit
  
-  @retval RETURN_UNSUPPORTED        In runtime, this method is not supported.
   @retval RETURN_OUT_OF_RESOURCES   Not enough memory for the table to perform 
                                     the operation.
@@ -462,5 +466,4 @@
                       script table.
 
-  @retval RETURN_UNSUPPORTED        In runtime, this method is not supported.
   @retval RETURN_OUT_OF_RESOURCES   Not enough memory for the table to perform 
                                     the operation.
@@ -495,5 +498,5 @@
   maintained by the lib will be destroyed.
  
-  @return the base address of the new copy of the boot script tble.   
+  @return the base address of the new copy of the boot script table.   
 
 **/
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/S3IoLib.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/S3IoLib.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/S3IoLib.h	(revision 58459)
@@ -4,5 +4,5 @@
   of the IoLib class. 
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
@@ -187,4 +187,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Port       The I/O port to write.
@@ -222,4 +223,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Port       The I/O port to write.
@@ -257,4 +259,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Port       The I/O port to write.
@@ -293,4 +296,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Port       The I/O port to write.
@@ -482,4 +487,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Port       The I/O port to write.
@@ -517,4 +523,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Port       The I/O port to write.
@@ -552,4 +559,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Port       The I/O port to write.
@@ -589,4 +597,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Port       The I/O port to write.
@@ -778,4 +788,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Port       The I/O port to write.
@@ -813,4 +824,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Port       The I/O port to write.
@@ -848,4 +860,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Port       The I/O port to write.
@@ -885,4 +898,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Port       The I/O port to write.
@@ -1074,4 +1089,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Port       The I/O port to write.
@@ -1109,4 +1125,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Port       The I/O port to write.
@@ -1144,4 +1161,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Port       The I/O port to write.
@@ -1181,4 +1199,6 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Port       The I/O port to write.
@@ -1369,4 +1389,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Address    The MMIO register to write.
@@ -1405,4 +1426,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Address    The MMIO register to write.
@@ -1441,4 +1463,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Address    The MMIO register to write.
@@ -1478,4 +1501,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Address    The MMIO register to write.
@@ -1667,4 +1692,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Address    The MMIO register to write.
@@ -1703,4 +1729,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Address    The MMIO register to write.
@@ -1739,4 +1766,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Address    The MMIO register to write.
@@ -1776,4 +1804,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Address    The MMIO register to write.
@@ -1964,4 +1994,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Address    The MMIO register to write.
@@ -2000,4 +2031,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Address    The MMIO register to write.
@@ -2036,4 +2068,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Address    The MMIO register to write.
@@ -2073,4 +2106,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Address    The MMIO register to write.
@@ -2261,4 +2296,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Address    The MMIO register to write.
@@ -2297,4 +2333,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Address    The MMIO register to write.
@@ -2333,4 +2370,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Address    The MMIO register to write.
@@ -2370,4 +2408,6 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in]  Address    The MMIO register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/S3PciLib.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/S3PciLib.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/S3PciLib.h	(revision 58459)
@@ -4,5 +4,5 @@
   maps directly on top of the PciLib class. 
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
@@ -209,4 +209,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in] Address    The PCI configuration register to write.
@@ -245,4 +246,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in] Address    The PCI configuration register to write.
@@ -281,4 +283,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in] Address    The PCI configuration register to write.
@@ -318,4 +321,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in] Address    The PCI configuration register to write.
@@ -521,4 +526,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in] Address    The PCI configuration register to write.
@@ -558,4 +564,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in] Address    The PCI configuration register to write.
@@ -595,4 +602,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in] Address    The PCI configuration register to write.
@@ -633,4 +641,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in] Address    The PCI configuration register to write.
@@ -804,5 +814,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
-
+ 
   @param[in] Address    The PCI configuration register to read.
   @param[in] StartBit   The ordinal of the least significant bit in the bit field.
@@ -836,4 +846,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in] Address    The PCI configuration register to write.
@@ -873,4 +884,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in] Address    The PCI configuration register to write.
@@ -910,4 +922,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in] Address    The PCI configuration register to write.
@@ -948,4 +961,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param[in] Address    The PCI configuration register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/SynchronizationLib.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/SynchronizationLib.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/SynchronizationLib.h	(revision 58459)
@@ -2,5 +2,5 @@
   Provides synchronization functions.
 
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
@@ -27,6 +27,6 @@
 
   This function retrieves the spin lock alignment requirements for optimal
-  performance on a given CPU architecture. The spin lock alignment must be a
-  power of two and is returned by this function. If there are no alignment
+  performance on a given CPU architecture. The spin lock alignment is byte alignment. 
+  It must be a power of two and is returned by this function. If there are no alignment
   requirements, then 1 must be returned. The spin lock synchronization
   functions must function correctly if the spin lock size and alignment values
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/UefiLib.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/UefiLib.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/UefiLib.h	(revision 58459)
@@ -13,5 +13,5 @@
   defined, then debug and assert related macros wrapped by it are the NULL implementations.
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -630,6 +630,9 @@
   );
 
-
-/**
+#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
+
+/**
+  [ATTENTION] This function will be deprecated for security reason.
+
   Returns a pointer to an allocated buffer that contains the contents of a 
   variable retrieved through the UEFI Runtime Service GetVariable().  The 
@@ -656,4 +659,6 @@
 
 /**
+  [ATTENTION] This function will be deprecated for security reason.
+
   Returns a pointer to an allocated buffer that contains the contents of a 
   variable retrieved through the UEFI Runtime Service GetVariable().  This 
@@ -676,5 +681,62 @@
   IN CONST CHAR16  *Name
   );
-
+#endif
+
+
+/**
+  Returns the status whether get the variable success. The function retrieves 
+  variable  through the UEFI Runtime Service GetVariable().  The 
+  returned buffer is allocated using AllocatePool().  The caller is responsible
+  for freeing this buffer with FreePool().
+
+  If Name  is NULL, then ASSERT().
+  If Guid  is NULL, then ASSERT().
+  If Value is NULL, then ASSERT().
+
+  @param[in]  Name  The pointer to a Null-terminated Unicode string.
+  @param[in]  Guid  The pointer to an EFI_GUID structure
+  @param[out] Value The buffer point saved the variable info.
+  @param[out] Size  The buffer size of the variable.
+
+  @return EFI_OUT_OF_RESOURCES      Allocate buffer failed.
+  @return EFI_SUCCESS               Find the specified variable.
+  @return Others Errors             Return errors from call to gRT->GetVariable.
+
+**/
+EFI_STATUS
+EFIAPI
+GetVariable2 (
+  IN CONST CHAR16    *Name,
+  IN CONST EFI_GUID  *Guid,
+  OUT VOID           **Value,
+  OUT UINTN          *Size OPTIONAL
+  );
+
+/**
+  Returns a pointer to an allocated buffer that contains the contents of a 
+  variable retrieved through the UEFI Runtime Service GetVariable().  This 
+  function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables.
+  The returned buffer is allocated using AllocatePool().  The caller is 
+  responsible for freeing this buffer with FreePool().
+
+  If Name  is NULL, then ASSERT().
+  If Value is NULL, then ASSERT().
+
+  @param[in]  Name  The pointer to a Null-terminated Unicode string.
+  @param[out] Value The buffer point saved the variable info.
+  @param[out] Size  The buffer size of the variable.
+
+  @return EFI_OUT_OF_RESOURCES      Allocate buffer failed.
+  @return EFI_SUCCESS               Find the specified variable.
+  @return Others Errors             Return errors from call to gRT->GetVariable.
+
+**/
+EFI_STATUS
+EFIAPI
+GetEfiGlobalVariable2 (
+  IN CONST CHAR16    *Name,
+  OUT VOID           **Value,
+  OUT UINTN          *Size OPTIONAL
+  );
 
 /**
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/UefiScsiLib.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/UefiScsiLib.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Library/UefiScsiLib.h	(revision 58459)
@@ -6,5 +6,5 @@
   This library class depends on SCSI I/O Protocol defined in UEFI Specification and SCSI-2 industry standard.
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials                          
 are licensed and made available under the terms and conditions of the BSD License         
@@ -548,5 +548,5 @@
   @param[in, out] DataLength           The length of data buffer.
   @param[in]      StartLba             The start address of LBA.
-  @param[in]      SectorSize           The sector size.
+  @param[in]      SectorSize           The number of contiguous logical blocks of data that shall be transferred.
 
   @retval  EFI_SUCCESS          Command is executed successfully.
@@ -600,5 +600,5 @@
   @param[in, out] DataLength           The length of data buffer.
   @param[in]      StartLba             The start address of LBA.
-  @param[in]      SectorSize           The sector size.
+  @param[in]      SectorSize           The number of contiguous logical blocks of data that shall be transferred.
 
   @retval  EFI_SUCCESS          Command is executed successfully.
@@ -652,5 +652,5 @@
   @param[in, out] DataLength           The length of data buffer.
   @param[in]      StartLba             The start address of LBA.
-  @param[in]      SectorSize           The sector size.
+  @param[in]      SectorSize           The number of contiguous logical blocks of data that shall be transferred.
 
   @retval  EFI_SUCCESS          Command is executed successfully.
@@ -704,5 +704,5 @@
   @param[in, out] DataLength           The length of data buffer.
   @param[in]      StartLba             The start address of LBA.
-  @param[in]      SectorSize           The sector size.
+  @param[in]      SectorSize           The number of contiguous logical blocks of data that shall be transferred.
 
   @retval  EFI_SUCCESS          Command is executed successfully.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Pi/PiBootMode.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Pi/PiBootMode.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Pi/PiBootMode.h	(revision 58459)
@@ -2,5 +2,5 @@
   Present the boot mode values in PI.
 
-  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -12,5 +12,5 @@
 
   @par Revision Reference:
-  PI Version 1.0
+  PI Version 1.2.1A
 
 **/
@@ -34,4 +34,5 @@
 #define BOOT_ON_S4_RESUME                             0x05
 #define BOOT_ON_S5_RESUME                             0x06
+#define BOOT_WITH_MFG_MODE_SETTINGS                   0x07
 #define BOOT_ON_S2_RESUME                             0x10
 #define BOOT_ON_S3_RESUME                             0x11
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Pi/PiDxeCis.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Pi/PiDxeCis.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Pi/PiDxeCis.h	(revision 58459)
@@ -2,5 +2,5 @@
   Include file matches things in PI.
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -12,5 +12,5 @@
 
   @par Revision Reference:
-  PI Version 1.2
+  PI Version 1.4
 
 **/
@@ -49,4 +49,9 @@
   ///
   EfiGcdMemoryTypeMemoryMappedIo,
+  ///
+  /// A memory region that is visible to the boot processor. 
+  /// This memory supports byte-addressable non-volatility. 
+  ///
+  EfiGcdMemoryTypePersistentMemory,
   EfiGcdMemoryTypeMaximum
 } EFI_GCD_MEMORY_TYPE;
@@ -366,5 +371,5 @@
   @retval EFI_UNSUPPORTED       The bit mask of attributes is not support for the memory resource
                                 range specified by BaseAddress and Length.
-  @retval EFI_ACCESS_DEFINED    The attributes for the memory resource range specified by
+  @retval EFI_ACCESS_DENIED     The attributes for the memory resource range specified by
                                 BaseAddress and Length cannot be modified.
   @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to modify the attributes of
@@ -379,4 +384,29 @@
   IN UINT64                       Length,
   IN UINT64                       Attributes
+  );
+
+/**
+  Modifies the capabilities for a memory region in the global coherency domain of the
+  processor.
+
+  @param  BaseAddress      The physical address that is the start address of a memory region.
+  @param  Length           The size in bytes of the memory region.
+  @param  Capabilities     The bit mask of capabilities that the memory region supports.
+
+  @retval EFI_SUCCESS           The capabilities were set for the memory region.
+  @retval EFI_INVALID_PARAMETER Length is zero.
+  @retval EFI_UNSUPPORTED       The capabilities specified by Capabilities do not include the
+                                memory region attributes currently in use.
+  @retval EFI_ACCESS_DENIED     The capabilities for the memory resource range specified by
+                                BaseAddress and Length cannot be modified.
+  @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to modify the capabilities
+                                of the memory resource range.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_SET_MEMORY_SPACE_CAPABILITIES) (
+  IN EFI_PHYSICAL_ADDRESS  BaseAddress,
+  IN UINT64                Length,
+  IN UINT64                Capabilities
   );
 
@@ -658,5 +688,5 @@
 #define DXE_SERVICES_SIGNATURE            0x565245535f455844ULL
 #define DXE_SPECIFICATION_MAJOR_REVISION  1
-#define DXE_SPECIFICATION_MINOR_REVISION  20
+#define DXE_SPECIFICATION_MINOR_REVISION  30
 #define DXE_SERVICES_REVISION             ((DXE_SPECIFICATION_MAJOR_REVISION<<16) | (DXE_SPECIFICATION_MINOR_REVISION))
 
@@ -695,4 +725,8 @@
   //
   EFI_PROCESS_FIRMWARE_VOLUME     ProcessFirmwareVolume;
+  //
+  // Extensions to Global Coherency Domain Services
+  //
+  EFI_SET_MEMORY_SPACE_CAPABILITIES SetMemorySpaceCapabilities;
 } DXE_SERVICES;
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Pi/PiFirmwareVolume.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Pi/PiFirmwareVolume.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Pi/PiFirmwareVolume.h	(revision 58459)
@@ -2,5 +2,5 @@
   The firmware volume related definitions in PI.
 
-  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -12,5 +12,5 @@
 
   @par Revision Reference:
-  PI Version 1.2C
+  PI Version 1.3
 
 **/
@@ -87,5 +87,5 @@
 #define EFI_FVB2_ALIGNMENT_1G       0x001E0000
 #define EFI_FVB2_ALIGNMENT_2G       0x001F0000
-
+#define EFI_FVB2_WEAK_ALIGNMENT     0x80000000
 
 typedef struct {
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Pi/PiHob.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Pi/PiHob.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Pi/PiHob.h	(revision 58459)
@@ -2,5 +2,5 @@
   HOB related definitions in PI.
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -258,4 +258,5 @@
 #define EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTED          0x00000100
 #define EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTED      0x00000200
+#define EFI_RESOURCE_ATTRIBUTE_PERSISTENT               0x00800000
 //
 // The rest of the attributes are used to describe capabilities
@@ -276,4 +277,5 @@
 #define EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTABLE        0x00200000
 #define EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTABLE    0x00400000
+#define EFI_RESOURCE_ATTRIBUTE_PERSISTABLE              0x01000000
 
 ///
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Pi/PiMultiPhase.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Pi/PiMultiPhase.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Pi/PiMultiPhase.h	(revision 58459)
@@ -2,5 +2,5 @@
   Include file matches things in PI for multiple module types.
 
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -134,3 +134,32 @@
 } EFI_SMRAM_DESCRIPTOR;
 
+typedef enum {
+  EFI_PCD_TYPE_8,
+  EFI_PCD_TYPE_16,
+  EFI_PCD_TYPE_32,
+  EFI_PCD_TYPE_64,
+  EFI_PCD_TYPE_BOOL,
+  EFI_PCD_TYPE_PTR
+} EFI_PCD_TYPE;
+
+typedef struct {
+  ///
+  /// The returned information associated with the requested TokenNumber. If
+  /// TokenNumber is 0, then PcdType is set to EFI_PCD_TYPE_8.
+  ///
+  EFI_PCD_TYPE      PcdType;
+  ///
+  /// The size of the data in bytes associated with the TokenNumber specified. If
+  /// TokenNumber is 0, then PcdSize is set 0.
+  ///
+  UINTN             PcdSize;
+  ///
+  /// The null-terminated ASCII string associated with a given token. If the
+  /// TokenNumber specified was 0, then this field corresponds to the null-terminated
+  /// ASCII string associated with the token's namespace Guid. If NULL, there is no
+  /// name associated with this request.
+  ///
+  CHAR8             *PcdName;
+} EFI_PCD_INFO;
+
 #endif
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Pi/PiPeiCis.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Pi/PiPeiCis.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Pi/PiPeiCis.h	(revision 58459)
@@ -2,5 +2,5 @@
   PI PEI master include file. This file should match the PI spec.
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -394,4 +394,36 @@
   IN EFI_PEI_FILE_HANDLE               FileHandle,
   OUT VOID                             **SectionData
+  );
+
+/**
+  Searches for the next matching section within the specified file.
+
+  This service enables PEI modules to discover the section of a given type within a valid file.
+  This service will search within encapsulation sections (compression and GUIDed) as well. It will
+  search inside of a GUIDed section or a compressed section, but may not, for example, search a
+  GUIDed section inside a GUIDes section.
+  This service will not search within compression sections or GUIDed sections that require
+  extraction if memory is not present.
+
+  @param  PeiServices           An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
+  @param  SectionType           The value of the section type to find.
+  @param  SectionInstance       Section instance to find.
+  @param  FileHandle            Handle of the firmware file to search.
+  @param  SectionData           A pointer to the discovered section, if successful.
+  @param  AuthenticationStatus  A pointer to the authentication status for this section.
+
+  @retval EFI_SUCCESS      The section was found.
+  @retval EFI_NOT_FOUND    The section was not found.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PEI_FFS_FIND_SECTION_DATA3)(
+  IN CONST EFI_PEI_SERVICES            **PeiServices,
+  IN EFI_SECTION_TYPE                  SectionType,
+  IN UINTN                             SectionInstance,
+  IN EFI_PEI_FILE_HANDLE               FileHandle,
+  OUT VOID                             **SectionData,
+  OUT UINT32                           *AuthenticationStatus
   );
 
@@ -609,4 +641,36 @@
 } EFI_FV_FILE_INFO;
 
+///
+/// The information with authentication status of the FV file.
+///
+typedef struct {
+  ///
+  /// Name of the file.
+  ///
+  EFI_GUID                FileName;
+  ///
+  /// File type.
+  ///
+  EFI_FV_FILETYPE         FileType;
+  ///
+  /// Attributes of the file.
+  ///
+  EFI_FV_FILE_ATTRIBUTES  FileAttributes;
+  ///
+  /// Points to the file's data (not the header).
+  /// Not valid if EFI_FV_FILE_ATTRIB_MEMORY_MAPPED
+  /// is zero.
+  ///
+  VOID                    *Buffer;
+  ///
+  /// Size of the file's data.
+  ///
+  UINT32                  BufferSize;
+  ///
+  /// Authentication status for this file.
+  ///
+  UINT32                  AuthenticationStatus;
+} EFI_FV_FILE_INFO2;
+
 /**
   Returns information about a specific file.
@@ -632,4 +696,28 @@
   IN  EFI_PEI_FILE_HANDLE         FileHandle,
   OUT EFI_FV_FILE_INFO            *FileInfo
+  );
+
+/**
+  Returns information about a specific file.
+
+  This function returns information about a specific file,
+  including its file name, type, attributes, starting address, size and authentication status.
+  If the firmware volume is not memory mapped, then the Buffer member will be NULL.
+
+  @param FileHandle   The handle of the file.
+  @param FileInfo     Upon exit, points to the file's
+                      information.
+
+  @retval EFI_SUCCESS             File information was returned.
+  @retval EFI_INVALID_PARAMETER   FileHandle does not
+                                  represent a valid file.
+  @retval EFI_INVALID_PARAMETER   FileInfo is NULL.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PEI_FFS_GET_FILE_INFO2)(
+  IN  EFI_PEI_FILE_HANDLE         FileHandle,
+  OUT EFI_FV_FILE_INFO2           *FileInfo
   );
 
@@ -721,5 +809,5 @@
 //
 #define PEI_SPECIFICATION_MAJOR_REVISION  1
-#define PEI_SPECIFICATION_MINOR_REVISION  20
+#define PEI_SPECIFICATION_MINOR_REVISION  30
 ///
 /// Specification inconsistency here: 
@@ -814,4 +902,6 @@
   EFI_PEI_FFS_GET_VOLUME_INFO     FfsGetVolumeInfo;
   EFI_PEI_REGISTER_FOR_SHADOW     RegisterForShadow;
+  EFI_PEI_FFS_FIND_SECTION_DATA3  FindSectionData3;
+  EFI_PEI_FFS_GET_FILE_INFO2      FfsGetFileInfo2;
 };
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Pi/PiSmmCis.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Pi/PiSmmCis.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Pi/PiSmmCis.h	(revision 58459)
@@ -3,5 +3,5 @@
   VOLUME 4 System Management Mode Core Interface version.
 
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -30,5 +30,5 @@
 ///
 #define SMM_SPECIFICATION_MAJOR_REVISION  1
-#define SMM_SPECIFICATION_MINOR_REVISION  20
+#define SMM_SPECIFICATION_MINOR_REVISION  30
 #define EFI_SMM_SYSTEM_TABLE2_REVISION    ((SMM_SPECIFICATION_MAJOR_REVISION<<16) | (SMM_SPECIFICATION_MINOR_REVISION))
 
@@ -107,4 +107,5 @@
   called whenever a protocol interface is installed for Protocol by 
   SmmInstallProtocolInterface().
+  If Function == NULL and Registration is an existing registration, then the callback is unhooked.
 
   @param[in]  Protocol          The unique ID of the protocol for which the event is to be registered.
@@ -115,4 +116,5 @@
   @retval EFI_INVALID_PARAMETER One or more of Protocol, Function and Registration is NULL.
   @retval EFI_OUT_OF_RESOURCES  Not enough memory resource to finish the request.
+  @retval EFI_NOT_FOUND         If the registration is not found when Function == NULL.
 **/
 typedef
@@ -132,8 +134,8 @@
   @param[in,out] CommBufferSize  Points to the size of the optional communication buffer.
 
-  @retval EFI_SUCCESS                        Interrupt source was processed successfully but not quiesced.
+  @retval EFI_WARN_INTERRUPT_SOURCE_PENDING  Interrupt source was processed successfully but not quiesced.
   @retval EFI_INTERRUPT_PENDING              One or more SMI sources could not be quiesced.
-  @retval EFI_WARN_INTERRUPT_SOURCE_PENDING  Interrupt source was not handled or quiesced.
-  @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED Interrupt source was handled and quiesced.
+  @retval EFI_NOT_FOUND                      Interrupt source was not handled or quiesced.
+  @retval EFI_SUCCESS                        Interrupt source was handled and quiesced.
 **/
 typedef
@@ -217,5 +219,5 @@
   UINTN                    CurrentlyExecutingCpu;
   ///
-  /// The number of current operational processors in the platform.  This is a 1 based 
+  /// The number of possible processors in the platform.  This is a 1 based 
   /// counter.  This does not indicate the number of processors that entered SMM.
   ///
@@ -298,5 +300,5 @@
   UINTN                                CurrentlyExecutingCpu;
   ///
-  /// The number of current operational processors in the platform.  This is a 1 based counter.
+  /// The number of possible processors in the platform.  This is a 1 based counter.
   ///
   UINTN                                NumberOfCpus;
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Pi/PiStatusCode.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Pi/PiStatusCode.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Pi/PiStatusCode.h	(revision 58459)
@@ -2,5 +2,5 @@
   StatusCode related definitions in PI.
 
-Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -597,5 +597,8 @@
 // IO Bus Class ATA/ATAPI Subclass Progress Code definitions.
 //
-
+#define EFI_IOB_ATA_BUS_SMART_ENABLE          (EFI_SUBCLASS_SPECIFIC | 0x00000000)
+#define EFI_IOB_ATA_BUS_SMART_DISABLE         (EFI_SUBCLASS_SPECIFIC | 0x00000001)
+#define EFI_IOB_ATA_BUS_SMART_OVERTHRESHOLD   (EFI_SUBCLASS_SPECIFIC | 0x00000002)
+#define EFI_IOB_ATA_BUS_SMART_UNDERTHRESHOLD  (EFI_SUBCLASS_SPECIFIC | 0x00000003)
 //
 // IO Bus Class FC Subclass Progress Code definitions.
@@ -670,4 +673,6 @@
 // IO Bus Class ATA/ATAPI Subclass Error Code definitions.
 //
+#define EFI_IOB_ATA_BUS_SMART_NOTSUPPORTED  (EFI_SUBCLASS_SPECIFIC | 0x00000000)
+#define EFI_IOB_ATA_BUS_SMART_DISABLED      (EFI_SUBCLASS_SPECIFIC | 0x00000001)
 
 //
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/BlockIo.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/BlockIo.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/BlockIo.h	(revision 58459)
@@ -11,5 +11,5 @@
   driver are the same, here we define a set of general PPIs for both drivers to use.
   
-Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -55,4 +55,7 @@
   IdeLS120      = 2,   ///< The recovery device is an IDE LS-120
   UsbMassStorage= 3,   ///< The recovery device is a USB Mass Storage device
+  SD            = 4,   ///< The recovery device is a Secure Digital device
+  EMMC          = 5,   ///< The recovery device is a eMMC device
+  UfsDevice     = 6,   ///< The recovery device is a Universal Flash Storage device
   MaxDeviceType
 } EFI_PEI_BLOCK_DEVICE_TYPE;
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/FirmwareVolume.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/FirmwareVolume.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/FirmwareVolume.h	(revision 58459)
@@ -2,5 +2,5 @@
   This file provides functions for accessing a memory-mapped firmware volume of a specific format.
 
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -155,4 +155,31 @@
 
 /**
+  Returns information about a specific file.
+
+  This function returns information about a specific
+  file, including its file name, type, attributes, starting
+  address, size and authentication status. 
+
+  @param This                     Points to this instance of the
+                                  EFI_PEI_FIRMWARE_VOLUME_PPI.
+  @param FileHandle               Handle of the file.
+  @param FileInfo                 Upon exit, points to the file's
+                                  information.
+
+  @retval EFI_SUCCESS             File information returned.
+  @retval EFI_INVALID_PARAMETER   If FileHandle does not
+                                  represent a valid file.
+  @retval EFI_INVALID_PARAMETER   If FileInfo is NULL.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PEI_FV_GET_FILE_INFO2)(
+  IN  CONST EFI_PEI_FIRMWARE_VOLUME_PPI   *This, 
+  IN  EFI_PEI_FILE_HANDLE                 FileHandle,
+  OUT EFI_FV_FILE_INFO2                   *FileInfo
+);
+
+/**
   This function returns information about the firmware volume.
   
@@ -203,4 +230,41 @@
   OUT VOID                                 **SectionData
 );
+
+/**
+  Find the next matching section in the firmware file.
+
+  This service enables PEI modules to discover sections
+  of a given instance and type within a valid file.
+
+  @param This                   Points to this instance of the
+                                EFI_PEI_FIRMWARE_VOLUME_PPI.
+  @param SearchType             A filter to find only sections of this
+                                type.
+  @param SearchInstance         A filter to find the specific instance
+                                of sections.
+  @param FileHandle             Handle of firmware file in which to
+                                search.
+  @param SectionData            Updated upon return to point to the
+                                section found.
+  @param AuthenticationStatus   Updated upon return to point to the
+                                authentication status for this section.
+
+  @retval EFI_SUCCESS     Section was found.
+  @retval EFI_NOT_FOUND   Section of the specified type was not
+                          found. SectionData contains NULL.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PEI_FV_FIND_SECTION2)(
+  IN  CONST EFI_PEI_FIRMWARE_VOLUME_PPI    *This,
+  IN  EFI_SECTION_TYPE                     SearchType,
+  IN  UINTN                                SearchInstance,
+  IN  EFI_PEI_FILE_HANDLE                  FileHandle,
+  OUT VOID                                 **SectionData,
+  OUT UINT32                               *AuthenticationStatus
+);
+
+#define EFI_PEI_FIRMWARE_VOLUME_PPI_SIGNATURE SIGNATURE_32 ('P', 'F', 'V', 'P')
+#define EFI_PEI_FIRMWARE_VOLUME_PPI_REVISION 0x00010030
 
 ///
@@ -214,4 +278,14 @@
   EFI_PEI_FV_GET_INFO         GetVolumeInfo;
   EFI_PEI_FV_FIND_SECTION     FindSectionByType;
+  EFI_PEI_FV_GET_FILE_INFO2   GetFileInfo2;
+  EFI_PEI_FV_FIND_SECTION2    FindSectionByType2;
+  ///
+  /// Signature is used to keep backward-compatibility, set to {'P','F','V','P'}.
+  ///
+  UINT32                      Signature;
+  ///
+  /// Revision for further extension.
+  ///
+  UINT32                      Revision;
 };
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/LoadFile.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/LoadFile.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/LoadFile.h	(revision 58459)
@@ -2,5 +2,5 @@
   Load image file from fv to memory. 
 
-  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -48,5 +48,8 @@
   @retval EFI_UNSUPPORTED       An image requires relocations or is not
                                 memory mapped.
-   
+  @retval EFI_WARN_BUFFER_TOO_SMALL 
+                                There is not enough heap to allocate the requested size.
+                                This will not prevent the XIP image from being invoked.
+
 **/
 typedef
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Pcd.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Pcd.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Pcd.h	(revision 58459)
@@ -7,5 +7,5 @@
   but interfaces for dynamic-ex type PCD require token space guid as parameter.
 
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -776,8 +776,6 @@
   @param[in, out]  TokenNumber A pointer to the PCD token number to use to find the subsequent token number.
                    
-  @retval EFI_SUCCESS   The PCD service has retrieved the next valid token number. 
-                        Or the input token number is already the last valid token number in the PCD database. 
-                        In the later case, *TokenNumber is updated with the value of 0.
-  @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.
+  @retval EFI_SUCCESS   The PCD service has retrieved the next valid token number.
+  @retval EFI_NOT_FOUND The PCD service could not find data from the requested token number.
 
 **/
@@ -794,23 +792,15 @@
   Retrieves the next valid PCD token namespace for a given namespace.
 
-  If *Guid is NULL, then the GUID of the first token space of the 
-  current platform is assigned to *Guid the function return EFI_SUCCESS. 
-  If  *Guid is NULL  and there is no namespace exist in the platform other than the default 
-  (NULL) tokennamespace, *Guid is unchanged and the function return EFI_SUCCESS. 
-  If this input token namespace is the last namespace on the platform, 
-  *Guid will be assigned to NULL and the function return EFI_SUCCESS.
-
-  @param[in, out]  Guid An indirect pointer to EFI_GUID.  On input it designates a known 
-                        token namespace from which the search will start. On output, it designates 
-                        the next valid token namespace on the platform. If the input token namespace 
-                        does not exist on the platform, an error is returned, and the value of *Guid is 
-                        undefined.
-
-  @retval EFI_SUCCESS  The PCD service has retrieved the next valid token namespace. 
-                        Or the input token namespace is already the last valid token 
-                        number in the PCD database. In the later case, *Guid is updated 
-                        with the value of NULL. Or the input token name space is NULL and there 
-                        is no valid token namespace other than the default namespace (NULL).
-  @retval EFI_NOT_FOUND If the input token namespace does not exist on the platform.
+  Gets the next valid token namespace for a given namespace. This is useful to traverse the valid
+  token namespaces on a platform.
+
+  @param[in, out]   Guid    An indirect pointer to EFI_GUID. On input it designates a known token
+                            namespace from which the search will start. On output, it designates the next valid
+                            token namespace on the platform. If *Guid is NULL, then the GUID of the first token
+                            space of the current platform is returned. If the search cannot locate the next valid
+                            token namespace, an error is returned and the value of *Guid is undefined.
+ 
+  @retval  EFI_SUCCESS      The PCD service retrieved the value requested.
+  @retval  EFI_NOT_FOUND    The PCD service could not find the next valid token namespace.
 
 **/
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/PiPcd.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/PiPcd.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/PiPcd.h	(revision 58459)
@@ -1,10 +1,9 @@
 /** @file
-  Platform Configuration Database (PCD) Protocol defined in PI 1.2 Vol3
+  Platform Configuration Database (PCD) PPI defined in PI 1.2 Vol3
 
   A platform database that contains a variety of current platform settings or
   directives that can be accessed by a driver or application.
-  PI PCD protocol only provide the accessing interfaces for Dynamic-Ex type PCD.
-
-  Callers to this protocol must be at a TPL_APPLICATION task priority level.
+  PI PCD ppi only provide the accessing interfaces for Dynamic-Ex type PCD.
+
   This is the base PCD service API that provides an abstraction for accessing configuration content in
   the platform. It a seamless mechanism for extracting information regardless of where the
@@ -13,5 +12,5 @@
   firmware component to monitor specific settings and be alerted when a setting is changed.
 
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -74,5 +73,5 @@
 
 /**
-  Retrieves the current byte-sized value for a PCD token number. If the TokenNumber is invalid,
+  Retrieves the current word-sized value for a PCD token number. If the TokenNumber is invalid,
   the results are unpredictable.
 
@@ -376,5 +375,6 @@
 
   @param[in]    Guid          The 128-bit unique value that designates which namespace to extract the value from.
-  @param[in]    TokenNumber   The PCD token number.
+  @param[in]    TokenNumber   A pointer to the PCD token number to use to find the subsequent token number. To
+                              retrieve the "first" token, have the pointer reference a TokenNumber value of 0.
 
   @retval   EFI_SUCCESS       The PCD service has retrieved the value requested.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Security2.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Security2.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Ppi/Security2.h	(revision 58459)
@@ -6,5 +6,5 @@
   state being returned during the PEI section extraction process.
 
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -76,5 +76,5 @@
   IN UINT32                       AuthenticationStatus,
   IN EFI_PEI_FV_HANDLE            FvHandle,
-  IN EFI_PEI_FV_HANDLE            FileHandle,
+  IN EFI_PEI_FILE_HANDLE          FileHandle,
   IN OUT    BOOLEAN               *DeferExecution
 );
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/AbsolutePointer.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/AbsolutePointer.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/AbsolutePointer.h	(revision 58459)
@@ -3,5 +3,5 @@
   absolute pointer device to be retrieved.
   
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -117,5 +117,5 @@
   
   ///
-  /// The unsigned position of the activation on the x axis. If the AboluteMinY 
+  /// The unsigned position of the activation on the y axis. If the AboluteMinY 
   /// and the AboluteMaxY fields of the EFI_ABSOLUTE_POINTER_MODE structure are 
   /// both 0, then this pointer device does not support an y-axis, and this field
@@ -125,5 +125,5 @@
   
   ///
-  /// The unsigned position of the activation on the x axis, or the pressure 
+  /// The unsigned position of the activation on the z axis, or the pressure 
   /// measurement. If the AboluteMinZ and the AboluteMaxZ fields of the 
   /// EFI_ABSOLUTE_POINTER_MODE structure are both 0, then this pointer device 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/AcpiTable.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/AcpiTable.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/AcpiTable.h	(revision 58459)
@@ -3,5 +3,5 @@
   table from a platform. 
   
-  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -32,5 +32,10 @@
   table at the end of the RSDT/XSDT. To prevent namespace   
   collision, ACPI tables may be created using UEFI ACPI table   
-  format. On successful output, TableKey is   
+  format. If this protocol is used to install a table with a
+  signature already present in the system, the new table will not
+  replace the existing table. It is a platform implementation
+  decision to add a new table with a signature matching an
+  existing table or disallow duplicate table signatures and
+  return EFI_ACCESS_DENIED. On successful output, TableKey is   
   initialized with a unique key. Its value may be used in a   
   subsequent call to UninstallAcpiTable to remove an ACPI table.   
@@ -62,5 +67,8 @@
   @retval EFI_OUT_OF_RESOURCES  Insufficient resources exist to
                                 complete the request.
-  
+  @retval EFI_ACCESS_DENIED     The table signature matches a table already
+                                present in the system and platform policy
+                                does not allow duplicate tables of this type.
+
 **/
 typedef
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/AtaPassThru.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/AtaPassThru.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/AtaPassThru.h	(revision 58459)
@@ -4,5 +4,5 @@
   includes the attributes of the ATA controller.
 
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -213,5 +213,5 @@
 
 /**
-  Used to retrieve the lis t of legal port numbers for ATA devices on an ATA controller.
+  Used to retrieve the list of legal port numbers for ATA devices on an ATA controller.
   These can either be the list of ports where ATA devices are actually present or the
   list of legal port numbers for the ATA controller. Regardless, the caller of this
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/DebugPort.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/DebugPort.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/DebugPort.h	(revision 58459)
@@ -5,5 +5,5 @@
   remote debug host.
   
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -129,5 +129,6 @@
 #define EFI_DEBUGPORT_VARIABLE_NAME L"DEBUGPORT"
 #define EFI_DEBUGPORT_VARIABLE_GUID EFI_DEBUGPORT_PROTOCOL_GUID
-#define gEfiDebugPortVariableGuid   gEfiDebugPortProtocolGuid
+
+extern EFI_GUID  gEfiDebugPortVariableGuid;
 
 //
@@ -135,5 +136,6 @@
 //
 #define DEVICE_PATH_MESSAGING_DEBUGPORT EFI_DEBUGPORT_PROTOCOL_GUID
-#define gEfiDebugPortDevicePathGuid     gEfiDebugPortProtocolGuid
+
+extern EFI_GUID  gEfiDebugPortDevicePathGuid;
 
 typedef struct {
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/DebugSupport.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/DebugSupport.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/DebugSupport.h	(revision 58459)
@@ -1,4 +1,4 @@
 /** @file
-  DebugSupport protocol and supporting definitions as defined in the UEFI2.0
+  DebugSupport protocol and supporting definitions as defined in the UEFI2.4
   specification.
 
@@ -7,4 +7,6 @@
 
 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
+
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -518,4 +520,95 @@
 } EFI_SYSTEM_CONTEXT_ARM;
 
+
+///
+///  AARCH64 processor exception types.
+///
+#define EXCEPT_AARCH64_SYNCHRONOUS_EXCEPTIONS    0
+#define EXCEPT_AARCH64_IRQ                       1
+#define EXCEPT_AARCH64_FIQ                       2
+#define EXCEPT_AARCH64_SERROR                    3
+
+///
+/// For coding convenience, define the maximum valid ARM exception.
+///
+#define MAX_AARCH64_EXCEPTION EXCEPT_AARCH64_SERROR
+
+typedef struct {
+  // General Purpose Registers
+  UINT64  X0;
+  UINT64  X1;
+  UINT64  X2;
+  UINT64  X3;
+  UINT64  X4;
+  UINT64  X5;
+  UINT64  X6;
+  UINT64  X7;
+  UINT64  X8;
+  UINT64  X9;
+  UINT64  X10;
+  UINT64  X11;
+  UINT64  X12;
+  UINT64  X13;
+  UINT64  X14;
+  UINT64  X15;
+  UINT64  X16;
+  UINT64  X17;
+  UINT64  X18;
+  UINT64  X19;
+  UINT64  X20;
+  UINT64  X21;
+  UINT64  X22;
+  UINT64  X23;
+  UINT64  X24;
+  UINT64  X25;
+  UINT64  X26;
+  UINT64  X27;
+  UINT64  X28;
+  UINT64  FP;   // x29 - Frame pointer
+  UINT64  LR;   // x30 - Link Register
+  UINT64  SP;   // x31 - Stack pointer
+
+  // FP/SIMD Registers
+  UINT64  V0[2];
+  UINT64  V1[2];
+  UINT64  V2[2];
+  UINT64  V3[2];
+  UINT64  V4[2];
+  UINT64  V5[2];
+  UINT64  V6[2];
+  UINT64  V7[2];
+  UINT64  V8[2];
+  UINT64  V9[2];
+  UINT64  V10[2];
+  UINT64  V11[2];
+  UINT64  V12[2];
+  UINT64  V13[2];
+  UINT64  V14[2];
+  UINT64  V15[2];
+  UINT64  V16[2];
+  UINT64  V17[2];
+  UINT64  V18[2];
+  UINT64  V19[2];
+  UINT64  V20[2];
+  UINT64  V21[2];
+  UINT64  V22[2];
+  UINT64  V23[2];
+  UINT64  V24[2];
+  UINT64  V25[2];
+  UINT64  V26[2];
+  UINT64  V27[2];
+  UINT64  V28[2];
+  UINT64  V29[2];
+  UINT64  V30[2];
+  UINT64  V31[2];
+
+  UINT64  ELR;  // Exception Link Register
+  UINT64  SPSR; // Saved Processor Status Register
+  UINT64  FPSR; // Floating Point Status Register
+  UINT64  ESR;  // Exception syndrome register
+  UINT64  FAR;  // Fault Address Register
+} EFI_SYSTEM_CONTEXT_AARCH64;
+
+
 ///
 /// Universal EFI_SYSTEM_CONTEXT definition.
@@ -527,4 +620,5 @@
   EFI_SYSTEM_CONTEXT_IPF  *SystemContextIpf;
   EFI_SYSTEM_CONTEXT_ARM  *SystemContextArm;
+  EFI_SYSTEM_CONTEXT_AARCH64  *SystemContextAArch64;
 } EFI_SYSTEM_CONTEXT;
 
@@ -567,5 +661,6 @@
   IsaIpf  = IMAGE_FILE_MACHINE_IA64,           ///< 0x0200
   IsaEbc  = IMAGE_FILE_MACHINE_EBC,            ///< 0x0EBC
-  IsaArm  = IMAGE_FILE_MACHINE_ARMTHUMB_MIXED  ///< 0x01c2
+  IsaArm  = IMAGE_FILE_MACHINE_ARMTHUMB_MIXED, ///< 0x01c2
+  IsaAArch64  = IMAGE_FILE_MACHINE_ARM64       ///< 0xAA64
 } EFI_INSTRUCTION_SET_ARCHITECTURE;
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Decompress.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Decompress.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Decompress.h	(revision 58459)
@@ -2,5 +2,5 @@
   The Decompress Protocol Interface as defined in UEFI spec
 
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -76,5 +76,5 @@
 
   If the compressed source data specified by Source and SourceSize is 
-  sucessfully decompressed into Destination, then EFI_SUCCESS is returned.  
+  successfully decompressed into Destination, then EFI_SUCCESS is returned.  
   If the compressed source data specified by Source and SourceSize is not in 
   a valid compressed data format, then EFI_INVALID_PARAMETER is returned.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/DevicePath.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/DevicePath.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/DevicePath.h	(revision 58459)
@@ -6,5 +6,5 @@
   it can not contain things like PCI bus numbers that change from boot to boot.
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -787,4 +787,30 @@
 
 ///
+/// NvmExpress Namespace Device Path SubType.
+///
+#define MSG_NVME_NAMESPACE_DP     0x17
+typedef struct {
+  EFI_DEVICE_PATH_PROTOCOL        Header;
+  UINT32                          NamespaceId;
+  UINT64                          NamespaceUuid;
+} NVME_NAMESPACE_DEVICE_PATH;
+
+///
+/// Universal Flash Storage (UFS) Device Path SubType.
+///
+#define MSG_UFS_DP                0x19
+typedef struct {
+  EFI_DEVICE_PATH_PROTOCOL        Header;
+  ///
+  /// Target ID on the UFS bus (PUN).
+  ///
+  UINT8                           Pun;
+  ///
+  /// Logical Unit Number (LUN).
+  ///
+  UINT8                           Lun;
+} UFS_DEVICE_PATH;
+
+///
 /// iSCSI Device Path SubType
 ///
@@ -1084,4 +1110,6 @@
   SAS_DEVICE_PATH                            Sas;
   SASEX_DEVICE_PATH                          SasEx;
+  NVME_NAMESPACE_DEVICE_PATH                 NvmeNamespace;
+  UFS_DEVICE_PATH                            Ufs;
   HARDDRIVE_DEVICE_PATH                      HardDrive;
   CDROM_DEVICE_PATH                          CD;
@@ -1133,4 +1161,6 @@
   SAS_DEVICE_PATH                            *Sas;
   SASEX_DEVICE_PATH                          *SasEx;
+  NVME_NAMESPACE_DEVICE_PATH                 *NvmeNamespace;
+  UFS_DEVICE_PATH                            *Ufs;
   HARDDRIVE_DEVICE_PATH                      *HardDrive;
   CDROM_DEVICE_PATH                          *CD;
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/DiskInfo.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/DiskInfo.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/DiskInfo.h	(revision 58459)
@@ -3,5 +3,5 @@
   IDE controller.  
 
-  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -63,5 +63,21 @@
 #define EFI_DISK_INFO_AHCI_INTERFACE_GUID \
   { \
-    0x9e498932, 0x4abc, 0x45af, {0xa3, 0x4d, 0x2, 0x47, 0x78, 0x7b, 0xe7, 0xc6} \
+    0x9e498932, 0x4abc, 0x45af, {0xa3, 0x4d, 0x2, 0x47, 0x78, 0x7b, 0xe7, 0xc6 } \
+  }
+
+///
+/// Global ID for a NVME interface.  Used to fill in EFI_DISK_INFO_PROTOCOL.Interface
+///
+#define EFI_DISK_INFO_NVME_INTERFACE_GUID \
+  { \
+    0x3ab14680, 0x5d3f, 0x4a4d, {0xbc, 0xdc, 0xcc, 0x38, 0x0, 0x18, 0xc7, 0xf7 } \
+  }
+
+///
+/// Global ID for a UFS interface.  Used to fill in EFI_DISK_INFO_PROTOCOL.Interface
+///
+#define EFI_DISK_INFO_UFS_INTERFACE_GUID \
+  { \
+    0x4b3029cc, 0x6b98, 0x47fb, { 0xbc, 0x96, 0x76, 0xdc, 0xb8, 0x4, 0x41, 0xf0 } \
   }
 
@@ -197,4 +213,6 @@
 extern EFI_GUID gEfiDiskInfoUsbInterfaceGuid;
 extern EFI_GUID gEfiDiskInfoAhciInterfaceGuid;
+extern EFI_GUID gEfiDiskInfoNvmeInterfaceGuid;
+extern EFI_GUID gEfiDiskInfoUfsInterfaceGuid;
 
 #endif
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/DriverDiagnostics.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/DriverDiagnostics.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/DriverDiagnostics.h	(revision 58459)
@@ -2,5 +2,5 @@
   EFI Driver Diagnostics Protocol
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -41,4 +41,10 @@
   ///
   EfiDriverDiagnosticTypeManufacturing= 2,
+  ///
+  /// This is an optional diagnostic type that would only be used in the situation where an 
+  /// EFI_NOT_READY had been returned by a previous call to RunDiagnostics()
+  /// and there is a desire to cancel the current running diagnostics operation.
+  ///
+  EfiDriverDiagnosticTypeCancel       = 3,
   EfiDriverDiagnosticTypeMaximum
 } EFI_DRIVER_DIAGNOSTIC_TYPE;
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/DriverHealth.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/DriverHealth.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/DriverHealth.h	(revision 58459)
@@ -21,5 +21,6 @@
   configuration changes to take affect. 
 
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>  
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -63,5 +64,14 @@
   EFI_HII_HANDLE  HiiHandle;
   EFI_STRING_ID   StringId;
-  UINT64          Reserved;
+  
+  ///
+  /// 64-bit numeric value of the warning/error specified by this message. 
+  ///   A value of 0x0000000000000000 is used to indicate that MessageCode is not specified. 
+  ///   The values  0x0000000000000001 to 0x0fffffffffffffff are reserved for allocation by the UEFI Specification.
+  ///   The values  0x1000000000000000 to 0x1fffffffffffffff are reserved for IHV-developed drivers. 
+  ///   The values 0x8000000000000000 to 0x8fffffffffffffff is reserved for platform/OEM drivers.
+  ///   All other values are reserved and should not be used.
+  ///
+  UINT64          MessageCode;
 } EFI_DRIVER_HEALTH_HII_MESSAGE;
 
@@ -75,18 +85,8 @@
                                 For example, a driver that wants to specify progress in 
                                 percent would use a Limit value of 100.
-  
-  @retval EFI_SUCCESS           An attempt to repair the controller specified by
-                                ControllerHandle and ChildHandle was performed. The
-                                result of the repair operation can bet determined by
-                                calling GetHealthStatus().
-  @retval EFI_UNSUPPORTED       The driver specified by This is not currently managing the
-                                controller specified by ControllerHandle and
-                                ChildHandle.
-  @retval EFI_OUT_OF_RESOURCES  There are not enough resources to perform the repair operation.
-
 **/
 typedef
 EFI_STATUS
-(EFIAPI *EFI_DRIVER_HEALTH_REPAIR_PROGRESS_NOTIFY)(
+(EFIAPI *EFI_DRIVER_HEALTH_REPAIR_NOTIFY)(
   IN UINTN  Value,
   IN UINTN  Limit
@@ -194,15 +194,15 @@
   optionally report repair progress information back to the platform. 
   
-  @param[in] This                  A pointer to the EFI_DRIVER_HEALTH_PROTOCOL instance.
-  @param[in] ControllerHandle      The handle of the controller to repair.
-  @param[in] ChildHandle           The handle of the child controller to repair.  This is 
-                                   an optional parameter that may be NULL.  It will be NULL 
-                                   for device drivers.  It will also be NULL for bus 
-                                   drivers when an attempt is made to repair a bus controller.
-                                   If will not be NULL when an attempt is made to repair a 
-                                   child controller produced by the driver.
-  @param[in] ProgressNotification  A notification function that may be used by a driver to 
-                                   report the progress of the repair operation.  This is 
-                                   an optional parameter that may be NULL.  
+  @param[in] This              A pointer to the EFI_DRIVER_HEALTH_PROTOCOL instance.
+  @param[in] ControllerHandle  The handle of the controller to repair.
+  @param[in] ChildHandle       The handle of the child controller to repair.  This is 
+                               an optional parameter that may be NULL.  It will be NULL 
+                               for device drivers.  It will also be NULL for bus 
+                               drivers when an attempt is made to repair a bus controller.
+                               If will not be NULL when an attempt is made to repair a 
+                               child controller produced by the driver.
+  @param[in] RepairNotify      A notification function that may be used by a driver to 
+                               report the progress of the repair operation.  This is 
+                               an optional parameter that may be NULL.  
 
 
@@ -223,6 +223,6 @@
   IN  EFI_DRIVER_HEALTH_PROTOCOL                *This,
   IN  EFI_HANDLE                                ControllerHandle,
-  IN  EFI_HANDLE                                ChildHandle          OPTIONAL,
-  IN  EFI_DRIVER_HEALTH_REPAIR_PROGRESS_NOTIFY  ProgressNotification OPTIONAL
+  IN  EFI_HANDLE                                ChildHandle       OPTIONAL,
+  IN  EFI_DRIVER_HEALTH_REPAIR_NOTIFY           RepairNotify      OPTIONAL
   );
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Eap.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Eap.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Eap.h	(revision 58459)
@@ -3,8 +3,8 @@
   The EFI EAP Protocol is used to abstract the ability to configure and extend the
   EAP framework. 
-  The definitions in this file are defined in UEFI Specification 2.3, which have
+  The definitions in this file are defined in UEFI Specification 2.3.1B, which have
   not been verified by one implementation yet.
 
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -38,11 +38,15 @@
 
 ///
-/// EAP Authentication Method Type (RFC 2284 Section 3)
+/// EAP Authentication Method Type (RFC 3748)
 ///@{
-#define EFI_EAP_TYPE_MD5                0x4   ///< REQUIRED
-#define EFI_EAP_TYPE_OTP                0x5   ///< OPTIONAL
-#define EFI_EAP_TYPE_TOKEN_CARD         0x6   ///< OPTIONAL
+#define EFI_EAP_TYPE_TLS 13 ///< REQUIRED - RFC 5216
 ///@}
 
+//
+// EAP_TYPE MD5, OTP and TOEKN_CARD has been removed from UEFI2.3.1B.
+//
+#define EFI_EAP_TYPE_MD5                0x4
+#define EFI_EAP_TYPE_OTP                0x5
+#define EFI_EAP_TYPE_TOKEN_CARD         0x6
 
 /**
@@ -86,5 +90,7 @@
   If the EAP authentication method of EapAuthType is unsupported by the Ports, then it will
   return EFI_UNSUPPORTED.
-
+  The cryptographic strength of EFI_EAP_TYPE_TLS shall be at least of hash strength 
+  SHA-256 and RSA key length of at least 2048 bits.
+  
   @param[in] This                A pointer to the EFI_EAP_PROTOCOL instance that indicates 
                                  the calling context.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/EdidActive.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/EdidActive.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/EdidActive.h	(revision 58459)
@@ -4,5 +4,5 @@
   Placed on the video output device child handle that is actively displaying output.
 
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -42,5 +42,5 @@
   /// NULL if no EDID information is available for the video output
   /// device. The minimum size of a valid Edid buffer is 128 bytes.
-  /// EDID information is defined in the E-DID EEPROM
+  /// EDID information is defined in the E-EDID EEPROM
   /// specification published by VESA (www.vesa.org).
   ///
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/EdidDiscovered.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/EdidDiscovered.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/EdidDiscovered.h	(revision 58459)
@@ -5,5 +5,5 @@
   the EDID information being used for the output device represented by the child handle.
 
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -40,5 +40,5 @@
   /// NULL if no EDID information is available for the video output
   /// device. The minimum size of a valid Edid buffer is 128 bytes.
-  /// EDID information is defined in the E-DID EEPROM
+  /// EDID information is defined in the E-EDID EEPROM
   /// specification published by VESA (www.vesa.org).
   ///  
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/FirmwareManagement.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/FirmwareManagement.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/FirmwareManagement.h	(revision 58459)
@@ -1,23 +1,24 @@
 /** @file
   UEFI Firmware Management Protocol definition
-  Firmware Management Protocol provides an abstraction for device to provide firmware 
-  management support. The base requirements for managing device firmware images include 
+  Firmware Management Protocol provides an abstraction for device to provide firmware
+  management support. The base requirements for managing device firmware images include
   identifying firmware image revision level and programming the image into the device.
 
-  GetImageInfo() is the only required function. GetImage(), SetImage(), 
-  CheckImage(), GetPackageInfo(), and SetPackageInfo() shall return 
+  GetImageInfo() is the only required function. GetImage(), SetImage(),
+  CheckImage(), GetPackageInfo(), and SetPackageInfo() shall return
   EFI_UNSUPPORTED if not supported by the driver.
-  
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
-  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.    
-
-  @par Revision Reference:          
-  This Protocol is introduced in UEFI Specification 2.3      
+
+  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2013 - 2014, Hewlett-Packard Development Company, L.P.<BR>
+  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.
+
+  @par Revision Reference:
+  This Protocol is introduced in UEFI Specification 2.3
 
 **/
@@ -38,52 +39,83 @@
 ///
 typedef struct {
-  /// 
-  /// A unique number identifying the firmware image within the device.  The number is 
+  ///
+  /// A unique number identifying the firmware image within the device. The number is
   /// between 1 and DescriptorCount.
-  /// 
+  ///
   UINT8                            ImageIndex;
   ///
-  /// A unique number identifying the firmware image type.  
-  /// 
+  /// A unique GUID identifying the firmware image type.
+  ///
   EFI_GUID                         ImageTypeId;
-  /// 
-  /// A unique number identifying the firmware image. 
-  /// 
+  ///
+  /// A unique number identifying the firmware image.
+  ///
   UINT64                           ImageId;
-  /// 
-  /// A pointer to a null-terminated string representing the firmware image name.  
-  /// 
+  ///
+  /// A pointer to a null-terminated string representing the firmware image name.
+  ///
   CHAR16                           *ImageIdName;
-  /// 
-  /// Identifies the version of the device firmware. The format is vendor specific and new 
+  ///
+  /// Identifies the version of the device firmware. The format is vendor specific and new
   /// version must have a greater value than an old version.
-  /// 
+  ///
   UINT32                           Version;
-  /// 
+  ///
   /// A pointer to a null-terminated string representing the firmware image version name.
-  /// 
+  ///
   CHAR16                           *VersionName;
-  /// 
-  /// Size of the image in bytes.  If size=0, then only ImageIndex and ImageTypeId are valid.
-  /// 
+  ///
+  /// Size of the image in bytes. If size=0, then only ImageIndex and ImageTypeId are valid.
+  ///
   UINTN                            Size;
-  /// 
-  /// Image attributes that are supported by this device.  See 'Image Attribute Definitions' 
-  /// for possible returned values of this parameter.  A value of 1 indicates the attribute is 
-  /// supported and the current setting value is indicated in AttributesSetting.  A 
-  /// value of 0 indicates the attribute is not supported and the current setting value in 
+  ///
+  /// Image attributes that are supported by this device. See 'Image Attribute Definitions'
+  /// for possible returned values of this parameter. A value of 1 indicates the attribute is
+  /// supported and the current setting value is indicated in AttributesSetting. A
+  /// value of 0 indicates the attribute is not supported and the current setting value in
   /// AttributesSetting is meaningless.
-  /// 
+  ///
   UINT64                           AttributesSupported;
-  /// 
-  /// Image attributes.  See 'Image Attribute Definitions' for possible returned values of 
+  ///
+  /// Image attributes. See 'Image Attribute Definitions' for possible returned values of
   /// this parameter.
-  /// 
+  ///
   UINT64                           AttributesSetting;
-  /// 
-  /// Image compatibilities.  See 'Image Compatibility Definitions' for possible returned 
+  ///
+  /// Image compatibilities. See 'Image Compatibility Definitions' for possible returned
   /// values of this parameter.
-  /// 
+  ///
   UINT64                           Compatibilities;
+  ///
+  /// Describes the lowest ImageDescriptor version that the device will accept. Only
+  /// present in version 2 or higher.
+  ///
+  UINT32                           LowestSupportedImageVersion;
+  ///
+  /// Describes the version that was last attempted to update. If no update attempted the
+  /// value will be 0. If the update attempted was improperly formatted and no version
+  /// number was available then the value will be zero. Only present in version 3 or higher.
+  UINT32                           LastAttemptVersion;
+  ///
+  /// Describes the status that was last attempted to update. If no update has been attempted
+  /// the value will be LAST_ATTEMPT_STATUS_SUCCESS. Only present in version 3 or higher.
+  ///
+  UINT32                           LastAttemptStatus;
+  ///
+  /// An optional number to identify the unique hardware instance within the system for
+  /// devices that may have multiple instances (Example: a plug in pci network card). This
+  /// number must be unique within the namespace of the ImageTypeId GUID and
+  /// ImageIndex. For FMP instances that have multiple descriptors for a single
+  /// hardware instance, all descriptors must have the same HardwareInstance value.
+  /// This number must be consistent between boots and should be based on some sort of
+  /// hardware identified unique id (serial number, etc) whenever possible. If a hardware
+  /// based number is not available the FMP provider may use some other characteristic
+  /// such as device path, bus/dev/function, slot num, etc for generating the
+  /// HardwareInstance. For implementations that will never have more than one
+  /// instance a zero can be used. A zero means the FMP provider is not able to determine a
+  /// unique hardware instance number or a hardware instance number is not needed. Only
+  /// present in version 3 or higher.
+  ///
+  UINT64                           HardwareInstance;
 } EFI_FIRMWARE_IMAGE_DESCRIPTOR;
 
@@ -93,25 +125,29 @@
 //
 ///
-/// The attribute IMAGE_ATTRIBUTE_IMAGE_UPDATABLE indicates this device supports firmware 
+/// The attribute IMAGE_ATTRIBUTE_IMAGE_UPDATABLE indicates this device supports firmware
 /// image update.
 ///
 #define    IMAGE_ATTRIBUTE_IMAGE_UPDATABLE         0x0000000000000001
 ///
-/// The attribute IMAGE_ATTRIBUTE_RESET_REQUIRED indicates a reset of the device is required 
-/// for the new firmware image to take effect after a firmware update.  The device is the device hosting 
+/// The attribute IMAGE_ATTRIBUTE_RESET_REQUIRED indicates a reset of the device is required
+/// for the new firmware image to take effect after a firmware update. The device is the device hosting
 /// the firmware image.
-/// 
+///
 #define    IMAGE_ATTRIBUTE_RESET_REQUIRED          0x0000000000000002
 ///
-/// The attribute IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED indicates authentication is 
-/// required to perform the following image operations: GetImage(), SetImage(), and 
+/// The attribute IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED indicates authentication is
+/// required to perform the following image operations: GetImage(), SetImage(), and
 /// CheckImage(). See 'Image Attribute - Authentication'.
-/// 
+///
 #define    IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED 0x0000000000000004
 ///
-/// The attribute IMAGE_ATTRIBUTE_IN_USE indicates the current state of the firmware image.  
-/// This distinguishes firmware images in a device that supports redundant images.  
-/// 
+/// The attribute IMAGE_ATTRIBUTE_IN_USE indicates the current state of the firmware image.
+/// This distinguishes firmware images in a device that supports redundant images.
+///
 #define    IMAGE_ATTRIBUTE_IN_USE                  0x0000000000000008
+///
+/// The attribute IMAGE_ATTRIBUTE_UEFI_IMAGE indicates that this image is an EFI compatible image.
+///
+#define    IMAGE_ATTRIBUTE_UEFI_IMAGE              0x0000000000000010
 
 
@@ -120,5 +156,5 @@
 //
 /// Values from 0x0000000000000002 thru 0x000000000000FFFF are reserved for future assignments.
-/// Values from 0x0000000000010000 thru 0xFFFFFFFFFFFFFFFF are used by firmware vendor for 
+/// Values from 0x0000000000010000 thru 0xFFFFFFFFFFFFFFFF are used by firmware vendor for
 /// compatibility check.
 ///
@@ -126,7 +162,7 @@
 
 ///
-/// Descriptor Version
-///
-#define   EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION   1
+/// Descriptor Version exposed by GetImageInfo() function
+///
+#define   EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION   3
 
 
@@ -136,12 +172,14 @@
 typedef struct {
   ///
-  /// It is included in the signature of AuthInfo.  It is used to ensure freshness/no replay.   
-  /// It is incremented during each firmware image operation.  
-  ///                                
+  /// It is included in the signature of AuthInfo. It is used to ensure freshness/no replay.
+  /// It is incremented during each firmware image operation.
+  ///
   UINT64                                  MonotonicCount;
   ///
-  /// Provides the authorization for the firmware image operations.  It is a signature across 
-  /// the image data and the Monotonic Count value.  Caller uses the private key that is 
-  /// associated with a public key that has been provisioned via the key exchange.  
+  /// Provides the authorization for the firmware image operations. It is a signature across
+  /// the image data and the Monotonic Count value. Caller uses the private key that is
+  /// associated with a public key that has been provisioned via the key exchange.
+  /// Because this is defined as a signature, WIN_CERTIFICATE_UEFI_GUID.CertType must
+  /// be EFI_CERT_TYPE_PKCS7_GUID.
   ///
   WIN_CERTIFICATE_UEFI_GUID               AuthInfo;
@@ -153,22 +191,22 @@
 //
 ///
-/// IMAGE_UPDATABLE_VALID indicates SetImage() will accept the new image and update the 
+/// IMAGE_UPDATABLE_VALID indicates SetImage() will accept the new image and update the
 /// device with the new image.
 ///
 #define  IMAGE_UPDATABLE_VALID                     0x0000000000000001
 ///
-/// IMAGE_UPDATABLE_INVALID indicates SetImage() will reject the new image. No additional 
+/// IMAGE_UPDATABLE_INVALID indicates SetImage() will reject the new image. No additional
 /// information is provided for the rejection.
 ///
 #define  IMAGE_UPDATABLE_INVALID                   0x0000000000000002
 ///
-/// IMAGE_UPDATABLE_INVALID_TYPE indicates SetImage() will reject the new image. The 
+/// IMAGE_UPDATABLE_INVALID_TYPE indicates SetImage() will reject the new image. The
 /// rejection is due to the new image is not a firmware image recognized for this device.
 ///
 #define  IMAGE_UPDATABLE_INVALID_TYPE              0x0000000000000004
 ///
-/// IMAGE_UPDATABLE_INVALID_OLD indicates SetImage() will reject the new image. The 
+/// IMAGE_UPDATABLE_INVALID_OLD indicates SetImage() will reject the new image. The
 /// rejection is due to the new image version is older than the current firmware image
-/// version in the device. The device firmware update policy does not support firmware 
+/// version in the device. The device firmware update policy does not support firmware
 /// version downgrade.
 ///
@@ -180,24 +218,24 @@
 //
 ///
-/// The attribute PACKAGE_ATTRIBUTE_VERSION_UPDATABLE indicates this device supports the 
+/// The attribute PACKAGE_ATTRIBUTE_VERSION_UPDATABLE indicates this device supports the
 /// update of the firmware package version.
 ///
 #define  PACKAGE_ATTRIBUTE_VERSION_UPDATABLE       0x0000000000000001
 ///
-/// The attribute PACKAGE_ATTRIBUTE_RESET_REQUIRED indicates a reset of the device is 
+/// The attribute PACKAGE_ATTRIBUTE_RESET_REQUIRED indicates a reset of the device is
 /// required for the new package info to take effect after an update.
 ///
 #define  PACKAGE_ATTRIBUTE_RESET_REQUIRED          0x0000000000000002
 ///
-/// The attribute PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED indicates authentication 
+/// The attribute PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED indicates authentication
 /// is required to update the package info.
 ///
 #define  PACKAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED 0x0000000000000004
 
-/** 
+/**
   Callback funtion to report the process of the firmware updating.
 
   @param[in]  Completion    A value between 1 and 100 indicating the current completion
-                            progress of the firmware update. Completion progress is 
+                            progress of the firmware update. Completion progress is
                             reported as from 1 to 100 percent. A value of 0 is used by
                             the driver to indicate that progress reporting is not supported.
@@ -221,7 +259,7 @@
 
   @param[in]      This               A pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.
-  @param[in, out] ImageInfoSize      A pointer to the size, in bytes, of the ImageInfo buffer. 
+  @param[in, out] ImageInfoSize      A pointer to the size, in bytes, of the ImageInfo buffer.
                                      On input, this is the size of the buffer allocated by the caller.
-                                     On output, it is the size of the buffer returned by the firmware 
+                                     On output, it is the size of the buffer returned by the firmware
                                      if the buffer was large enough, or the size of the buffer needed
                                      to contain the image(s) information if the buffer was too small.
@@ -229,5 +267,5 @@
                                      information. The information is an array of EFI_FIRMWARE_IMAGE_DESCRIPTORs.
   @param[out]     DescriptorVersion  A pointer to the location in which firmware returns the version number
-                                     associated with the EFI_FIRMWARE_IMAGE_DESCRIPTOR. 
+                                     associated with the EFI_FIRMWARE_IMAGE_DESCRIPTOR.
   @param[out]     DescriptorCount    A pointer to the location in which firmware returns the number of
                                      descriptors or firmware images within this device.
@@ -241,15 +279,15 @@
                                      that package version update is in progress.
   @param[out]     PackageVersionName A pointer to a pointer to a null-terminated string representing the
-                                     package version name. The buffer is allocated by this function with 
+                                     package version name. The buffer is allocated by this function with
                                      AllocatePool(), and it is the caller's responsibility to free it with a call
                                      to FreePool().
 
   @retval EFI_SUCCESS                The device was successfully updated with the new image.
-  @retval EFI_BUFFER_TOO_SMALL       The ImageInfo buffer was too small. The current buffer size 
-                                     needed to hold the image(s) information is returned in ImageInfoSize.                                               
+  @retval EFI_BUFFER_TOO_SMALL       The ImageInfo buffer was too small. The current buffer size
+                                     needed to hold the image(s) information is returned in ImageInfoSize.
   @retval EFI_INVALID_PARAMETER      ImageInfoSize is NULL.
   @retval EFI_DEVICE_ERROR           Valid information could not be returned. Possible corrupted image.
 
-**/                         
+**/
 typedef
 EFI_STATUS
@@ -266,5 +304,5 @@
 
 /**
-  Retrieves a copy of the current firmware image of the device. 
+  Retrieves a copy of the current firmware image of the device.
 
   This function allows a copy of the current firmware image to be created and saved.
@@ -279,6 +317,6 @@
 
   @retval EFI_SUCCESS            The device was successfully updated with the new image.
-  @retval EFI_BUFFER_TOO_SMALL   The buffer specified by ImageSize is too small to hold the 
-                                 image. The current buffer size needed to hold the image is returned 
+  @retval EFI_BUFFER_TOO_SMALL   The buffer specified by ImageSize is too small to hold the
+                                 image. The current buffer size needed to hold the image is returned
                                  in ImageSize.
   @retval EFI_INVALID_PARAMETER  The Image was NULL.
@@ -287,5 +325,5 @@
   @retval EFI_SECURITY_VIOLATIO  The operation could not be performed due to an authentication failure.
 
-**/                         
+**/
 typedef
 EFI_STATUS
@@ -304,18 +342,18 @@
   If the firmware image is updatable, the function should perform the following minimal validations
   before proceeding to do the firmware image update.
-  - Validate the image authentication if image has attribute 
-    IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED.  The function returns 
+  - Validate the image authentication if image has attribute
+    IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED. The function returns
     EFI_SECURITY_VIOLATION if the validation fails.
-  - Validate the image is a supported image for this device.  The function returns EFI_ABORTED if 
-    the image is unsupported.  The function can optionally provide more detailed information on 
+  - Validate the image is a supported image for this device. The function returns EFI_ABORTED if
+    the image is unsupported. The function can optionally provide more detailed information on
     why the image is not a supported image.
-  - Validate the data from VendorCode if not null.  Image validation must be performed before 
-    VendorCode data validation.  VendorCode data is ignored or considered invalid if image 
-    validation failed.  The function returns EFI_ABORTED if the data is invalid.
-  
-  VendorCode enables vendor to implement vendor-specific firmware image update policy.  Null if 
-  the caller did not specify the policy or use the default policy.  As an example, vendor can implement 
-  a policy to allow an option to force a firmware image update when the abort reason is due to the new 
-  firmware image version is older than the current firmware image version or bad image checksum.  
+  - Validate the data from VendorCode if not null. Image validation must be performed before
+    VendorCode data validation. VendorCode data is ignored or considered invalid if image
+    validation failed. The function returns EFI_ABORTED if the data is invalid.
+
+  VendorCode enables vendor to implement vendor-specific firmware image update policy. Null if
+  the caller did not specify the policy or use the default policy. As an example, vendor can implement
+  a policy to allow an option to force a firmware image update when the abort reason is due to the new
+  firmware image version is older than the current firmware image version or bad image checksum.
   Sensitive operations such as those wiping the entire firmware image and render the device to be
   non-functional should be encoded in the image itself rather than passed with the VendorCode.
@@ -328,9 +366,9 @@
   @param[in]  Image              Points to the new image.
   @param[in]  ImageSize          Size of the new image in bytes.
-  @param[in]  VendorCode         This enables vendor to implement vendor-specific firmware image update policy.  
+  @param[in]  VendorCode         This enables vendor to implement vendor-specific firmware image update policy.
                                  Null indicates the caller did not specify the policy or use the default policy.
   @param[in]  Progress           A function used by the driver to report the progress of the firmware update.
   @param[out] AbortReason        A pointer to a pointer to a null-terminated string providing more
-                                 details for the aborted operation. The buffer is allocated by this function 
+                                 details for the aborted operation. The buffer is allocated by this function
                                  with AllocatePool(), and it is the caller's responsibility to free it with a
                                  call to FreePool().
@@ -342,5 +380,5 @@
   @retval EFI_SECURITY_VIOLATIO  The operation could not be performed due to an authentication failure.
 
-**/                         
+**/
 typedef
 EFI_STATUS
@@ -358,5 +396,5 @@
   Checks if the firmware image is valid for the device.
 
-  This function allows firmware update application to validate the firmware image without 
+  This function allows firmware update application to validate the firmware image without
   invoking the SetImage() first.
 
@@ -367,5 +405,5 @@
   @param[in]  ImageSize          Size of the new image in bytes.
   @param[out] ImageUpdatable     Indicates if the new image is valid for update. It also provides,
-                                 if available, additional information if the image is invalid. 
+                                 if available, additional information if the image is invalid.
 
   @retval EFI_SUCCESS            The image was successfully checked.
@@ -374,5 +412,5 @@
   @retval EFI_SECURITY_VIOLATIO  The operation could not be performed due to an authentication failure.
 
-**/                         
+**/
 typedef
 EFI_STATUS
@@ -386,5 +424,5 @@
 
 /**
-  Returns information about the firmware package. 
+  Returns information about the firmware package.
 
   This function returns package information.
@@ -405,6 +443,6 @@
                                        update of package version name. Length is the number of Unicode characters,
                                        including the terminating null character.
-  @param[out] AttributesSupported      Package attributes that are supported by this device. See 'Package Attribute 
-                                       Definitions' for possible returned values of this parameter. A value of 1 
+  @param[out] AttributesSupported      Package attributes that are supported by this device. See 'Package Attribute
+                                       Definitions' for possible returned values of this parameter. A value of 1
                                        indicates the attribute is supported and the current setting value is
                                        indicated in AttributesSetting. A value of 0 indicates the attribute is not
@@ -442,16 +480,16 @@
                                  0 if authentication is not required.
   @param[in]  VendorCode         This enables vendor to implement vendor-specific firmware
-                                 image update policy.  
+                                 image update policy.
                                  Null indicates the caller did not specify this policy or use
                                  the default policy.
   @param[in]  PackageVersion     The new package version.
   @param[in]  PackageVersionName A pointer to the new null-terminated Unicode string representing
-                                 the package version name. 
-                                 The string length is equal to or less than the value returned in 
+                                 the package version name.
+                                 The string length is equal to or less than the value returned in
                                  PackageVersionNameMaxLen.
 
   @retval EFI_SUCCESS            The device was successfully updated with the new package
                                  information.
-  @retval EFI_INVALID_PARAMETER  The PackageVersionName length is longer than the value 
+  @retval EFI_INVALID_PARAMETER  The PackageVersionName length is longer than the value
                                  returned in PackageVersionNameMaxLen.
   @retval EFI_UNSUPPORTED        The operation is not supported.
@@ -474,5 +512,5 @@
 /// The protocol for managing firmware provides the following services.
 /// - Get the attributes of the current firmware image. Attributes include revision level.
-/// - Get a copy of the current firmware image. As an example, this service could be used by a 
+/// - Get a copy of the current firmware image. As an example, this service could be used by a
 ///   management application to facilitate a firmware roll-back.
 /// - Program the device with a firmware image supplied by the user.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/FormBrowser2.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/FormBrowser2.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/FormBrowser2.h	(revision 58459)
@@ -5,5 +5,5 @@
   leverage the EFI configuration driver interface.
   
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -83,5 +83,5 @@
   @param FormSetGuid     This field points to the EFI_GUID which must match the Guid field or one of the
                          elements of the ClassId field  in the EFI_IFR_FORM_SET op-code.  If
-                         FormsetGuid is NULL, then this function will display the the form set class
+                         FormsetGuid is NULL, then this function will display the form set class
                          EFI_HII_PLATFORM_SETUP_FORMSET_GUID.
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/GraphicsOutput.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/GraphicsOutput.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/GraphicsOutput.h	(revision 58459)
@@ -4,5 +4,5 @@
   Abstraction of a very simple graphics device.
 
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -102,9 +102,7 @@
   @param  Info                  A pointer to callee allocated buffer that returns information about ModeNumber.
 
-  @retval EFI_SUCCESS           Mode information returned.
-  @retval EFI_BUFFER_TOO_SMALL  The Info buffer was too small.
+  @retval EFI_SUCCESS           Valid mode information was returned.
   @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.
+  @retval EFI_INVALID_PARAMETER ModeNumber is not valid.
 
 **/
@@ -154,5 +152,5 @@
 typedef enum {
   ///
-  /// Write data from the  BltBuffer pixel (SourceX, SourceY) 
+  /// Write data from the BltBuffer pixel (0, 0) 
   /// directly to every pixel of the video display rectangle 
   /// (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). 
@@ -172,5 +170,5 @@
   
   ///
-  /// Write data from the  BltBuffer rectangle 
+  /// Write data from the BltBuffer rectangle 
   /// (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the 
   /// video display rectangle (DestinationX, DestinationY) 
@@ -183,8 +181,7 @@
   ///
   /// Copy from the video display rectangle (SourceX, SourceY)
-  /// (SourceX + Width, SourceY + Height) .to the video display rectangle 
+  /// (SourceX + Width, SourceY + Height) to the video display rectangle 
   /// (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). 
-  /// The BltBuffer and Delta  are not used in this mode.
-  /// EfiBltVideoToVideo,
+  /// The BltBuffer and Delta are not used in this mode.
   ///
   EfiBltVideoToVideo,
@@ -197,18 +194,21 @@
   
   @param  This         Protocol instance pointer.
-  @param  BltBuffer    Buffer containing data to blit into video buffer. This
-                       buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
-  @param  BltOperation Operation to perform on BlitBuffer and video memory
-  @param  SourceX      X coordinate of source for the BltBuffer.
-  @param  SourceY      Y coordinate of source for the BltBuffer.
-  @param  DestinationX X coordinate of destination for the BltBuffer.
-  @param  DestinationY Y coordinate of destination for the BltBuffer.
-  @param  Width        Width of rectangle in BltBuffer in pixels.
-  @param  Height       Hight of rectangle in BltBuffer in pixels.
-  @param  Delta        OPTIONAL
-
-  @retval EFI_SUCCESS           The Blt operation completed.
+  @param  BltBuffer    The data to transfer to the graphics screen.
+                       Size is at least Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL).
+  @param  BltOperation The operation to perform when copying BltBuffer on to the graphics screen.
+  @param  SourceX      The X coordinate of source for the BltOperation.
+  @param  SourceY      The Y coordinate of source for the BltOperation.
+  @param  DestinationX The X coordinate of destination for the BltOperation.
+  @param  DestinationY The Y coordinate of destination for the BltOperation.
+  @param  Width        The width of a rectangle in the blt rectangle in pixels.
+  @param  Height       The height of a rectangle in the blt rectangle in pixels.
+  @param  Delta        Not used for EfiBltVideoFill or the EfiBltVideoToVideo operation.
+                       If a Delta of zero is used, the entire BltBuffer is being operated on.
+                       If a subrectangle of the BltBuffer is being used then Delta
+                       represents the number of bytes in a row of the BltBuffer.
+
+  @retval EFI_SUCCESS           BltBuffer was drawn to the graphics screen.
   @retval EFI_INVALID_PARAMETER BltOperation is not valid.
-  @retval EFI_DEVICE_ERROR      A hardware error occured writting to the video buffer.
+  @retval EFI_DEVICE_ERROR      The device had an error and could not complete the request.
 
 **/
@@ -251,5 +251,6 @@
   EFI_PHYSICAL_ADDRESS                   FrameBufferBase;
   ///
-  /// Size of the frame buffer represented by FrameBufferBase in bytes.
+  /// Amount of frame buffer needed to support the active mode as defined by 
+  /// PixelsPerScanLine xVerticalResolution x PixelElementSize.
   ///
   UINTN                                  FrameBufferSize;
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Hash.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Hash.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Hash.h	(revision 58459)
@@ -6,5 +6,5 @@
   so that a multiple drivers can use the underlying hashing services.
 
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -60,4 +60,24 @@
   }
 
+#define EFI_HASH_ALGORITHM_SHA1_NOPAD_GUID \
+  { \
+    0x24c5dc2f, 0x53e2, 0x40ca, {0x9e, 0xd6, 0xa5, 0xd9, 0xa4, 0x9f, 0x46, 0x3b } \
+  }
+
+#define EFI_HASH_ALGORITHM_SHA256_NOPAD_GUID \
+  { \
+    0x8628752a, 0x6cb7, 0x4814, {0x96, 0xfc, 0x24, 0xa8, 0x15, 0xac, 0x22, 0x26 } \
+  }
+
+//
+// Note: Use of the following algorithms with EFI_HASH_PROTOCOL is deprecated.
+//       EFI_HASH_ALGORITHM_SHA1_GUID
+//       EFI_HASH_ALGORITHM_SHA224_GUID
+//       EFI_HASH_ALGORITHM_SHA256_GUID
+//       EFI_HASH_ALGORITHM_SHA384_GUID
+//       EFI_HASH_ALGORITHM_SHA512_GUID
+//       EFI_HASH_ALGORTIHM_MD5_GUID
+//
+
 typedef struct _EFI_HASH_PROTOCOL EFI_HASH_PROTOCOL;
 
@@ -86,5 +106,5 @@
 
   @retval EFI_SUCCESS           Hash size returned successfully.
-  @retval EFI_INVALID_PARAMETER HashSize is NULL
+  @retval EFI_INVALID_PARAMETER HashSize is NULL or HashAlgorithm is NULL.
   @retval EFI_UNSUPPORTED       The algorithm specified by HashAlgorithm is not supported 
                                 by this driver.
@@ -100,5 +120,5 @@
 
 /**
-  Returns the size of the hash which results from a specific algorithm.
+  Creates a hash for the specified message text.
 
   @param[in]  This          Points to this instance of EFI_HASH_PROTOCOL.
@@ -108,9 +128,14 @@
   @param[in]  Message       Points to the start of the message.
   @param[in]  MessageSize   The size of Message, in bytes.
-  @param[in,out]  Hash      On input, if Extend is TRUE, then this holds the hash to extend. On
-                            output, holds the resulting hash computed from the message.
-
+  @param[in,out]  Hash      On input, if Extend is TRUE, then this parameter holds a pointer 
+                            to a pointer to an array containing the hash to extend. If Extend 
+                            is FALSE, then this parameter holds a pointer to a pointer to a 
+                            caller-allocated array that will receive the result of the hash 
+                            computation. On output (regardless of the value of Extend), the 
+                            array will contain the result of the hash computation.
+  
   @retval EFI_SUCCESS           Hash returned successfully.
-  @retval EFI_INVALID_PARAMETER Message or Hash is NULL
+  @retval EFI_INVALID_PARAMETER Message or Hash, HashAlgorithm is NULL or MessageSize is 0.
+                                MessageSize is not an integer multiple of block size.
   @retval EFI_UNSUPPORTED       The algorithm specified by HashAlgorithm is not supported by this
                                  driver. Or, Extend is TRUE, and the algorithm doesn't support extending the hash.
@@ -145,4 +170,6 @@
 extern EFI_GUID gEfiHashAlgorithmSha512Guid;
 extern EFI_GUID gEfiHashAlgorithmMD5Guid;
+extern EFI_GUID gEfiHashAlgorithmSha1NoPadGuid;
+extern EFI_GUID gEfiHashAlgorithmSha256NoPadGuid;
 
 #endif
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/HiiConfigAccess.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/HiiConfigAccess.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/HiiConfigAccess.h	(revision 58459)
@@ -6,5 +6,5 @@
   configuration data from HII. It may only be invoked by HII.
   
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -95,11 +95,8 @@
                                   protocols.
 
-  @retval EFI_NOT_FOUND           Routing data doesn't match any
-                                  known driver. Progress set to the
-                                  first character in the routing header.
-                                  Note: There is no requirement that the
-                                  driver validate the routing data. It
-                                  must skip the <ConfigHdr> in order to
-                                  process the names.
+  @retval EFI_NOT_FOUND           A configuration element matching 
+                                  the routing data is not found.
+                                  Progress set to the first character
+                                  in the routing header.
 
   @retval EFI_INVALID_PARAMETER   Illegal syntax. Progress set
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/HiiConfigRouting.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/HiiConfigRouting.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/HiiConfigRouting.h	(revision 58459)
@@ -6,5 +6,5 @@
   results to the appropriate drivers.
   
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -100,6 +100,11 @@
                                   error, or the beginning of the
                                   string.
-  @retval EFI_INVALID_PARAMETER   Unknown name.
-
+  @retval EFI_INVALID_PARAMETER   The ExtractConfig function of the
+                                  underlying HII Configuration 
+                                  Access Protocol returned 
+                                  EFI_INVALID_PARAMETER. Progress
+                                  set to most recent & before the
+                                  error or the beginning of the
+                                  string.
 
 **/
@@ -125,9 +130,9 @@
   @param This     Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL instance.
   
-  @param Results  A null-terminated string in <MultiConfigAltResp>
-                  format which has all values filled in for the
-                  names in the Request string.
-                  String to be allocated by this function.
-                  De-allocation is up to the caller.
+  @param  Results Null-terminated Unicode string in
+                  <MultiConfigAltResp> format which has all values
+                  filled in for the entirety of the current HII 
+                  database. String to be allocated by the  called 
+                  function. De-allocation is up to the caller.
   
   @retval EFI_SUCCESS             The Results string is filled with the
@@ -306,6 +311,8 @@
   @param BlockSize      The length of the Block in units of UINT8.
                         On input, this is the size of the Block. On
-                        output, if successful, contains the index of
-                        the last modified byte in the Block.
+                        output, if successful, contains the largest 
+                        index of the modified byte in the Block, or
+                        the required buffer size if the Block is not
+                        large enough.
 
   @param Progress       On return, points to an element of the
@@ -333,4 +340,7 @@
                                  Progress points to the "G" in "GUID" of the errant
                                  routing data.
+  @retval EFI_BUFFER_TOO_SMALL   Block not large enough. Progress undefined. 
+                                 BlockSize is updated with the required buffer size.
+
 **/
 typedef
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/HiiDatabase.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/HiiDatabase.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/HiiDatabase.h	(revision 58459)
@@ -224,5 +224,7 @@
                                 enable the data to fit.
   @retval EFI_NOT_FOUND         No matching handle could be found in database.
-  @retval EFI_INVALID_PARAMETER Handle or HandleBufferLength was NULL.
+  @retval EFI_INVALID_PARAMETER HandleBufferLength was NULL.
+  @retval EFI_INVALID_PARAMETER The value referenced by HandleBufferLength was not
+                                zero and Handle was NULL.
   @retval EFI_INVALID_PARAMETER PackageType is not a EFI_HII_PACKAGE_TYPE_GUID but
                                 PackageGuid is not NULL, PackageType is a EFI_HII_
@@ -272,4 +274,11 @@
   @retval EFI_OUT_OF_RESOURCES  BufferSize is too small to hold the package.
 
+  @retval EFI_NOT_FOUND         The specifiecd Handle could not be found in the
+                                current database.
+  
+  @retval EFI_INVALID_PARAMETER BufferSize was NULL.
+  
+  @retval EFI_INVALID_PARAMETER The value referenced by BufferSize was not zero 
+                                and Buffer was NULL.
 **/
 typedef
@@ -394,4 +403,9 @@
                                 with a value that will enable
                                 the data to fit.
+  @retval EFI_INVALID_PARAMETER The KeyGuidBufferLength is NULL.
+  @retval EFI_INVALID_PARAMETER The value referenced by 
+                                KeyGuidBufferLength is not
+                                zero and KeyGuidBuffer is NULL.
+  @retval EFI_NOT_FOUND         There was no keyboard layout.
 
 **/
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/HiiFont.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/HiiFont.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/HiiFont.h	(revision 58459)
@@ -57,5 +57,5 @@
   
   ///
-  /// The number of pixels above the bottom of the row of the font baseline or 0 if none.  
+  /// The font baseline offset in pixels from the bottom of the row, or 0 if none.
   ///
   UINTN   BaselineOffset;
@@ -428,7 +428,10 @@
                         about the system default font will be returned.
 
-  @param StringInfoOut  Upon return, contains the matching
-                        font's information. If NULL, then no
-                        information is returned.
+  @param  StringInfoOut Upon return, contains the matching font's information.
+                        If NULL, then no information is returned. This buffer
+                        is allocated with a call to the Boot Service AllocatePool().
+                        It is the caller's responsibility to call the Boot 
+                        Service FreePool() when the caller no longer requires
+                        the contents of StringInfoOut.
 
   @param String         Points to the string which will be tested to
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/HiiString.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/HiiString.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/HiiString.h	(revision 58459)
@@ -89,12 +89,14 @@
   @retval EFI_SUCCESS            The string was returned successfully.
   @retval EFI_NOT_FOUND          The string specified by StringId is not available.
-  @retval EFI_NOT_FOUND          The string specified by StringId is available but
-                                 not in the specified language.
                                  The specified PackageList is not in the database.
+  @retval EFI_INVALID_LANGUAGE    The string specified by StringId is available but 
+                                  not in the specified language.
   @retval EFI_BUFFER_TOO_SMALL   The buffer specified by StringSize is too small to
                                  hold the string.
-  @retval EFI_INVALID_PARAMETER  The String or Language or StringSize was NULL.
-  @retval EFI_OUT_OF_RESOURCES   There were insufficient resources to complete the
-                                 request.
+  @retval EFI_INVALID_PARAMETER   The Language or StringSize was NULL.
+  @retval EFI_INVALID_PARAMETER   The value referenced by StringSize was not zero and
+                                  String was NULL.
+  @retval EFI_OUT_OF_RESOURCES    There were insufficient resources to complete the
+                                  request.
 
 **/
@@ -158,5 +160,7 @@
 
   @retval EFI_SUCCESS            The languages were returned successfully.
-  @retval EFI_INVALID_PARAMETER  The Languages or LanguagesSize was NULL.
+  @retval EFI_INVALID_PARAMETER  The LanguagesSize was NULL.
+  @retval EFI_INVALID_PARAMETER  The value referenced by LanguagesSize is not zero
+                                 and Languages is NULL.
   @retval EFI_BUFFER_TOO_SMALL   The LanguagesSize is too small to hold the list of
                                  supported languages. LanguageSize is updated to
@@ -197,6 +201,7 @@
 
   @retval EFI_SUCCESS            Secondary languages were correctly returned.
-  @retval EFI_INVALID_PARAMETER  PrimaryLanguage or SecondaryLanguages or
-                                 SecondaryLanguagesSize was NULL.
+  @retval EFI_INVALID_PARAMETER  PrimaryLanguage or SecondaryLanguagesSize was NULL.
+  @retval EFI_INVALID_PARAMETER  The value referenced by SecondaryLanguagesSize is not
+                                 zero and SecondaryLanguages is NULL.
   @retval EFI_BUFFER_TOO_SMALL   The buffer specified by SecondaryLanguagesSize is
                                  too small to hold the returned information.
@@ -205,5 +210,5 @@
   @retval EFI_INVALID_LANGUAGE   The language specified by PrimaryLanguage is not
                                  present in the specified package list.
-  @retval EFI_NOT_FOUND          The specified PackageList is not in the Database.                                
+  @retval EFI_NOT_FOUND          The specified PackageList is not in the Database.
 
 **/
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Ip4.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Ip4.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Ip4.h	(revision 58459)
@@ -4,5 +4,5 @@
   sections:
   - EFI IPv4 Service Binding Protocol
-  - EFI IPv4 Variable
+  - EFI IPv4 Variable (deprecated in UEFI 2.4B)
   - EFI IPv4 Protocol.
   The EFI IPv4 Protocol provides basic network IPv4 packet I/O services,
@@ -11,5 +11,5 @@
   Protocol (IGMP).
   
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -41,5 +41,9 @@
 
 typedef struct _EFI_IP4_PROTOCOL EFI_IP4_PROTOCOL;
-  
+
+///
+/// EFI_IP4_ADDRESS_PAIR is deprecated in the UEFI 2.4B and should not be used any more.
+/// The definition in here is only present to provide backwards compatability.
+///
 typedef struct {
   EFI_HANDLE              InstanceHandle;
@@ -48,4 +52,8 @@
 } EFI_IP4_ADDRESS_PAIR; 
 
+///
+/// EFI_IP4_VARIABLE_DATA is deprecated in the UEFI 2.4B and should not be used any more.
+/// The definition in here is only present to provide backwards compatability.
+///
 typedef struct {
   EFI_HANDLE              DriverHandle;
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Ip4Config.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Ip4Config.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Ip4Config.h	(revision 58459)
@@ -3,5 +3,5 @@
   Protocol.
 
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -29,6 +29,5 @@
 
 #define IP4_CONFIG_VARIABLE_ATTRIBUTES \
-        (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | \
-         EFI_VARIABLE_RUNTIME_ACCESS)
+        (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS)
 
 ///
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Ip6.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Ip6.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Ip6.h	(revision 58459)
@@ -4,5 +4,5 @@
   sections:
   - EFI IPv6 Service Binding Protocol
-  - EFI IPv6 Variable
+  - EFI IPv6 Variable (deprecated in UEFI 2.4B)
   - EFI IPv6 Protocol
   The EFI IPv6 Protocol provides basic network IPv6 packet I/O services,
@@ -11,5 +11,5 @@
   Message Protocol (ICMPv6).
 
-  Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -44,5 +44,6 @@
 
 ///
-/// EFI_IP6_ADDRESS_PAIR
+/// EFI_IP6_ADDRESS_PAIR is deprecated in the UEFI 2.4B and should not be used any more.
+/// The definition in here is only present to provide backwards compatability.
 ///
 typedef struct{
@@ -62,5 +63,6 @@
 
 ///
-/// EFI_IP6_VARIABLE_DATA
+/// EFI_IP6_VARIABLE_DATA is deprecated in the UEFI 2.4B and should not be used any more.
+/// The definition in here is only present to provide backwards compatability.
 ///
 typedef struct {
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/NetworkInterfaceIdentifier.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/NetworkInterfaceIdentifier.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/NetworkInterfaceIdentifier.h	(revision 58459)
@@ -2,5 +2,5 @@
   EFI Network Interface Identifier Protocol.
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under
 the terms and conditions of the BSD License that accompanies this distribution.
@@ -35,5 +35,9 @@
   }
 
-#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION    0x00010000
+//
+// Revision defined in UEFI Specification 2.4
+//
+#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION    0x00020000
+
 
 ///
@@ -71,7 +75,7 @@
   UINT8     MinorVer;   ///< Minor version number.
   BOOLEAN   Ipv6Supported; ///< TRUE if the network interface supports IPv6; otherwise FALSE.
-  UINT8     IfNum;      ///< The network interface number that is being identified by this Network
-                        ///< Interface Identifier Protocol. This field must be less than or equal
-                        ///< to the IFcnt field in the !PXE structure.
+  UINT16    IfNum;      ///< The network interface number that is being identified by this Network 
+                        ///< Interface Identifier Protocol. This field must be less than or 
+                        ///< equal to the (IFcnt | IFcntExt <<8 ) fields in the !PXE structure.
 
 };
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Pcd.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Pcd.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Pcd.h	(revision 58459)
@@ -7,5 +7,5 @@
   but interfaces in dynamic-ex type PCD require token space guid as parameter.
   
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -767,5 +767,5 @@
   
   This is useful since the PCD infrastructure contains a sparse list of token numbers, 
-  and one cannot know without examination or by deduction what token numbers are valid in the database. 
+  and one cannot a priori know what token numbers are valid in the database.
   
   If TokenNumber is 0 and Guid is not NULL, then the first token from the token space specified by Guid is returned.  
@@ -785,8 +785,6 @@
                           A pointer to the PCD token number to use to find the subsequent token number.  
 
-  @retval EFI_SUCCESS   The PCD service retrieved the next valid token number. Or the input token number 
-                        is already the last valid token number in the PCD database. 
-                        In the later case, *TokenNumber is updated with the value of 0.
-  @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.
+  @retval EFI_SUCCESS   The PCD service has retrieved the next valid token number.
+  @retval EFI_NOT_FOUND The PCD service could not find data from the requested token number.
 
 **/
@@ -803,20 +801,15 @@
   Retrieves the next valid PCD token namespace for a given namespace.
 
-  @param[in, out]  Guid An indirect pointer to EFI_GUID. On input it designates 
-                        a known token namespace from which the search will start. On output, 
-                        it designates the next valid token namespace on the platform. If the input 
-                        token namespace does not exist on the platform, an error is returned and 
-                        the value of *Guid is undefined. If *Guid is NULL, then the GUID of the 
-                        first token space of the current platform is assigned to *Guid the function 
-                        return EFI_SUCCESS. If *Guid is NULL  and there is no namespace exist in 
-                        the platform other than the default (NULL) token namespace, *Guid is unchanged 
-                        and the function return EFI_SUCCESS. If this input token namespace is the last 
-                        namespace on the platform, *Guid will be assigned to NULL and the function return 
-                        EFI_SUCCESS. 
-
-  @retval EFI_SUCCESS  The PCD service retrieved the next valid token space Guid. 
-                        Or, the input token space Guid is already the last valid token space Guid 
-                        in the PCD database. In the later case, *Guid is updated with the value of NULL.
-  @retval EFI_NOT_FOUND If the input token namespace does not exist on the platform.
+  Gets the next valid token namespace for a given namespace. This is useful to traverse the valid
+  token namespaces on a platform.
+
+  @param[in, out]   Guid    An indirect pointer to EFI_GUID. On input it designates a known token namespace
+                            from which the search will start. On output, it designates the next valid token
+                            namespace on the platform. If *Guid is NULL, then the GUID of the first token
+                            space of the current platform is returned. If the search cannot locate the next valid
+                            token namespace, an error is returned and the value of *Guid is undefined.
+
+  @retval   EFI_SUCCESS   The PCD service retrieved the value requested.
+  @retval   EFI_NOT_FOUND The PCD service could not find the next valid token namespace.
 
 **/
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/PlatformToDriverConfiguration.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/PlatformToDriverConfiguration.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/PlatformToDriverConfiguration.h	(revision 58459)
@@ -6,5 +6,5 @@
   configuration information as part of being started.
 
-  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -85,5 +85,5 @@
                               protocols. UEFI driver decodes this
                               structure and its contents based on
-                              ProtocolGuid. ParameterBlock is
+                              ParameterTypeGuid. ParameterBlock is
                               allocated by the platform and the
                               platform is responsible for freeing
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/PxeBaseCode.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/PxeBaseCode.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/PxeBaseCode.h	(revision 58459)
@@ -149,4 +149,6 @@
 // PXE Tag definition that identifies the processor 
 // and programming environment of the client system.
+// These identifiers are defined by IETF:
+// http://www.ietf.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml
 //
 #if defined (MDE_CPU_IA32)
@@ -158,4 +160,6 @@
 #elif defined (MDE_CPU_ARM)
 #define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE    0x000A
+#elif defined (MDE_CPU_AARCH64)
+#define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE    0x000B
 #endif
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/ScsiIo.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/ScsiIo.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/ScsiIo.h	(revision 58459)
@@ -5,5 +5,5 @@
   managing devices on SCSI buses are defined here.
 
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -28,4 +28,29 @@
 ///
 typedef struct _EFI_SCSI_IO_PROTOCOL EFI_SCSI_IO_PROTOCOL;
+
+//
+// SCSI Device type information, defined in the SCSI Primary Commands standard (e.g., SPC-4)
+//
+#define EFI_SCSI_IO_TYPE_DISK                                  0x00    ///< Disk device
+#define EFI_SCSI_IO_TYPE_TAPE                                  0x01    ///< Tape device
+#define EFI_SCSI_IO_TYPE_PRINTER                               0x02    ///< Printer
+#define EFI_SCSI_IO_TYPE_PROCESSOR                             0x03    ///< Processor
+#define EFI_SCSI_IO_TYPE_WORM                                  0x04    ///< Write-once read-multiple
+#define EFI_SCSI_IO_TYPE_CDROM                                 0x05    ///< CD or DVD device
+#define EFI_SCSI_IO_TYPE_SCANNER                               0x06    ///< Scanner device
+#define EFI_SCSI_IO_TYPE_OPTICAL                               0x07    ///< Optical memory device
+#define EFI_SCSI_IO_TYPE_MEDIUMCHANGER                         0x08    ///< Medium Changer device
+#define EFI_SCSI_IO_TYPE_COMMUNICATION                         0x09    ///< Communications device
+#define MFI_SCSI_IO_TYPE_A                                     0x0A    ///< Obsolete
+#define MFI_SCSI_IO_TYPE_B                                     0x0B    ///< Obsolete
+#define MFI_SCSI_IO_TYPE_RAID                                  0x0C    ///< Storage array controller device (e.g., RAID)
+#define MFI_SCSI_IO_TYPE_SES                                   0x0D    ///< Enclosure services device
+#define MFI_SCSI_IO_TYPE_RBC                                   0x0E    ///< Simplified direct-access device (e.g., magnetic disk)
+#define MFI_SCSI_IO_TYPE_OCRW                                  0x0F    ///< Optical card reader/writer device
+#define MFI_SCSI_IO_TYPE_BRIDGE                                0x10    ///< Bridge Controller Commands
+#define MFI_SCSI_IO_TYPE_OSD                                   0x11    ///< Object-based Storage Device
+#define EFI_SCSI_IO_TYPE_RESERVED_LOW                          0x12    ///< Reserved (low)
+#define EFI_SCSI_IO_TYPE_RESERVED_HIGH                         0x1E    ///< Reserved (high)
+#define EFI_SCSI_IO_TYPE_UNKNOWN                               0x1F    ///< Unknown no device type
 
 //
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/SimpleFileSystem.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/SimpleFileSystem.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/SimpleFileSystem.h	(revision 58459)
@@ -8,5 +8,5 @@
   UEFI 2.0 can boot from any valid EFI image contained in a SimpleFileSystem.
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -191,5 +191,5 @@
   @retval EFI_DEVICE_ERROR     On entry, the current file position is beyond the end of the file.
   @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
-  @retval EFI_BUFFER_TO_SMALL  The BufferSize is too small to read the current directory
+  @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current directory
                                entry. BufferSize has been updated with the size
                                needed to complete the request.
@@ -364,5 +364,162 @@
   );
 
-#define EFI_FILE_PROTOCOL_REVISION   0x00010000
+typedef struct {
+  //
+  // If Event is NULL, then blocking I/O is performed.
+  // If Event is not NULL and non-blocking I/O is supported, then non-blocking I/O is performed,
+  // and Event will be signaled when the read request is completed.
+  // The caller must be prepared to handle the case where the callback associated with Event
+  // occurs before the original asynchronous I/O request call returns.
+  //
+  EFI_EVENT                   Event;
+
+  //
+  // Defines whether or not the signaled event encountered an error.
+  //
+  EFI_STATUS                  Status;
+
+  //
+  // For OpenEx():  Not Used, ignored.
+  // For ReadEx():  On input, the size of the Buffer. On output, the amount of data returned in Buffer.
+  //                In both cases, the size is measured in bytes.
+  // For WriteEx(): On input, the size of the Buffer. On output, the amount of data actually written.
+  //                In both cases, the size is measured in bytes.
+  // For FlushEx(): Not used, ignored.
+  //
+  UINTN                       BufferSize;
+
+  //
+  // For OpenEx():  Not Used, ignored.
+  // For ReadEx():  The buffer into which the data is read.
+  // For WriteEx(): The buffer of data to write.
+  // For FlushEx(): Not Used, ignored.
+  //
+  VOID                        *Buffer;
+} EFI_FILE_IO_TOKEN;
+
+/**
+  Opens a new file relative to the source directory's location.
+
+  @param  This       A pointer to the EFI_FILE_PROTOCOL instance that is the file
+                     handle to the source location.
+  @param  NewHandle  A pointer to the location to return the opened handle for the new
+                     file.
+  @param  FileName   The Null-terminated string of the name of the file to be opened.
+                     The file name may contain the following path modifiers: "\", ".",
+                     and "..".
+  @param  OpenMode   The mode to open the file. The only valid combinations that the
+                     file may be opened with are: Read, Read/Write, or Create/Read/Write.
+  @param  Attributes Only valid for EFI_FILE_MODE_CREATE, in which case these are the 
+                     attribute bits for the newly created file.
+  @param  Token      A pointer to the token associated with the transaction.
+
+  @retval EFI_SUCCESS          If Event is NULL (blocking I/O): The data was read successfully.
+                               If Event is not NULL (asynchronous I/O): The request was successfully
+                                                                        queued for processing.
+  @retval EFI_NOT_FOUND        The specified file could not be found on the device.
+  @retval EFI_NO_MEDIA         The device has no medium.
+  @retval EFI_MEDIA_CHANGED    The device has a different medium in it or the medium is no
+                               longer supported.
+  @retval EFI_DEVICE_ERROR     The device reported an error.
+  @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
+  @retval EFI_WRITE_PROTECTED  An attempt was made to create a file, or open a file for write
+                               when the media is write-protected.
+  @retval EFI_ACCESS_DENIED    The service denied access to the file.
+  @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file.
+  @retval EFI_VOLUME_FULL      The volume is full.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_FILE_OPEN_EX)(
+  IN EFI_FILE_PROTOCOL        *This,
+  OUT EFI_FILE_PROTOCOL       **NewHandle,
+  IN CHAR16                   *FileName,
+  IN UINT64                   OpenMode,
+  IN UINT64                   Attributes,
+  IN OUT EFI_FILE_IO_TOKEN    *Token
+  );
+
+
+/**
+  Reads data from a file.
+
+  @param  This       A pointer to the EFI_FILE_PROTOCOL instance that is the file handle to read data from.
+  @param  Token      A pointer to the token associated with the transaction.
+
+  @retval EFI_SUCCESS          If Event is NULL (blocking I/O): The data was read successfully.
+                               If Event is not NULL (asynchronous I/O): The request was successfully
+                                                                        queued for processing.
+  @retval EFI_NO_MEDIA         The device has no medium.
+  @retval EFI_DEVICE_ERROR     The device reported an error.
+  @retval EFI_DEVICE_ERROR     An attempt was made to read from a deleted file.
+  @retval EFI_DEVICE_ERROR     On entry, the current file position is beyond the end of the file.
+  @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
+  @retval EFI_OUT_OF_RESOURCES Unable to queue the request due to lack of resources.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_FILE_READ_EX) (
+  IN EFI_FILE_PROTOCOL        *This,
+  IN OUT EFI_FILE_IO_TOKEN    *Token
+);
+
+
+/**
+  Writes data to a file.
+
+  @param  This       A pointer to the EFI_FILE_PROTOCOL instance that is the file handle to write data to.
+  @param  Token      A pointer to the token associated with the transaction.
+
+  @retval EFI_SUCCESS          If Event is NULL (blocking I/O): The data was read successfully.
+                               If Event is not NULL (asynchronous I/O): The request was successfully
+                                                                        queued for processing.
+  @retval EFI_UNSUPPORTED      Writes to open directory files are not supported.
+  @retval EFI_NO_MEDIA         The device has no medium.
+  @retval EFI_DEVICE_ERROR     The device reported an error.
+  @retval EFI_DEVICE_ERROR     An attempt was made to write to a deleted file.
+  @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
+  @retval EFI_WRITE_PROTECTED  The file or medium is write-protected.
+  @retval EFI_ACCESS_DENIED    The file was opened read only.
+  @retval EFI_VOLUME_FULL      The volume is full.
+  @retval EFI_OUT_OF_RESOURCES Unable to queue the request due to lack of resources.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_FILE_WRITE_EX) (
+  IN EFI_FILE_PROTOCOL        *This,
+  IN OUT EFI_FILE_IO_TOKEN    *Token 
+);
+
+/**
+  Flushes all modified data associated with a file to a device.
+
+  @param  This  A pointer to the EFI_FILE_PROTOCOL instance that is the file 
+                handle to flush.
+  @param  Token A pointer to the token associated with the transaction.
+
+  @retval EFI_SUCCESS          If Event is NULL (blocking I/O): The data was read successfully.
+                               If Event is not NULL (asynchronous I/O): The request was successfully
+                                                                        queued for processing.
+  @retval EFI_NO_MEDIA         The device has no medium.
+  @retval EFI_DEVICE_ERROR     The device reported an error.
+  @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
+  @retval EFI_WRITE_PROTECTED  The file or medium is write-protected.
+  @retval EFI_ACCESS_DENIED    The file was opened read-only.
+  @retval EFI_VOLUME_FULL      The volume is full.
+  @retval EFI_OUT_OF_RESOURCES Unable to queue the request due to lack of resources.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_FILE_FLUSH_EX) (
+  IN EFI_FILE_PROTOCOL        *This,
+  IN OUT EFI_FILE_IO_TOKEN    *Token
+  );
+
+#define EFI_FILE_PROTOCOL_REVISION        0x00010000
+#define EFI_FILE_PROTOCOL_REVISION2       0x00020000
+#define EFI_FILE_PROTOCOL_LATEST_REVISION EFI_FILE_PROTOCOL_REVISION2
+
 //
 // Revision defined in EFI1.1.
@@ -380,6 +537,6 @@
   ///
   /// The version of the EFI_FILE_PROTOCOL interface. The version specified 
-  /// by this specification is 0x00010000. Future versions are required 
-  /// to be backward compatible to version 1.0.
+  /// by this specification is EFI_FILE_PROTOCOL_LATEST_REVISION.
+  /// Future versions are required to be backward compatible to version 1.0.
   ///
   UINT64                Revision;
@@ -394,4 +551,8 @@
   EFI_FILE_SET_INFO     SetInfo;
   EFI_FILE_FLUSH        Flush;
+  EFI_FILE_OPEN_EX      OpenEx;
+  EFI_FILE_READ_EX      ReadEx;
+  EFI_FILE_WRITE_EX     WriteEx;
+  EFI_FILE_FLUSH_EX     FlushEx;
 };
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/SimpleTextInEx.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/SimpleTextInEx.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/SimpleTextInEx.h	(revision 58459)
@@ -6,5 +6,5 @@
   also allows one to register a notification for a particular keystroke.
 
-  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -275,5 +275,5 @@
   IN  EFI_KEY_DATA                      *KeyData,
   IN  EFI_KEY_NOTIFY_FUNCTION           KeyNotificationFunction,
-  OUT EFI_HANDLE                        *NotifyHandle
+  OUT VOID                              **NotifyHandle
 );
 
@@ -297,5 +297,5 @@
 (EFIAPI *EFI_UNREGISTER_KEYSTROKE_NOTIFY)(
   IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL  *This,
-  IN EFI_HANDLE                         NotificationHandle
+  IN VOID                               *NotificationHandle
 );
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/SmmCpu.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/SmmCpu.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/SmmCpu.h	(revision 58459)
@@ -7,5 +7,5 @@
   format.  
 
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -107,5 +107,6 @@
   ///
   EFI_SMM_SAVE_STATE_REGISTER_IO            = 512,
-  EFI_SMM_SAVE_STATE_REGISTER_LMA           = 513
+  EFI_SMM_SAVE_STATE_REGISTER_LMA           = 513,
+  EFI_SMM_SAVE_STATE_REGISTER_PROCESSOR_ID  = 514
 } EFI_SMM_SAVE_STATE_REGISTER;  
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/SmmSwDispatch2.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/SmmSwDispatch2.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/SmmSwDispatch2.h	(revision 58459)
@@ -5,5 +5,5 @@
   This protocol provides the parent dispatch service for a given SMI source generator.
 
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -65,8 +65,4 @@
   DispatchHandle contains a unique handle which may be used later to unregister the function 
   using UnRegister().
-
-  Note that the modifiers for the parameter RegisterContext are IN, OUT, while they are IN, CONST
-  in the PI 1.2 errta B spec. This in-consistency is for support for the case where SwSmiInputValue
-  is set to -1, a unique value will be returned in the RegisterContext structure.
 
   @param[in]  This                 Pointer to the EFI_SMM_SW_DISPATCH2_PROTOCOL instance.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Tcp4.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Tcp4.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Tcp4.h	(revision 58459)
@@ -5,5 +5,5 @@
   The EFI TCPv4 Protocol provides services to send and receive data stream.
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -36,4 +36,8 @@
 typedef struct _EFI_TCP4_PROTOCOL EFI_TCP4_PROTOCOL;
 
+///
+/// EFI_TCP4_SERVICE_POINT is deprecated in the UEFI 2.4B and should not be used any more.
+/// The definition in here is only present to provide backwards compatability.
+///
 typedef struct {
   EFI_HANDLE              InstanceHandle;
@@ -44,4 +48,8 @@
 } EFI_TCP4_SERVICE_POINT;
 
+///
+/// EFI_TCP4_VARIABLE_DATA is deprecated in the UEFI 2.4B and should not be used any more.
+/// The definition in here is only present to provide backwards compatability.
+///
 typedef struct {
   EFI_HANDLE              DriverHandle;
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Tcp6.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Tcp6.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Tcp6.h	(revision 58459)
@@ -5,5 +5,5 @@
   The EFI TCPv6 Protocol provides services to send and receive data stream.
 
-  Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -39,5 +39,6 @@
 
 ///
-/// EFI_TCP6_SERVICE_POINT
+/// EFI_TCP6_SERVICE_POINT is deprecated in the UEFI 2.4B and should not be used any more.
+/// The definition in here is only present to provide backwards compatability.
 ///
 typedef struct {
@@ -70,5 +71,6 @@
 
 ///
-/// EFI_TCP6_VARIABLE_DATA
+/// EFI_TCP6_VARIABLE_DATA is deprecated in the UEFI 2.4B and should not be used any more.
+/// The definition in here is only present to provide backwards compatability.
 ///
 typedef struct {
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Udp4.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Udp4.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Udp4.h	(revision 58459)
@@ -5,5 +5,5 @@
   to transmit and receive UDP packets.  
 
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -38,4 +38,8 @@
 typedef struct _EFI_UDP4_PROTOCOL EFI_UDP4_PROTOCOL; 
   
+///
+/// EFI_UDP4_SERVICE_POINT is deprecated in the UEFI 2.4B and should not be used any more.
+/// The definition in here is only present to provide backwards compatability.
+///
 typedef struct {
   EFI_HANDLE              InstanceHandle;
@@ -46,4 +50,8 @@
 } EFI_UDP4_SERVICE_POINT; 
 
+///
+/// EFI_UDP4_VARIABLE_DATA is deprecated in the UEFI 2.4B and should not be used any more.
+/// The definition in here is only present to provide backwards compatability.
+///
 typedef struct {
   EFI_HANDLE              DriverHandle;
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Udp6.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Udp6.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Protocol/Udp6.h	(revision 58459)
@@ -4,5 +4,5 @@
   UDP packets.
 
-  Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -33,4 +33,8 @@
   }
 
+///
+/// EFI_UDP6_SERVICE_POINT is deprecated in the UEFI 2.4B and should not be used any more.
+/// The definition in here is only present to provide backwards compatability.
+///
 typedef struct {
   ///
@@ -60,4 +64,8 @@
 } EFI_UDP6_SERVICE_POINT;
 
+///
+/// EFI_UDP6_VARIABLE_DATA is deprecated in the UEFI 2.4B and should not be used any more.
+/// The definition in here is only present to provide backwards compatability.
+///
 typedef struct {
   ///
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Uefi/UefiBaseType.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Uefi/UefiBaseType.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Uefi/UefiBaseType.h	(revision 58459)
@@ -3,4 +3,6 @@
 
 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
+
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -242,4 +244,9 @@
 #define EFI_IMAGE_MACHINE_ARMTHUMB_MIXED  0x01C2
 
+///
+/// PE32+ Machine type for AARCH64 A64 images.
+///
+#define EFI_IMAGE_MACHINE_AARCH64  0xAA64
+
 
 #if   defined (MDE_CPU_IA32)
@@ -270,4 +277,11 @@
 
 #define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_ARMTHUMB_MIXED) 
+
+#elif defined (MDE_CPU_AARCH64)
+
+#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
+  (((Machine) == EFI_IMAGE_MACHINE_AARCH64) || ((Machine) == EFI_IMAGE_MACHINE_EBC))
+
+#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
 
 #elif defined (MDE_CPU_EBC)
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h	(revision 58459)
@@ -4,5 +4,5 @@
   internal application and drivers as well as all add-in card option-ROM drivers
 
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -676,5 +676,5 @@
   EFI_STRING_ID   string; ///< EFI_IFR_TYPE_STRING, EFI_IFR_TYPE_ACTION
   EFI_HII_REF     ref;    ///< EFI_IFR_TYPE_REF
-  // UINT8 buffer[];      ///< EFI_IFR_TYPE_ORDERED_LIST
+  // UINT8 buffer[];      ///< EFI_IFR_TYPE_BUFFER
 } EFI_IFR_TYPE_VALUE;
 
@@ -701,5 +701,5 @@
 #define EFI_IFR_EQ_ID_VAL_OP           0x12
 #define EFI_IFR_EQ_ID_ID_OP            0x13
-#define EFI_IFR_EQ_ID_LIST_OP          0x14
+#define EFI_IFR_EQ_ID_VAL_LIST_OP      0x14
 #define EFI_IFR_AND_OP                 0x15
 #define EFI_IFR_OR_OP                  0x16
@@ -780,4 +780,5 @@
 #define EFI_IFR_MODAL_TAG_OP           0x61
 #define EFI_IFR_REFRESH_ID_OP          0x62
+#define EFI_IFR_WARNING_IF_OP          0x63
 
 //
@@ -886,7 +887,7 @@
 } EFI_IFR_IMAGE;
 
-typedef struct _EFI_IFR_MODAL {
-  EFI_IFR_OP_HEADER        Header;
-} EFI_IFR_MODAL;
+typedef struct _EFI_IFR_MODAL_TAG {
+  EFI_IFR_OP_HEADER        Header;
+} EFI_IFR_MODAL_TAG;
 
 typedef struct _EFI_IFR_LOCKED {
@@ -905,4 +906,10 @@
   EFI_IFR_TYPE_VALUE       Value;
 } EFI_IFR_DEFAULT;
+
+typedef struct _EFI_IFR_DEFAULT_2 {
+  EFI_IFR_OP_HEADER        Header;
+  UINT16                   DefaultId;
+  UINT8                    Type;
+} EFI_IFR_DEFAULT_2;
 
 typedef struct _EFI_IFR_VALUE {
@@ -1120,4 +1127,10 @@
   EFI_STRING_ID            Error;
 } EFI_IFR_NO_SUBMIT_IF;
+
+typedef struct _EFI_IFR_WARNING_IF {
+  EFI_IFR_OP_HEADER        Header;
+  EFI_STRING_ID            Warning;
+  UINT8                    TimeOut;
+} EFI_IFR_WARNING_IF;
 
 typedef struct _EFI_IFR_REFRESH {
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Uefi/UefiMultiPhase.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Uefi/UefiMultiPhase.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Uefi/UefiMultiPhase.h	(revision 58459)
@@ -2,5 +2,5 @@
   This includes some definitions introduced in UEFI that will be used in both PEI and DXE phases.
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -83,4 +83,9 @@
   ///
   EfiPalCode,
+  ///
+  /// A memory region that operates as EfiConventionalMemory, 
+  /// however it happens to also support byte-addressable non-volatility.
+  ///
+  EfiPersistentMemory,
   EfiMaxMemoryType
 } EFI_MEMORY_TYPE;
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Uefi/UefiPxe.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Uefi/UefiPxe.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Uefi/UefiPxe.h	(revision 58459)
@@ -4,5 +4,5 @@
   are needed for porting PXE to EFI.
 
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -720,8 +720,9 @@
   PXE_UINT8   Fudge;          ///< makes 8-bit cksum equal zero.
   PXE_UINT8   Rev;            ///< PXE_ROMID_REV.
-  PXE_UINT8   IFcnt;          ///< physical connector count.
+  PXE_UINT8   IFcnt;          ///< physical connector count lower byte.
   PXE_UINT8   MajorVer;       ///< PXE_ROMID_MAJORVER.
   PXE_UINT8   MinorVer;       ///< PXE_ROMID_MINORVER.
-  PXE_UINT16  reserved;       ///< zero, not used.
+  PXE_UINT8   IFcntExt;       ///< physical connector count upper byte.
+  PXE_UINT8   reserved;       ///< zero, not used.
   PXE_UINT32  Implementation; ///< implementation flags.
   ///< reserved             ///< vendor use.
@@ -816,8 +817,9 @@
   PXE_UINT8   Fudge;          ///< makes 8-bit cksum zero.
   PXE_UINT8   Rev;            ///< PXE_ROMID_REV.
-  PXE_UINT8   IFcnt;          ///< physical connector count.
+  PXE_UINT8   IFcnt;          ///< physical connector count lower byte.
   PXE_UINT8   MajorVer;       ///< PXE_ROMID_MAJORVER.
   PXE_UINT8   MinorVer;       ///< PXE_ROMID_MINORVER.
-  PXE_UINT16  reserved1;      ///< zero, not used.
+  PXE_UINT8   IFcntExt;       ///< physical connector count upper byte.
+  PXE_UINT8   reserved1;      ///< zero, not used.
   PXE_UINT32  Implementation; ///< Implementation flags.
   PXE_UINT64  EntryPoint;     ///< API entry point.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Uefi/UefiSpec.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Uefi/UefiSpec.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Uefi/UefiSpec.h	(revision 58459)
@@ -2,9 +2,9 @@
   Include file that supports UEFI.
 
-  This include file must contain things defined in the UEFI 2.3 specification.
-  If a code construct is defined in the UEFI 2.3 specification it must be included
+  This include file must contain things defined in the UEFI 2.4 specification.
+  If a code construct is defined in the UEFI 2.4 specification it must be included
   by this include file.
 
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
@@ -76,4 +76,9 @@
 #define EFI_MEMORY_XP   0x0000000000004000ULL
 //
+// Physical memory persistence attribute. 
+// The memory region supports byte-addressable non-volatility.
+//
+#define EFI_MEMORY_NV   0x0000000000008000ULL
+//
 // Runtime memory attribute
 //
@@ -129,4 +134,5 @@
                                 2) MemoryType is in the range
                                 3) Memory is NULL.
+                                4) MemoryType was EfiPersistentMemory.
                                 EfiMaxMemoryType..0x7FFFFFFF.
   @retval EFI_OUT_OF_RESOURCES  The pages could not be allocated.
@@ -208,4 +214,5 @@
   @retval EFI_OUT_OF_RESOURCES  The pool requested could not be allocated.
   @retval EFI_INVALID_PARAMETER PoolType was invalid or Buffer is NULL.
+                                PoolType was EfiPersistentMemory.
 
 **/
@@ -282,5 +289,7 @@
                                 present in the system.
                                 2) No drivers were connected to ControllerHandle.
-
+  @retval EFI_SECURITY_VIOLATION 
+                                The user has no permission to start UEFI device drivers on the device path 
+                                associated with the ControllerHandle or specified by the RemainingDevicePath.
 **/
 typedef
@@ -456,9 +465,9 @@
   TimerCancel,
   ///
-  /// An event is to be signalled periodically at a specified interval from the current time.
+  /// An event is to be signaled periodically at a specified interval from the current time.
   ///
   TimerPeriodic,
   ///
-  /// An event is to be signalled once at a specified interval from the current time.
+  /// An event is to be signaled once at a specified interval from the current time.
   ///
   TimerRelative
@@ -661,11 +670,18 @@
   @param  VendorGuid             A unique identifier for the vendor.
   @param  Attributes             Attributes bitmask to set for the variable.
-  @param  DataSize               The size in bytes of the Data buffer. A size of zero causes the
-                                 variable to be deleted.
+  @param  DataSize               The size in bytes of the Data buffer. Unless the EFI_VARIABLE_APPEND_WRITE, 
+                                 EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS, or 
+                                 EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS attribute is set, a size of zero 
+                                 causes the variable to be deleted. When the EFI_VARIABLE_APPEND_WRITE attribute is 
+                                 set, then a SetVariable() call with a DataSize of zero will not cause any change to 
+                                 the variable value (the timestamp associated with the variable may be updated however 
+                                 even if no new data value is provided,see the description of the 
+                                 EFI_VARIABLE_AUTHENTICATION_2 descriptor below. In this case the DataSize will not 
+                                 be zero since the EFI_VARIABLE_AUTHENTICATION_2 descriptor will be populated). 
   @param  Data                   The contents for the variable.
 
   @retval EFI_SUCCESS            The firmware has successfully stored the variable and its data as
                                  defined by the Attributes.
-  @retval EFI_INVALID_PARAMETER  An invalid combination of attribute bits was supplied, or the
+  @retval EFI_INVALID_PARAMETER  An invalid combination of attribute bits, name, and GUID was supplied, or the
                                  DataSize exceeds the maximum allowed.
   @retval EFI_INVALID_PARAMETER  VariableName is an empty string.
@@ -674,7 +690,8 @@
   @retval EFI_WRITE_PROTECTED    The variable in question is read-only.
   @retval EFI_WRITE_PROTECTED    The variable in question cannot be deleted.
-  @retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS
-                                 set but the AuthInfo does NOT pass the validation check carried out
-                                 by the firmware.
+  @retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 
+                                 or EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS being set, but the AuthInfo 
+                                 does NOT pass the validation check carried out by the firmware.
+  
   @retval EFI_NOT_FOUND          The variable trying to be updated or deleted was not found.
 
@@ -849,6 +866,7 @@
                                 string, optionally followed by additional binary data.
 
-  @retval EFI_INVALID_PARAMETER ImageHandle is either an invalid image handle or the image
-                                has already been initialized with StartImage.
+  @retval EFI_INVALID_PARAMETER  ImageHandle is either an invalid image handle or the image
+                                 has already been initialized with StartImage.
+  @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started.
   @return Exit code from image
 
@@ -985,5 +1003,13 @@
   /// is rebooted, it should exhibit the EfiResetCold attributes.
   ///
-  EfiResetShutdown
+  EfiResetShutdown,
+  ///
+  /// Used to induce a system-wide reset. The exact type of the reset is defined by
+  /// the EFI_GUID that follows the Null-terminated Unicode string passed into
+  /// ResetData. If the platform does not recognize the EFI_GUID in ResetData the 
+  /// platform must pick a supported reset type to perform. The platform may
+  /// optionally log the parameters from any non-normal reset that occurs.
+  ///
+  EfiResetPlatformSpecific
 } EFI_RESET_TYPE;
 
@@ -1137,6 +1163,6 @@
   Installs one or more protocol interfaces into the boot services environment.
 
-  @param  Handle                The handle to install the new protocol interfaces on, or NULL if a new
-                                handle is to be allocated.
+  @param  Handle                The pointer to a handle to install the new protocol interfaces on,
+                                or a pointer to NULL if a new handle is to be allocated.
   @param  ...                   A variable argument list containing pairs of protocol GUIDs and protocol
                                 interfaces.
@@ -1146,4 +1172,6 @@
   @retval EFI_ALREADY_STARTED   A Device Path Protocol instance was passed in that is already present in
                                 the handle database.
+  @retval EFI_INVALID_PARAMETER Handle is NULL.
+  @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.
 
 **/
@@ -1651,5 +1679,9 @@
   @retval EFI_DEVICE_ERROR      The capsule update was started, but failed due to a device error.
   @retval EFI_UNSUPPORTED       The capsule type is not supported on this platform.
-  @retval EFI_OUT_OF_RESOURCES  There were insufficient resources to process the capsule.
+  @retval EFI_OUT_OF_RESOURCES  When ExitBootServices() has been previously called this error indicates the capsule 
+                                is compatible with this platform but is not capable of being submitted or processed 
+                                in runtime. The caller may resubmit the capsule prior to ExitBootServices().
+  @retval EFI_OUT_OF_RESOURCES  When ExitBootServices() has not been previously called then this error indicates 
+                                the capsule is compatible with this platform but there are insufficient resources to process.
 
 **/
@@ -1678,5 +1710,9 @@
                                 MaximumCapsuleSize and ResetType are undefined.
   @retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL.
-  @retval EFI_OUT_OF_RESOURCES  There were insufficient resources to process the query request.
+  @retval EFI_OUT_OF_RESOURCES  When ExitBootServices() has been previously called this error indicates the capsule 
+                                is compatible with this platform but is not capable of being submitted or processed 
+                                in runtime. The caller may resubmit the capsule prior to ExitBootServices().
+  @retval EFI_OUT_OF_RESOURCES  When ExitBootServices() has not been previously called then this error indicates 
+                                the capsule is compatible with this platform but there are insufficient resources to process.
 
 **/
@@ -1721,4 +1757,12 @@
   );
 
+//
+// Firmware should stop at a firmware user interface on next boot
+//
+#define EFI_OS_INDICATIONS_BOOT_TO_FW_UI                    0x0000000000000001
+#define EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION             0x0000000000000002
+#define EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED  0x0000000000000004
+#define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED            0x0000000000000008
+#define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED     0x0000000000000010
 
 //
@@ -1726,4 +1770,5 @@
 //
 #define EFI_SYSTEM_TABLE_SIGNATURE      SIGNATURE_64 ('I','B','I',' ','S','Y','S','T')
+#define EFI_2_40_SYSTEM_TABLE_REVISION  ((2 << 16) | (40))
 #define EFI_2_31_SYSTEM_TABLE_REVISION  ((2 << 16) | (31))
 #define EFI_2_30_SYSTEM_TABLE_REVISION  ((2 << 16) | (30))
@@ -1733,8 +1778,9 @@
 #define EFI_1_10_SYSTEM_TABLE_REVISION  ((1 << 16) | (10))
 #define EFI_1_02_SYSTEM_TABLE_REVISION  ((1 << 16) | (02))
-#define EFI_SYSTEM_TABLE_REVISION       EFI_2_31_SYSTEM_TABLE_REVISION
+#define EFI_SYSTEM_TABLE_REVISION       EFI_2_40_SYSTEM_TABLE_REVISION
+#define EFI_SPECIFICATION_VERSION       EFI_SYSTEM_TABLE_REVISION
 
 #define EFI_RUNTIME_SERVICES_SIGNATURE  SIGNATURE_64 ('R','U','N','T','S','E','R','V')
-#define EFI_RUNTIME_SERVICES_REVISION   EFI_2_31_SYSTEM_TABLE_REVISION
+#define EFI_RUNTIME_SERVICES_REVISION   EFI_SPECIFICATION_VERSION
 
 ///
@@ -1788,5 +1834,5 @@
 
 #define EFI_BOOT_SERVICES_SIGNATURE   SIGNATURE_64 ('B','O','O','T','S','E','R','V')
-#define EFI_BOOT_SERVICES_REVISION    EFI_2_31_SYSTEM_TABLE_REVISION
+#define EFI_BOOT_SERVICES_REVISION    EFI_SPECIFICATION_VERSION
 
 ///
@@ -2063,4 +2109,5 @@
 /// EFI Key Option.
 ///
+#pragma pack(1)
 typedef struct {
   ///
@@ -2086,4 +2133,5 @@
   //EFI_INPUT_KEY      Keys[];
 } EFI_KEY_OPTION;
+#pragma pack()
 
 //
@@ -2094,4 +2142,5 @@
 #define EFI_REMOVABLE_MEDIA_FILE_NAME_X64     L"\\EFI\\BOOT\\BOOTX64.EFI"
 #define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM     L"\\EFI\\BOOT\\BOOTARM.EFI"
+#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI"
 
 #if   defined (MDE_CPU_IA32)
@@ -2104,4 +2153,6 @@
 #elif defined (MDE_CPU_ARM)
   #define EFI_REMOVABLE_MEDIA_FILE_NAME   EFI_REMOVABLE_MEDIA_FILE_NAME_ARM
+#elif defined (MDE_CPU_AARCH64)
+  #define EFI_REMOVABLE_MEDIA_FILE_NAME   EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64
 #else
   #error Unknown Processor Type
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/X64/ProcessorBind.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/X64/ProcessorBind.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Include/X64/ProcessorBind.h	(revision 58459)
@@ -2,5 +2,5 @@
   Processor or Compiler specific defines and types x64 (Intel 64, AMD64).
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -95,4 +95,24 @@
 #pragma warning ( disable : 4206 )
 
+#if _MSC_VER == 1800
+
+//
+// Disable these warnings for VS2013.
+//
+
+//
+// This warning is for potentially uninitialized local variable, and it may cause false 
+// positive issues in VS2013 build
+//
+#pragma warning ( disable : 4701 )
+  
+//
+// This warning is for potentially uninitialized local pointer variable, and it may cause 
+// false positive issues in VS2013 build
+//
+#pragma warning ( disable : 4703 )
+  
+#endif
+
 #endif
 
@@ -148,5 +168,5 @@
   /// 1-byte signed value
   ///
-  typedef char                INT8;
+  typedef signed char         INT8;
 #else
   ///
@@ -195,5 +215,5 @@
   /// 1-byte signed value
   ///
-  typedef char                INT8;
+  typedef signed char         INT8;
 #endif
 
@@ -227,4 +247,10 @@
 ///
 #define MAX_ADDRESS   0xFFFFFFFFFFFFFFFFULL
+
+///
+/// Maximum legal x64 INTN and UINTN values.
+///
+#define MAX_INTN   ((INTN)0x7FFFFFFFFFFFFFFFULL)
+#define MAX_UINTN  ((UINTN)0xFFFFFFFFFFFFFFFFULL)
 
 ///
@@ -285,4 +311,8 @@
 #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
 
-#endif
-
+#ifndef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__
+#endif
+
+#endif
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf	(revision 58459)
@@ -5,5 +5,5 @@
 #  This library assumes there are no chipset dependencies required to maintain caches.
 #
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
 #
@@ -21,4 +21,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BaseCacheMaintenanceLib
+  MODULE_UNI_FILE                = BaseCacheMaintenanceLib.uni
   FILE_GUID                      = 123dd843-57c9-4158-8418-ce68b3944ce7
   MODULE_TYPE                    = BASE
@@ -28,5 +29,5 @@
 
 #
-#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC ARM
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC ARM AARCH64
 #
 
@@ -46,4 +47,7 @@
   ArmCache.c
 
+[Sources.AARCH64]
+  ArmCache.c
+
 [Packages]
   MdePkg/MdePkg.dec
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c	(revision 58459)
@@ -143,5 +143,5 @@
   // 
   End = (Start + Length + (CACHE_LINE_SIZE - 1)) & ~(CACHE_LINE_SIZE - 1);
-  Start &= ~(CACHE_LINE_SIZE - 1);
+  Start &= ~((UINTN) CACHE_LINE_SIZE - 1);
 
   do {
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf	(revision 58459)
@@ -5,6 +5,7 @@
 #  PAL CALLs for IPF, and empty functions for EBC.
 #
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
+#  Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -21,4 +22,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BaseCpuLib
+  MODULE_UNI_FILE                = BaseCpuLib.uni
   FILE_GUID                      = 4FBD2538-249C-4b50-8F4A-A9E66609CBF6
   MODULE_TYPE                    = BASE
@@ -28,5 +30,5 @@
 
 #
-#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC ARM
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC ARM AARCH64
 #
 
@@ -61,4 +63,8 @@
   Arm/CpuSleep.S      | GCC  
 
+[Sources.AARCH64]
+  AArch64/CpuFlushTlb.S | GCC
+  AArch64/CpuSleep.S    | GCC
+
 [Packages]
   MdePkg/MdePkg.dec
@@ -68,2 +74,3 @@
   PalLib
   BaseLib
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf	(revision 58459)
@@ -2,5 +2,5 @@
 #  Debug Library with empty functions.
 #
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -17,4 +17,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BaseDebugLibNull
+  MODULE_UNI_FILE                = BaseDebugLibNull.uni
   FILE_GUID                      = 9ba1d976-0624-41a3-8650-28165e8d9ae8
   MODULE_TYPE                    = BASE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseDebugLibNull/DebugLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseDebugLibNull/DebugLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseDebugLibNull/DebugLib.c	(revision 58459)
@@ -2,5 +2,5 @@
   Null Base Debug Library instance with empty functions.
 
-  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -178,2 +178,21 @@
   return FALSE;
 }
+
+/**
+  Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
+
+  This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
+
+  @retval  TRUE    Current ErrorLevel is supported.
+  @retval  FALSE   Current ErrorLevel is not supported.
+
+**/
+BOOLEAN
+EFIAPI
+DebugPrintLevelEnabled (
+  IN  CONST UINTN        ErrorLevel
+  )
+{
+  return FALSE;
+}
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf	(revision 58459)
@@ -1,7 +1,7 @@
 ## @file
 #  Instance of Debug Library based on Serial Port Library.
-#  It uses Print Library to produce formatted output strings.
+#  It uses Print Library to produce formatted output strings to seiral port device.
 #
-#  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -18,4 +18,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BaseDebugLibSerialPort
+  MODULE_UNI_FILE                = BaseDebugLibSerialPort.uni
   FILE_GUID                      = BB83F95F-EDBC-4884-A520-CD42AF388FAE
   MODULE_TYPE                    = BASE
@@ -43,5 +44,6 @@
 
 [Pcd]
-  gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue
-  gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask
+  gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue  ## SOMETIMES_CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask      ## CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel ## CONSUMES
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c	(revision 58459)
@@ -264,2 +264,21 @@
   return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
 }
+
+/**
+  Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
+
+  This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
+
+  @retval  TRUE    Current ErrorLevel is supported.
+  @retval  FALSE   Current ErrorLevel is not supported.
+
+**/
+BOOLEAN
+EFIAPI
+DebugPrintLevelEnabled (
+  IN  CONST UINTN        ErrorLevel
+  )
+{
+  return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0);
+}
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf	(revision 58459)
@@ -1,7 +1,7 @@
 ## @file
-#  Debug Print Error Level library instance that retrieves the current error 
-#  level from PcdDebugPrintErrorLevel.  
+#  Debug Print Error Level library instance based on PcdDebugPrintErrorLevel.
+#  It retrieves the current error level from PcdDebugPrintErrorLevel.  
 #
-#  Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -17,4 +17,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BaseDebugPrintErrorLevelLib
+  MODULE_UNI_FILE                = BaseDebugPrintErrorLevelLib.uni
   FILE_GUID                      = A2C09E18-E4D2-407e-AFCC-628B79113F72
   MODULE_TYPE                    = BASE
@@ -36,3 +37,4 @@
   
 [Pcd]
-  gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel
+  gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel  ## CONSUMES
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf	(revision 58459)
@@ -9,5 +9,5 @@
 #  convert the address pointed by PcdGuidedExtractHandlerTableAddress to the virtual address.
 #  
-#  Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -23,4 +23,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BaseExtractGuidedSectionLib
+  MODULE_UNI_FILE                = BaseExtractGuidedSectionLib.uni
   FILE_GUID                      = 4e3236e9-d1c8-4c04-a89f-26f1c44b2592
   MODULE_TYPE                    = BASE
@@ -46,4 +47,5 @@
 
 [Pcd]
-  gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler
-  gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress
+  gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler         ## CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress    ## CONSUMES
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf	(revision 58459)
@@ -6,5 +6,5 @@
 #  MMIO requests are forwarded directly to memory.
 #
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
 #
@@ -22,4 +22,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BaseIoLibIntrinsic
+  MODULE_UNI_FILE                = BaseIoLibIntrinsic.uni
   FILE_GUID                      = 926c9cd0-4bb8-479b-9ac4-8a2a23f85307
   MODULE_TYPE                    = BASE
@@ -29,5 +30,5 @@
 
 #
-#  VALID_ARCHITECTURES           = IA32 X64 IPF ARM
+#  VALID_ARCHITECTURES           = IA32 X64 IPF ARM AARCH64
 #
 
@@ -55,4 +56,7 @@
   IoLibArm.c
 
+[Sources.AARCH64]
+  IoLibArm.c
+
 [Packages]
   MdePkg/MdePkg.dec
@@ -66,4 +70,4 @@
 
 [Pcd.IPF]
-  gEfiMdePkgTokenSpaceGuid.PcdIoBlockBaseAddressForIpf
+  gEfiMdePkgTokenSpaceGuid.PcdIoBlockBaseAddressForIpf  ## SOMETIMES_CONSUMES
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseIoLibIntrinsic/IoHighLevel.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseIoLibIntrinsic/IoHighLevel.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseIoLibIntrinsic/IoHighLevel.c	(revision 58459)
@@ -5,5 +5,5 @@
   Base Library.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -153,4 +153,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -193,4 +194,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -233,4 +235,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -275,4 +278,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -438,4 +443,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -479,4 +485,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -520,4 +527,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -563,4 +571,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -726,4 +736,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -767,4 +778,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -808,4 +820,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -851,4 +864,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1014,4 +1029,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1055,4 +1071,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1096,4 +1113,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1139,4 +1157,6 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1297,4 +1317,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1338,4 +1359,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1379,4 +1401,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1421,4 +1444,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1583,4 +1608,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1625,4 +1651,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1667,4 +1694,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1710,4 +1738,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1872,4 +1902,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1914,4 +1945,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1956,4 +1988,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1999,4 +2032,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -2161,4 +2196,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -2203,4 +2239,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -2245,4 +2282,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -2288,4 +2326,6 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/BaseLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/BaseLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/BaseLib.inf	(revision 58459)
@@ -2,6 +2,7 @@
 #  Base Library implementation.
 #
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
+#  Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -18,4 +19,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BaseLib
+  MODULE_UNI_FILE                = BaseLib.uni
   FILE_GUID                      = 27d67720-ea68-48ae-93da-a3a074c90e30
   MODULE_TYPE                    = BASE
@@ -24,5 +26,5 @@
 
 #
-#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC ARM
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC ARM AARCH64
 #
 
@@ -60,4 +62,5 @@
   Cpu.c
   LinkedList.c
+  SafeString.c
   String.c
   BaseLibInternals.h
@@ -251,5 +254,8 @@
 
   Ia32/GccInline.c | GCC
-  Ia32/Thunk16.S | GCC 
+# VBox begin (yasm doesn't like the nasm variant) - original:
+#  Ia32/Thunk16.nasm | GCC 
+  Ia32/Thunk16.asm | GCC
+# VBox end
   Ia32/EnableDisableInterrupts.S | GCC 
   Ia32/EnablePaging64.S | GCC 
@@ -417,5 +423,8 @@
   X86DisablePaging32.c
   X64/GccInline.c | GCC
-  X64/Thunk16.S | GCC 
+# VBox begin (yasm doesn't like the nasm variant) - original:
+#  Ia32/Thunk16.nasm | GCC 
+  Ia32/Thunk16.asm | GCC
+# VBox end
   X64/SwitchStack.S | GCC 
   X64/SetJump.S | GCC 
@@ -481,4 +490,5 @@
   Arm/CpuPause.asm           | RVCT
   Arm/CpuBreakpoint.asm      | RVCT
+  Arm/MemoryFence.asm        | RVCT
  
   Arm/Math64.S                  | GCC
@@ -489,4 +499,18 @@
   Arm/SetJumpLongJump.S         | GCC
   Arm/CpuBreakpoint.S           | GCC
+  Arm/MemoryFence.S             | GCC
+
+[Sources.AARCH64]
+  Arm/InternalSwitchStack.c
+  Arm/Unaligned.c
+  Math64.c
+
+  AArch64/MemoryFence.S             | GCC
+  AArch64/SwitchStack.S             | GCC
+  AArch64/EnableInterrupts.S        | GCC
+  AArch64/DisableInterrupts.S       | GCC
+  AArch64/GetInterruptsState.S      | GCC
+  AArch64/SetJumpLongJump.S         | GCC
+  AArch64/CpuBreakpoint.S           | GCC
 
 [Packages]
@@ -499,8 +523,11 @@
 
 [Pcd]
-  gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength
-  gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength
-  gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength
-  gEfiMdePkgTokenSpaceGuid.PcdVerifyNodeInList
+  gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength      ## SOMETIMES_CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength     ## SOMETIMES_CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength   ## SOMETIMES_CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask            ## SOMETIMES_CONSUMES
+
+[FeaturePcd]
+  gEfiMdePkgTokenSpaceGuid.PcdVerifyNodeInList  ## CONSUMES
 
 # VBox - enable this for non-optimized IA32 builds.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/BaseLibInternals.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/BaseLibInternals.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/BaseLibInternals.h	(revision 58459)
@@ -350,5 +350,5 @@
   If List->backLink is NULL, then ASSERT().
   If Node is NULL, then ASSERT();
-  If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number
+  If PcdMaximumLinkedListLength is not zero, and prior to insertion the number
   of nodes in ListHead, including the ListHead node, is greater than or
   equal to PcdMaximumLinkedListLength, then ASSERT().
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/BitField.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/BitField.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/BitField.c	(revision 58459)
@@ -2,5 +2,5 @@
   Bit field functions of BaseLib.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -50,4 +50,6 @@
   preserved. The new value is returned.
 
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+
   @param  Operand   Operand on which to perform the bitfield operation.
   @param  StartBit  The ordinal of the least significant bit in the bit field.
@@ -67,4 +69,12 @@
   )
 {
+  //
+  // Higher bits in OrData those are not used must be zero. 
+  //
+  // EndBit - StartBit + 1 might be 32 while the result right shifting 32 on a 32bit integer is undefined,
+  // So the logic is updated to right shift (EndBit - StartBit) bits and compare the last bit directly.
+  //
+  ASSERT ((OrData >> (EndBit - StartBit)) == ((OrData >> (EndBit - StartBit)) & 1));
+  
   //
   // ~((UINTN)-2 << EndBit) is a mask in which bit[0] thru bit[EndBit]
@@ -82,4 +92,6 @@
   preserved. The new value is returned.
 
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+
   @param  Operand   Operand on which to perform the bitfield operation.
   @param  StartBit  The ordinal of the least significant bit in the bit field.
@@ -99,4 +111,12 @@
   )
 {
+  //
+  // Higher bits in AndData those are not used must be zero. 
+  //
+  // EndBit - StartBit + 1 might be 32 while the result right shifting 32 on a 32bit integer is undefined,
+  // So the logic is updated to right shift (EndBit - StartBit) bits and compare the last bit directly.
+  //
+  ASSERT ((AndData >> (EndBit - StartBit)) == ((AndData >> (EndBit - StartBit)) & 1));
+
   //
   // ~((UINTN)-2 << EndBit) is a mask in which bit[0] thru bit[EndBit]
@@ -149,4 +169,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -186,4 +207,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -223,4 +245,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -261,4 +284,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -336,4 +361,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -373,4 +399,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -410,4 +437,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -448,4 +476,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -523,4 +553,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -560,4 +591,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -597,4 +629,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -635,4 +668,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -710,4 +745,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -747,4 +783,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -772,4 +809,11 @@
   ASSERT (EndBit < 64);
   ASSERT (StartBit <= EndBit);
+  //
+  // Higher bits in OrData those are not used must be zero. 
+  //
+  // EndBit - StartBit + 1 might be 64 while the result right shifting 64 on RShiftU64() API is invalid,
+  // So the logic is updated to right shift (EndBit - StartBit) bits and compare the last bit directly.
+  //
+  ASSERT (RShiftU64 (OrData, EndBit - StartBit) == (RShiftU64 (OrData, EndBit - StartBit) & 1));
 
   Value1 = LShiftU64 (OrData, StartBit);
@@ -791,4 +835,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
@@ -816,4 +861,11 @@
   ASSERT (EndBit < 64);
   ASSERT (StartBit <= EndBit);
+  //
+  // Higher bits in AndData those are not used must be zero. 
+  //
+  // EndBit - StartBit + 1 might be 64 while the right shifting 64 on RShiftU64() API is invalid,
+  // So the logic is updated to right shift (EndBit - StartBit) bits and compare the last bit directly.
+  //
+  ASSERT (RShiftU64 (AndData, EndBit - StartBit) == (RShiftU64 (AndData, EndBit - StartBit) & 1));
 
   Value1 = LShiftU64 (~AndData, StartBit);
@@ -836,4 +888,6 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Operand   Operand on which to perform the bitfield operation.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/CpuIdEx.S
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/CpuIdEx.S	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/CpuIdEx.S	(revision 58459)
@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
 #
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD License
@@ -22,5 +22,5 @@
 #------------------------------------------------------------------------------
 
-    .686:
+
     .code:
 
@@ -54,11 +54,11 @@
     movl    %ebx, (%ecx)
 L2:
+    movl    32(%ebp), %ecx
+    jecxz   L3
+    movl    %edx, (%ecx)
+L3:
     movl    28(%ebp), %ecx
-    jecxz   L3
+    jecxz   L4
     popl    (%ecx)
-L3:
-    movl    32(%ebp), %edx
-    jecxz   L4
-    movl    %edx, (%ecx)
 L4:
     movl    12(%ebp), %eax
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/CpuIdEx.asm
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/CpuIdEx.asm	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/CpuIdEx.asm	(revision 58459)
@@ -1,5 +1,5 @@
 ;------------------------------------------------------------------------------
 ;
-; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
 ; This program and the accompanying materials
 ; are licensed and made available under the terms and conditions of the BSD License
@@ -53,11 +53,11 @@
     mov     [ecx], ebx
 @@:
+    mov     ecx, [ebp + 32]
+    jecxz   @F
+    mov     [ecx], edx
+@@:
     mov     ecx, [ebp + 28]
     jecxz   @F
     pop     [ecx]
-@@:
-    mov     edx, [ebp + 32]
-    jecxz   @F
-    mov     [ecx], edx
 @@:
     mov     eax, [ebp + 12]
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.S
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.S	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.S	(revision 58459)
@@ -38,5 +38,5 @@
     movl    20(%esp), %ecx
     jecxz   L1
-    and     $0, 4(%ecx)                 # zero high dword of remainder
+    andl     $0, 4(%ecx)                # zero high dword of remainder
     movl    %ecx, 16(%esp)              # set up stack frame to match DivRemU64x32
 L1:
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/EnablePaging64.S
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/EnablePaging64.S	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/EnablePaging64.S	(revision 58459)
@@ -59,5 +59,5 @@
     movl    0x18(%esp), %esp            # mov rsp, [esp + 18h]
     .byte   0x48
-    addl    $0x-0x20, %esp              # add rsp, -20h
+    addl    $-0x20, %esp                # add rsp, -20h
     call    *%ebx                       # call rbx
     jmp     .                           # no one should get here
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/MultU64x32.S
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/MultU64x32.S	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/MultU64x32.S	(revision 58459)
@@ -20,5 +20,5 @@
 #------------------------------------------------------------------------------
 
-    .386:
+
     .code:
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/RShiftU64.S
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/RShiftU64.S	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/RShiftU64.S	(revision 58459)
@@ -20,5 +20,5 @@
 #------------------------------------------------------------------------------
 
-    .686:
+
     .code:
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/ReadCr0.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/ReadCr0.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/ReadCr0.c	(revision 58459)
@@ -2,5 +2,5 @@
   AsmReadCr0 function
 
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -19,5 +19,5 @@
   Reads the current value of the Control Register 0 (CR0).
 
-  Reads and returns the current value of CR4. This function is only available
+  Reads and returns the current value of CR0. This function is only available
   on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on
   x64.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/Thunk16.S
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/Thunk16.S	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/Thunk16.S	(revision 58459)
@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
 #
-# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD License
@@ -25,4 +25,26 @@
 ASM_GLOBAL ASM_PFX(InternalAsmThunk16)
 
+# define the structure of IA32_REGS
+.set  _EDI, 0       #size 4
+.set  _ESI, 4       #size 4
+.set  _EBP, 8       #size 4
+.set  _ESP, 12      #size 4
+.set  _EBX, 16      #size 4
+.set  _EDX, 20      #size 4
+.set  _ECX, 24      #size 4
+.set  _EAX, 28      #size 4
+.set  _DS,  32      #size 2
+.set  _ES,  34      #size 2
+.set  _FS,  36      #size 2
+.set  _GS,  38      #size 2
+.set  _EFLAGS, 40   #size 4
+.set  _EIP, 44      #size 4
+.set  _CS, 48       #size 2
+.set  _SS, 50       #size 2
+.set  IA32_REGS_SIZE, 52
+
+    .text
+    .code16
+
 ASM_PFX(m16Start):
 
@@ -32,8 +54,8 @@
     push    %ss
     push    %cs
-    .byte   0x66
-    call    L_Base1                     # push eip
+
+    calll   L_Base1                     # push eip
 L_Base1:
-    pushfw                              # pushfd actually
+    pushfl
     cli                                 # disable interrupts
     push    %gs
@@ -41,10 +63,11 @@
     push    %es
     push    %ds
-    pushaw                              # pushad actually
+    pushal
     .byte   0x66, 0xba                  # mov edx, imm32
 ASM_PFX(ThunkAttr): .space  4
     testb   $THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15, %dl
     jz      1f
-    movl    $0x15cd2401, %eax           # mov ax, 2401h & int 15h
+    movw    $0x2401, %ax
+    int     $0x15
     cli                                 # disable interrupts
     jnc     2f
@@ -56,16 +79,16 @@
     outb    %al, $0x92                  # deactivate A20M#
 2:
-    xorw    %ax, %ax                    # xor eax, eax
-    movl    %ss, %eax                   # mov ax, ss
-    .byte   0x67, 0x66, 0x8d, 0x6c, 0x24, 0x34, 0x66
-    mov     %ebp, 0xffffffd8(%esi)
-    mov     0xfffffff8(%esi), %ebx
-    shlw    $4, %ax                     # shl eax, 4
-    addw    %ax, %bp                    # add ebp, eax
-    .byte   0x66, 0xb8                   # mov eax, imm32
+    xorl    %eax, %eax
+    movw    %ss, %ax
+    leal    IA32_REGS_SIZE(%esp), %ebp
+    mov     %ebp, (_ESP - IA32_REGS_SIZE)(%bp)
+    mov     (_EIP - IA32_REGS_SIZE)(%bp), %bx
+    shll    $4, %eax
+    addl    %eax, %ebp
+    .byte   0x66, 0xb8                  # mov eax, imm32
 SavedCr4:   .space  4
     movl    %eax, %cr4
-    lgdtw   %cs:0xfffffff2(%edi)
-    .byte   0x66, 0xb8                   # mov eax, imm32
+    lgdtl   %cs:(SavedGdt - L_Base1)(%bx)
+    .byte   0x66, 0xb8                  # mov eax, imm32
 SavedCr0:   .space  4
     movl    %eax, %cr0
@@ -73,8 +96,7 @@
 SavedSs:    .space  2
     movl    %eax, %ss
-    .byte   0x66, 0xbc                   # mov esp, imm32
+    .byte   0x66, 0xbc                  # mov esp, imm32
 SavedEsp:   .space  4
-    .byte   0x66
-    lret                                # return to protected mode
+    lretl                               # return to protected mode
 
 _EntryPoint:    .long      ASM_PFX(ToUserCode) - ASM_PFX(m16Start)
@@ -86,35 +108,29 @@
 
 ASM_PFX(ToUserCode):
-    movl    %ss, %edx
-    movl    %ecx, %ss                   # set new segment selectors
-    movl    %ecx, %ds
-    movl    %ecx, %es
-    movl    %ecx, %fs
-    movl    %ecx, %gs
-    movl    %eax, %cr0
-    movl    %ebp, %cr4                  # real mode starts at next instruction
-    movl    %esi, %ss                   # set up 16-bit stack segment
-    xchgw   %bx, %sp                    # set up 16-bit stack pointer
-    .byte   0x66
-    call    L_Base                      # push eip
-L_Base:
-    popw    %bp                         # ebp <- offset L_Base
-    .byte   0x67;                       # address size override
-    push    54(%esp)
-    lea     0xc(%esi), %eax
-    push    %eax
-    lret
-
-L_RealMode:
-    mov     %edx, %cs:0xffffffc5(%esi)
-    mov     %bx, %cs:0xffffffcb(%esi)
-    lidtw   %cs:0xffffffd7(%esi)
-    popaw                               # popad actually
+    movw    %ss, %dx
+    movw    %cx, %ss                    # set new segment selectors
+    movw    %cx, %ds
+    movw    %cx, %es
+    movw    %cx, %fs
+    movw    %cx, %gs
+    movl    %eax, %cr0                  # real mode starts at next instruction
+                                        #  which (per SDM) *must* be a far JMP.
+    ljmpw   $0,$0                       # will be filled in by InternalAsmThunk16
+L_Base:                                 #  to point here.
+    movl    %ebp, %cr4
+    movw    %si, %ss                    # set up 16-bit stack segment
+    xchgl   %ebx, %esp                  # set up 16-bit stack pointer
+
+    movw    IA32_REGS_SIZE(%esp), %bp   # get BackToUserCode address from stack
+    mov     %dx, %cs:(SavedSs - ASM_PFX(BackFromUserCode))(%bp)
+    mov     %ebx, %cs:(SavedEsp - ASM_PFX(BackFromUserCode))(%bp)
+    lidtl   %cs:(_16Idtr - ASM_PFX(BackFromUserCode))(%bp)
+    popal
     pop     %ds
     pop     %es
     pop     %fs
     pop     %gs
-    popfw                               # popfd
-    lretw                               # transfer control to user code
+    popfl
+    lretl                               # transfer control to user code
 
 _NullSegDesc:   .quad   0
@@ -135,4 +151,5 @@
 GdtEnd:
 
+    .code32
 #
 #   @param  RegSet  The pointer to a IA32_DWORD_REGS structure
@@ -150,10 +167,10 @@
     push    %gs
     movl    36(%esp), %esi              # esi <- RegSet
-    movzwl  0x32(%esi), %edx
-    mov     0xc(%esi), %edi
-    add     $0xffffffc8, %edi
+    movzwl  _SS(%esi), %edx
+    mov     _ESP(%esi), %edi
+    add     $(-(IA32_REGS_SIZE + 4)), %edi
     movl    %edi, %ebx                  # ebx <- stack offset
     imul    $0x10, %edx, %eax
-    push    $0xd
+    push    $(IA32_REGS_SIZE / 4)
     addl    %eax, %edi                  # edi <- linear address of 16-bit stack
     pop     %ecx
@@ -162,12 +179,14 @@
     movl    40(%esp), %eax              # eax <- address of transition code
     movl    %edx, %esi                  # esi <- 16-bit stack segment
-    lea     0x61(%eax), %edx
+    lea     (SavedCr0 - ASM_PFX(m16Start))(%eax), %edx
     movl    %eax, %ecx
     andl    $0xf, %ecx
     shll    $12, %eax
-    lea     0x6(%ecx), %ecx
+    lea     (ASM_PFX(BackFromUserCode) - ASM_PFX(m16Start))(%ecx), %ecx
     movw    %cx, %ax
     stosl                               # [edi] <- return address of user code
-    sgdtl   0xffffff9f(%edx)
+    addl    $(L_Base - ASM_PFX(BackFromUserCode)), %eax
+    movl    %eax, (L_Base - SavedCr0 - 4)(%edx)
+    sgdtl   (SavedGdt - SavedCr0)(%edx)
     sidtl   0x24(%esp)
     movl    %cr0, %eax
@@ -175,14 +194,14 @@
     andl    $0x7ffffffe, %eax           # clear PE, PG bits
     movl    %cr4, %ebp
-    mov     %ebp, 0xfffffff1(%edx)
-    andl    $0x300, %ebp                # clear all but PCE and OSFXSR bits
+    mov     %ebp, (SavedCr4 - SavedCr0)(%edx)
+    andl    $0xffffffcf, %ebp           # clear PAE, PSE bits
     pushl   $0x10
     pop     %ecx                        # ecx <- selector for data segments
-    lgdtl   0x20(%edx)
+    lgdtl   (_16Gdtr - SavedCr0)(%edx)
     pushfl
-    lcall   *0x14(%edx)
+    lcall   *(_EntryPoint - SavedCr0)(%edx)
     popfl
     lidtl   0x24(%esp)
-    lea     0xffffffcc(%ebp), %eax
+    lea     -IA32_REGS_SIZE(%ebp), %eax
     pop     %gs
     pop     %fs
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/Thunk16.asm
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/Thunk16.asm	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/Ia32/Thunk16.asm	(revision 58459)
@@ -4,5 +4,5 @@
 ;------------------------------------------------------------------------------
 ;
-; Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
 ; This program and the accompanying materials
 ; are licensed and made available under the terms and conditions of the BSD License
@@ -158,22 +158,28 @@
     mov     fs, ecx
     mov     gs, ecx
-    mov     cr0, eax
-    mov     cr4, ebp                    ; real mode starts at next instruction
+    mov     cr0, eax                    ; real mode starts at next instruction
+                                        ;  which (per SDM) *must* be a far JMP.
+    DB      0eah
+_RealAddr DW 0,0                       ; filled in by InternalAsmThunk16
+
+    mov     cr4, ebp
     mov     ss, esi                     ; set up 16-bit stack segment
     xchg    sp, bx                      ; set up 16-bit stack pointer
-    DB      66h
-    call    @Base                       ; push eip
-@Base:
-    pop     bp                          ; ebp <- address of @Base
-    DB      67h                         ; address size override
-    push    [esp + sizeof (IA32_REGS) + 2]
-    lea     eax, [esi + (@RealMode - @Base)]
-    push    eax
-    retf
-@RealMode:
-    mov     cs:[esi + (SavedSs - @Base)], edx
-    mov     cs:[esi + (SavedEsp - @Base)], bx
-    DB      66h
-    lidt    fword ptr cs:[esi + (_16Idtr - @Base)]
+
+;   mov     bp, [esp + sizeof(IA32_REGS)
+    DB      67h
+    mov     ebp, [esp + sizeof(IA32_REGS)] ; BackFromUserCode address from stack
+
+;   mov     cs:[bp + (SavedSs - _BackFromUserCode)], dx
+    mov     cs:[esi + (SavedSs - _BackFromUserCode)], edx
+
+;   mov     cs:[bp + (SavedEsp - _BackFromUserCode)], ebx
+    DB      2eh, 66h, 89h, 9eh
+    DW      SavedEsp - _BackFromUserCode
+
+;   lidt    cs:[bp + (_16Idtr - _BackFromUserCode)]
+    DB      2eh, 66h, 0fh, 01h, 9eh
+    DW      _16Idtr - _BackFromUserCode
+
     popaw                               ; popad actually
     pop     ds
@@ -231,4 +237,6 @@
     mov     ax, cx
     stosd                               ; [edi] <- return address of user code
+    add     eax, _RealAddr + 4 - _BackFromUserCode
+    mov     dword ptr [edx + (_RealAddr - SavedCr0)], eax
     sgdt    fword ptr [edx + (SavedGdt - SavedCr0)]
     sidt    fword ptr [esp + 36]        ; save IDT stack in argument space
@@ -238,5 +246,5 @@
     mov     ebp, cr4
     mov     [edx + (SavedCr4 - SavedCr0)], ebp
-    and     ebp, 300h                   ; clear all but PCE and OSFXSR bits
+    and     ebp, NOT 30h                ; clear PAE, PSE bits
     push    10h
     pop     ecx                         ; ecx <- selector for data segments
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/LinkedList.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/LinkedList.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/LinkedList.c	(revision 58459)
@@ -2,5 +2,5 @@
   Linked List Library Functions.
 
-  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -27,6 +27,6 @@
   If PcdVerifyNodeInList is TRUE and DoMembershipCheck is TRUE and Node 
   is in not a member of List, then return FALSE
-  If PcdMaximumLinkedListLenth is not zero, and List contains more than
-  PcdMaximumLinkedListLenth nodes, then ASSERT().
+  If PcdMaximumLinkedListLength is not zero, and List contains more than
+  PcdMaximumLinkedListLength nodes, then ASSERT().
 
   @param  List              A pointer to a node in a linked list.
@@ -154,5 +154,5 @@
   If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
   InitializeListHead(), then ASSERT().
-  If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number
+  If PcdMaximumLinkedListLength is not zero, and prior to insertion the number
   of nodes in ListHead, including the ListHead node, is greater than or
   equal to PcdMaximumLinkedListLength, then ASSERT().
@@ -195,5 +195,5 @@
   If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or 
   InitializeListHead(), then ASSERT().
-  If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number
+  If PcdMaximumLinkedListLength is not zero, and prior to insertion the number
   of nodes in ListHead, including the ListHead node, is greater than or
   equal to PcdMaximumLinkedListLength, then ASSERT().
@@ -235,5 +235,5 @@
   If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or 
   InitializeListHead(), then ASSERT().
-  If PcdMaximumLinkedListLenth is not zero, and the number of nodes
+  If PcdMaximumLinkedListLength is not zero, and the number of nodes
   in List, including the List node, is greater than or equal to
   PcdMaximumLinkedListLength, then ASSERT().
@@ -242,5 +242,5 @@
 
   @return The first node of a doubly-linked list.
-  @retval NULL  The list is empty.
+  @retval List  The list is empty.
 
 **/
@@ -270,6 +270,6 @@
   If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or 
   InitializeListHead(), then ASSERT().
-  If PcdMaximumLinkedListLenth is not zero, and List contains more than
-  PcdMaximumLinkedListLenth nodes, then ASSERT().
+  If PcdMaximumLinkedListLength is not zero, and List contains more than
+  PcdMaximumLinkedListLength nodes, then ASSERT().
   If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().
 
@@ -306,6 +306,6 @@
   If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or 
   InitializeListHead(), then ASSERT().
-  If PcdMaximumLinkedListLenth is not zero, and List contains more than
-  PcdMaximumLinkedListLenth nodes, then ASSERT().
+  If PcdMaximumLinkedListLength is not zero, and List contains more than
+  PcdMaximumLinkedListLength nodes, then ASSERT().
   If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().
  
@@ -340,5 +340,5 @@
   If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or 
   InitializeListHead(), then ASSERT().
-  If PcdMaximumLinkedListLenth is not zero, and the number of nodes
+  If PcdMaximumLinkedListLength is not zero, and the number of nodes
   in List, including the List node, is greater than or equal to
   PcdMaximumLinkedListLength, then ASSERT().
@@ -377,5 +377,5 @@
   If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(), 
   then ASSERT().
-  If PcdMaximumLinkedListLenth is not zero, and the number of nodes
+  If PcdMaximumLinkedListLength is not zero, and the number of nodes
   in List, including the List node, is greater than or equal to
   PcdMaximumLinkedListLength, then ASSERT().
@@ -416,5 +416,5 @@
   If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or
   InitializeListHead(), then ASSERT().
-  If PcdMaximumLinkedListLenth is not zero, and the number of nodes
+  If PcdMaximumLinkedListLength is not zero, and the number of nodes
   in List, including the List node, is greater than or equal to
   PcdMaximumLinkedListLength, then ASSERT().
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/String.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/String.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/String.c	(revision 58459)
@@ -2,5 +2,5 @@
   Unicode and ASCII string primatives.
 
-  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -15,6 +15,9 @@
 #include "BaseLibInternals.h"
 
-
-/**
+#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
+
+/**
+  [ATTENTION] This function will be deprecated for security reason.
+
   Copies one Null-terminated Unicode string to another Null-terminated Unicode
   string and returns the new Unicode string.
@@ -69,4 +72,6 @@
 
 /**
+  [ATTENTION] This function will be deprecated for security reason.
+
   Copies up to a specified length from one Null-terminated Unicode string  to 
   another Null-terminated Unicode string and returns the new Unicode string.
@@ -138,4 +143,5 @@
   return ReturnValue;
 }
+#endif
 
 /**
@@ -320,5 +326,9 @@
 }
 
-/**
+#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
+
+/**
+  [ATTENTION] This function will be deprecated for security reason.
+
   Concatenates one Null-terminated Unicode string to another Null-terminated
   Unicode string, and returns the concatenated Unicode string.
@@ -370,4 +380,6 @@
 
 /**
+  [ATTENTION] This function will be deprecated for security reason.
+
   Concatenates up to a specified length one Null-terminated Unicode to the end 
   of another Null-terminated Unicode string, and returns the concatenated 
@@ -428,4 +440,5 @@
   return Destination;
 }
+#endif
 
 /**
@@ -1041,5 +1054,5 @@
   // Source and Destination should not overlap
   //
-  ASSERT ((UINTN) ((CHAR16 *) Destination -  Source) > StrLen (Source));
+  ASSERT ((UINTN) (Destination - (CHAR8 *) Source) >= StrSize (Source));
   ASSERT ((UINTN) ((CHAR8 *) Source - Destination) > StrLen (Source));
 
@@ -1066,6 +1079,9 @@
 }
 
-
-/**
+#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
+
+/**
+  [ATTENTION] This function will be deprecated for security reason.
+
   Copies one Null-terminated ASCII string to another Null-terminated ASCII
   string and returns the new ASCII string.
@@ -1117,4 +1133,6 @@
 
 /**
+  [ATTENTION] This function will be deprecated for security reason.
+
   Copies up to a specified length one Null-terminated ASCII string to another 
   Null-terminated ASCII string and returns the new ASCII string.
@@ -1182,4 +1200,5 @@
   return ReturnValue;
 }
+#endif
 
 /**
@@ -1463,5 +1482,9 @@
 }
 
-/**
+#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
+
+/**
+  [ATTENTION] This function will be deprecated for security reason.
+
   Concatenates one Null-terminated ASCII string to another Null-terminated
   ASCII string, and returns the concatenated ASCII string.
@@ -1508,4 +1531,6 @@
 
 /**
+  [ATTENTION] This function will be deprecated for security reason.
+
   Concatenates up to a specified length one Null-terminated ASCII string to 
   the end of another Null-terminated ASCII string, and returns the 
@@ -1564,4 +1589,5 @@
   return Destination;
 }
+#endif
 
 /**
@@ -2009,7 +2035,7 @@
   //
   ASSERT ((UINTN) ((CHAR8 *) Destination - Source) > AsciiStrLen (Source));
-  ASSERT ((UINTN) (Source - (CHAR8 *) Destination) > (AsciiStrLen (Source) * sizeof (CHAR16)));
-
- 
+  ASSERT ((UINTN) (Source - (CHAR8 *) Destination) >= (AsciiStrSize (Source) * sizeof (CHAR16)));
+
+
   ReturnValue = Destination;
   while (*Source != '\0') {
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/X64/Thunk16.S
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/X64/Thunk16.S	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/X64/Thunk16.S	(revision 58459)
@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
 #
-# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD License
@@ -147,6 +147,6 @@
 L_64BitCode:
     .byte   0x90
-    .byte   0x67,0xbc                  # mov esp, imm32
-L_SavedSp:  .space      4              # restore stack
+    .byte   0x48,0xbc                  # mov rsp, imm64
+L_SavedSp:  .space      8              # restore stack
     nop
     ret
@@ -296,5 +296,5 @@
     movq    %cr4, %rbp
     movl    %ebp, (%rcx)                # save CR4 in SavedCr4
-    andl    $0x300,%ebp                 # clear all but PCE and OSFXSR bits
+    andl    $0xffffffcf,%ebp            # clear PAE, PSE bits
     movl    %r8d, %esi                  # esi <- 16-bit stack segment
     .byte      0x6a, DATA32
@@ -308,5 +308,5 @@
     movl    %cs, %r8d
     movw    %r8w, (L_SavedCs - L_SavedCr4)(%rcx)
-    movl    %esp, (L_SavedSp - L_SavedCr4)(%rcx)
+    movq    %rsp, (L_SavedSp - L_SavedCr4)(%rcx)
     .byte   0xff, 0x69                  #  jmp (_EntryPoint - L_SavedCr4)(%rcx)
     .set    Ltemp1, _EntryPoint - L_SavedCr4
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/X64/Thunk16.asm
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/X64/Thunk16.asm	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/X64/Thunk16.asm	(revision 58459)
@@ -4,5 +4,5 @@
 ;------------------------------------------------------------------------------
 ;
-; Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
 ; This program and the accompanying materials
 ; are licensed and made available under the terms and conditions of the BSD License
@@ -143,6 +143,6 @@
 @64BitCode:
     db      090h 
-    db      067h, 0bch                 ; mov esp, imm32
-SavedSp     DD   ?                     ; restore stack
+    db      048h, 0bch                 ; mov rsp, imm64
+SavedSp     DQ   ?                     ; restore stack
     nop
     ret
@@ -283,5 +283,5 @@
     mov     rbp, cr4
     mov     [rcx], ebp                  ; save CR4 in SavedCr4
-    and     ebp, 300h                   ; clear all but PCE and OSFXSR bits
+    and     ebp, NOT 30h                ; clear PAE, PSE bits
     mov     esi, r8d                    ; esi <- 16-bit stack segment
     DB      6ah, DATA32                 ; push DATA32
@@ -295,5 +295,5 @@
     mov     r8d, cs
     mov     [rcx + (SavedCs - SavedCr4)], r8w
-    mov     [rcx + (SavedSp - SavedCr4)], esp
+    mov     [rcx + (SavedSp - SavedCr4)], rsp
     jmp     fword ptr [rcx + (_EntryPoint - SavedCr4)]
 @RetFromRealMode:
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/X86FxRestore.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/X86FxRestore.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/X86FxRestore.c	(revision 58459)
@@ -2,5 +2,5 @@
   IA-32/x64 AsmFxRestore()
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -44,5 +44,5 @@
   // Check the flag recorded by AsmFxSave()
   //
-  ASSERT (0xAA5555AA == *(UINT32 *) (&Buffer[sizeof (IA32_FX_BUFFER) - 4]));
+  ASSERT (0xAA5555AA == *(UINT32 *) (&Buffer->Buffer[sizeof (Buffer->Buffer) - 4]));
 
   InternalX86FxRestore (Buffer);
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/X86FxSave.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/X86FxSave.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/X86FxSave.c	(revision 58459)
@@ -2,5 +2,5 @@
   IA-32/x64 AsmFxSave()
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -45,4 +45,4 @@
   // Mark one flag at end of Buffer, it will be check by AsmFxRestor()
   //
-  *(UINT32 *) (&Buffer[sizeof (IA32_FX_BUFFER) - 4]) = 0xAA5555AA;
+  *(UINT32 *) (&Buffer->Buffer[sizeof (Buffer->Buffer) - 4]) = 0xAA5555AA;
 }
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/X86Msr.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/X86Msr.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/X86Msr.c	(revision 58459)
@@ -2,5 +2,5 @@
   IA-32/x64 MSR functions.
 
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -204,4 +204,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Index     The 32-bit MSR index to write.
@@ -244,4 +245,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Index     The 32-bit MSR index to write.
@@ -284,4 +286,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Index     The 32-bit MSR index to write.
@@ -326,4 +329,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Index     The 32-bit MSR index to write.
@@ -492,4 +497,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Index     The 32-bit MSR index to write.
@@ -533,4 +539,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Index     The 32-bit MSR index to write.
@@ -574,4 +581,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Index     The 32-bit MSR index to write.
@@ -616,4 +624,6 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Index     The 32-bit MSR index to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/X86Thunk.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/X86Thunk.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/X86Thunk.c	(revision 58459)
@@ -2,5 +2,5 @@
   Real Mode Thunk Functions for IA32 and x64.
 
-  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -100,5 +100,5 @@
 EFIAPI
 AsmPrepareThunk16 (
-  OUT     THUNK_CONTEXT             *ThunkContext
+  IN OUT  THUNK_CONTEXT             *ThunkContext
   )
 {
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf	(revision 58459)
@@ -4,5 +4,5 @@
 #  Base Memory Library implementation - no ASM.
 #
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -19,4 +19,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BaseMemoryLib
+  MODULE_UNI_FILE                = BaseMemoryLib.uni
   FILE_GUID                      = fd44e603-002a-4b29-9f5f-529e815b6165
   MODULE_TYPE                    = BASE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf	(revision 58459)
@@ -5,5 +5,5 @@
 #  Optimized for use in DXE.
 #
-#  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BaseMemoryLibMmx
+  MODULE_UNI_FILE                = BaseMemoryLibMmx.uni
   FILE_GUID                      = d458a654-f64c-49db-b8d1-3821306bf1f6
   MODULE_TYPE                    = BASE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.S
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.S	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.S	(revision 58459)
@@ -44,5 +44,5 @@
     shrl    $3, %ecx                    # # of Qwords to set
     jz      L1
-    addl    $0x-10, %esp
+    addl    $-16, %esp
     movq    %mm0, (%esp)                # save mm0
     movq    %mm1, 8(%esp)               # save mm1
@@ -54,5 +54,5 @@
     movq    %mm0, (%edi)
     addl    $8, %edi
-    loopl   L0
+    loop    L0
     movq    (%esp), %mm0                # restore mm0
     movq    8(%esp), %mm1               # restore mm1
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem16.S
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem16.S	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem16.S	(revision 58459)
@@ -50,5 +50,5 @@
     movq    %mm0, (%edi)
     addl    $8, %edi
-    loopl   L0
+    loop    L0
 L1:
     movl    %edx, %ecx
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem32.S
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem32.S	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem32.S	(revision 58459)
@@ -45,5 +45,5 @@
     movq    %mm0, (%edx)
     lea     8(%edx), %edx
-    loopl   L0
+    loop    L0
 L1:
     jnc     L2
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem64.S
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem64.S	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem64.S	(revision 58459)
@@ -40,4 +40,4 @@
     movq    %mm0, (%edx)
     lea     8(%edx), %edx
-    loopl   L0
+    loop    L0
     ret
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.S
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.S	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.S	(revision 58459)
@@ -37,5 +37,5 @@
 ASM_PFX(InternalMemSetMem64):
     movd      %r8, %mm0                 #Value
-    movw      %rcx, %rax                #rax <- Buffer
+    movq      %rcx, %rax                #rax <- Buffer
     xchg      %rdx, %rcx                #rcx <- Count
 L0:
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf	(revision 58459)
@@ -5,5 +5,5 @@
 #  Uses REP, MMX, XMM registers as required for best performance.
 #
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BaseMemoryLibOptDxe
+  MODULE_UNI_FILE                = BaseMemoryLibOptDxe.uni
   FILE_GUID                      = 02BD55C2-AB1D-4b75-B0FD-9A63AE09B31D
   MODULE_TYPE                    = BASE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf	(revision 58459)
@@ -5,5 +5,5 @@
 #  Uses REP, MMX, XMM registers as required for best performance.
 #
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BaseMemoryLibOptPei
+  MODULE_UNI_FILE                = BaseMemoryLibOptPei.uni
   FILE_GUID                      = D6F43B1B-0F21-462b-B8B7-A033C3EB4261
   MODULE_TYPE                    = BASE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem64.S
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem64.S	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem64.S	(revision 58459)
@@ -41,5 +41,5 @@
     xchgq   %rdx, %rcx
     rep     stosq
-    movw    %rdx, %rax
+    movq    %rdx, %rax
     popq    %rdi
     ret
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf	(revision 58459)
@@ -5,5 +5,5 @@
 #  high performance and small size. Optimized for use in PEI.
 #
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BaseMemoryLibRepStr
+  MODULE_UNI_FILE                = BaseMemoryLibRepStr.uni
   FILE_GUID                      = e7884bf4-51a1-485b-982a-ff89129983bc
   MODULE_TYPE                    = BASE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.S
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.S	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.S	(revision 58459)
@@ -22,5 +22,5 @@
 #------------------------------------------------------------------------------
 
-    .386:
+
     .code:
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf	(revision 58459)
@@ -1,9 +1,8 @@
 ## @file
-#  Instance of Base Memory Library using XMM registers.
+#  Instance of Base Memory Library using SSE2 registers.
 #
-#  Base Memory Library that uses XMM registers for high performance.
-#  Optimized for use in DXE.
+#  Base Memory Library that uses SSE2 registers for high performance.
 #
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +19,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BaseMemoryLibSse2
+  MODULE_UNI_FILE                = BaseMemoryLibSse2.uni
   FILE_GUID                      = 65a18235-5096-4032-8c63-214f0249ce8d
   MODULE_TYPE                    = BASE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem.S
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem.S	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem.S	(revision 58459)
@@ -22,5 +22,5 @@
 #------------------------------------------------------------------------------
 
-    .686:
+
     #.MODEL flat,C
     .xmm:
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePalLibNull/BasePalLibNull.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePalLibNull/BasePalLibNull.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePalLibNull/BasePalLibNull.inf	(revision 58459)
@@ -2,5 +2,5 @@
 #  Null instance of PAL Library with empty functions.
 #
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -17,4 +17,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BasePalLibNull
+  MODULE_UNI_FILE                = BasePalLibNull.uni
   FILE_GUID                      = 632D5625-B73D-43b8-AF30-8D225D96168E
   MODULE_TYPE                    = BASE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf	(revision 58459)
@@ -5,5 +5,5 @@
 #  and Binary Patch typed PCD entries. Access to Dynamic PCD entries is ignored.
 #
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BasePcdLibNull
+  MODULE_UNI_FILE                = BasePcdLibNull.uni
   FILE_GUID                      = 40096a3a-5c2a-4fbc-aef7-5475dd7ab334
   MODULE_TYPE                    = BASE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePcdLibNull/PcdLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePcdLibNull/PcdLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePcdLibNull/PcdLib.c	(revision 58459)
@@ -2,5 +2,5 @@
   A emptry template implementation of PCD Library.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -401,5 +401,7 @@
   Sets the 8-bit value for the token specified by TokenNumber 
   to the value specified by Value.  Value is returned.
-  
+
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  TokenNumber   The PCD token number to set a current value for.
   @param[in]  Value         The 8-bit value to set.
@@ -427,5 +429,7 @@
   Sets the 16-bit value for the token specified by TokenNumber 
   to the value specified by Value.  Value is returned.
-  
+
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  TokenNumber   The PCD token number to set a current value for.
   @param[in]  Value         The 16-bit value to set.
@@ -453,5 +457,7 @@
   Sets the 32-bit value for the token specified by TokenNumber 
   to the value specified by Value.  Value is returned.
-  
+
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  TokenNumber   The PCD token number to set a current value for.
   @param[in]  Value         The 32-bit value to set.
@@ -479,5 +485,7 @@
   Sets the 64-bit value for the token specified by TokenNumber 
   to the value specified by Value.  Value is returned.
-  
+
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  TokenNumber   The PCD token number to set a current value for.
   @param[in]  Value         The 64-bit value to set.
@@ -507,5 +515,6 @@
   If SizeOfBuffer is greater than the maximum size support by TokenNumber, 
   then set SizeOfBuffer to the maximum size supported by TokenNumber and 
-  return NULL to indicate that the set operation was not actually performed.  
+  return NULL to indicate that the set operation was not actually performed,
+  or ASSERT() if the set operation was not corretly performed.
 
   If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the 
@@ -542,5 +551,7 @@
   Sets the Boolean value for the token specified by TokenNumber 
   to the value specified by Value.  Value is returned.
-  
+
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  TokenNumber   The PCD token number to set a current value for.
   @param[in]  Value         The boolean value to set.
@@ -568,7 +579,8 @@
   Sets the 8-bit value for the token specified by TokenNumber and 
   Guid to the value specified by Value. Value is returned.
-  
+
   If Guid is NULL, then ASSERT().
-  
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  Guid          The pointer to a 128-bit unique value that 
                             designates which namespace to set a value from.
@@ -599,7 +611,8 @@
   Sets the 16-bit value for the token specified by TokenNumber and 
   Guid to the value specified by Value. Value is returned.
-  
+
   If Guid is NULL, then ASSERT().
-  
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  Guid          The pointer to a 128-bit unique value that 
                             designates which namespace to set a value from.
@@ -630,7 +643,8 @@
   Sets the 32-bit value for the token specified by TokenNumber and 
   Guid to the value specified by Value. Value is returned.
-  
+
   If Guid is NULL, then ASSERT().
-  
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  Guid          The pointer to a 128-bit unique value that 
                             designates which namespace to set a value from.
@@ -661,6 +675,8 @@
   Sets the 64-bit value for the token specified by TokenNumber and 
   Guid to the value specified by Value. Value is returned.
+
   If Guid is NULL, then ASSERT().
-  
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  Guid          The pointer to a 128-bit unique value that 
                             designates which namespace to set a value from.
@@ -693,5 +709,5 @@
   the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size 
   supported by TokenNumber and return NULL to indicate that the set operation 
-  was not actually performed. 
+  was not actually performed, or ASSERT() if the set operation was not corretly performed.
   
   If Guid is NULL, then ASSERT().
@@ -729,7 +745,8 @@
   Sets the Boolean value for the token specified by TokenNumber and 
   Guid to the value specified by Value. Value is returned.
-  
+
   If Guid is NULL, then ASSERT().
-  
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  Guid          The pointer to a 128-bit unique value that 
                             designates which namespace to set a value from.
@@ -920,2 +937,68 @@
 }
 
+/**
+  Retrieve additional information associated with a PCD token.
+
+  This includes information such as the type of value the TokenNumber is associated with as well as possible
+  human readable name that is associated with the token.
+
+  If TokenNumber is not in the default token space specified, then ASSERT().
+
+  @param[in]    TokenNumber The PCD token number.
+  @param[out]   PcdInfo     The returned information associated with the requested TokenNumber.
+                            The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
+**/
+VOID
+EFIAPI
+LibPcdGetInfo (
+  IN        UINTN           TokenNumber,
+  OUT       PCD_INFO        *PcdInfo
+  )
+{
+  ASSERT (FALSE);
+}
+
+/**
+  Retrieve additional information associated with a PCD token.
+
+  This includes information such as the type of value the TokenNumber is associated with as well as possible
+  human readable name that is associated with the token.
+
+  If TokenNumber is not in the token space specified by Guid, then ASSERT().
+
+  @param[in]    Guid        The 128-bit unique value that designates the namespace from which to extract the value.
+  @param[in]    TokenNumber The PCD token number.
+  @param[out]   PcdInfo     The returned information associated with the requested TokenNumber.
+                            The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
+**/
+VOID
+EFIAPI
+LibPcdGetInfoEx (
+  IN CONST  GUID            *Guid,
+  IN        UINTN           TokenNumber,
+  OUT       PCD_INFO        *PcdInfo
+  )
+{
+  ASSERT (FALSE);
+}
+
+/**
+  Retrieve the currently set SKU Id.
+
+  If the sku id got >= PCD_MAX_SKU_ID, then ASSERT().
+
+  @return   The currently set SKU Id. If the platform has not set at a SKU Id, then the
+            default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU
+            Id is returned.
+**/
+UINTN
+EFIAPI
+LibPcdGetSku (
+  VOID
+  )
+{
+  ASSERT (FALSE);
+
+  return 0;
+}
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf	(revision 58459)
@@ -5,5 +5,5 @@
 #  Layers on top of an I/O Library instance.
 #
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BasePciCf8Lib
+  MODULE_UNI_FILE                = BasePciCf8Lib.uni
   FILE_GUID                      = 472ab06d-9810-4c00-bb7f-dad1828fc1ab
   MODULE_TYPE                    = BASE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePciCf8Lib/PciCf8Lib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePciCf8Lib/PciCf8Lib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePciCf8Lib/PciCf8Lib.c	(revision 58459)
@@ -3,5 +3,5 @@
   Layers on top of an I/O Library instance.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -370,4 +370,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -425,4 +426,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -480,4 +482,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -537,4 +540,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -863,4 +868,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -919,4 +925,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -975,4 +982,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1033,4 +1041,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1359,4 +1369,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1415,4 +1426,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1471,4 +1483,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1529,4 +1542,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf	(revision 58459)
@@ -5,5 +5,5 @@
 #  PCI Configuration cycles. Layers on top of an I/O Library instance.
 #
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BasePciExpressLib
+  MODULE_UNI_FILE                = BasePciExpressLib.uni
   FILE_GUID                      = 287e50f4-a188-4699-b907-3e4080ca5688
   MODULE_TYPE                    = BASE
@@ -42,4 +43,4 @@
 
 [Pcd]
-  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
+  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress  ## CONSUMES
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePciExpressLib/PciExpressLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePciExpressLib/PciExpressLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePciExpressLib/PciExpressLib.c	(revision 58459)
@@ -6,5 +6,5 @@
   Library.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -287,4 +287,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -331,4 +332,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -375,4 +377,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -421,4 +424,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -661,4 +666,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -706,4 +712,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -751,4 +758,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -798,4 +806,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1038,4 +1048,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1083,4 +1094,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1128,4 +1140,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1175,4 +1188,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf	(revision 58459)
@@ -5,5 +5,5 @@
 #  PCI Configuration cycles. Layers on top of one PCI CF8 Library instance.
 #
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BasePciLibCf8
+  MODULE_UNI_FILE                = BasePciLibCf8.uni
   FILE_GUID                      = 28bde99c-e8a7-4e3e-9a8a-e66cd64f31c6
   MODULE_TYPE                    = BASE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePciLibCf8/PciLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePciLibCf8/PciLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePciLibCf8/PciLib.c	(revision 58459)
@@ -3,5 +3,5 @@
   PCI Configuration cycles. Layers on top of one PCI CF8 Library instance.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -237,4 +237,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -275,4 +276,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -313,4 +315,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -353,4 +356,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -572,4 +577,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -611,4 +617,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -650,4 +657,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -691,4 +699,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -910,4 +920,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -949,4 +960,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -988,4 +1000,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1029,4 +1042,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf	(revision 58459)
@@ -5,5 +5,5 @@
 #  Configuration cycles. Layers on one PCI Express Library instance.
 #
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BasePciLibPciExpress
+  MODULE_UNI_FILE                = BasePciLibPciExpress.uni
   FILE_GUID                      = 8987081e-daeb-44a9-8bef-a195b22d9417
   MODULE_TYPE                    = BASE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePciLibPciExpress/PciLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePciLibPciExpress/PciLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePciLibPciExpress/PciLib.c	(revision 58459)
@@ -3,5 +3,5 @@
   Configuration cycles. Layers on PCI Express Library.
 
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -237,4 +237,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -275,4 +276,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -313,4 +315,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -353,4 +356,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -572,4 +577,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -611,4 +617,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -650,4 +657,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -691,4 +699,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -910,4 +920,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -949,4 +960,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -988,4 +1000,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1029,4 +1042,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf	(revision 58459)
@@ -2,5 +2,5 @@
 #  Null PE/Coff Extra Action library instances with empty functions.
 #
-#  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -17,4 +17,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = PeCoffExtraActionLibNull
+  MODULE_UNI_FILE                = PeCoffExtraActionLibNull.uni
   FILE_GUID                      = 0EB84DA1-267A-40b4-8347-1F48694C8B47
   MODULE_TYPE                    = BASE
@@ -36,3 +37,2 @@
   DebugLib
 
-
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf	(revision 58459)
@@ -2,5 +2,5 @@
 #  PE/COFF Entry Point Library implementation.
 #
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -17,4 +17,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BasePeCoffGetEntryPointLib
+  MODULE_UNI_FILE                = BasePeCoffGetEntryPointLib.uni
   FILE_GUID                      = be490364-73d2-420d-950e-f6450ca75dfb
   MODULE_TYPE                    = BASE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePeCoffLib/BasePeCoff.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePeCoffLib/BasePeCoff.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePeCoffLib/BasePeCoff.c	(revision 58459)
@@ -3,5 +3,18 @@
   only supports relocating IA32, x64, IPF, and EBC images.
 
-  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+  Caution: This file requires additional review when modified.
+  This library will have external input - PE/COFF image.
+  This external input must be validated carefully to avoid security issue like
+  buffer overflow, integer overflow.
+
+  The basic guideline is that caller need provide ImageContext->ImageRead () with the
+  necessary data range check, to make sure when this library reads PE/COFF image, the
+  PE image buffer is always in valid range.
+  This library will also do some additional check for PE header fields.
+
+  PeCoffLoaderGetPeHeader() routine will do basic check for PE/COFF header.
+  PeCoffLoaderGetImageInfo() routine will do basic check for whole PE/COFF image.
+
+  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
   Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
   This program and the accompanying materials
@@ -16,4 +29,21 @@
 
 #include "BasePeCoffLibInternals.h"
+
+/**
+  Adjust some fields in section header for TE image.
+
+  @param  SectionHeader             Pointer to the section header.
+  @param  TeStrippedOffset          Size adjust for the TE image.
+
+**/
+VOID
+PeCoffLoaderAdjustOffsetForTeImage (
+  EFI_IMAGE_SECTION_HEADER              *SectionHeader,
+  UINT32                                TeStrippedOffset
+  )
+{
+  SectionHeader->VirtualAddress   -= TeStrippedOffset;
+  SectionHeader->PointerToRawData -= TeStrippedOffset;
+}
 
 /**
@@ -49,5 +79,8 @@
 /**
   Retrieves the PE or TE Header from a PE/COFF or TE image. 
-  Also done many checks in PE image to make sure PE image DosHeader, PeOptionHeader, 
+
+  Caution: This function may receive untrusted input.
+  PE/COFF image is external input, so this routine will 
+  also done many checks in PE image to make sure PE image DosHeader, PeOptionHeader, 
   SizeOfHeader, Section Data Region and Security Data Region be in PE image range. 
 
@@ -68,7 +101,9 @@
   EFI_IMAGE_DOS_HEADER  DosHdr;
   UINTN                 Size;
+  UINTN                 ReadSize;
   UINT16                Magic;
   UINT32                SectionHeaderOffset;
   UINT32                Index;
+  UINT32                HeaderWithoutDataDir;
   CHAR8                 BufferData;
   UINTN                 NumberOfSections;
@@ -79,4 +114,5 @@
   //
   Size = sizeof (EFI_IMAGE_DOS_HEADER);
+  ReadSize = Size;
   Status = ImageContext->ImageRead (
                            ImageContext->Handle,
@@ -85,6 +121,9 @@
                            &DosHdr
                            );
-  if (RETURN_ERROR (Status)) {
+  if (RETURN_ERROR (Status) || (Size != ReadSize)) {
     ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
+    if (Size != ReadSize) {
+      Status = RETURN_UNSUPPORTED;
+    }
     return Status;
   }
@@ -106,4 +145,5 @@
   //
   Size = sizeof (EFI_IMAGE_OPTIONAL_HEADER_UNION);
+  ReadSize = Size;
   Status = ImageContext->ImageRead (
                            ImageContext->Handle,
@@ -112,6 +152,9 @@
                            Hdr.Pe32
                            );
-  if (RETURN_ERROR (Status)) {
+  if (RETURN_ERROR (Status) || (Size != ReadSize)) {
     ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
+    if (Size != ReadSize) {
+      Status = RETURN_UNSUPPORTED;
+    }
     return Status;
   }
@@ -132,4 +175,48 @@
     ImageContext->SizeOfHeaders     = sizeof (EFI_TE_IMAGE_HEADER) + (UINTN)Hdr.Te->BaseOfCode - (UINTN)Hdr.Te->StrippedSize;
 
+    //
+    // Check the StrippedSize.
+    //
+    if (sizeof (EFI_TE_IMAGE_HEADER) >= (UINT32)Hdr.Te->StrippedSize) {
+      ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+      return RETURN_UNSUPPORTED;
+    }
+
+    //
+    // Check the SizeOfHeaders field.
+    //
+    if (Hdr.Te->BaseOfCode <= Hdr.Te->StrippedSize) {
+      ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+      return RETURN_UNSUPPORTED;
+    }
+
+    //
+    // Read last byte of Hdr.Te->SizeOfHeaders from the file.
+    //
+    Size = 1;
+    ReadSize = Size;
+    Status = ImageContext->ImageRead (
+                             ImageContext->Handle,
+                             ImageContext->SizeOfHeaders - 1,
+                             &Size,
+                             &BufferData
+                             );
+    if (RETURN_ERROR (Status) || (Size != ReadSize)) {
+      ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
+      if (Size != ReadSize) {
+        Status = RETURN_UNSUPPORTED;
+      }
+      return Status;
+    }
+
+    //
+    // TE Image Data Directory Entry size is non-zero, but the Data Directory Virtual Address is zero.
+    // This case is not a valid TE image. 
+    //
+    if ((Hdr.Te->DataDirectory[0].Size != 0 && Hdr.Te->DataDirectory[0].VirtualAddress == 0) ||
+        (Hdr.Te->DataDirectory[1].Size != 0 && Hdr.Te->DataDirectory[1].VirtualAddress == 0)) {
+      ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+      return RETURN_UNSUPPORTED;
+    }
   } else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE)  {
     ImageContext->IsTeImage = FALSE;
@@ -140,25 +227,57 @@
     if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
       //
-      // 1. Check FileHeader.SizeOfOptionalHeader filed.
+      // 1. Check OptionalHeader.NumberOfRvaAndSizes filed.
       //
       if (EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES < Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes) {
+        ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
         return RETURN_UNSUPPORTED;
       }
 
       //
-      // 2. Check the OptionalHeader.SizeOfHeaders field.
-      // This field will be use like the following mode, so just compare the result.
-      // The DataDirectory array begin with 1, not 0, so here use < to compare not <=.
-      //
-      if (EFI_IMAGE_DIRECTORY_ENTRY_SECURITY + 1 < Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes) {
-        if (Hdr.Pe32->OptionalHeader.SizeOfHeaders < (UINT32)((UINT8 *)(&Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY + 1]) - (UINT8 *) &Hdr)) {
-          return RETURN_UNSUPPORTED;
-        }
-      }
-
-      //
-      // Read Hdr.Pe32.OptionalHeader.SizeOfHeaders data from file
+      // 2. Check the FileHeader.SizeOfOptionalHeader field.
+      // OptionalHeader.NumberOfRvaAndSizes is not bigger than 16, so 
+      // OptionalHeader.NumberOfRvaAndSizes * sizeof (EFI_IMAGE_DATA_DIRECTORY) will not overflow.
+      //
+      HeaderWithoutDataDir = sizeof (EFI_IMAGE_OPTIONAL_HEADER32) - sizeof (EFI_IMAGE_DATA_DIRECTORY) * EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES;
+      if (((UINT32)Hdr.Pe32->FileHeader.SizeOfOptionalHeader - HeaderWithoutDataDir) !=
+          Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes * sizeof (EFI_IMAGE_DATA_DIRECTORY)) {
+        ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+        return RETURN_UNSUPPORTED;
+      }
+
+      SectionHeaderOffset = ImageContext->PeCoffHeaderOffset + sizeof (UINT32) + sizeof (EFI_IMAGE_FILE_HEADER) + Hdr.Pe32->FileHeader.SizeOfOptionalHeader;
+      //
+      // 3. Check the FileHeader.NumberOfSections field.
+      //
+      if (Hdr.Pe32->OptionalHeader.SizeOfImage <= SectionHeaderOffset) {
+        ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+        return RETURN_UNSUPPORTED;
+      }
+      if ((Hdr.Pe32->OptionalHeader.SizeOfImage - SectionHeaderOffset) / EFI_IMAGE_SIZEOF_SECTION_HEADER <= Hdr.Pe32->FileHeader.NumberOfSections) {
+        ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+        return RETURN_UNSUPPORTED;
+      }
+
+      //
+      // 4. Check the OptionalHeader.SizeOfHeaders field.
+      //
+      if (Hdr.Pe32->OptionalHeader.SizeOfHeaders <= SectionHeaderOffset) {
+        ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+        return RETURN_UNSUPPORTED;
+      }
+      if (Hdr.Pe32->OptionalHeader.SizeOfHeaders >= Hdr.Pe32->OptionalHeader.SizeOfImage) {
+        ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+        return RETURN_UNSUPPORTED;
+      }
+      if ((Hdr.Pe32->OptionalHeader.SizeOfHeaders - SectionHeaderOffset) / EFI_IMAGE_SIZEOF_SECTION_HEADER < (UINT32)Hdr.Pe32->FileHeader.NumberOfSections) {
+        ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+        return RETURN_UNSUPPORTED;
+      }
+
+      //
+      // 4.2 Read last byte of Hdr.Pe32.OptionalHeader.SizeOfHeaders from the file.
       //
       Size = 1;
+      ReadSize = Size;
       Status = ImageContext->ImageRead (
                                ImageContext->Handle,
@@ -167,5 +286,9 @@
                                &BufferData
                                );
-      if (RETURN_ERROR (Status)) {
+      if (RETURN_ERROR (Status) || (Size != ReadSize)) {
+        ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
+        if (Size != ReadSize) {
+          Status = RETURN_UNSUPPORTED;
+        }
         return Status;
       }
@@ -183,11 +306,13 @@
           if ((UINT32) (~0) - Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY].VirtualAddress <
               Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY].Size) {
-            return RETURN_INVALID_PARAMETER;
+            ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+            return RETURN_UNSUPPORTED;
           }
 
           //
-          // Read section header from file
+          // Read last byte of section header from file
           //
           Size = 1;
+          ReadSize = Size;
           Status = ImageContext->ImageRead (
                                    ImageContext->Handle,
@@ -197,5 +322,9 @@
                                    &BufferData
                                    );
-          if (RETURN_ERROR (Status)) {
+          if (RETURN_ERROR (Status) || (Size != ReadSize)) {
+            ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
+            if (Size != ReadSize) {
+              Status = RETURN_UNSUPPORTED;
+            }
             return Status;
           }
@@ -213,25 +342,56 @@
     } else if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
       //
-      // 1. Check FileHeader.SizeOfOptionalHeader filed.
+      // 1. Check FileHeader.NumberOfRvaAndSizes filed.
       //
       if (EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES < Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes) {
+        ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
         return RETURN_UNSUPPORTED;
       }
-
-      //
-      // 2. Check the OptionalHeader.SizeOfHeaders field.
-      // This field will be use like the following mode, so just compare the result.
-      // The DataDirectory array begin with 1, not 0, so here use < to compare not <=.
-      //
-      if (EFI_IMAGE_DIRECTORY_ENTRY_SECURITY + 1 < Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes) {
-        if (Hdr.Pe32Plus->OptionalHeader.SizeOfHeaders < (UINT32)((UINT8 *)(&Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY + 1]) - (UINT8 *) &Hdr)) {
-          return RETURN_UNSUPPORTED;
-        }
-      }
-
-      //
-      // Read Hdr.Pe32.OptionalHeader.SizeOfHeaders data from file
+      //
+      // 2. Check the FileHeader.SizeOfOptionalHeader field.
+      // OptionalHeader.NumberOfRvaAndSizes is not bigger than 16, so 
+      // OptionalHeader.NumberOfRvaAndSizes * sizeof (EFI_IMAGE_DATA_DIRECTORY) will not overflow.
+      //
+      HeaderWithoutDataDir = sizeof (EFI_IMAGE_OPTIONAL_HEADER64) - sizeof (EFI_IMAGE_DATA_DIRECTORY) * EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES;
+      if (((UINT32)Hdr.Pe32Plus->FileHeader.SizeOfOptionalHeader - HeaderWithoutDataDir) !=
+          Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes * sizeof (EFI_IMAGE_DATA_DIRECTORY)) {
+        ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+        return RETURN_UNSUPPORTED;
+      }
+
+      SectionHeaderOffset = ImageContext->PeCoffHeaderOffset + sizeof (UINT32) + sizeof (EFI_IMAGE_FILE_HEADER) + Hdr.Pe32Plus->FileHeader.SizeOfOptionalHeader;
+      //
+      // 3. Check the FileHeader.NumberOfSections field.
+      //
+      if (Hdr.Pe32Plus->OptionalHeader.SizeOfImage <= SectionHeaderOffset) {
+        ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+        return RETURN_UNSUPPORTED;
+      }
+      if ((Hdr.Pe32Plus->OptionalHeader.SizeOfImage - SectionHeaderOffset) / EFI_IMAGE_SIZEOF_SECTION_HEADER <= Hdr.Pe32Plus->FileHeader.NumberOfSections) {
+        ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+        return RETURN_UNSUPPORTED;
+      }
+
+      //
+      // 4. Check the OptionalHeader.SizeOfHeaders field.
+      //
+      if (Hdr.Pe32Plus->OptionalHeader.SizeOfHeaders <= SectionHeaderOffset) {
+        ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+        return RETURN_UNSUPPORTED;
+      }
+      if (Hdr.Pe32Plus->OptionalHeader.SizeOfHeaders >= Hdr.Pe32Plus->OptionalHeader.SizeOfImage) {
+        ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+        return RETURN_UNSUPPORTED;
+      }
+      if ((Hdr.Pe32Plus->OptionalHeader.SizeOfHeaders - SectionHeaderOffset) / EFI_IMAGE_SIZEOF_SECTION_HEADER < (UINT32)Hdr.Pe32Plus->FileHeader.NumberOfSections) {
+        ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+        return RETURN_UNSUPPORTED;
+      }
+
+      //
+      // 4.2 Read last byte of Hdr.Pe32Plus.OptionalHeader.SizeOfHeaders from the file.
       //
       Size = 1;
+      ReadSize = Size;
       Status = ImageContext->ImageRead (
                                ImageContext->Handle,
@@ -240,5 +400,9 @@
                                &BufferData
                                );
-      if (RETURN_ERROR (Status)) {
+      if (RETURN_ERROR (Status) || (Size != ReadSize)) {
+        ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
+        if (Size != ReadSize) {
+          Status = RETURN_UNSUPPORTED;
+        }
         return Status;
       }
@@ -256,11 +420,13 @@
           if ((UINT32) (~0) - Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY].VirtualAddress <
               Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_SECURITY].Size) {
-            return RETURN_INVALID_PARAMETER;
+            ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+            return RETURN_UNSUPPORTED;
           }
 
           //
-          // Read section header from file
+          // Read last byte of section header from file
           //
           Size = 1;
+          ReadSize = Size;
           Status = ImageContext->ImageRead (
                                    ImageContext->Handle,
@@ -270,5 +436,9 @@
                                    &BufferData
                                    );
-          if (RETURN_ERROR (Status)) {
+          if (RETURN_ERROR (Status) || (Size != ReadSize)) {
+            ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
+            if (Size != ReadSize) {
+              Status = RETURN_UNSUPPORTED;
+            }
             return Status;
           }
@@ -318,4 +488,5 @@
     //
     Size = sizeof (EFI_IMAGE_SECTION_HEADER);
+    ReadSize = Size;
     Status = ImageContext->ImageRead (
                              ImageContext->Handle,
@@ -324,14 +495,35 @@
                              &SectionHeader
                              );
-    if (RETURN_ERROR (Status)) {
+    if (RETURN_ERROR (Status) || (Size != ReadSize)) {
+      ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
+      if (Size != ReadSize) {
+        Status = RETURN_UNSUPPORTED;
+      }
       return Status;
     }
 
+    //
+    // Adjust some field in Section Header for TE image.
+    //
+    if (ImageContext->IsTeImage) {
+      PeCoffLoaderAdjustOffsetForTeImage (&SectionHeader, (UINT32)Hdr.Te->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER));
+    }
+
     if (SectionHeader.SizeOfRawData > 0) {
       //
+      // Section data should bigger than the Pe header.
+      //
+      if (SectionHeader.VirtualAddress < ImageContext->SizeOfHeaders || 
+          SectionHeader.PointerToRawData < ImageContext->SizeOfHeaders) {
+        ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+        return RETURN_UNSUPPORTED;
+      }
+
+      //
       // Check the member data to avoid overflow.
       //
       if ((UINT32) (~0) - SectionHeader.PointerToRawData < SectionHeader.SizeOfRawData) {
-        return RETURN_INVALID_PARAMETER;
+        ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+        return RETURN_UNSUPPORTED;
       }
 
@@ -341,4 +533,5 @@
       //
       Size = 1;
+      ReadSize = Size;
       Status = ImageContext->ImageRead (
                                ImageContext->Handle,
@@ -347,5 +540,9 @@
                                &BufferData
                                );
-      if (RETURN_ERROR (Status)) {
+      if (RETURN_ERROR (Status) || (Size != ReadSize)) {
+        ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
+        if (Size != ReadSize) {
+          Status = RETURN_UNSUPPORTED;
+        }
         return Status;
       }
@@ -377,5 +574,7 @@
   to invoking this service.
 
-  Also done many checks in PE image to make sure PE image DosHeader, PeOptionHeader, 
+  Caution: This function may receive untrusted input.
+  PE/COFF image is external input, so this routine will 
+  also done many checks in PE image to make sure PE image DosHeader, PeOptionHeader, 
   SizeOfHeader, Section Data Region and Security Data Region be in PE image range. 
 
@@ -399,4 +598,5 @@
   EFI_IMAGE_DATA_DIRECTORY              *DebugDirectoryEntry;
   UINTN                                 Size;
+  UINTN                                 ReadSize;
   UINTN                                 Index;
   UINTN                                 DebugDirectoryEntryRva;
@@ -407,4 +607,5 @@
   UINT32                                NumberOfRvaAndSizes;
   UINT16                                Magic;
+  UINT32                                TeStrippedOffset;
 
   if (ImageContext == NULL) {
@@ -428,4 +629,5 @@
   //
   if (!(ImageContext->IsTeImage)) {
+    TeStrippedOffset = 0;
     if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
       //
@@ -440,5 +642,6 @@
     }
   } else {
-    ImageContext->ImageAddress = (PHYSICAL_ADDRESS)(Hdr.Te->ImageBase + Hdr.Te->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER));
+    TeStrippedOffset = (UINT32)Hdr.Te->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER);
+    ImageContext->ImageAddress = (PHYSICAL_ADDRESS)(Hdr.Te->ImageBase + TeStrippedOffset);
   }
 
@@ -474,12 +677,4 @@
     ImageContext->RelocationsStripped = FALSE;
   }
-  
-  //
-  // TE Image Relocation Data Directory Entry size is non-zero, but the Relocation Data Directory Virtual Address is zero.
-  // This case is not a valid TE image. 
-  //
-  if ((ImageContext->IsTeImage) && (Hdr.Te->DataDirectory[0].Size != 0) && (Hdr.Te->DataDirectory[0].VirtualAddress == 0)) {
-    return RETURN_INVALID_PARAMETER;
-  }
 
   if (!(ImageContext->IsTeImage)) {
@@ -521,4 +716,5 @@
         //
         Size = sizeof (EFI_IMAGE_SECTION_HEADER);
+        ReadSize = Size;
         Status = ImageContext->ImageRead (
                                  ImageContext->Handle,
@@ -527,6 +723,9 @@
                                  &SectionHeader
                                  );
-        if (RETURN_ERROR (Status)) {
+        if (RETURN_ERROR (Status) || (Size != ReadSize)) {
           ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
+          if (Size != ReadSize) {
+            Status = RETURN_UNSUPPORTED;
+          }
           return Status;
         }
@@ -548,4 +747,5 @@
           //
           Size = sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY);
+          ReadSize = Size;
           Status = ImageContext->ImageRead (
                                    ImageContext->Handle,
@@ -554,8 +754,17 @@
                                    &DebugEntry
                                    );
-          if (RETURN_ERROR (Status)) {
+          if (RETURN_ERROR (Status) || (Size != ReadSize)) {
             ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
+            if (Size != ReadSize) {
+              Status = RETURN_UNSUPPORTED;
+            }
             return Status;
           }
+
+          //
+          // From PeCoff spec, when DebugEntry.RVA == 0 means this debug info will not load into memory.
+          // Here we will always load EFI_IMAGE_DEBUG_TYPE_CODEVIEW type debug info. so need adjust the
+          // ImageContext->ImageSize when DebugEntry.RVA == 0.
+          //
           if (DebugEntry.Type == EFI_IMAGE_DEBUG_TYPE_CODEVIEW) {
             ImageContext->DebugDirectoryEntryRva = (UINT32) (DebugDirectoryEntryRva + Index);
@@ -582,4 +791,5 @@
       //
       Size   = sizeof (EFI_IMAGE_SECTION_HEADER);
+      ReadSize = Size;
       Status = ImageContext->ImageRead (
                                ImageContext->Handle,
@@ -588,6 +798,9 @@
                                &SectionHeader
                                );
-      if (RETURN_ERROR (Status)) {
+      if (RETURN_ERROR (Status) || (Size != ReadSize)) {
         ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
+        if (Size != ReadSize) {
+          Status = RETURN_UNSUPPORTED;
+        }
         return Status;
       }
@@ -597,7 +810,6 @@
         DebugDirectoryEntryFileOffset = DebugDirectoryEntryRva -
                                         SectionHeader.VirtualAddress +
-                                        SectionHeader.PointerToRawData +
-                                        sizeof (EFI_TE_IMAGE_HEADER) -
-                                        Hdr.Te->StrippedSize;
+                                        SectionHeader.PointerToRawData -
+                                        TeStrippedOffset;
 
         //
@@ -623,5 +835,5 @@
       //
       if ((++Index) == (UINTN)Hdr.Te->NumberOfSections) {
-        ImageContext->ImageSize = (SectionHeader.VirtualAddress + SectionHeader.Misc.VirtualSize);
+        ImageContext->ImageSize = (SectionHeader.VirtualAddress + SectionHeader.Misc.VirtualSize) - TeStrippedOffset;
       }
 
@@ -635,4 +847,5 @@
         //
         Size = sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY);
+        ReadSize = Size;
         Status = ImageContext->ImageRead (
                                  ImageContext->Handle,
@@ -641,6 +854,9 @@
                                  &DebugEntry
                                  );
-        if (RETURN_ERROR (Status)) {
+        if (RETURN_ERROR (Status) || (Size != ReadSize)) {
           ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
+          if (Size != ReadSize) {
+            Status = RETURN_UNSUPPORTED;
+          }
           return Status;
         }
@@ -661,6 +877,7 @@
   Converts an image address to the loaded address.
 
-  @param  ImageContext  The context of the image being loaded.
-  @param  Address       The relative virtual address to be converted to the loaded address.
+  @param  ImageContext      The context of the image being loaded.
+  @param  Address           The address to be converted to the loaded address.
+  @param  TeStrippedOffset  Stripped offset for TE image.
 
   @return The converted address or NULL if the address can not be converted.
@@ -670,5 +887,6 @@
 PeCoffLoaderImageAddress (
   IN OUT PE_COFF_LOADER_IMAGE_CONTEXT          *ImageContext,
-  IN     UINTN                                 Address
+  IN     UINTN                                 Address, 
+  IN     UINTN                                 TeStrippedOffset
   )
 {
@@ -676,10 +894,10 @@
   // Make sure that Address and ImageSize is correct for the loaded image.
   //
-  if (Address >= ImageContext->ImageSize) {
+  if (Address >= ImageContext->ImageSize + TeStrippedOffset) {
     ImageContext->ImageError = IMAGE_ERROR_INVALID_IMAGE_ADDRESS;
     return NULL;
   }
 
-  return (CHAR8 *)((UINTN) ImageContext->ImageAddress + Address);
+  return (CHAR8 *)((UINTN) ImageContext->ImageAddress + Address - TeStrippedOffset);
 }
 
@@ -724,4 +942,5 @@
   EFI_IMAGE_DATA_DIRECTORY              *RelocDir;
   UINT64                                Adjust;
+  EFI_IMAGE_BASE_RELOCATION             *RelocBaseOrg;
   EFI_IMAGE_BASE_RELOCATION             *RelocBase;
   EFI_IMAGE_BASE_RELOCATION             *RelocBaseEnd;
@@ -737,4 +956,5 @@
   UINT32                                NumberOfRvaAndSizes;
   UINT16                                Magic;
+  UINT32                                TeStrippedOffset;
 
   ASSERT (ImageContext != NULL);
@@ -767,5 +987,5 @@
   if (!(ImageContext->IsTeImage)) {
     Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)ImageContext->ImageAddress + ImageContext->PeCoffHeaderOffset);
-
+    TeStrippedOffset = 0;
     Magic = PeCoffLoaderGetPeHeaderMagicValue (Hdr);
 
@@ -800,25 +1020,13 @@
     // the optional header to verify a desired directory entry is there.
     //
-
-    if ((NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) && (RelocDir->Size > 0)) {
-      RelocBase = PeCoffLoaderImageAddress (ImageContext, RelocDir->VirtualAddress);
-      RelocBaseEnd = PeCoffLoaderImageAddress (
-                      ImageContext,
-                      RelocDir->VirtualAddress + RelocDir->Size - 1
-                      );
-      if (RelocBase == NULL || RelocBaseEnd == NULL) {
-        return RETURN_LOAD_ERROR;
-      }
-    } else {
-      //
-      // Set base and end to bypass processing below.
-      //
-      RelocBase = RelocBaseEnd = NULL;
+    if ((NumberOfRvaAndSizes < EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC)) {
+      RelocDir = NULL;
     }
   } else {
     Hdr.Te             = (EFI_TE_IMAGE_HEADER *)(UINTN)(ImageContext->ImageAddress);
-    Adjust             = (UINT64) (BaseAddress - Hdr.Te->StrippedSize + sizeof (EFI_TE_IMAGE_HEADER) - Hdr.Te->ImageBase);
+    TeStrippedOffset   = (UINT32)Hdr.Te->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER);
+    Adjust             = (UINT64) (BaseAddress - (Hdr.Te->ImageBase + TeStrippedOffset));
     if (Adjust != 0) {
-      Hdr.Te->ImageBase  = (UINT64) (BaseAddress - Hdr.Te->StrippedSize + sizeof (EFI_TE_IMAGE_HEADER));
+      Hdr.Te->ImageBase  = (UINT64) (BaseAddress - TeStrippedOffset);
     }
 
@@ -827,19 +1035,23 @@
     //
     RelocDir = &Hdr.Te->DataDirectory[0];
-    if (RelocDir->Size > 0) {
-      RelocBase = (EFI_IMAGE_BASE_RELOCATION *)(UINTN)(
-                                      ImageContext->ImageAddress +
-                                      RelocDir->VirtualAddress +
-                                      sizeof(EFI_TE_IMAGE_HEADER) -
-                                      Hdr.Te->StrippedSize
-                                      );
-      RelocBaseEnd = (EFI_IMAGE_BASE_RELOCATION *) ((UINTN) RelocBase + (UINTN) RelocDir->Size - 1);
-    } else {
-      //
-      // Set base and end to bypass processing below.
-      //
-      RelocBase = RelocBaseEnd = NULL;    
-    }
-  }
+  }
+
+  if ((RelocDir != NULL) && (RelocDir->Size > 0)) {
+    RelocBase = (EFI_IMAGE_BASE_RELOCATION *) PeCoffLoaderImageAddress (ImageContext, RelocDir->VirtualAddress, TeStrippedOffset);
+    RelocBaseEnd = (EFI_IMAGE_BASE_RELOCATION *) PeCoffLoaderImageAddress (ImageContext,
+                                                                            RelocDir->VirtualAddress + RelocDir->Size - 1,
+                                                                            TeStrippedOffset
+                                                                            );
+    if (RelocBase == NULL || RelocBaseEnd == NULL || RelocBaseEnd < RelocBase) {
+      ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
+      return RETURN_LOAD_ERROR;
+    }
+  } else {
+    //
+    // Set base and end to bypass processing below.
+    //
+    RelocBase = RelocBaseEnd = NULL;    
+  }
+  RelocBaseOrg = RelocBase;
 
   //
@@ -854,34 +1066,36 @@
 
       Reloc     = (UINT16 *) ((CHAR8 *) RelocBase + sizeof (EFI_IMAGE_BASE_RELOCATION));
-      RelocEnd  = (UINT16 *) ((CHAR8 *) RelocBase + RelocBase->SizeOfBlock);
-      
-      //
-      // Make sure RelocEnd is in the Image range.
-      //
-      if ((CHAR8 *) RelocEnd < (CHAR8 *)((UINTN) ImageContext->ImageAddress) ||
-          (CHAR8 *) RelocEnd > (CHAR8 *)((UINTN)ImageContext->ImageAddress + (UINTN)ImageContext->ImageSize)) {
+      //
+      // Add check for RelocBase->SizeOfBlock field.
+      //
+      if (RelocBase->SizeOfBlock == 0) {
         ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
         return RETURN_LOAD_ERROR;
       }
-
-      if (!(ImageContext->IsTeImage)) {
-        FixupBase = PeCoffLoaderImageAddress (ImageContext, RelocBase->VirtualAddress);
-        if (FixupBase == NULL) {
+      if ((UINTN)RelocBase > MAX_ADDRESS - RelocBase->SizeOfBlock) {
+        ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
+        return RETURN_LOAD_ERROR;
+      }
+
+      RelocEnd  = (UINT16 *) ((CHAR8 *) RelocBase + RelocBase->SizeOfBlock);
+      if ((UINTN)RelocEnd > (UINTN)RelocBaseOrg + RelocDir->Size) {
+        ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
+        return RETURN_LOAD_ERROR;
+      }
+      FixupBase = PeCoffLoaderImageAddress (ImageContext, RelocBase->VirtualAddress, TeStrippedOffset);
+      if (FixupBase == NULL) {
+        ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
+        return RETURN_LOAD_ERROR;
+      }  
+
+      //
+      // Run this relocation record
+      //
+      while (Reloc < RelocEnd) {
+        Fixup = PeCoffLoaderImageAddress (ImageContext, RelocBase->VirtualAddress + (*Reloc & 0xFFF), TeStrippedOffset);
+        if (Fixup == NULL) {
+          ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
           return RETURN_LOAD_ERROR;
         }
-      } else {
-        FixupBase = (CHAR8 *)(UINTN)(ImageContext->ImageAddress +
-                      RelocBase->VirtualAddress +
-                      sizeof(EFI_TE_IMAGE_HEADER) -
-                      Hdr.Te->StrippedSize
-                      );
-      }    
-
-      //
-      // Run this relocation record
-      //
-      while (Reloc < RelocEnd) {
-
-        Fixup = FixupBase + (*Reloc & 0xFFF);
         switch ((*Reloc) >> 12) {
         case EFI_IMAGE_REL_BASED_ABSOLUTE:
@@ -950,4 +1164,5 @@
       RelocBase = (EFI_IMAGE_BASE_RELOCATION *) RelocEnd;
     }
+    ASSERT ((UINTN)FixupData <= (UINTN)ImageContext->FixupData + ImageContext->FixupDataSize);
 
     //
@@ -1013,5 +1228,4 @@
   CHAR8                                 *Base;
   CHAR8                                 *End;
-  CHAR8                                 *MaxEnd;
   EFI_IMAGE_DATA_DIRECTORY              *DirectoryEntry;
   EFI_IMAGE_DEBUG_DIRECTORY_ENTRY       *DebugEntry;
@@ -1025,5 +1239,6 @@
   EFI_IMAGE_RESOURCE_DATA_ENTRY         *ResourceDataEntry;
   CHAR16                                *String;
-
+  UINT32                                Offset;
+  UINT32                                TeStrippedOffset;
 
   ASSERT (ImageContext != NULL);
@@ -1112,4 +1327,5 @@
       );
     NumberOfSections = (UINTN) (Hdr.Pe32->FileHeader.NumberOfSections);
+    TeStrippedOffset = 0;
   } else {
     Status = ImageContext->ImageRead (
@@ -1121,5 +1337,4 @@
 
     Hdr.Te = (EFI_TE_IMAGE_HEADER *)(UINTN)(ImageContext->ImageAddress);
-
     FirstSection = (EFI_IMAGE_SECTION_HEADER *) (
                       (UINTN)ImageContext->ImageAddress +
@@ -1127,5 +1342,5 @@
                       );
     NumberOfSections  = (UINTN) (Hdr.Te->NumberOfSections);
-
+    TeStrippedOffset  = (UINT32) Hdr.Te->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER);
   }
 
@@ -1139,5 +1354,5 @@
   //
   Section = FirstSection;
-  for (Index = 0, MaxEnd = NULL; Index < NumberOfSections; Index++) {
+  for (Index = 0; Index < NumberOfSections; Index++) {
     //
     // Read the section
@@ -1151,9 +1366,6 @@
     // Compute sections address
     //
-    Base = PeCoffLoaderImageAddress (ImageContext, Section->VirtualAddress);
-    End = PeCoffLoaderImageAddress (
-            ImageContext,
-            Section->VirtualAddress + Section->Misc.VirtualSize - 1
-            );
+    Base = PeCoffLoaderImageAddress (ImageContext, Section->VirtualAddress, TeStrippedOffset);
+    End  = PeCoffLoaderImageAddress (ImageContext, Section->VirtualAddress + Section->Misc.VirtualSize - 1, TeStrippedOffset);
 
     //
@@ -1165,30 +1377,11 @@
     }
 
-    if (ImageContext->IsTeImage) {
-      Base = (CHAR8 *)((UINTN) Base + sizeof (EFI_TE_IMAGE_HEADER) - (UINTN)Hdr.Te->StrippedSize);
-      End  = (CHAR8 *)((UINTN) End +  sizeof (EFI_TE_IMAGE_HEADER) - (UINTN)Hdr.Te->StrippedSize);
-    }
-
-    if (End > MaxEnd) {
-      MaxEnd = End;
-    }
-
     if (Section->SizeOfRawData > 0) {
-      if (!(ImageContext->IsTeImage)) {
-        Status = ImageContext->ImageRead (
-                                ImageContext->Handle,
-                                Section->PointerToRawData,
-                                &Size,
-                                Base
-                                );
-      } else {
-        Status = ImageContext->ImageRead (
-                                ImageContext->Handle,
-                                Section->PointerToRawData + sizeof (EFI_TE_IMAGE_HEADER) - (UINTN)Hdr.Te->StrippedSize,
-                                &Size,
-                                Base
-                                );
-      }
-
+      Status = ImageContext->ImageRead (
+                              ImageContext->Handle,
+                              Section->PointerToRawData - TeStrippedOffset,
+                              &Size,
+                              Base
+                              );
       if (RETURN_ERROR (Status)) {
         ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
@@ -1225,5 +1418,6 @@
       ImageContext->EntryPoint = (PHYSICAL_ADDRESS)(UINTN)PeCoffLoaderImageAddress (
                                                             ImageContext,
-                                                            (UINTN)Hdr.Pe32->OptionalHeader.AddressOfEntryPoint
+                                                            (UINTN)Hdr.Pe32->OptionalHeader.AddressOfEntryPoint,
+                                                            0
                                                             );
     } else {
@@ -1233,14 +1427,14 @@
       ImageContext->EntryPoint = (PHYSICAL_ADDRESS)(UINTN)PeCoffLoaderImageAddress (
                                                             ImageContext,
-                                                            (UINTN)Hdr.Pe32Plus->OptionalHeader.AddressOfEntryPoint
+                                                            (UINTN)Hdr.Pe32Plus->OptionalHeader.AddressOfEntryPoint,
+                                                            0
                                                             );
     }
   } else {
-    ImageContext->EntryPoint =  (PHYSICAL_ADDRESS) (
-                                (UINTN)ImageContext->ImageAddress  +
-                                (UINTN)Hdr.Te->AddressOfEntryPoint +
-                                (UINTN)sizeof(EFI_TE_IMAGE_HEADER) -
-                                (UINTN)Hdr.Te->StrippedSize
-                                );
+    ImageContext->EntryPoint = (PHYSICAL_ADDRESS)(UINTN)PeCoffLoaderImageAddress (
+                                                          ImageContext,
+                                                          (UINTN)Hdr.Te->AddressOfEntryPoint,
+                                                          TeStrippedOffset
+                                                          );
   }
 
@@ -1267,6 +1461,9 @@
     }
 
+    //
+    // Must use UINT64 here, because there might a case that 32bit loader to load 64bit image.
+    //
     if (NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) {
-      ImageContext->FixupDataSize = DirectoryEntry->Size / sizeof (UINT16) * sizeof (UINTN);
+      ImageContext->FixupDataSize = DirectoryEntry->Size / sizeof (UINT16) * sizeof (UINT64);
     } else {
       ImageContext->FixupDataSize = 0;
@@ -1274,5 +1471,5 @@
   } else {
     DirectoryEntry              = &Hdr.Te->DataDirectory[0];
-    ImageContext->FixupDataSize = DirectoryEntry->Size / sizeof (UINT16) * sizeof (UINTN);
+    ImageContext->FixupDataSize = DirectoryEntry->Size / sizeof (UINT16) * sizeof (UINT64);
   }
   //
@@ -1286,93 +1483,80 @@
   //
   if (ImageContext->DebugDirectoryEntryRva != 0) {
-    if (!(ImageContext->IsTeImage)) {
-      DebugEntry = PeCoffLoaderImageAddress (
-                    ImageContext,
-                    ImageContext->DebugDirectoryEntryRva
-                    );
-    } else {
-      DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)(UINTN)(
-                      ImageContext->ImageAddress +
-                      ImageContext->DebugDirectoryEntryRva +
-                      sizeof(EFI_TE_IMAGE_HEADER) -
-                      Hdr.Te->StrippedSize
-                      );
-    }
-
-    if (DebugEntry != NULL) {
-      TempDebugEntryRva = DebugEntry->RVA;
-      if (DebugEntry->RVA == 0 && DebugEntry->FileOffset != 0) {
-        Section--;
-        if ((UINTN)Section->SizeOfRawData < Section->Misc.VirtualSize) {
-          TempDebugEntryRva = Section->VirtualAddress + Section->Misc.VirtualSize;
-        } else {
-          TempDebugEntryRva = Section->VirtualAddress + Section->SizeOfRawData;
-        }
-      }
-
-      if (TempDebugEntryRva != 0) {
-        if (!(ImageContext->IsTeImage)) {
-          ImageContext->CodeView = PeCoffLoaderImageAddress (ImageContext, TempDebugEntryRva);
-        } else {
-          ImageContext->CodeView = (VOID *)(
-                                    (UINTN)ImageContext->ImageAddress +
-                                    (UINTN)TempDebugEntryRva +
-                                    (UINTN)sizeof (EFI_TE_IMAGE_HEADER) -
-                                    (UINTN) Hdr.Te->StrippedSize
-                                    );
-        }
-
-        if (ImageContext->CodeView == NULL) {
+    DebugEntry = PeCoffLoaderImageAddress (
+                ImageContext,
+                ImageContext->DebugDirectoryEntryRva,
+                TeStrippedOffset
+                );
+    if (DebugEntry == NULL) {
+      ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
+      return RETURN_LOAD_ERROR;
+    }
+
+    TempDebugEntryRva = DebugEntry->RVA;
+    if (DebugEntry->RVA == 0 && DebugEntry->FileOffset != 0) {
+      Section--;
+      if ((UINTN)Section->SizeOfRawData < Section->Misc.VirtualSize) {
+        TempDebugEntryRva = Section->VirtualAddress + Section->Misc.VirtualSize;
+      } else {
+        TempDebugEntryRva = Section->VirtualAddress + Section->SizeOfRawData;
+      }
+    }
+
+    if (TempDebugEntryRva != 0) {
+      ImageContext->CodeView = PeCoffLoaderImageAddress (ImageContext, TempDebugEntryRva, TeStrippedOffset); 
+      if (ImageContext->CodeView == NULL) {
+        ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
+        return RETURN_LOAD_ERROR;
+      }
+
+      if (DebugEntry->RVA == 0) {
+        Size = DebugEntry->SizeOfData;
+        Status = ImageContext->ImageRead (
+                                ImageContext->Handle,
+                                DebugEntry->FileOffset - TeStrippedOffset,
+                                &Size,
+                                ImageContext->CodeView
+                                );
+        //
+        // Should we apply fix up to this field according to the size difference between PE and TE?
+        // Because now we maintain TE header fields unfixed, this field will also remain as they are
+        // in original PE image.
+        //
+
+        if (RETURN_ERROR (Status)) {
           ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
           return RETURN_LOAD_ERROR;
         }
 
-        if (DebugEntry->RVA == 0) {
-          Size = DebugEntry->SizeOfData;
-          if (!(ImageContext->IsTeImage)) {
-            Status = ImageContext->ImageRead (
-                                    ImageContext->Handle,
-                                    DebugEntry->FileOffset,
-                                    &Size,
-                                    ImageContext->CodeView
-                                    );
-          } else {
-            Status = ImageContext->ImageRead (
-                                    ImageContext->Handle,
-                                    DebugEntry->FileOffset + sizeof (EFI_TE_IMAGE_HEADER) - Hdr.Te->StrippedSize,
-                                    &Size,
-                                    ImageContext->CodeView
-                                    );
-            //
-            // Should we apply fix up to this field according to the size difference between PE and TE?
-            // Because now we maintain TE header fields unfixed, this field will also remain as they are
-            // in original PE image.
-            //
-          }
-
-          if (RETURN_ERROR (Status)) {
-            ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
-            return RETURN_LOAD_ERROR;
-          }
-
-          DebugEntry->RVA = TempDebugEntryRva;
-        }
-
-        switch (*(UINT32 *) ImageContext->CodeView) {
-        case CODEVIEW_SIGNATURE_NB10:
-          ImageContext->PdbPointer = (CHAR8 *)ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY);
-          break;
-
-        case CODEVIEW_SIGNATURE_RSDS:
-          ImageContext->PdbPointer = (CHAR8 *)ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY);
-          break;
-
-        case CODEVIEW_SIGNATURE_MTOC:
-          ImageContext->PdbPointer = (CHAR8 *)ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY);
-          break;
-
-        default:
-          break;
-        }
+        DebugEntry->RVA = TempDebugEntryRva;
+      }
+
+      switch (*(UINT32 *) ImageContext->CodeView) {
+      case CODEVIEW_SIGNATURE_NB10:
+        if (DebugEntry->SizeOfData < sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY)) {
+          ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+          return RETURN_UNSUPPORTED;
+        }
+        ImageContext->PdbPointer = (CHAR8 *)ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY);
+        break;
+
+      case CODEVIEW_SIGNATURE_RSDS:
+        if (DebugEntry->SizeOfData < sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY)) {
+          ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+          return RETURN_UNSUPPORTED;
+        }
+        ImageContext->PdbPointer = (CHAR8 *)ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY);
+        break;
+
+      case CODEVIEW_SIGNATURE_MTOC:
+        if (DebugEntry->SizeOfData < sizeof (EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY)) {
+          ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+          return RETURN_UNSUPPORTED;
+        }
+        ImageContext->PdbPointer = (CHAR8 *)ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY);
+        break;
+
+      default:
+        break;
       }
     }
@@ -1388,4 +1572,5 @@
       // Use PE32 offset
       //
+      NumberOfRvaAndSizes = Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes;
       DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE];
     } else {
@@ -1393,15 +1578,29 @@
       // Use PE32+ offset
       //
+      NumberOfRvaAndSizes = Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes;
       DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE];
     }
 
-    if (DirectoryEntry->Size != 0) {
-      Base = PeCoffLoaderImageAddress (ImageContext, DirectoryEntry->VirtualAddress);
+    if (NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE && DirectoryEntry->Size != 0) {
+      Base = PeCoffLoaderImageAddress (ImageContext, DirectoryEntry->VirtualAddress, 0);
       if (Base != NULL) {
         ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *) Base;
+        Offset = sizeof (EFI_IMAGE_RESOURCE_DIRECTORY) + sizeof (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY) * 
+               (ResourceDirectory->NumberOfNamedEntries + ResourceDirectory->NumberOfIdEntries);
+        if (Offset > DirectoryEntry->Size) {
+          ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+          return RETURN_UNSUPPORTED;
+        }
         ResourceDirectoryEntry = (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *) (ResourceDirectory + 1);
 
         for (Index = 0; Index < ResourceDirectory->NumberOfNamedEntries; Index++) {
           if (ResourceDirectoryEntry->u1.s.NameIsString) {
+            //
+            // Check the ResourceDirectoryEntry->u1.s.NameOffset before use it.
+            //
+            if (ResourceDirectoryEntry->u1.s.NameOffset >= DirectoryEntry->Size) {
+              ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+              return RETURN_UNSUPPORTED;
+            }
             ResourceDirectoryString = (EFI_IMAGE_RESOURCE_DIRECTORY_STRING *) (Base + ResourceDirectoryEntry->u1.s.NameOffset);
             String = &ResourceDirectoryString->String[0];
@@ -1418,5 +1617,15 @@
                 // Move to next level - resource Name
                 //
+                if (ResourceDirectoryEntry->u2.s.OffsetToDirectory >= DirectoryEntry->Size) {
+                  ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+                  return RETURN_UNSUPPORTED;
+                }
                 ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *) (Base + ResourceDirectoryEntry->u2.s.OffsetToDirectory);
+                Offset = ResourceDirectoryEntry->u2.s.OffsetToDirectory + sizeof (EFI_IMAGE_RESOURCE_DIRECTORY) + 
+                         sizeof (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY) * (ResourceDirectory->NumberOfNamedEntries + ResourceDirectory->NumberOfIdEntries);
+                if (Offset > DirectoryEntry->Size) {
+                  ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+                  return RETURN_UNSUPPORTED;
+                }
                 ResourceDirectoryEntry = (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *) (ResourceDirectory + 1);
 
@@ -1425,5 +1634,15 @@
                   // Move to next level - resource Language
                   //
+                  if (ResourceDirectoryEntry->u2.s.OffsetToDirectory >= DirectoryEntry->Size) {
+                    ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+                    return RETURN_UNSUPPORTED;
+                  }
                   ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *) (Base + ResourceDirectoryEntry->u2.s.OffsetToDirectory);
+                  Offset = ResourceDirectoryEntry->u2.s.OffsetToDirectory + sizeof (EFI_IMAGE_RESOURCE_DIRECTORY) + 
+                           sizeof (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY) * (ResourceDirectory->NumberOfNamedEntries + ResourceDirectory->NumberOfIdEntries);
+                  if (Offset > DirectoryEntry->Size) {
+                    ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+                    return RETURN_UNSUPPORTED;
+                  }
                   ResourceDirectoryEntry = (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *) (ResourceDirectory + 1);
                 }
@@ -1434,6 +1653,10 @@
               //
               if (!ResourceDirectoryEntry->u2.s.DataIsDirectory) {
+                if (ResourceDirectoryEntry->u2.OffsetToData >= DirectoryEntry->Size) {
+                  ImageContext->ImageError = IMAGE_ERROR_UNSUPPORTED;
+                  return RETURN_UNSUPPORTED;
+                }
                 ResourceDataEntry = (EFI_IMAGE_RESOURCE_DATA_ENTRY *) (Base + ResourceDirectoryEntry->u2.OffsetToData);
-                ImageContext->HiiResourceData = (PHYSICAL_ADDRESS) (UINTN) PeCoffLoaderImageAddress (ImageContext, ResourceDataEntry->OffsetToData);
+                ImageContext->HiiResourceData = (PHYSICAL_ADDRESS) (UINTN) PeCoffLoaderImageAddress (ImageContext, ResourceDataEntry->OffsetToData, 0);
                 break;
               }
@@ -1579,4 +1802,13 @@
   FixupData = RelocationData;
   while (RelocBase < RelocBaseEnd) {
+    //
+    // Add check for RelocBase->SizeOfBlock field.
+    //
+    if ((RelocBase->SizeOfBlock == 0) || (RelocBase->SizeOfBlock > RelocDir->Size)) {
+      //
+      // Data invalid, cannot continue to relocate the image, just return.
+      //
+      return;
+    }
 
     Reloc     = (UINT16 *) ((UINT8 *) RelocBase + sizeof (EFI_IMAGE_BASE_RELOCATION));
@@ -1631,11 +1863,4 @@
 
         FixupData = FixupData + sizeof (UINT64);
-        break;
-
-      case EFI_IMAGE_REL_BASED_HIGHADJ:
-        //
-        // Not valid Relocation type for UEFI image, ASSERT
-        //
-        ASSERT (FALSE);
         break;
 
@@ -1672,4 +1897,6 @@
   The size of the buffer actually read is returned in ReadSize.
   
+  The caller must make sure the FileOffset and ReadSize within the file scope.
+
   If FileHandle is NULL, then ASSERT().
   If ReadSize is NULL, then ASSERT().
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf	(revision 58459)
@@ -5,5 +5,10 @@
 #  The X64 version library support loading IA32, X64 and EBC PE/COFF images.
 #
-#  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Caution: This module requires additional review when modified.
+#  This library will have external input - PE/COFF image.
+#  This external input must be validated carefully to avoid security issue like
+#  buffer overflow, integer overflow.
+#
+#  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 #  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
 #
@@ -21,4 +26,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BasePeCoffLib
+  MODULE_UNI_FILE                = BasePeCoffLib.uni
   FILE_GUID                      = 556f5d10-7309-4af4-b80a-8196bd60946f
   MODULE_TYPE                    = BASE
@@ -28,5 +34,5 @@
 
 #
-#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC ARM
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC ARM AARCH64
 #
 
@@ -44,4 +50,7 @@
   Arm/PeCoffLoaderEx.c
 
+[Sources.AARCH64]
+  AArch64/PeCoffLoaderEx.c
+
 [Packages]
   MdePkg/MdePkg.dec
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h	(revision 58459)
@@ -117,6 +117,7 @@
   Converts an image address to the loaded address.
 
-  @param  ImageContext  The context of the image being loaded.
-  @param  Address       The address to be converted to the loaded address.
+  @param  ImageContext      The context of the image being loaded.
+  @param  Address           The address to be converted to the loaded address.
+  @param  TeStrippedOffset  Stripped offset for TE image.
 
   @return The converted address or NULL if the address can not be converted.
@@ -126,5 +127,6 @@
 PeCoffLoaderImageAddress (
   IN OUT PE_COFF_LOADER_IMAGE_CONTEXT          *ImageContext,
-  IN     UINTN                                 Address
+  IN     UINTN                                 Address,
+  IN     UINTN                                 TeStrippedOffset
   );
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf	(revision 58459)
@@ -1,9 +1,6 @@
 ## @file
-#  Instance of Performance Library based on Base Library.
+#  Instance of Performance Library with empty functions.
 #
-#  Performance Library that layers on top of the Base Library to measure start
-#  and end times using CPU specific timer services if they are available.
-#
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +17,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BasePerformanceLibNull
+  MODULE_UNI_FILE                = BasePerformanceLibNull.uni
   FILE_GUID                      = FC120ED3-40E1-46dc-8C9C-AAE3CA139ACF
   MODULE_TYPE                    = BASE
@@ -44,4 +42,4 @@
 
 [Pcd]
-  gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask
+  gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask  ## CONSUMES
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePerformanceLibNull/PerformanceLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePerformanceLibNull/PerformanceLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePerformanceLibNull/PerformanceLib.c	(revision 58459)
@@ -2,5 +2,5 @@
   Base Performance Library which provides no service.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -63,5 +63,4 @@
   If the record is found and TimeStamp is zero, then this function reads
   the current time stamp and adds that time stamp value to the record as the end time.
-  If this function is called multiple times for the same record, then the end time is overwritten.
 
   @param  Handle                  The pointer to environment specific context used
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePostCodeLibDebug/BasePostCodeLibDebug.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePostCodeLibDebug/BasePostCodeLibDebug.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePostCodeLibDebug/BasePostCodeLibDebug.inf	(revision 58459)
@@ -2,7 +2,8 @@
 #  Instance of Post Code Library based on Debug Library.
 #
-#  Post Code Library that layers on top of a Debug Library instance.
+#  Post Code Library that uses DebugLib service to send PostCode.
+#  It layers on top of a Debug Library instance.
 #
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -19,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BasePostCodeLibDebug
+  MODULE_UNI_FILE                = BasePostCodeLibDebug.uni
   FILE_GUID                      = 19e3bbba-beb1-43e8-b32d-9acbb22c7639
   MODULE_TYPE                    = BASE
@@ -45,4 +47,4 @@
 
 [Pcd]
-  gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask
+  gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask  ## CONSUMES
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf	(revision 58459)
@@ -4,5 +4,5 @@
 #  Post Code Library that writes post code values to I/O port 0x80.
 #
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -19,4 +19,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BasePostCodeLibPort80
+  MODULE_UNI_FILE                = BasePostCodeLibPort80.uni
   FILE_GUID                      = b6e9a733-eb75-41b6-b30c-009bcf3801c8
   MODULE_TYPE                    = BASE
@@ -43,4 +44,4 @@
 
 [Pcd]
-  gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask
+  gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask  ## CONSUMES
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePrintLib/BasePrintLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePrintLib/BasePrintLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePrintLib/BasePrintLib.inf	(revision 58459)
@@ -2,5 +2,5 @@
 #  Print Library implementation.
 #
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -17,4 +17,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BasePrintLib
+  MODULE_UNI_FILE                = BasePrintLib.uni
   FILE_GUID                      = a86fbfca-0183-4eeb-aa8a-762e3b7da1f3
   MODULE_TYPE                    = BASE
@@ -41,2 +42,3 @@
   DebugLib
   BaseLib
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePrintLib/PrintLibInternal.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePrintLib/PrintLibInternal.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BasePrintLib/PrintLibInternal.c	(revision 58459)
@@ -15,6 +15,6 @@
 #include "PrintLibInternal.h"
 
-#define WARNING_STATUS_NUMBER         4
-#define ERROR_STATUS_NUMBER           24
+#define WARNING_STATUS_NUMBER         5
+#define ERROR_STATUS_NUMBER           33
 
 GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mHexStr[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
@@ -26,4 +26,5 @@
   "Warning Write Failure",        //  RETURN_WARN_WRITE_FAILURE     = 3
   "Warning Buffer Too Small",     //  RETURN_WARN_BUFFER_TOO_SMALL  = 4
+  "Warning Stale Data",           //  RETURN_WARN_STALE_DATA        = 5
   "Load Error",                   //  RETURN_LOAD_ERROR             = 1  | MAX_BIT
   "Invalid Parameter",            //  RETURN_INVALID_PARAMETER      = 2  | MAX_BIT
@@ -49,5 +50,14 @@
   "ICMP Error",                   //  RETURN_ICMP_ERROR             = 22 | MAX_BIT
   "TFTP Error",                   //  RETURN_TFTP_ERROR             = 23 | MAX_BIT
-  "Protocol Error"                //  RETURN_PROTOCOL_ERROR         = 24 | MAX_BIT
+  "Protocol Error",               //  RETURN_PROTOCOL_ERROR         = 24 | MAX_BIT
+  "Incompatible Version",         //  RETURN_INCOMPATIBLE_VERSION   = 25 | MAX_BIT
+  "Security Violation",           //  RETURN_SECURITY_VIOLATION     = 26 | MAX_BIT
+  "CRC Error",                    //  RETURN_CRC_ERROR              = 27 | MAX_BIT
+  "End of Media",                 //  RETURN_END_OF_MEDIA           = 28 | MAX_BIT
+  "Reserved (29)",                //  RESERVED                      = 29 | MAX_BIT
+  "Reserved (30)",                //  RESERVED                      = 30 | MAX_BIT
+  "End of File",                  //  RETURN_END_OF_FILE            = 31 | MAX_BIT
+  "Invalid Language",             //  RETURN_INVALID_LANGUAGE       = 32 | MAX_BIT
+  "Compromised Data"              //  RETURN_COMPROMISED_DATA       = 33 | MAX_BIT
 };
 
@@ -204,5 +214,5 @@
   //
   if (Width == 0 || (Flags & COMMA_TYPE) != 0) {
-    Flags &= (~PREFIX_ZERO);
+    Flags &= ~((UINTN) PREFIX_ZERO);
   }
   //
@@ -364,15 +374,19 @@
 
   LengthToReturn = 0;
+  EndBuffer = NULL;
+  OriginalBuffer = NULL;
 
   //
   // Reserve space for the Null terminator.
   //
-  BufferSize--;
-  OriginalBuffer = Buffer;
-
-  //
-  // Set the tag for the end of the input Buffer.
-  //
-  EndBuffer      = Buffer + BufferSize * BytesPerOutputCharacter;
+  if (Buffer != NULL) {
+    BufferSize--;
+    OriginalBuffer = Buffer;
+
+    //
+    // Set the tag for the end of the input Buffer.
+    //
+    EndBuffer = Buffer + BufferSize * BytesPerOutputCharacter;
+  }
 
   if ((Flags & FORMAT_UNICODE) != 0) {
@@ -402,9 +416,12 @@
   // Loop until the end of the format string is reached or the output buffer is full
   //
-  while (FormatCharacter != 0 && Buffer < EndBuffer) {
+  while (FormatCharacter != 0) {
+    if ((Buffer != NULL) && (Buffer >= EndBuffer)) {
+      break;
+    }
     //
     // Clear all the flag bits except those that may have been passed in
     //
-    Flags &= (OUTPUT_UNICODE | FORMAT_UNICODE | COUNT_ONLY_NO_PRINT);
+    Flags &= (UINTN) (OUTPUT_UNICODE | FORMAT_UNICODE | COUNT_ONLY_NO_PRINT);
 
     //
@@ -514,8 +531,11 @@
         // Flag space, +, 0, L & l are invalid for type p.
         //
-        Flags &= ~(PREFIX_BLANK | PREFIX_SIGN | PREFIX_ZERO | LONG_TYPE);
+        Flags &= ~((UINTN) (PREFIX_BLANK | PREFIX_SIGN | PREFIX_ZERO | LONG_TYPE));
         if (sizeof (VOID *) > 4) {
           Flags |= LONG_TYPE;
         }
+        //
+        // break skipped on purpose
+        //
       case 'X':
         Flags |= PREFIX_ZERO;
@@ -562,5 +582,5 @@
           Radix = 10;
           if (Comma) {
-            Flags &= (~PREFIX_ZERO);
+            Flags &= ~((UINTN) PREFIX_ZERO);
             Precision = 1;
           }
@@ -631,5 +651,5 @@
         }
         if (ArgumentString == NULL) {
-          Flags &= (~ARGUMENT_UNICODE);
+          Flags &= ~((UINTN) ARGUMENT_UNICODE);
           ArgumentString = "<null string>";
         }
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf	(revision 58459)
@@ -2,5 +2,5 @@
 #  Report Status Code Library with empty functions.
 #
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -17,4 +17,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BaseReportStatusCodeLibNull
+  MODULE_UNI_FILE                = BaseReportStatusCodeLibNull.uni
   FILE_GUID                      = 1DE0B8C2-FFB6-4bdf-97F5-0FFB33979038
   MODULE_TYPE                    = BASE
@@ -36,2 +37,3 @@
 [LibraryClasses]
   DebugLib
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseS3BootScriptLibNull/BaseS3BootScriptLibNull.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseS3BootScriptLibNull/BaseS3BootScriptLibNull.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseS3BootScriptLibNull/BaseS3BootScriptLibNull.inf	(revision 58459)
@@ -6,5 +6,5 @@
 # performing any operation.
 #
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 # This program and the accompanying materials are
@@ -21,4 +21,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BaseS3BootScriptLibNull
+  MODULE_UNI_FILE                = BaseS3BootScriptLibNull.uni
   FILE_GUID                      = 9A6DC1AC-94C0-43b1-8714-4C70FD58A815
   MODULE_TYPE                    = BASE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseS3BootScriptLibNull/BootScriptLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseS3BootScriptLibNull/BootScriptLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseS3BootScriptLibNull/BootScriptLib.c	(revision 58459)
@@ -2,5 +2,5 @@
   Null function implementation for EFI S3 boot script. 
 
-  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
@@ -258,5 +258,5 @@
 }
 /**
-  Adds a record for an execution stall on the processor into a specified boot script table.
+  Adds a record for dispatching specified arbitrary code into a specified boot script table.
 
   @param EntryPoint   Entry point of the code to be dispatched.
@@ -279,5 +279,10 @@
   Adds a record for memory reads of the memory location and continues when the exit criteria is
   satisfied or after a defined duration.
-  
+ 
+  Please aware, below interface is different with PI specification, Vol 5:
+  EFI_S3_SAVE_STATE_PROTOCOL.Write() for EFI_BOOT_SCRIPT_MEM_POLL_OPCODE.
+  "Duration" below is microseconds, while "Delay" in PI specification means
+  the number of 100ns units to poll.
+
   @param Width     The width of the memory operations.
   @param Address   The base address of the memory operations.
@@ -456,5 +461,5 @@
   destroyed.
  
-  @return the base address of the new copy of the boot script tble.   
+  @return the base address of the new copy of the boot script table.   
 
 **/
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseS3IoLib/BaseS3IoLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseS3IoLib/BaseS3IoLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseS3IoLib/BaseS3IoLib.inf	(revision 58459)
@@ -1,9 +1,9 @@
 ## @file
-# Component description file for S3IoLib.
+# Instance of S3 I/O Library based on I/O and S3 BootScript Library.
 #
-# I/O and MMIO Library Services that do I/O and also enable the I/O operatation
-# to be replayed during an S3 resume.
+# S3 I/O and MMIO Library Services that do I/O and also 
+# enable the I/O operatation to be replayed during an S3 resume.
 #
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 # This program and the accompanying materials are
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BaseS3IoLib
+  MODULE_UNI_FILE                = BaseS3IoLib.uni
   FILE_GUID                      = B13F938E-47DF-4516-A397-8927A4E42B61
   MODULE_TYPE                    = BASE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseS3IoLib/S3IoLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseS3IoLib/S3IoLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseS3IoLib/S3IoLib.c	(revision 58459)
@@ -3,5 +3,5 @@
   to be replayed during an S3 resume.
   
-  Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 -2012, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
@@ -265,4 +265,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port          The I/O port to write.
@@ -303,4 +304,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port          The I/O port to write.
@@ -341,4 +343,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port          The I/O port to write.
@@ -380,4 +383,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port          The I/O port to write.
@@ -615,4 +620,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port          The I/O port to write.
@@ -653,4 +659,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port          The I/O port to write.
@@ -691,4 +698,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port          The I/O port to write.
@@ -731,4 +739,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port          The I/O port to write.
@@ -966,4 +976,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port          The I/O port to write.
@@ -1004,4 +1015,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port          The I/O port to write.
@@ -1042,4 +1054,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port          The I/O port to write.
@@ -1082,4 +1095,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port          The I/O port to write.
@@ -1317,4 +1332,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port          The I/O port to write.
@@ -1355,4 +1371,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port          The I/O port to write.
@@ -1393,4 +1410,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port          The I/O port to write.
@@ -1433,4 +1451,6 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port          The I/O port to write.
@@ -1698,4 +1718,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address       The MMIO register to write.
@@ -1737,4 +1758,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address       The MMIO register to write.
@@ -1776,4 +1798,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address       The MMIO register to write.
@@ -1816,4 +1839,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address       The MMIO register to write.
@@ -2051,4 +2076,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address       The MMIO register to write.
@@ -2090,4 +2116,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address       The MMIO register to write.
@@ -2129,4 +2156,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address       The MMIO register to write.
@@ -2169,4 +2197,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address       The MMIO register to write.
@@ -2403,4 +2433,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address       The MMIO register to write.
@@ -2442,4 +2473,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address       The MMIO register to write.
@@ -2481,4 +2513,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address       The MMIO register to write.
@@ -2521,4 +2554,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address       The MMIO register to write.
@@ -2755,4 +2790,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address       The MMIO register to write.
@@ -2794,4 +2830,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address       The MMIO register to write.
@@ -2833,4 +2870,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address       The MMIO register to write.
@@ -2873,4 +2911,6 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address       The MMIO register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseS3PciLib/BaseS3PciLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseS3PciLib/BaseS3PciLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseS3PciLib/BaseS3PciLib.inf	(revision 58459)
@@ -1,6 +1,9 @@
 ## @file
-# Component discription file for DxeS3PciLib module
+# Instance of S3 PCI Library based on PCI and S3 BootScript Library.
 #
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+# S3 PCI Services that perform PCI Configuration cycles and 
+# also enable the PCI operation to be replayed during an S3 resume.
+#
+# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 # This program and the accompanying materials are
@@ -17,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BaseS3PciLib
+  MODULE_UNI_FILE                = BaseS3PciLib.uni
   FILE_GUID                      = F66B6BD2-513F-441d-B367-2D5BD4998A50
   MODULE_TYPE                    = BASE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseS3PciLib/S3PciLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseS3PciLib/S3PciLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseS3PciLib/S3PciLib.c	(revision 58459)
@@ -4,5 +4,5 @@
   maps directly on top of the PciLib class. 
 
-  Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
@@ -278,4 +278,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -317,4 +318,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -356,4 +358,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -396,4 +399,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -646,4 +651,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -686,4 +692,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -726,4 +733,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -767,4 +775,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -1017,4 +1027,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -1057,4 +1068,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -1097,4 +1109,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -1138,4 +1151,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseS3SmbusLib/BaseS3SmbusLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseS3SmbusLib/BaseS3SmbusLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseS3SmbusLib/BaseS3SmbusLib.inf	(revision 58459)
@@ -1,10 +1,9 @@
 ## @file
-# Component description file for S3SmbusLib.
+# Instance of S3 Smbus Library based on SmBus and S3 BootScript Library.
 #
-# Smbus Library Services that do SMBus transactions and also enable the
-# operatation to be replayed during an S3 resume. This library class maps
-# directly on top of the SmbusLib class.
+# S3 Smbus Library Services that do SMBus transactions and also enable the
+# operatation to be replayed during an S3 resume. 
 #
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 # This program and the accompanying materials are
@@ -21,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BaseS3SmbusLib
+  MODULE_UNI_FILE                = BaseS3SmbusLib.uni
   FILE_GUID                      = 01190654-FED0-40d3-BA7F-2925539E5830
   MODULE_TYPE                    = BASE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseS3StallLib/BaseS3StallLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseS3StallLib/BaseS3StallLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseS3StallLib/BaseS3StallLib.inf	(revision 58459)
@@ -1,10 +1,9 @@
 ## @file
-# Component description file for S3StallLib.
+# Instance of S3 Stall Library based on Timer and S3 BootScript Library.
 #
 # Stall Services that do stall and also enable the Stall operatation
-# to be replayed during an S3 resume. This library class maps directly on top
-# of the Timer class.
+# to be replayed during an S3 resume. 
 #
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 # This program and the accompanying materials are
@@ -21,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BaseS3StallLib
+  MODULE_UNI_FILE                = BaseS3StallLib.uni
   FILE_GUID                      = 498C6AC3-CC29-4821-BE6F-7C6F4ECF2C14
   MODULE_TYPE                    = BASE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf	(revision 58459)
@@ -2,5 +2,5 @@
 #  Null instance of Serial Port Library with empty functions.
 #
-#  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -17,4 +17,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BaseSerialPortLibNull
+  MODULE_UNI_FILE                = BaseSerialPortLibNull.uni
   FILE_GUID                      = E4541241-8897-411a-91F8-7D7E45837146
   MODULE_TYPE                    = BASE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf	(revision 58459)
@@ -2,5 +2,5 @@
 #  Base Synchronization Library implementation.
 #
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
 #
@@ -18,4 +18,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BaseSynchronizationLib
+  MODULE_UNI_FILE                = BaseSynchronizationLib.uni
   FILE_GUID                      = FC9990DF-C5FF-44cf-8799-CBB45B577F87
   MODULE_TYPE                    = BASE
@@ -24,5 +25,5 @@
 
 #
-#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC ARM
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC ARM AARCH64
 #
 [Sources]
@@ -80,4 +81,8 @@
   Arm/Synchronization.c
 
+[Sources.AARCH64]
+  Synchronization.c
+  AArch64/Synchronization.c
+
 [Packages]
   MdePkg/MdePkg.dec
@@ -90,3 +95,4 @@
 
 [Pcd]
-  gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout
+  gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout  ## SOMETIMES_CONSUMES
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseSynchronizationLib/Synchronization.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseSynchronizationLib/Synchronization.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseSynchronizationLib/Synchronization.c	(revision 58459)
@@ -2,5 +2,5 @@
   Implementation of synchronization functions.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -23,6 +23,6 @@
 
   This function retrieves the spin lock alignment requirements for optimal
-  performance on a given CPU architecture. The spin lock alignment must be a
-  power of two and is returned by this function. If there are no alignment
+  performance on a given CPU architecture. The spin lock alignment is byte alignment. 
+  It must be a power of two and is returned by this function. If there are no alignment
   requirements, then 1 must be returned. The spin lock synchronization
   functions must function correctly if the spin lock size and alignment values
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseSynchronizationLib/SynchronizationGcc.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseSynchronizationLib/SynchronizationGcc.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseSynchronizationLib/SynchronizationGcc.c	(revision 58459)
@@ -2,5 +2,5 @@
   Implementation of synchronization functions.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
   This program and the accompanying materials
@@ -29,6 +29,6 @@
 
   This function retrieves the spin lock alignment requirements for optimal
-  performance on a given CPU architecture. The spin lock alignment must be a
-  power of two and is returned by this function. If there are no alignment
+  performance on a given CPU architecture. The spin lock alignment is byte alignment. 
+  It must be a power of two and is returned by this function. If there are no alignment
   requirements, then 1 must be returned. The spin lock synchronization
   functions must function correctly if the spin lock size and alignment values
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseSynchronizationLib/SynchronizationMsc.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseSynchronizationLib/SynchronizationMsc.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseSynchronizationLib/SynchronizationMsc.c	(revision 58459)
@@ -2,5 +2,5 @@
   Implementation of synchronization functions.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -31,6 +31,6 @@
 
   This function retrieves the spin lock alignment requirements for optimal
-  performance on a given CPU architecture. The spin lock alignment must be a
-  power of two and is returned by this function. If there are no alignment
+  performance on a given CPU architecture. The spin lock alignment is byte alignment. 
+  It must be a power of two and is returned by this function. If there are no alignment
   requirements, then 1 must be returned. The spin lock synchronization
   functions must function correctly if the spin lock size and alignment values
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf	(revision 58459)
@@ -7,5 +7,5 @@
 #  services as well as EBC modules that require timer services.
 #
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -22,4 +22,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BaseTimerLibNullTemplate
+  MODULE_UNI_FILE                = BaseTimerLibNullTemplate.uni
   FILE_GUID                      = f4731d79-537e-4505-bd52-c03f9b1f6b89
   MODULE_TYPE                    = BASE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c	(revision 58459)
@@ -2,5 +2,5 @@
   UEFI Decompress Library implementation refer to UEFI specification.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
   Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
   This program and the accompanying materials
@@ -334,4 +334,5 @@
   UINT32  Mask;
 
+  ASSERT (nn <= NPT);
   //
   // Read Extra Set Code Length Array size 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf	(revision 58459)
@@ -2,5 +2,5 @@
 #  UEFI Decompress Library implementation.
 #
-#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -17,4 +17,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = BaseUefiDecompressLib
+  MODULE_UNI_FILE                = BaseUefiDecompressLib.uni
   FILE_GUID                      = 9ae5147d-b240-467f-a484-b024fdc42ee0
   MODULE_TYPE                    = BASE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf	(revision 58459)
@@ -2,5 +2,5 @@
 # Module entry point library for DXE core.
 #
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -17,4 +17,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = DxeCoreEntryPoint
+  MODULE_UNI_FILE                = DxeCoreEntryPoint.uni
   FILE_GUID                      = d258d6af-2fc0-4019-9c1f-1101c3dd19b5
   MODULE_TYPE                    = DXE_CORE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf	(revision 58459)
@@ -5,5 +5,5 @@
 #  Uses gHobList defined in the DXE Core Entry Point Library.
 #
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = DxeCoreHobLib
+  MODULE_UNI_FILE                = DxeCoreHobLib.uni
   FILE_GUID                      = 882ee1a3-35b2-412c-b8a2-7a8d34a7c390
   MODULE_TYPE                    = DXE_CORE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeCoreHobLib/HobLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeCoreHobLib/HobLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeCoreHobLib/HobLib.c	(revision 58459)
@@ -2,5 +2,5 @@
   HOB Library implementation for DxeCore driver.
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
@@ -241,4 +241,36 @@
 
 /**
+  Builds a HOB that describes a chunk of system memory with Owner GUID.
+
+  This function builds a HOB that describes a chunk of system memory.
+  It can only be invoked during PEI phase;
+  for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
+  
+  If there is no additional space for HOB creation, then ASSERT().
+
+  @param  ResourceType        The type of resource described by this HOB.
+  @param  ResourceAttribute   The resource attributes of the memory described by this HOB.
+  @param  PhysicalStart       The 64 bit physical address of memory described by this HOB.
+  @param  NumberOfBytes       The length of the memory described by this HOB in bytes.
+  @param  OwnerGUID           GUID for the owner of this resource.
+
+**/
+VOID
+EFIAPI
+BuildResourceDescriptorWithOwnerHob (
+  IN EFI_RESOURCE_TYPE            ResourceType,
+  IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
+  IN EFI_PHYSICAL_ADDRESS         PhysicalStart,
+  IN UINT64                       NumberOfBytes,
+  IN EFI_GUID                     *OwnerGUID
+  )
+{
+  //
+  // PEI HOB is read only for DXE phase
+  //
+  ASSERT (FALSE);
+}
+
+/**
   Builds a HOB that describes a chunk of system memory.
 
@@ -282,5 +314,6 @@
   If Guid is NULL, then ASSERT().
   If there is no additional space for HOB creation, then ASSERT().
-  If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
+  If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
+  HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.
 
   @param  Guid          The GUID to tag the customized HOB.
@@ -319,5 +352,6 @@
   If Data is NULL and DataLength > 0, then ASSERT().
   If there is no additional space for HOB creation, then ASSERT().
-  If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
+  If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
+  HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.
 
   @param  Guid          The GUID to tag the customized HOB.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeExtendedSalLib/DxeExtendedSalLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeExtendedSalLib/DxeExtendedSalLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeExtendedSalLib/DxeExtendedSalLib.inf	(revision 58459)
@@ -2,5 +2,5 @@
 #  The library implements the Extended SAL Library Class for boot service only modules.
 #
-#  Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -16,4 +16,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = DxeExtendedSalLib
+  MODULE_UNI_FILE                = DxeExtendedSalLib.uni
   FILE_GUID                      = 8FDED21D-7AB5-4c26-8CF7-20EC4DB9861D
   MODULE_TYPE                    = DXE_DRIVER
@@ -39,6 +40,7 @@
 
 [Protocols]
-  gEfiExtendedSalBootServiceProtocolGuid        # PROTOCOL ALWAYS_CONSUMED
+  gEfiExtendedSalBootServiceProtocolGuid        ## CONSUMES
 
 [Depex.common.DXE_DRIVER]
   gEfiExtendedSalBootServiceProtocolGuid
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c	(revision 58459)
@@ -2,5 +2,5 @@
   Provide generic extract guided section functions for Dxe phase.
 
-  Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -19,4 +19,5 @@
 #include <Library/MemoryAllocationLib.h>
 #include <Library/ExtractGuidedSectionLib.h>
+#include <Library/UefiBootServicesTableLib.h>
 
 #define EXTRACT_HANDLER_TABLE_SIZE   0x10
@@ -176,4 +177,6 @@
 {
   UINT32 Index;
+  VOID   *GuidData;
+
   //
   // Check input paramter.
@@ -212,5 +215,14 @@
   mExtractDecodeHandlerTable [mNumberOfExtractHandler] = DecodeHandler;
   mExtractGetInfoHandlerTable [mNumberOfExtractHandler++] = GetInfoHandler;
-  
+
+  //
+  // Install the Guided Section GUID configuration table to record the GUID itself.
+  // Then the content of the configuration table buffer will be the same as the GUID value itself.
+  //
+  GuidData = AllocateCopyPool (sizeof (GUID), (VOID *) SectionGuid);
+  if (GuidData != NULL) {
+    gBS->InstallConfigurationTable ((EFI_GUID *) SectionGuid, GuidData);
+  }
+
   return RETURN_SUCCESS;
 }
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf	(revision 58459)
@@ -4,5 +4,5 @@
 # This library provides generic extract guided section functions for DXE module.
 #
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -19,4 +19,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = DxeExtractGuidedSectionLib
+  MODULE_UNI_FILE                = DxeExtractGuidedSectionLib.uni
   FILE_GUID                      = f773469b-e265-4b0c-b0a6-2f971fbfe72b
   MODULE_TYPE                    = DXE_DRIVER
@@ -43,3 +44,4 @@
   BaseMemoryLib
   DebugLib
+  UefiBootServicesTableLib
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeHobLib/DxeHobLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeHobLib/DxeHobLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeHobLib/DxeHobLib.inf	(revision 58459)
@@ -5,5 +5,5 @@
 #  from the System Configuration Table in the EFI System Table.
 #
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = DxeHobLib
+  MODULE_UNI_FILE                = DxeHobLib.uni
   FILE_GUID                      = f12b59c9-76d0-4661-ad7c-f04d1bef0558
   MODULE_TYPE                    = DXE_DRIVER
@@ -44,4 +45,4 @@
     
 [Guids]
-  gEfiHobListGuid                               ## CONSUMES
+  gEfiHobListGuid                               ## CONSUMES  ## SystemTable
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeHobLib/HobLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeHobLib/HobLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeHobLib/HobLib.c	(revision 58459)
@@ -2,5 +2,5 @@
   HOB Library implemenation for Dxe Phase.
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
@@ -274,4 +274,36 @@
 
 /**
+  Builds a HOB that describes a chunk of system memory with Owner GUID.
+
+  This function builds a HOB that describes a chunk of system memory.
+  It can only be invoked during PEI phase;
+  for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
+  
+  If there is no additional space for HOB creation, then ASSERT().
+
+  @param  ResourceType        The type of resource described by this HOB.
+  @param  ResourceAttribute   The resource attributes of the memory described by this HOB.
+  @param  PhysicalStart       The 64 bit physical address of memory described by this HOB.
+  @param  NumberOfBytes       The length of the memory described by this HOB in bytes.
+  @param  OwnerGUID           GUID for the owner of this resource.
+
+**/
+VOID
+EFIAPI
+BuildResourceDescriptorWithOwnerHob (
+  IN EFI_RESOURCE_TYPE            ResourceType,
+  IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
+  IN EFI_PHYSICAL_ADDRESS         PhysicalStart,
+  IN UINT64                       NumberOfBytes,
+  IN EFI_GUID                     *OwnerGUID
+  )
+{
+  //
+  // PEI HOB is read only for DXE phase
+  //
+  ASSERT (FALSE);
+}
+
+/**
   Builds a HOB that describes a chunk of system memory.
 
@@ -315,5 +347,6 @@
   If Guid is NULL, then ASSERT().
   If there is no additional space for HOB creation, then ASSERT().
-  If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
+  If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
+  HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.
 
   @param  Guid          The GUID to tag the customized HOB.
@@ -352,5 +385,6 @@
   If Data is NULL and DataLength > 0, then ASSERT().
   If there is no additional space for HOB creation, then ASSERT().
-  If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
+  If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
+  HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.
 
   @param  Guid          The GUID to tag the customized HOB.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeIoLibCpuIo2/DxeIoLibCpuIo2.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeIoLibCpuIo2/DxeIoLibCpuIo2.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeIoLibCpuIo2/DxeIoLibCpuIo2.inf	(revision 58459)
@@ -4,5 +4,5 @@
 # I/O Library implementation that uses the CPU I/O2 Protocol for I/O and MMIO operations.
 #
-# Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
 # This program and the accompanying materials are licensed and made available
 # under the terms and conditions of the BSD License which accompanies this 
@@ -19,4 +19,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = DxeIoLibCpuIo2
+  MODULE_UNI_FILE                = DxeIoLibCpuIo2.uni
   FILE_GUID                      = 33D33BF3-349E-4768-9459-836A9F7558FB
   MODULE_TYPE                    = DXE_DRIVER
@@ -50,2 +51,3 @@
 [Depex]
   gEfiCpuIo2ProtocolGuid
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeIoLibCpuIo2/IoHighLevel.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeIoLibCpuIo2/IoHighLevel.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeIoLibCpuIo2/IoHighLevel.c	(revision 58459)
@@ -5,5 +5,5 @@
   Base Library.
 
-  Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials are licensed and made available
   under the terms and conditions of the BSD License which accompanies this
@@ -149,4 +149,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -189,4 +190,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -229,4 +231,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -271,4 +274,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -429,4 +434,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -469,4 +475,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -509,4 +516,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -551,4 +559,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -709,4 +719,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -749,4 +760,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -789,4 +801,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -831,4 +844,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -989,4 +1004,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1029,4 +1045,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1069,4 +1086,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1111,4 +1129,6 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1269,4 +1289,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1310,4 +1331,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1351,4 +1373,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1393,4 +1416,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1551,4 +1576,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1592,4 +1618,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1633,4 +1660,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1675,4 +1703,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1833,4 +1863,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1874,4 +1905,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1915,4 +1947,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1957,4 +1990,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -2115,4 +2150,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -2156,4 +2192,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -2197,4 +2234,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -2239,4 +2277,6 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeIoLibEsal/DxeIoLibEsal.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeIoLibEsal/DxeIoLibEsal.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeIoLibEsal/DxeIoLibEsal.inf	(revision 58459)
@@ -1,10 +1,9 @@
 ## @file
-# Component description file for a CPU I/O Library that layers on top of 
-# Itanium ESAL services.
+# I/O Library instance that layers on top of Itanium ESAL services.
 #
 # I/O Library implementation that uses Itanium ESAL services for I/O
 #  and MMIO operations.
 #
-# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 # This program and the accompanying materials are licensed and made available
 # under the terms and conditions of the BSD License which accompanies this 
@@ -15,9 +14,10 @@
 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #
-#
+##
 
 [Defines]
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = DxeIoLibEsal
+  MODULE_UNI_FILE                = DxeIoLibEsal.uni
   FILE_GUID                      = 0D8E6E4E-B029-475f-9122-60A3FEDBA8C0
   MODULE_TYPE                    = DXE_DRIVER
@@ -47,2 +47,3 @@
 [Depex]
   gEfiExtendedSalBaseIoServicesProtocolGuid
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeIoLibEsal/IoHighLevel.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeIoLibEsal/IoHighLevel.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeIoLibEsal/IoHighLevel.c	(revision 58459)
@@ -2,5 +2,5 @@
   High-level Io/Mmio functions.
 
-  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -145,4 +145,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -185,4 +186,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -225,4 +227,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -267,4 +270,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -425,4 +430,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -465,4 +471,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -505,4 +512,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -547,4 +555,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -705,4 +715,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -745,4 +756,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -785,4 +797,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -827,4 +840,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -985,4 +1000,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1025,4 +1041,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1065,4 +1082,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1107,4 +1125,6 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1265,4 +1285,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -1306,4 +1327,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -1347,4 +1369,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -1389,4 +1412,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -1547,4 +1572,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -1588,4 +1614,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -1629,4 +1656,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -1671,4 +1699,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -1829,4 +1859,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -1870,4 +1901,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -1911,4 +1943,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -1953,4 +1986,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -2111,4 +2146,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -2152,4 +2188,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -2193,4 +2230,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -2235,4 +2273,6 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxePalLibEsal/DxePalLibEsal.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxePalLibEsal/DxePalLibEsal.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxePalLibEsal/DxePalLibEsal.inf	(revision 58459)
@@ -2,5 +2,5 @@
 #  Instance of PAL Library Class using Extended SAL functions
 #
-#  Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -16,4 +16,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = DxePalLibEsal
+  MODULE_UNI_FILE                = DxePalLibEsal.uni
   FILE_GUID                      = 8BA65DE3-39E1-4afd-A8FE-7DD0BAFEFCC0
   MODULE_TYPE                    = DXE_DRIVER
@@ -38,2 +39,3 @@
 [Depex.common.DXE_DRIVER, Depex.common.DXE_RUNTIME_DRIVER, Depex.common.DXE_SAL_DRIVER, Depex.common.DXE_SMM_DRIVER]
   gEfiExtendedSalPalServicesProtocolGuid
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxePcdLib/DxePcdLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxePcdLib/DxePcdLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxePcdLib/DxePcdLib.c	(revision 58459)
@@ -2,5 +2,5 @@
 Implementation of PcdLib class library for DXE phase.
 
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials                          
 are licensed and made available under the terms and conditions of the BSD License         
@@ -19,4 +19,6 @@
 #include <Protocol/Pcd.h>
 #include <Protocol/PiPcd.h>
+#include <Protocol/PcdInfo.h>
+#include <Protocol/PiPcdInfo.h>
 
 #include <Library/PcdLib.h>
@@ -25,9 +27,13 @@
 #include <Library/BaseMemoryLib.h>
 
-PCD_PROTOCOL     *mPcd   = NULL;
-EFI_PCD_PROTOCOL *mPiPcd = NULL;
+PCD_PROTOCOL                *mPcd       = NULL;
+EFI_PCD_PROTOCOL            *mPiPcd     = NULL;
+GET_PCD_INFO_PROTOCOL       *mPcdInfo   = NULL;
+EFI_GET_PCD_INFO_PROTOCOL   *mPiPcdInfo = NULL;
 
 /**
   Retrieves the PI PCD protocol from the handle database.
+
+  @retval EFI_PCD_PROTOCOL * The pointer to the EFI_PCD_PROTOCOL.
 **/
 EFI_PCD_PROTOCOL *
@@ -53,4 +59,6 @@
 /**
   Retrieves the PCD protocol from the handle database.
+
+  @retval PCD_PROTOCOL * The pointer to the PCD_PROTOCOL.
 **/
 PCD_PROTOCOL *
@@ -74,4 +82,43 @@
 }
 
+/**
+  Retrieves the PI PCD info protocol from the handle database.
+
+  @retval EFI_GET_PCD_INFO_PROTOCOL * The pointer to the EFI_GET_PCD_INFO_PROTOCOL defined in PI 1.2.1 Vol 3.
+**/
+EFI_GET_PCD_INFO_PROTOCOL *
+GetPiPcdInfoProtocolPointer (
+  VOID
+  )
+{
+  EFI_STATUS  Status;
+
+  if (mPiPcdInfo == NULL) {
+    Status = gBS->LocateProtocol (&gEfiGetPcdInfoProtocolGuid, NULL, (VOID **)&mPiPcdInfo);
+    ASSERT_EFI_ERROR (Status);
+    ASSERT (mPiPcdInfo != NULL);
+  }
+  return mPiPcdInfo;
+}
+
+/**
+  Retrieves the PCD info protocol from the handle database.
+
+  @retval GET_PCD_INFO_PROTOCOL * The pointer to the GET_PCD_INFO_PROTOCOL.
+**/
+GET_PCD_INFO_PROTOCOL *
+GetPcdInfoProtocolPointer (
+  VOID
+  ) 
+{
+  EFI_STATUS  Status;
+
+  if (mPcdInfo == NULL) {
+    Status = gBS->LocateProtocol (&gGetPcdInfoProtocolGuid, NULL, (VOID **)&mPcdInfo);
+    ASSERT_EFI_ERROR (Status);
+    ASSERT (mPcdInfo != NULL);
+  }
+  return mPcdInfo;
+}
 
 /**
@@ -443,5 +490,7 @@
   Sets the 8-bit value for the token specified by TokenNumber 
   to the value specified by Value.  Value is returned.
-  
+
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  TokenNumber   The PCD token number to set a current value for.
   @param[in]  Value         The 8-bit value to set.
@@ -472,5 +521,7 @@
   Sets the 16-bit value for the token specified by TokenNumber 
   to the value specified by Value.  Value is returned.
-  
+
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  TokenNumber   The PCD token number to set a current value for.
   @param[in]  Value         The 16-bit value to set.
@@ -501,5 +552,7 @@
   Sets the 32-bit value for the token specified by TokenNumber 
   to the value specified by Value.  Value is returned.
-  
+
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  TokenNumber   The PCD token number to set a current value for.
   @param[in]  Value         The 32-bit value to set.
@@ -530,4 +583,6 @@
   Sets the 64-bit value for the token specified by TokenNumber 
   to the value specified by Value.  Value is returned.
+
+  If the set operation was not correctly performed, then ASSERT().
   
   @param[in]  TokenNumber   The PCD token number to set a current value for.
@@ -561,5 +616,6 @@
   If SizeOfBuffer is greater than the maximum size support by TokenNumber, 
   then set SizeOfBuffer to the maximum size supported by TokenNumber and 
-  return NULL to indicate that the set operation was not actually performed.  
+  return NULL to indicate that the set operation was not actually performed,
+  or ASSERT() if the set operation was not correctly performed.
 
   If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the 
@@ -585,4 +641,5 @@
 {
   EFI_STATUS Status;
+  UINTN      InputSizeOfBuffer;
 
   ASSERT (SizeOfBuffer != NULL);
@@ -592,8 +649,10 @@
   }
 
+  InputSizeOfBuffer = *SizeOfBuffer;
   Status = GetPcdProtocol()->SetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer);
-  if (EFI_ERROR (Status)) {
+  if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) {
     return NULL;
   }
+  ASSERT_EFI_ERROR (Status);
 
   return (VOID *)Buffer;
@@ -607,5 +666,7 @@
   Sets the Boolean value for the token specified by TokenNumber 
   to the value specified by Value.  Value is returned.
-  
+
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  TokenNumber   The PCD token number to set a current value for.
   @param[in]  Value         The boolean value to set.
@@ -636,7 +697,8 @@
   Sets the 8-bit value for the token specified by TokenNumber and 
   Guid to the value specified by Value. Value is returned.
-  
+
   If Guid is NULL, then ASSERT().
-  
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  Guid          The pointer to a 128-bit unique value that 
                             designates which namespace to set a value from.
@@ -672,7 +734,8 @@
   Sets the 16-bit value for the token specified by TokenNumber and 
   Guid to the value specified by Value. Value is returned.
-  
+
   If Guid is NULL, then ASSERT().
-  
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  Guid          The pointer to a 128-bit unique value that 
                             designates which namespace to set a value from.
@@ -708,7 +771,8 @@
   Sets the 32-bit value for the token specified by TokenNumber and 
   Guid to the value specified by Value. Value is returned.
-  
+
   If Guid is NULL, then ASSERT().
-  
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  Guid          The pointer to a 128-bit unique value that 
                             designates which namespace to set a value from.
@@ -744,6 +808,8 @@
   Sets the 64-bit value for the token specified by TokenNumber and 
   Guid to the value specified by Value. Value is returned.
+
   If Guid is NULL, then ASSERT().
-  
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  Guid          The pointer to a 128-bit unique value that 
                             designates which namespace to set a value from.
@@ -781,5 +847,5 @@
   the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size 
   supported by TokenNumber and return NULL to indicate that the set operation 
-  was not actually performed. 
+  was not actually performed, or ASSERT() if the set operation was not corretly performed.
   
   If Guid is NULL, then ASSERT().
@@ -806,4 +872,5 @@
 {
   EFI_STATUS  Status;
+  UINTN       InputSizeOfBuffer;
 
   ASSERT (Guid != NULL);
@@ -815,8 +882,10 @@
   }
 
+  InputSizeOfBuffer = *SizeOfBuffer;
   Status = GetPiPcdProtocol()->SetPtr (Guid, TokenNumber, SizeOfBuffer, Buffer);
-  if (EFI_ERROR (Status)) {
+  if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) {
     return NULL;
   }
+  ASSERT_EFI_ERROR (Status);
 
   return Buffer;
@@ -830,7 +899,8 @@
   Sets the Boolean value for the token specified by TokenNumber and 
   Guid to the value specified by Value. Value is returned.
-  
+
   If Guid is NULL, then ASSERT().
-  
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  Guid          The pointer to a 128-bit unique value that 
                             designates which namespace to set a value from.
@@ -956,8 +1026,8 @@
   )
 {
-  EFI_STATUS Status;
+  EFI_STATUS    Status;
 
   Status = GetPiPcdProtocol()->GetNextToken (Guid, &TokenNumber);
-  ASSERT_EFI_ERROR (Status);
+  ASSERT (!EFI_ERROR (Status) || TokenNumber == 0);
 
   return TokenNumber;
@@ -985,8 +1055,5 @@
   )
 {
-  EFI_STATUS Status;
-
-  Status = GetPiPcdProtocol()->GetNextTokenSpace (&TokenSpaceGuid);
-  ASSERT_EFI_ERROR (Status);
+  GetPiPcdProtocol()->GetNextTokenSpace (&TokenSpaceGuid);
 
   return (GUID *)TokenSpaceGuid;
@@ -1044,4 +1111,77 @@
 }
 
-
-
+/**
+  Retrieve additional information associated with a PCD token.
+
+  This includes information such as the type of value the TokenNumber is associated with as well as possible
+  human readable name that is associated with the token.
+
+  If TokenNumber is not in the default token space specified, then ASSERT().
+
+  @param[in]    TokenNumber The PCD token number.
+  @param[out]   PcdInfo     The returned information associated with the requested TokenNumber.
+                            The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
+**/
+VOID
+EFIAPI
+LibPcdGetInfo (
+  IN        UINTN           TokenNumber,
+  OUT       PCD_INFO        *PcdInfo
+  )
+{
+  EFI_STATUS Status;
+
+  Status = GetPcdInfoProtocolPointer()->GetInfo (TokenNumber, (EFI_PCD_INFO *) PcdInfo);
+  ASSERT_EFI_ERROR (Status);
+}
+
+/**
+  Retrieve additional information associated with a PCD token.
+
+  This includes information such as the type of value the TokenNumber is associated with as well as possible
+  human readable name that is associated with the token.
+
+  If TokenNumber is not in the token space specified by Guid, then ASSERT().
+
+  @param[in]    Guid        The 128-bit unique value that designates the namespace from which to extract the value.
+  @param[in]    TokenNumber The PCD token number.
+  @param[out]   PcdInfo     The returned information associated with the requested TokenNumber.
+                            The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
+**/
+VOID
+EFIAPI
+LibPcdGetInfoEx (
+  IN CONST  GUID            *Guid,
+  IN        UINTN           TokenNumber,
+  OUT       PCD_INFO        *PcdInfo
+  )
+{
+  EFI_STATUS Status;
+
+  Status = GetPiPcdInfoProtocolPointer()->GetInfo (Guid, TokenNumber, (EFI_PCD_INFO *) PcdInfo);
+  ASSERT_EFI_ERROR (Status);
+}
+
+/**
+  Retrieve the currently set SKU Id.
+
+  If the sku id got >= PCD_MAX_SKU_ID, then ASSERT().
+
+  @return   The currently set SKU Id. If the platform has not set at a SKU Id, then the
+            default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU
+            Id is returned.
+**/
+UINTN
+EFIAPI
+LibPcdGetSku (
+  VOID
+  )
+{
+  UINTN SkuId;
+
+  SkuId = GetPiPcdInfoProtocolPointer()->GetSku ();
+  ASSERT (SkuId < PCD_MAX_SKU_ID);
+
+  return SkuId;
+}
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxePcdLib/DxePcdLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxePcdLib/DxePcdLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxePcdLib/DxePcdLib.inf	(revision 58459)
@@ -2,5 +2,5 @@
 # Instance of PCD Library using PCD Protocol.
 #
-# There are two PCD PPIs as follows:
+# There are two PCD protocols as follows:
 #   1) PCD_PROTOCOL
 #      It is EDKII implementation which support Dynamic/DynamicEx Pcds.
@@ -14,5 +14,10 @@
 # EFI_PCD_PROTOCOL to handle dynamicEx type PCD.
 #
-# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+# Note: A driver of type DXE_RUNTIME_DRIVER and DXE_SMM_DRIVER can only use this DxePcdLib 
+#  in their initialization without any issues to access Dynamic and DynamicEx PCD. They can't 
+#  access Dynamic and DynamicEx PCD in the implementation of runtime services and SMI handlers.
+#  Because EFI_PCD_PROTOCOL is DXE protocol that is not aviable in OS runtime phase.  
+#
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -29,4 +34,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = DxePcdLib
+  MODULE_UNI_FILE                = DxePcdLib.uni
   FILE_GUID                      = af97eb89-4cc6-45f8-a514-ca025b346480
   MODULE_TYPE                    = DXE_DRIVER
@@ -53,6 +59,8 @@
 
 [Protocols]
-  gPcdProtocolGuid                              ## CONSUMES
+  gPcdProtocolGuid                              ## SOMETIMES_CONSUMES
   gEfiPcdProtocolGuid                           ## CONSUMES
+  gGetPcdInfoProtocolGuid                       ## SOMETIMES_CONSUMES
+  gEfiGetPcdInfoProtocolGuid                    ## SOMETIMES_CONSUMES
 
 [Depex.common.DXE_DRIVER, Depex.common.DXE_RUNTIME_DRIVER, Depex.common.DXE_SAL_DRIVER, Depex.common.DXE_SMM_DRIVER]
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxePciLibEsal/DxePciLibEsal.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxePciLibEsal/DxePciLibEsal.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxePciLibEsal/DxePciLibEsal.inf	(revision 58459)
@@ -2,5 +2,5 @@
 #  PCI Library that uses ESAL services to perform PCI Configuration cycles.
 #
-#  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -16,4 +16,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = DxePciLibEsal
+  MODULE_UNI_FILE                = DxePciLibEsal.uni
   FILE_GUID                      = E3441740-3B41-4c90-9C9D-964056C7417D
   MODULE_TYPE                    = DXE_DRIVER
@@ -37,2 +38,3 @@
   DebugLib
   BaseLib
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxePciLibEsal/PciLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxePciLibEsal/PciLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxePciLibEsal/PciLib.c	(revision 58459)
@@ -2,5 +2,5 @@
   DXE PCI Library instance layered on top of ESAL services.
 
-  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -393,4 +393,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -434,4 +435,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -475,4 +477,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -518,4 +521,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -744,4 +749,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -786,4 +792,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -828,4 +835,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -872,4 +880,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -1098,4 +1108,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -1140,4 +1151,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -1182,4 +1194,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -1226,4 +1239,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxePciSegmentLibEsal/DxePciSegmentLibEsal.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxePciSegmentLibEsal/DxePciSegmentLibEsal.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxePciSegmentLibEsal/DxePciSegmentLibEsal.inf	(revision 58459)
@@ -2,5 +2,5 @@
 #  PCI Segment Library that uses ESAL services to perform PCI Configuration cycles.
 #
-#  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -16,4 +16,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = DxePciSegementLibEsal
+  MODULE_UNI_FILE                = DxePciSegementLibEsal.uni
   FILE_GUID                      = 6D497A7A-D7DA-467c-B485-B7FB3493C41F
   MODULE_TYPE                    = DXE_DRIVER
@@ -37,2 +38,3 @@
   DebugLib
   BaseLib
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxePciSegmentLibEsal/PciLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxePciSegmentLibEsal/PciLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxePciSegmentLibEsal/PciLib.c	(revision 58459)
@@ -2,5 +2,5 @@
   DXE PCI Segment Library instance layered on top of ESAL services.
 
-  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -365,4 +365,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -406,4 +407,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -447,4 +449,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -490,4 +493,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -709,4 +714,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -750,4 +756,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -791,4 +798,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -834,4 +842,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -1053,4 +1063,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -1094,4 +1105,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -1135,4 +1147,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
@@ -1178,4 +1191,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   PCI configuration register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeRuntimeExtendedSalLib/DxeRuntimeExtendedSalLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeRuntimeExtendedSalLib/DxeRuntimeExtendedSalLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeRuntimeExtendedSalLib/DxeRuntimeExtendedSalLib.inf	(revision 58459)
@@ -2,5 +2,5 @@
 #  This library implements the Extended SAL Library Class for use in boot services and runtime.
 #
-#  Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -16,4 +16,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = DxeRuntimeExtendedSalLib
+  MODULE_UNI_FILE                = DxeRuntimeExtendedSalLib.uni
   FILE_GUID                      = AE66715B-75F5-4423-8FAD-A4AFB3C53ACF
   MODULE_TYPE                    = DXE_RUNTIME_DRIVER
@@ -42,9 +43,10 @@
 
 [Protocols]
-  gEfiExtendedSalBootServiceProtocolGuid        # PROTOCOL ALWAYS_CONSUMED
+  gEfiExtendedSalBootServiceProtocolGuid        ## CONSUMES
 
 [Guids]
-  gEfiEventVirtualAddressChangeGuid
+  gEfiEventVirtualAddressChangeGuid   ## CONSUMES  ## Event
 
 [Depex]
   gEfiExtendedSalBootServiceProtocolGuid
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeRuntimePciExpressLib/DxeRuntimePciExpressLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeRuntimePciExpressLib/DxeRuntimePciExpressLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeRuntimePciExpressLib/DxeRuntimePciExpressLib.inf	(revision 58459)
@@ -8,5 +8,5 @@
 #  proper virtual address is used to perform the PCI Express Configuration cycle.
 #
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -23,4 +23,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = DxeRuntimePciExpressLib
+  MODULE_UNI_FILE                = DxeRuntimePciExpressLib.uni
   FILE_GUID                      = 54DCBCE5-92AD-41f5-AAAF-1170F16DA6A8
   MODULE_TYPE                    = DXE_RUNTIME_DRIVER
@@ -54,3 +55,4 @@
 
 [Guids]
-  gEfiEventVirtualAddressChangeGuid         ## PRODUCES ## Event
+  gEfiEventVirtualAddressChangeGuid         ## CONSUMES ## Event
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeRuntimePciExpressLib/PciExpressLib.c	(revision 58459)
@@ -6,5 +6,5 @@
   Library.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -546,4 +546,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -589,4 +590,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -632,4 +634,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -677,4 +680,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -910,4 +915,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -954,4 +960,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -998,4 +1005,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1044,4 +1052,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1277,4 +1287,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1321,4 +1332,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1365,4 +1377,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1411,4 +1424,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeSalLibEsal/DxeSalLibEsal.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeSalLibEsal/DxeSalLibEsal.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeSalLibEsal/DxeSalLibEsal.inf	(revision 58459)
@@ -2,5 +2,5 @@
 #  This library implements the SAL Library Class using Extended SAL functions
 #
-#  Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -16,4 +16,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = DxeSalLibEsal
+  MODULE_UNI_FILE                = DxeSalLibEsal.uni
   FILE_GUID                      = 2B73B074-2E67-498b-82AC-CE38FB770FFC
   MODULE_TYPE                    = DXE_DRIVER
@@ -35,2 +36,3 @@
 [LibraryClasses]
   ExtendedSalLib
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeServicesLib/DxeServicesLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeServicesLib/DxeServicesLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeServicesLib/DxeServicesLib.c	(revision 58459)
@@ -3,5 +3,5 @@
   These functions help access data from sections of FFS files or from file path.
 
-  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -579,5 +579,5 @@
   Allocate memory to store the found image. The caller is responsible to free memory.
 
-  If File is NULL, then NULL is returned.
+  If FilePath is NULL, then NULL is returned.
   If FileSize is NULL, then NULL is returned.
   If AuthenticationStatus is NULL, then NULL is returned.
@@ -593,8 +593,7 @@
   @param[out]      FileSize             The pointer to the size of the abstracted 
                                         file buffer.
-  @param[out]      AuthenticationStatus The pointer to a caller-allocated UINT32 
-                                        in which the authentication status is returned.
-
-  @retval NULL   File is NULL, or FileSize is NULL. Or, the file can't be found.
+  @param[out]      AuthenticationStatus Pointer to the authentication status.
+
+  @retval NULL   FilePath is NULL, or FileSize is NULL, or AuthenticationStatus is NULL, or the file can't be found.
   @retval other  The abstracted file buffer. The caller is responsible to free memory.
 **/
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeServicesLib/DxeServicesLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeServicesLib/DxeServicesLib.inf	(revision 58459)
@@ -1,8 +1,10 @@
 ## @file
+# DXE Services Library instance provides functions that simplify the development of DXE Drivers.
+#
 # DXE Services Library provides access data from sections of FFS files based on FV protocol.
 # It also provides access file based on file path from a firmware volume, 
 # from a file system interface, or from the load file interface.
 #
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -19,4 +21,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = DxeServicesLib
+  MODULE_UNI_FILE                = DxeServicesLib.uni
   FILE_GUID                      = EE680C58-FFC0-4a5d-858F-66FF9C84BC9F
   MODULE_TYPE                    = DXE_DRIVER
@@ -43,10 +46,11 @@
 
 [Guids]
-  gEfiFileInfoGuid                              ## CONSUMES
+  gEfiFileInfoGuid                              ## SOMETIMES_CONSUMES ## UNDEFINED
 
 [Protocols]
-  gEfiFirmwareVolume2ProtocolGuid               ## CONSUMES
-  gEfiLoadedImageProtocolGuid                   ## CONSUMES
-  gEfiLoadFileProtocolGuid                      ## CONSUMES
-  gEfiLoadFile2ProtocolGuid                     ## CONSUMES 
-  gEfiSimpleFileSystemProtocolGuid              ## CONSUMES 
+  gEfiFirmwareVolume2ProtocolGuid               ## SOMETIMES_CONSUMES
+  gEfiLoadedImageProtocolGuid                   ## SOMETIMES_CONSUMES
+  gEfiLoadFileProtocolGuid                      ## SOMETIMES_CONSUMES
+  gEfiLoadFile2ProtocolGuid                     ## SOMETIMES_CONSUMES 
+  gEfiSimpleFileSystemProtocolGuid              ## SOMETIMES_CONSUMES 
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf	(revision 58459)
@@ -5,5 +5,5 @@
 # Table from the Configuration Table in the EFI System Table.
 #
-# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = DxeServicesTableLib
+  MODULE_UNI_FILE                = DxeServicesTableLib.uni
   FILE_GUID                      = baa1baa3-0a8d-402c-8042-985115fae953
   MODULE_TYPE                    = DXE_DRIVER
@@ -45,4 +46,4 @@
 
 [Guids]
-  gEfiDxeServicesTableGuid                      ## CONSUMES
+  gEfiDxeServicesTableGuid                      ## CONSUMES  ## SystemTable
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeSmbusLib/DxeSmbusLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeSmbusLib/DxeSmbusLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeSmbusLib/DxeSmbusLib.inf	(revision 58459)
@@ -2,5 +2,5 @@
 # SMBUS Library that layers on top of the SMBUS Protocol.
 #
-# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -17,4 +17,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = DxeSmbusLib
+  MODULE_UNI_FILE                = DxeSmbusLib.uni
   FILE_GUID                      = 4F369FB1-31A7-423c-960E-B3EFD337894F
   MODULE_TYPE                    = DXE_DRIVER
@@ -48,2 +49,3 @@
 [Depex.common.DXE_DRIVER, Depex.common.DXE_RUNTIME_DRIVER, Depex.common.DXE_SAL_DRIVER, Depex.common.DXE_SMM_DRIVER]
   gEfiSmbusHcProtocolGuid
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeTimerLibEsal/DxeTimerLibEsal.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeTimerLibEsal/DxeTimerLibEsal.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/DxeTimerLibEsal/DxeTimerLibEsal.inf	(revision 58459)
@@ -2,5 +2,5 @@
 #  This library implements the Timer Library using the Extended SAL Stall Services Class.
 #
-#  Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -16,4 +16,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = DxeTimerLibEsal
+  MODULE_UNI_FILE                = DxeTimerLibEsal.uni
   FILE_GUID                      = F672AE85-3769-4fb8-A5A0-70B38FB0A7C4
   MODULE_TYPE                    = DXE_DRIVER
@@ -38,2 +39,3 @@
   BaseLib
   PalLib
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf	(revision 58459)
@@ -2,5 +2,5 @@
 # Module entry point library for PEI core.
 #
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -17,4 +17,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = PeiCoreEntryPoint
+  MODULE_UNI_FILE                = PeiCoreEntryPoint.uni
   FILE_GUID                      = b3b0654a-969d-4096-86cb-27e262a02083
   MODULE_TYPE                    = PEI_CORE
@@ -36,2 +37,3 @@
   BaseLib
   DebugLib
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.inf	(revision 58459)
@@ -4,5 +4,5 @@
 # Post Code Library that layers on top of a Report Status Code Libray instance.
 #
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -19,4 +19,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = PeiDxePostCodeLibReportStatusCode
+  MODULE_UNI_FILE                = PeiDxePostCodeLibReportStatusCode.uni
   FILE_GUID                      = e062c52d-78dc-4cc5-b246-b13497a8123c
   MODULE_TYPE                    = PEIM
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c	(revision 58459)
@@ -2,5 +2,5 @@
   Provide generic extract guided section functions for PEI phase.
 
-  Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -244,4 +244,14 @@
   HandlerInfo->ExtractGetInfoHandlerTable [HandlerInfo->NumberOfExtractHandler++] = GetInfoHandler;
 
+  //
+  // Build the Guided Section GUID HOB to record the GUID itself.
+  // Then the content of the GUIDed HOB will be the same as the GUID value itself.
+  //
+  BuildGuidDataHob (
+    (EFI_GUID *) SectionGuid,
+    (VOID *) SectionGuid,
+    sizeof (GUID)
+    );
+
   return RETURN_SUCCESS;
 }
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf	(revision 58459)
@@ -4,5 +4,5 @@
 # This library provides generic extract guided section functions for PEIM and PEI_CORE module.
 #
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -19,4 +19,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = PeiExtractGuidedSectionLib
+  MODULE_UNI_FILE                = PeiExtractGuidedSectionLib.uni
   FILE_GUID                      = 41ddf016-2a11-415f-8880-00d938e9541a
   MODULE_TYPE                    = PEIM
@@ -46,3 +47,2 @@
   gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler     ## CONSUMES
 
-
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiHobLib/HobLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiHobLib/HobLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiHobLib/HobLib.c	(revision 58459)
@@ -2,5 +2,5 @@
   Provide Hob Library functions for Pei phase.
 
-Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
@@ -302,4 +302,45 @@
 
 /**
+  Builds a HOB that describes a chunk of system memory with Owner GUID.
+
+  This function builds a HOB that describes a chunk of system memory.
+  It can only be invoked during PEI phase;
+  for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
+  
+  If there is no additional space for HOB creation, then ASSERT().
+
+  @param  ResourceType        The type of resource described by this HOB.
+  @param  ResourceAttribute   The resource attributes of the memory described by this HOB.
+  @param  PhysicalStart       The 64 bit physical address of memory described by this HOB.
+  @param  NumberOfBytes       The length of the memory described by this HOB in bytes.
+  @param  OwnerGUID           GUID for the owner of this resource.
+
+**/
+VOID
+EFIAPI
+BuildResourceDescriptorWithOwnerHob (
+  IN EFI_RESOURCE_TYPE            ResourceType,
+  IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
+  IN EFI_PHYSICAL_ADDRESS         PhysicalStart,
+  IN UINT64                       NumberOfBytes,
+  IN EFI_GUID                     *OwnerGUID
+  )
+{
+  EFI_HOB_RESOURCE_DESCRIPTOR  *Hob;
+
+  Hob = InternalPeiCreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, (UINT16) sizeof (EFI_HOB_RESOURCE_DESCRIPTOR));
+  if (Hob == NULL) {
+    return;
+  }
+
+  Hob->ResourceType      = ResourceType;
+  Hob->ResourceAttribute = ResourceAttribute;
+  Hob->PhysicalStart     = PhysicalStart;
+  Hob->ResourceLength    = NumberOfBytes;
+
+  CopyGuid (&Hob->Owner, OwnerGUID);
+}
+
+/**
   Builds a HOB that describes a chunk of system memory.
 
@@ -336,4 +377,5 @@
   Hob->PhysicalStart     = PhysicalStart;
   Hob->ResourceLength    = NumberOfBytes;
+  ZeroMem (&(Hob->Owner), sizeof (EFI_GUID));
 }
 
@@ -350,5 +392,6 @@
   If Guid is NULL, then ASSERT().
   If there is no additional space for HOB creation, then ASSERT().
-  If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
+  If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
+  HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.
 
   @param  Guid          The GUID to tag the customized HOB.
@@ -376,5 +419,5 @@
   // Make sure that data length is not too long.
   //
-  ASSERT (DataLength <= (0xffff - sizeof (EFI_HOB_GUID_TYPE)));
+  ASSERT (DataLength <= (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)));
 
   Hob = InternalPeiCreateHob (EFI_HOB_TYPE_GUID_EXTENSION, (UINT16) (sizeof (EFI_HOB_GUID_TYPE) + DataLength));
@@ -400,5 +443,6 @@
   If Data is NULL and DataLength > 0, then ASSERT().
   If there is no additional space for HOB creation, then ASSERT().
-  If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
+  If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
+  HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.
 
   @param  Guid          The GUID to tag the customized HOB.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiHobLib/PeiHobLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiHobLib/PeiHobLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiHobLib/PeiHobLib.inf	(revision 58459)
@@ -4,5 +4,5 @@
 # HOB Library implementation that uses PEI Services to retrieve the HOB List.
 #
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -19,4 +19,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = PeiHobLib
+  MODULE_UNI_FILE                = PeiHobLib.uni
   FILE_GUID                      = 9643128f-ac24-4b3e-b6be-d8849a306153
   MODULE_TYPE                    = PEIM
@@ -43,17 +44,13 @@
 
 [Guids]
-  gEfiHobMemoryAllocStackGuid                   ## PRODUCES ## HOB
-  gEfiHobMemoryAllocBspStoreGuid                ## PRODUCES ## HOB
-  gEfiHobMemoryAllocModuleGuid                  ## PRODUCES ## HOB
+  gEfiHobMemoryAllocStackGuid                   ## SOMETIMES_PRODUCES ## HOB # MemoryAllocation StackHob
+  gEfiHobMemoryAllocBspStoreGuid                ## SOMETIMES_PRODUCES ## HOB # MemoryAllocation BspStoreHob
+  gEfiHobMemoryAllocModuleGuid                  ## SOMETIMES_PRODUCES ## HOB # MemoryAllocation ModuleHob
 
 #
 # [Hob]
-#   RESOURCE_DESCRIPTOR   ## PRODUCES
-#   MEMORY_ALLOCATION     ## PRODUCES
-#   GUID_EXTENSION        ## CONSUMES
-#   GUID_EXTENSION        ## PRODUCES
-#   CPU                   ## PRODUCES
-#   FV2                   ## PRODUCES
-#   FV                    ## PRODUCES
+#   MEMORY_ALLOCATION     ## SOMETIMES_PRODUCES
+#   RESOURCE_DESCRIPTOR   ## SOMETIMES_PRODUCES
+#   FIRMWARE_VOLUME       ## SOMETIMES_PRODUCES
 #   
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiIoLibCpuIo/IoHighLevel.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiIoLibCpuIo/IoHighLevel.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiIoLibCpuIo/IoHighLevel.c	(revision 58459)
@@ -5,5 +5,5 @@
   Base Library.
 
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -153,4 +153,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -193,4 +194,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -233,4 +235,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -275,4 +278,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -438,4 +443,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -479,4 +485,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -520,4 +527,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -563,4 +571,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -726,4 +736,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -767,4 +778,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -808,4 +820,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -851,4 +864,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1014,4 +1029,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1055,4 +1071,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1096,4 +1113,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1139,4 +1157,6 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1297,4 +1317,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1338,4 +1359,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1379,4 +1401,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1421,4 +1444,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1583,4 +1608,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1625,4 +1651,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1667,4 +1694,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1710,4 +1738,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1872,4 +1902,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1914,4 +1945,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1956,4 +1988,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1999,4 +2032,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -2161,4 +2196,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -2203,4 +2239,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -2245,4 +2282,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   MMIO register to write.
@@ -2288,4 +2326,6 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf	(revision 58459)
@@ -5,5 +5,5 @@
 #  and MMIO operations.
 #
-# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = PeiIoLibCpuIo
+  MODULE_UNI_FILE                = PeiIoLibCpuIo.uni
   FILE_GUID                      = b2585b69-fb63-4220-844a-8fbea8bf01af
   MODULE_TYPE                    = PEIM
@@ -45,2 +46,3 @@
 [Depex.common.PEIM]
   gEfiPeiCpuIoPpiInstalledGuid
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c	(revision 58459)
@@ -3,5 +3,5 @@
   based on PeiService for PEI phase drivers.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -22,4 +22,5 @@
 #include <Library/BaseMemoryLib.h>
 #include <Library/DebugLib.h>
+#include <Library/HobLib.h>
 
 
@@ -45,4 +46,6 @@
   EFI_STATUS            Status;
   EFI_PHYSICAL_ADDRESS  Memory; 
+  EFI_MEMORY_TYPE       RequestType;
+  EFI_PEI_HOB_POINTERS  Hob;
 
   if (Pages == 0) {
@@ -50,8 +53,34 @@
   }
 
-  Status = PeiServicesAllocatePages (MemoryType, Pages, &Memory);
+  RequestType = MemoryType;
+  if (MemoryType == EfiReservedMemoryType) {
+    //
+    // PEI AllocatePages() doesn't support EfiReservedMemoryType. 
+    // Change RequestType to EfiBootServicesData for memory allocation.
+    //
+    RequestType = EfiBootServicesData;
+  }
+
+  Status = PeiServicesAllocatePages (RequestType, Pages, &Memory);
   if (EFI_ERROR (Status)) {
     return NULL;
   }
+  
+  if (MemoryType == EfiReservedMemoryType) {
+    //
+    // Memory type needs to be updated to EfiReservedMemoryType. Per PI spec Volume 1, 
+    // PEI AllocatePages() will automate the creation of the Memory Allocation HOB types. 
+    // Search Memory Allocation HOB and find the matched memory region,
+    // then change its memory type to EfiReservedMemoryType.
+    //
+    Hob.Raw = GetFirstHob (EFI_HOB_TYPE_MEMORY_ALLOCATION);
+    while (Hob.Raw != NULL && Hob.MemoryAllocation->AllocDescriptor.MemoryBaseAddress != Memory) {
+      Hob.Raw = GET_NEXT_HOB (Hob);
+      Hob.Raw = GetNextHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, Hob.Raw);
+    }
+    ASSERT (Hob.Raw != NULL);
+    Hob.MemoryAllocation->AllocDescriptor.MemoryType = EfiReservedMemoryType;
+  }
+
   return (VOID *) (UINTN) Memory;
 }
@@ -161,4 +190,5 @@
   NULL is returned.
   If Alignment is not a power of two and Alignment is not zero, then ASSERT().
+  If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
 
   @param  MemoryType            The type of memory to allocate.
@@ -178,6 +208,13 @@
   )
 {
-  VOID    *Memory;
-  UINTN   AlignmentMask;
+  EFI_PHYSICAL_ADDRESS   Memory;
+  EFI_PHYSICAL_ADDRESS   AlignedMemory;
+  EFI_PEI_HOB_POINTERS   Hob;
+  BOOLEAN                SkipBeforeMemHob;
+  BOOLEAN                SkipAfterMemHob;
+  EFI_PHYSICAL_ADDRESS   HobBaseAddress;
+  UINT64                 HobLength;
+  EFI_MEMORY_TYPE        HobMemoryType;
+  UINTN                  TotalPages;
 
   //
@@ -192,15 +229,134 @@
   // Make sure that Pages plus EFI_SIZE_TO_PAGES (Alignment) does not overflow.
   //
-  ASSERT (Pages <= (MAX_ADDRESS - EFI_SIZE_TO_PAGES (Alignment)));
+  ASSERT (Pages <= (MAX_ADDRESS - EFI_SIZE_TO_PAGES (Alignment))); 
+
   //
   // We would rather waste some memory to save PEI code size.
-  //
-  Memory = InternalAllocatePages (MemoryType, Pages + EFI_SIZE_TO_PAGES (Alignment));
-  if (Alignment == 0) {
-    AlignmentMask = Alignment;
+  // meaning in addition to the requested size for the aligned mem,
+  // we simply reserve an overhead memory equal to Alignmemt(page-aligned), no matter what.
+  // The overhead mem size could be reduced later with more involved malloc mechanisms
+  // (e.g., somthing that can detect the alignment boundary before allocating memory or 
+  //  can request that memory be allocated at a certain address that is aleady aligned).
+  //
+  TotalPages = Pages + (Alignment <= EFI_PAGE_SIZE ? 0 : EFI_SIZE_TO_PAGES(Alignment));
+  Memory = (EFI_PHYSICAL_ADDRESS) (UINTN) InternalAllocatePages (MemoryType, TotalPages);
+  if (Memory == 0) {
+    DEBUG((DEBUG_INFO, "Out of memory resource! \n"));
+    return NULL;
+  }
+  DEBUG ((DEBUG_INFO, "Allocated Memory unaligned: Address = 0x%LX, Pages = 0x%X, Type = %d \n", Memory, TotalPages, (UINTN) MemoryType));
+
+  //
+  // Alignment calculation
+  //
+  AlignedMemory = Memory;
+  if (Alignment > EFI_PAGE_SIZE) {
+    AlignedMemory = ALIGN_VALUE (Memory, Alignment);
+  }
+  DEBUG ((DEBUG_INFO, "After aligning to 0x%X bytes: Address = 0x%LX, Pages = 0x%X \n", Alignment, AlignedMemory, Pages));
+
+  //
+  // In general three HOBs cover the total allocated space.
+  // The aligned portion is covered by the aligned mem HOB and
+  // the unaligned(to be freed) portions before and after the aligned portion are covered by newly created HOBs.
+  //
+  // Before mem HOB covers the region between "Memory" and "AlignedMemory"
+  // Aligned mem HOB covers the region between "AlignedMemory" and "AlignedMemory + EFI_PAGES_TO_SIZE(Pages)"
+  // After mem HOB covers the region between "AlignedMemory + EFI_PAGES_TO_SIZE(Pages)" and "Memory + EFI_PAGES_TO_SIZE(TotalPages)"
+  //
+  // The before or after mem HOBs need to be skipped under special cases where the aligned portion
+  // touches either the top or bottom of the original allocated space.
+  //
+  SkipBeforeMemHob = FALSE;
+  SkipAfterMemHob  = FALSE;
+  if (Memory == AlignedMemory) {
+    SkipBeforeMemHob = TRUE;
+  }
+  if ((Memory + EFI_PAGES_TO_SIZE(TotalPages)) == (AlignedMemory + EFI_PAGES_TO_SIZE(Pages))) {
+    //
+    // This condition is never met in the current implementation.
+    // There is always some after-mem since the overhead mem(used in TotalPages)
+    // is no less than Alignment.
+    //
+    SkipAfterMemHob = TRUE;
+  }
+
+  //  
+  // Search for the mem HOB referring to the original(unaligned) allocation 
+  // and update the size and type if needed.
+  //
+  Hob.Raw = GetFirstHob (EFI_HOB_TYPE_MEMORY_ALLOCATION);
+  while (Hob.Raw != NULL) {
+    if (Hob.MemoryAllocation->AllocDescriptor.MemoryBaseAddress == Memory) {
+      break;
+    }
+    Hob.Raw = GET_NEXT_HOB (Hob);
+    Hob.Raw = GetNextHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, Hob.Raw);
+  }
+  ASSERT (Hob.Raw != NULL);
+  if (SkipBeforeMemHob) {
+    //
+    // Use this HOB as aligned mem HOB as there is no portion before it.
+    //
+    HobLength = EFI_PAGES_TO_SIZE(Pages);
+    Hob.MemoryAllocation->AllocDescriptor.MemoryLength = HobLength;
   } else {
-    AlignmentMask = Alignment - 1;  
-  }
-  return (VOID *) (UINTN) (((UINTN) Memory + AlignmentMask) & ~AlignmentMask);
+    //
+    // Use this HOB as before mem HOB and create a new HOB for the aligned portion 
+    //
+    HobLength = (AlignedMemory - Memory); 
+    Hob.MemoryAllocation->AllocDescriptor.MemoryLength = HobLength;
+    Hob.MemoryAllocation->AllocDescriptor.MemoryType = EfiConventionalMemory;
+  }
+
+  HobBaseAddress = Hob.MemoryAllocation->AllocDescriptor.MemoryBaseAddress;
+  HobMemoryType = Hob.MemoryAllocation->AllocDescriptor.MemoryType;
+
+  //
+  // Build the aligned mem HOB if needed
+  //
+  if (!SkipBeforeMemHob) {
+    DEBUG((DEBUG_INFO, "Updated before-mem HOB with BaseAddress = %LX, Length = %LX, MemoryType = %d \n",
+      HobBaseAddress, HobLength, (UINTN) HobMemoryType));
+
+    HobBaseAddress = AlignedMemory;
+    HobLength = EFI_PAGES_TO_SIZE(Pages);
+    HobMemoryType = MemoryType;
+
+    BuildMemoryAllocationHob (
+      HobBaseAddress,
+      HobLength,
+      HobMemoryType
+      );
+
+    DEBUG((DEBUG_INFO, "Created aligned-mem HOB with BaseAddress = %LX, Length = %LX, MemoryType = %d \n",
+      HobBaseAddress, HobLength, (UINTN) HobMemoryType));
+  } else {
+    if (HobBaseAddress != 0) {
+      DEBUG((DEBUG_INFO, "Updated aligned-mem HOB with BaseAddress = %LX, Length = %LX, MemoryType = %d \n",
+        HobBaseAddress, HobLength, (UINTN) HobMemoryType));
+    }
+  }
+
+
+  //
+  // Build the after mem HOB if needed
+  //
+  if (!SkipAfterMemHob) {
+    HobBaseAddress = AlignedMemory + EFI_PAGES_TO_SIZE(Pages);
+    HobLength = (Memory + EFI_PAGES_TO_SIZE(TotalPages)) - (AlignedMemory + EFI_PAGES_TO_SIZE(Pages));
+    HobMemoryType = EfiConventionalMemory;
+
+    BuildMemoryAllocationHob (
+      HobBaseAddress,
+      HobLength,
+      HobMemoryType
+      );
+
+    DEBUG((DEBUG_INFO, "Created after-mem HOB with BaseAddress = %LX, Length = %LX, MemoryType = %d \n",
+      HobBaseAddress, HobLength, (UINTN) HobMemoryType));
+  }
+
+  return (VOID *) (UINTN) AlignedMemory;
 }
 
@@ -214,4 +370,5 @@
   
   If Alignment is not a power of two and Alignment is not zero, then ASSERT().
+  If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
 
   @param  Pages                 The number of 4 KB pages to allocate.
@@ -242,4 +399,5 @@
   
   If Alignment is not a power of two and Alignment is not zero, then ASSERT().
+  If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
 
   @param  Pages                 The number of 4 KB pages to allocate.
@@ -270,4 +428,5 @@
   
   If Alignment is not a power of two and Alignment is not zero, then ASSERT().
+  If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
 
   @param  Pages                 The number of 4 KB pages to allocate.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf	(revision 58459)
@@ -5,5 +5,5 @@
 #  Free operations are ignored.
 #
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = PeiMemoryAllocationLib
+  MODULE_UNI_FILE                = PeiMemoryAllocationLib.uni
   FILE_GUID                      = b694e0dc-cd4e-4b30-885b-9c164ed3e74a
   MODULE_TYPE                    = PEIM
@@ -41,3 +42,4 @@
   BaseMemoryLib
   PeiServicesLib
+  HobLib
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiMemoryLib/PeiMemoryLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiMemoryLib/PeiMemoryLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiMemoryLib/PeiMemoryLib.inf	(revision 58459)
@@ -5,5 +5,5 @@
 #  where possible for size reduction.
 #
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = PeiMemoryLib
+  MODULE_UNI_FILE                = PeiMemoryLib.uni
   FILE_GUID                      = 3a9759d2-53bc-4eb2-abcd-c93099419063
   MODULE_TYPE                    = PEIM
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiPalLib/PeiPalLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiPalLib/PeiPalLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiPalLib/PeiPalLib.inf	(revision 58459)
@@ -1,9 +1,9 @@
 ## @file
-# Instance of PAL Library using a PPI for PAL entrypoint .
+# Instance of PAL Library using a PPI for PAL entrypoint.
 #
 # Instance of PAL Library that uses a PPI to retrieve the PAL
 # Entry Point and layers on top of AsmPalCall() in the Base Library
 #
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = PeiPalLib
+  MODULE_UNI_FILE                = PeiPalLib.uni
   FILE_GUID                      = B53DC524-6B98-4584-940B-8F1363DEF09E
   MODULE_TYPE                    = PEIM
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiPcdLib/PeiPcdLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiPcdLib/PeiPcdLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiPcdLib/PeiPcdLib.c	(revision 58459)
@@ -2,5 +2,5 @@
 Implementation of PcdLib class library for PEI phase.
 
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials                          
 are licensed and made available under the terms and conditions of the BSD License         
@@ -21,4 +21,6 @@
 #include <Ppi/Pcd.h>
 #include <Ppi/PiPcd.h>
+#include <Ppi/PcdInfo.h>
+#include <Ppi/PiPcdInfo.h>
 
 #include <Library/PeiServicesLib.h>
@@ -72,5 +74,51 @@
   return PiPcdPpi;
 }  
-  
+
+/**
+  Retrieve the GET_PCD_INFO_PPI pointer.
+
+  This function is to locate GET_PCD_INFO_PPI PPI via PeiService. 
+  If fail to locate GET_PCD_INFO_PPI, then ASSERT_EFI_ERROR().
+
+  @retval GET_PCD_INFO_PPI * The pointer to the GET_PCD_INFO_PPI.
+
+**/
+GET_PCD_INFO_PPI *
+GetPcdInfoPpiPointer (
+  VOID
+  ) 
+{
+  EFI_STATUS            Status;
+  GET_PCD_INFO_PPI      *PcdInfoPpi;
+  
+  Status = PeiServicesLocatePpi (&gGetPcdInfoPpiGuid, 0, NULL, (VOID **)&PcdInfoPpi);
+  ASSERT_EFI_ERROR (Status);
+
+  return PcdInfoPpi;
+}
+
+/**
+  Retrieve the pointer of EFI_GET_PCD_INFO_PPI defined in PI 1.2.1 Vol 3.
+
+  This function is to locate EFI_GET_PCD_INFO_PPI PPI via PeiService. 
+  If fail to locate EFI_GET_PCD_INFO_PPI, then ASSERT_EFI_ERROR().
+
+  @retval EFI_GET_PCD_INFO_PPI * The pointer to the EFI_GET_PCD_INFO_PPI.
+
+**/
+EFI_GET_PCD_INFO_PPI *
+GetPiPcdInfoPpiPointer (
+  VOID
+  )
+{
+  EFI_STATUS            Status;
+  EFI_GET_PCD_INFO_PPI  *PiPcdInfoPpi;
+  
+  Status = PeiServicesLocatePpi (&gEfiGetPcdInfoPpiGuid, 0, NULL, (VOID **)&PiPcdInfoPpi);
+  ASSERT_EFI_ERROR (Status);
+  
+  return PiPcdInfoPpi;
+}  
+
 /**
   This function provides a means by which SKU support can be established in the PCD infrastructure.
@@ -443,5 +491,7 @@
   Sets the 8-bit value for the token specified by TokenNumber 
   to the value specified by Value.  Value is returned.
-  
+
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  TokenNumber   The PCD token number to set a current value for.
   @param[in]  Value         The 8-bit value to set.
@@ -473,5 +523,7 @@
   Sets the 16-bit value for the token specified by TokenNumber 
   to the value specified by Value.  Value is returned.
-  
+
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  TokenNumber   The PCD token number to set a current value for.
   @param[in]  Value         The 16-bit value to set.
@@ -503,5 +555,7 @@
   Sets the 32-bit value for the token specified by TokenNumber 
   to the value specified by Value.  Value is returned.
-  
+
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  TokenNumber   The PCD token number to set a current value for.
   @param[in]  Value         The 32-bit value to set.
@@ -533,5 +587,7 @@
   Sets the 64-bit value for the token specified by TokenNumber 
   to the value specified by Value.  Value is returned.
-  
+
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  TokenNumber   The PCD token number to set a current value for.
   @param[in]  Value         The 64-bit value to set.
@@ -565,5 +621,6 @@
   If SizeOfBuffer is greater than the maximum size support by TokenNumber, 
   then set SizeOfBuffer to the maximum size supported by TokenNumber and 
-  return NULL to indicate that the set operation was not actually performed.  
+  return NULL to indicate that the set operation was not actually performed,
+  or ASSERT() if the set operation was not corretly performed.
 
   If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the 
@@ -589,4 +646,5 @@
 {
   EFI_STATUS Status;
+  UINTN      InputSizeOfBuffer;
 
   ASSERT (SizeOfBuffer != NULL);
@@ -595,10 +653,11 @@
     ASSERT (Buffer != NULL);
   }
-  
+
+  InputSizeOfBuffer = *SizeOfBuffer;
   Status = (GetPcdPpiPointer ())->SetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer);
-
-  if (EFI_ERROR (Status)) {
+  if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) {
     return NULL;
   }
+  ASSERT_EFI_ERROR (Status);
 
   return (VOID *) Buffer;
@@ -612,5 +671,7 @@
   Sets the Boolean value for the token specified by TokenNumber 
   to the value specified by Value.  Value is returned.
-  
+
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  TokenNumber   The PCD token number to set a current value for.
   @param[in]  Value         The boolean value to set.
@@ -642,7 +703,8 @@
   Sets the 8-bit value for the token specified by TokenNumber and 
   Guid to the value specified by Value. Value is returned.
-  
+
   If Guid is NULL, then ASSERT().
-  
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  Guid          The pointer to a 128-bit unique value that 
                             designates which namespace to set a value from.
@@ -679,7 +741,8 @@
   Sets the 16-bit value for the token specified by TokenNumber and 
   Guid to the value specified by Value. Value is returned.
-  
+
   If Guid is NULL, then ASSERT().
-  
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  Guid          The pointer to a 128-bit unique value that 
                             designates which namespace to set a value from.
@@ -714,7 +777,8 @@
   Sets the 32-bit value for the token specified by TokenNumber and 
   Guid to the value specified by Value. Value is returned.
-  
+
   If Guid is NULL, then ASSERT().
-  
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  Guid          The pointer to a 128-bit unique value that 
                             designates which namespace to set a value from.
@@ -751,6 +815,8 @@
   Sets the 64-bit value for the token specified by TokenNumber and 
   Guid to the value specified by Value. Value is returned.
+
   If Guid is NULL, then ASSERT().
-  
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  Guid          The pointer to a 128-bit unique value that 
                             designates which namespace to set a value from.
@@ -788,5 +854,5 @@
   the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size 
   supported by TokenNumber and return NULL to indicate that the set operation 
-  was not actually performed. 
+  was not actually performed, or ASSERT() if the set operation was not corretly performed.
   
   If Guid is NULL, then ASSERT().
@@ -813,4 +879,7 @@
 {
   EFI_STATUS      Status;
+  UINTN           InputSizeOfBuffer;
+
+
   ASSERT (SizeOfBuffer != NULL);
   if (*SizeOfBuffer > 0) {
@@ -819,9 +888,10 @@
   ASSERT (Guid != NULL);
 
+  InputSizeOfBuffer = *SizeOfBuffer;
   Status = (GetPiPcdPpiPointer ())->SetPtr (Guid, TokenNumber, SizeOfBuffer, Buffer);
-
-  if (EFI_ERROR (Status)) {
+  if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) {
     return NULL;
   }
+  ASSERT_EFI_ERROR (Status);
 
   return Buffer;
@@ -835,7 +905,8 @@
   Sets the Boolean value for the token specified by TokenNumber and 
   Guid to the value specified by Value. Value is returned.
-  
+
   If Guid is NULL, then ASSERT().
-  
+  If the set operation was not correctly performed, then ASSERT().
+
   @param[in]  Guid          The pointer to a 128-bit unique value that 
                             designates which namespace to set a value from.
@@ -963,9 +1034,8 @@
   )
 {
-  EFI_STATUS Status;
+  EFI_STATUS    Status;
 
   Status = (GetPiPcdPpiPointer ())->GetNextToken (Guid, &TokenNumber);
-
-  ASSERT_EFI_ERROR (Status);
+  ASSERT (!EFI_ERROR (Status) || TokenNumber == 0);
 
   return TokenNumber;
@@ -992,9 +1062,5 @@
   )
 {
-  EFI_STATUS Status;
-
-  Status = (GetPiPcdPpiPointer ())->GetNextTokenSpace (&TokenSpaceGuid);
-
-  ASSERT_EFI_ERROR (Status);
+  (GetPiPcdPpiPointer ())->GetNextTokenSpace (&TokenSpaceGuid);
 
   return (GUID *) TokenSpaceGuid;
@@ -1053,3 +1119,76 @@
 }
 
-
+/**
+  Retrieve additional information associated with a PCD token.
+
+  This includes information such as the type of value the TokenNumber is associated with as well as possible
+  human readable name that is associated with the token.
+
+  If TokenNumber is not in the default token space specified, then ASSERT().
+
+  @param[in]    TokenNumber The PCD token number.
+  @param[out]   PcdInfo     The returned information associated with the requested TokenNumber.
+                            The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
+**/
+VOID
+EFIAPI
+LibPcdGetInfo (
+  IN        UINTN           TokenNumber,
+  OUT       PCD_INFO        *PcdInfo
+  )
+{
+  EFI_STATUS Status;
+
+  Status = GetPcdInfoPpiPointer()->GetInfo (TokenNumber, (EFI_PCD_INFO *) PcdInfo);
+  ASSERT_EFI_ERROR (Status);
+}
+
+/**
+  Retrieve additional information associated with a PCD token.
+
+  This includes information such as the type of value the TokenNumber is associated with as well as possible
+  human readable name that is associated with the token.
+
+  If TokenNumber is not in the token space specified by Guid, then ASSERT().
+
+  @param[in]    Guid        The 128-bit unique value that designates the namespace from which to extract the value.
+  @param[in]    TokenNumber The PCD token number.
+  @param[out]   PcdInfo     The returned information associated with the requested TokenNumber.
+                            The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.
+**/
+VOID
+EFIAPI
+LibPcdGetInfoEx (
+  IN CONST  GUID            *Guid,
+  IN        UINTN           TokenNumber,
+  OUT       PCD_INFO        *PcdInfo
+  )
+{
+  EFI_STATUS Status;
+
+  Status = GetPiPcdInfoPpiPointer()->GetInfo (Guid, TokenNumber, (EFI_PCD_INFO *) PcdInfo);
+  ASSERT_EFI_ERROR (Status);
+}
+
+/**
+  Retrieve the currently set SKU Id.
+
+  If the sku id got >= PCD_MAX_SKU_ID, then ASSERT().
+
+  @return   The currently set SKU Id. If the platform has not set at a SKU Id, then the
+            default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU
+            Id is returned.
+**/
+UINTN
+EFIAPI
+LibPcdGetSku (
+  VOID
+  )
+{
+  UINTN SkuId;
+
+  SkuId = GetPiPcdInfoPpiPointer()->GetSku ();
+  ASSERT (SkuId < PCD_MAX_SKU_ID);
+
+  return SkuId;
+}
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf	(revision 58459)
@@ -16,5 +16,5 @@
 # PCD Library that uses the PCD PPI to access Dynamic and DynamicEx PCD entries
 #
-# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -31,4 +31,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = PeiPcdLib
+  MODULE_UNI_FILE                = PeiPcdLib.uni
   FILE_GUID                      = 9dbf6f25-0da2-4a1d-8e12-e78de6ab4d0e
   MODULE_TYPE                    = PEIM
@@ -56,8 +57,10 @@
 
 [Ppis]
-  gPcdPpiGuid                                   ## CONSUMES
+  gPcdPpiGuid                                   ## SOMETIMES_CONSUMES
   gEfiPeiPcdPpiGuid                             ## CONSUMES
-  
+  gGetPcdInfoPpiGuid                            ## SOMETIMES_CONSUMES
+  gEfiGetPcdInfoPpiGuid                         ## SOMETIMES_CONSUMES
+
 [Depex.common.PEIM]
   gEfiPeiPcdPpiGuid
-  
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiPciLibPciCfg2/PciLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiPciLibPciCfg2/PciLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiPciLibPciCfg2/PciLib.c	(revision 58459)
@@ -2,5 +2,5 @@
   PCI Library using PCI CFG2 PPI.
 
-  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials are
   licensed and made available under the terms and conditions of
@@ -351,4 +351,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -392,4 +393,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -433,4 +435,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -476,4 +479,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -702,4 +707,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -744,4 +750,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -786,4 +793,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -830,4 +838,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1056,4 +1066,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1098,4 +1109,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1140,4 +1152,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1184,4 +1197,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiPciLibPciCfg2/PeiPciLibPciCfg2.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiPciLibPciCfg2/PeiPciLibPciCfg2.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiPciLibPciCfg2/PeiPciLibPciCfg2.inf	(revision 58459)
@@ -8,5 +8,5 @@
 #  with a single PCI segment.
 #
-# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -23,4 +23,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = PeiPciLibPciCfg2
+  MODULE_UNI_FILE                = PeiPciLibPciCfg2.uni
   FILE_GUID                      = FA3AD693-D58A-4619-960B-8EE85C914870
   MODULE_TYPE                    = PEIM
@@ -53,2 +54,3 @@
 [Depex.common.PEIM]
   gEfiPciCfg2PpiGuid
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiPciSegmentLibPciCfg2/PciSegmentLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiPciSegmentLibPciCfg2/PciSegmentLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiPciSegmentLibPciCfg2/PciSegmentLib.c	(revision 58459)
@@ -2,5 +2,5 @@
   PCI Segment Library implementation using PCI CFG2 PPI.
 
-  Copyright (c) 2007 - 2009, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials are
   licensed and made available under the terms and conditions of
@@ -370,4 +370,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -411,4 +412,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -452,4 +454,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -495,4 +498,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -712,4 +717,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -748,4 +754,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -790,4 +797,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The address that encodes the PCI Segment, Bus, Device, Function, and Register.
@@ -833,4 +841,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1051,4 +1061,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1092,4 +1103,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1133,5 +1145,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
-  
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1177,4 +1189,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiPciSegmentLibPciCfg2/PeiPciSegmentLibPciCfg2.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiPciSegmentLibPciCfg2/PeiPciSegmentLibPciCfg2.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiPciSegmentLibPciCfg2/PeiPciSegmentLibPciCfg2.inf	(revision 58459)
@@ -7,5 +7,5 @@
 #  This library instance should only be used platforms with multiple PCI segments.
 #
-# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -22,4 +22,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = PeiPciSegmentLibPciCfg2
+  MODULE_UNI_FILE                = PeiPciSegmentLibPciCfg2.uni
   FILE_GUID                      = 254901AD-7DB7-45f8-93C8-93D579398D9F
   MODULE_TYPE                    = PEIM
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf	(revision 58459)
@@ -4,5 +4,5 @@
 # Resource Publication Library that uses PEI Services to publish system memory.
 #
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -19,4 +19,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = PeiResourcePublicationLib
+  MODULE_UNI_FILE                = PeiResourcePublicationLib.uni
   FILE_GUID                      = e8d6390d-e190-4957-9ab6-d47d51b01336
   MODULE_TYPE                    = PEIM
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesLib/PeiServicesLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesLib/PeiServicesLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesLib/PeiServicesLib.c	(revision 58459)
@@ -2,5 +2,5 @@
   Implementation for PEI Services Library.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -17,4 +17,5 @@
 
 #include <Ppi/FirmwareVolumeInfo.h>
+#include <Ppi/FirmwareVolumeInfo2.h>
 #include <Guid/FirmwareFileSystem2.h>
 
@@ -24,13 +25,4 @@
 #include <Library/MemoryAllocationLib.h>
 #include <Library/BaseMemoryLib.h>
-
-
-GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_PEI_PPI_DESCRIPTOR     mPpiListTemplate[] = {
-  {
-    (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
-    &gEfiPeiFirmwareVolumeInfoPpiGuid,
-    NULL
-  }
-};
 
 /**
@@ -311,4 +303,34 @@
 
 /**
+  This service enables PEIMs to discover sections of a given instance and type within a valid FFS file.
+
+  @param  SectionType           The value of the section type to find.
+  @param  SectionInstance       Section instance to find.
+  @param  FileHandle            A pointer to the file header that contains the set 
+                                of sections to be searched.
+  @param  SectionData           A pointer to the discovered section, if successful.
+  @param  AuthenticationStatus  A pointer to the authentication status for this section.
+
+  @retval EFI_SUCCESS           The section was found.
+  @retval EFI_NOT_FOUND         The section was not found.
+
+**/
+EFI_STATUS
+EFIAPI
+PeiServicesFfsFindSectionData3 (
+  IN EFI_SECTION_TYPE           SectionType,
+  IN UINTN                      SectionInstance,
+  IN EFI_PEI_FILE_HANDLE        FileHandle,
+  OUT VOID                      **SectionData,
+  OUT UINT32                    *AuthenticationStatus
+  )
+{
+  CONST EFI_PEI_SERVICES **PeiServices;
+
+  PeiServices = GetPeiServicesTablePointer ();
+  return (*PeiServices)->FindSectionData3 (PeiServices, SectionType, SectionInstance, FileHandle, SectionData, AuthenticationStatus);
+}
+
+/**
   This service enables PEIMs to register the permanent memory configuration
   that has been initialized with the PEI Foundation.
@@ -460,4 +482,28 @@
 }
 
+/**
+  This service is a wrapper for the PEI Service FfsGetFileInfo2(), except the pointer to the PEI Services
+  Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface
+  Specification for details.
+
+  @param FileHandle               The handle of the file.
+  @param FileInfo                 Upon exit, points to the file's
+                                  information.
+
+  @retval EFI_SUCCESS             File information returned.
+  @retval EFI_INVALID_PARAMETER   If FileHandle does not
+                                  represent a valid file.
+  @retval EFI_INVALID_PARAMETER   FileInfo is NULL.
+
+**/
+EFI_STATUS
+EFIAPI
+PeiServicesFfsGetFileInfo2 (
+  IN CONST  EFI_PEI_FILE_HANDLE   FileHandle,
+  OUT EFI_FV_FILE_INFO2           *FileInfo
+  )
+{
+  return (*GetPeiServicesTablePointer())->FfsGetFileInfo2 (FileHandle, FileInfo);
+}
 
 /**
@@ -523,41 +569,44 @@
 
 /**
-  Install a EFI_PEI_FIRMWARE_VOLUME_INFO_PPI instance so the PEI Core will be notified about a new firmware volume.
-  
-  This function allocates, initializes, and installs a new EFI_PEI_FIRMWARE_VOLUME_INFO_PPI using 
-  the parameters passed in to initialize the fields of the EFI_PEI_FIRMWARE_VOLUME_INFO_PPI instance.
-  If the resources can not be allocated for EFI_PEI_FIRMWARE_VOLUME_INFO_PPI, then ASSERT().
-  If the EFI_PEI_FIRMWARE_VOLUME_INFO_PPI can not be installed, then ASSERT().
-
-  
-  @param  FvFormat             Unique identifier of the format of the memory-mapped 
-                               firmware volume.  This parameter is optional and 
-                               may be NULL.  If NULL is specified, the 
+  Install a EFI_PEI_FIRMWARE_VOLUME_INFO(2)_PPI instance so the PEI Core will be notified about a new firmware volume.
+
+  This function allocates, initializes, and installs a new EFI_PEI_FIRMWARE_VOLUME_INFO(2)_PPI using
+  the parameters passed in to initialize the fields of the EFI_PEI_FIRMWARE_VOLUME_INFO(2)_PPI instance.
+  If the resources can not be allocated for EFI_PEI_FIRMWARE_VOLUME_INFO(2)_PPI, then ASSERT().
+  If the EFI_PEI_FIRMWARE_VOLUME_INFO(2)_PPI can not be installed, then ASSERT().
+
+  @param  InstallFvInfoPpi     Install FvInfo Ppi if it is TRUE. Otherwise, install FvInfo2 Ppi.
+  @param  FvFormat             Unique identifier of the format of the memory-mapped
+                               firmware volume.  This parameter is optional and
+                               may be NULL.  If NULL is specified, the
                                EFI_FIRMWARE_FILE_SYSTEM2_GUID format is assumed.
-  @param  FvInfo               Points to a buffer which allows the 
-                               EFI_PEI_FIRMWARE_VOLUME_PPI to process the volume. 
-                               The format of this buffer is specific to the FvFormat. 
-                               For memory-mapped firmware volumes, this typically 
+  @param  FvInfo               Points to a buffer which allows the
+                               EFI_PEI_FIRMWARE_VOLUME_PPI to process the volume.
+                               The format of this buffer is specific to the FvFormat.
+                               For memory-mapped firmware volumes, this typically
                                points to the first byte of the firmware volume.
-  @param  FvInfoSize           The size, in bytes, of FvInfo. For memory-mapped 
-                               firmware volumes, this is typically the size of 
+  @param  FvInfoSize           The size, in bytes, of FvInfo. For memory-mapped
+                               firmware volumes, this is typically the size of
                                the firmware volume.
-  @param  ParentFvName         If the new firmware volume originated from a file 
-                               in a different firmware volume, then this parameter 
+  @param  ParentFvName         If the new firmware volume originated from a file
+                               in a different firmware volume, then this parameter
                                specifies the GUID name of the originating firmware
                                volume. Otherwise, this parameter must be NULL.
-  @param  ParentFileName       If the new firmware volume originated from a file 
-                               in a different firmware volume, then this parameter 
-                               specifies the GUID file name of the originating 
+  @param  ParentFileName       If the new firmware volume originated from a file
+                               in a different firmware volume, then this parameter
+                               specifies the GUID file name of the originating
                                firmware file. Otherwise, this parameter must be NULL.
+  @param  AuthenticationStatus Authentication Status, it will be ignored if InstallFvInfoPpi is TRUE.
 **/
 VOID
 EFIAPI
-PeiServicesInstallFvInfoPpi (
+InternalPeiServicesInstallFvInfoPpi (
+  IN       BOOLEAN                 InstallFvInfoPpi,
   IN CONST EFI_GUID                *FvFormat, OPTIONAL
   IN CONST VOID                    *FvInfo,
   IN       UINT32                  FvInfoSize,
   IN CONST EFI_GUID                *ParentFvName, OPTIONAL
-  IN CONST EFI_GUID                *ParentFileName OPTIONAL
+  IN CONST EFI_GUID                *ParentFileName, OPTIONAL
+  IN       UINT32                  AuthenticationStatus
   )
 {
@@ -567,9 +616,24 @@
   EFI_GUID                         *ParentFvNameValue;
   EFI_GUID                         *ParentFileNameValue;
+  EFI_GUID                         *PpiGuid;
 
   ParentFvNameValue   = NULL;
   ParentFileNameValue = NULL;
-  FvInfoPpi = AllocateZeroPool (sizeof (EFI_PEI_FIRMWARE_VOLUME_INFO_PPI));
-  ASSERT(FvInfoPpi != NULL);
+  if (InstallFvInfoPpi) {
+    //
+    // To install FvInfo Ppi.
+    //
+    FvInfoPpi = AllocateZeroPool (sizeof (EFI_PEI_FIRMWARE_VOLUME_INFO_PPI));
+    ASSERT (FvInfoPpi != NULL);
+    PpiGuid = &gEfiPeiFirmwareVolumeInfoPpiGuid;
+  } else {
+    //
+    // To install FvInfo2 Ppi.
+    //
+    FvInfoPpi = AllocateZeroPool (sizeof (EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI));
+    ASSERT (FvInfoPpi != NULL);
+    ((EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI *) FvInfoPpi)->AuthenticationStatus = AuthenticationStatus;
+    PpiGuid = &gEfiPeiFirmwareVolumeInfo2PpiGuid;
+  }
 
   if (FvFormat != NULL) {
@@ -591,7 +655,9 @@
   }
 
-  FvInfoPpiDescriptor = AllocateCopyPool (sizeof(EFI_PEI_PPI_DESCRIPTOR), mPpiListTemplate);
+  FvInfoPpiDescriptor = AllocatePool (sizeof (EFI_PEI_PPI_DESCRIPTOR));
   ASSERT (FvInfoPpiDescriptor != NULL);
 
+  FvInfoPpiDescriptor->Guid  = PpiGuid;
+  FvInfoPpiDescriptor->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
   FvInfoPpiDescriptor->Ppi   = (VOID *) FvInfoPpi;
   Status = PeiServicesInstallPpi (FvInfoPpiDescriptor);
@@ -600,2 +666,88 @@
 }
 
+/**
+  Install a EFI_PEI_FIRMWARE_VOLUME_INFO_PPI instance so the PEI Core will be notified about a new firmware volume.
+
+  This function allocates, initializes, and installs a new EFI_PEI_FIRMWARE_VOLUME_INFO_PPI using
+  the parameters passed in to initialize the fields of the EFI_PEI_FIRMWARE_VOLUME_INFO_PPI instance.
+  If the resources can not be allocated for EFI_PEI_FIRMWARE_VOLUME_INFO_PPI, then ASSERT().
+  If the EFI_PEI_FIRMWARE_VOLUME_INFO_PPI can not be installed, then ASSERT().
+
+  @param  FvFormat             Unique identifier of the format of the memory-mapped
+                               firmware volume.  This parameter is optional and
+                               may be NULL.  If NULL is specified, the
+                               EFI_FIRMWARE_FILE_SYSTEM2_GUID format is assumed.
+  @param  FvInfo               Points to a buffer which allows the
+                               EFI_PEI_FIRMWARE_VOLUME_PPI to process the volume.
+                               The format of this buffer is specific to the FvFormat.
+                               For memory-mapped firmware volumes, this typically
+                               points to the first byte of the firmware volume.
+  @param  FvInfoSize           The size, in bytes, of FvInfo. For memory-mapped
+                               firmware volumes, this is typically the size of
+                               the firmware volume.
+  @param  ParentFvName         If the new firmware volume originated from a file
+                               in a different firmware volume, then this parameter
+                               specifies the GUID name of the originating firmware
+                               volume. Otherwise, this parameter must be NULL.
+  @param  ParentFileName       If the new firmware volume originated from a file
+                               in a different firmware volume, then this parameter
+                               specifies the GUID file name of the originating
+                               firmware file. Otherwise, this parameter must be NULL.
+**/
+VOID
+EFIAPI
+PeiServicesInstallFvInfoPpi (
+  IN CONST EFI_GUID                *FvFormat, OPTIONAL
+  IN CONST VOID                    *FvInfo,
+  IN       UINT32                  FvInfoSize,
+  IN CONST EFI_GUID                *ParentFvName, OPTIONAL
+  IN CONST EFI_GUID                *ParentFileName OPTIONAL
+  )
+{
+  InternalPeiServicesInstallFvInfoPpi (TRUE, FvFormat, FvInfo, FvInfoSize, ParentFvName, ParentFileName, 0);
+}
+
+/**
+  Install a EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI instance so the PEI Core will be notified about a new firmware volume.
+
+  This function allocates, initializes, and installs a new EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI using
+  the parameters passed in to initialize the fields of the EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI instance.
+  If the resources can not be allocated for EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI, then ASSERT().
+  If the EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI can not be installed, then ASSERT().
+
+  @param  FvFormat             Unique identifier of the format of the memory-mapped
+                               firmware volume.  This parameter is optional and
+                               may be NULL.  If NULL is specified, the
+                               EFI_FIRMWARE_FILE_SYSTEM2_GUID format is assumed.
+  @param  FvInfo               Points to a buffer which allows the
+                               EFI_PEI_FIRMWARE_VOLUME_PPI to process the volume.
+                               The format of this buffer is specific to the FvFormat.
+                               For memory-mapped firmware volumes, this typically
+                               points to the first byte of the firmware volume.
+  @param  FvInfoSize           The size, in bytes, of FvInfo. For memory-mapped
+                               firmware volumes, this is typically the size of
+                               the firmware volume.
+  @param  ParentFvName         If the new firmware volume originated from a file
+                               in a different firmware volume, then this parameter
+                               specifies the GUID name of the originating firmware
+                               volume. Otherwise, this parameter must be NULL.
+  @param  ParentFileName       If the new firmware volume originated from a file
+                               in a different firmware volume, then this parameter
+                               specifies the GUID file name of the originating
+                               firmware file. Otherwise, this parameter must be NULL.
+  @param  AuthenticationStatus Authentication Status
+**/
+VOID
+EFIAPI
+PeiServicesInstallFvInfo2Ppi (
+  IN CONST EFI_GUID                *FvFormat, OPTIONAL
+  IN CONST VOID                    *FvInfo,
+  IN       UINT32                  FvInfoSize,
+  IN CONST EFI_GUID                *ParentFvName, OPTIONAL
+  IN CONST EFI_GUID                *ParentFileName, OPTIONAL
+  IN       UINT32                  AuthenticationStatus
+  )
+{
+  InternalPeiServicesInstallFvInfoPpi (FALSE, FvFormat, FvInfo, FvInfoSize, ParentFvName, ParentFileName, AuthenticationStatus);
+}
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesLib/PeiServicesLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesLib/PeiServicesLib.inf	(revision 58459)
@@ -2,5 +2,5 @@
 # PEI Services Library implementation.
 #
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -17,4 +17,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = PeiServicesLib
+  MODULE_UNI_FILE                = PeiServicesLib.uni
   FILE_GUID                      = a804239b-4155-446f-acc8-f0825d74908c
   MODULE_TYPE                    = PEIM
@@ -40,9 +41,8 @@
 
 [Guids]
-  gEfiFirmwareFileSystem2Guid        ## PRODUCES ## FV
+  gEfiFirmwareFileSystem2Guid        ## SOMETIMES_PRODUCES ## GUID # FV File System Guid.
 
 [Ppis]
-  gEfiPeiFirmwareVolumeInfoPpiGuid   ## PRODUCES
+  gEfiPeiFirmwareVolumeInfoPpiGuid   ## SOMETIMES_PRODUCES
+  gEfiPeiFirmwareVolumeInfo2PpiGuid  ## SOMETIMES_PRODUCES
 
-
-
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c	(revision 58459)
@@ -5,5 +5,5 @@
   executed in memory.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -89,3 +89,28 @@
 }
 
+/**
+  Perform CPU specific actions required to migrate the PEI Services Table 
+  pointer from temporary RAM to permanent RAM.
 
+  For IA32 CPUs, the PEI Services Table pointer is stored in the 4 bytes 
+  immediately preceding the Interrupt Descriptor Table (IDT) in memory.
+  For X64 CPUs, the PEI Services Table pointer is stored in the 8 bytes 
+  immediately preceding the Interrupt Descriptor Table (IDT) in memory.
+  For Itanium and ARM CPUs, a the PEI Services Table Pointer is stored in
+  a dedicated CPU register.  This means that there is no memory storage 
+  associated with storing the PEI Services Table pointer, so no additional 
+  migration actions are required for Itanium or ARM CPUs.
+
+**/
+VOID
+EFIAPI
+MigratePeiServicesTablePointer (
+  VOID
+  )
+{
+  //
+  //  PEI Services Table pointer is cached in the global variable. No additional 
+  //  migration actions are required.
+  //
+  return;
+}
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf	(revision 58459)
@@ -6,5 +6,5 @@
 #  read-only memory.
 #
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -21,4 +21,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = PeiServicesTablePointerLib
+  MODULE_UNI_FILE                = PeiServicesTablePointerLib.uni
   FILE_GUID                      = 1c747f6b-0a58-49ae-8ea3-0327a4fa10e3
   MODULE_TYPE                    = PEIM
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointer.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointer.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointer.c	(revision 58459)
@@ -5,5 +5,5 @@
   table in IA32 and x64 architecture.
   
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -21,4 +21,5 @@
 #include <Library/PeiServicesTablePointerLib.h>
 #include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
 
 /**
@@ -68,5 +69,5 @@
   )
 {
-  IA32_DESCRIPTOR   Idtr;
+  IA32_DESCRIPTOR        Idtr;
   
   ASSERT (PeiServicesTablePointer != NULL);
@@ -75,3 +76,56 @@
 }
 
+/**
+  Perform CPU specific actions required to migrate the PEI Services Table 
+  pointer from temporary RAM to permanent RAM.
 
+  For IA32 CPUs, the PEI Services Table pointer is stored in the 4 bytes 
+  immediately preceding the Interrupt Descriptor Table (IDT) in memory.
+  For X64 CPUs, the PEI Services Table pointer is stored in the 8 bytes 
+  immediately preceding the Interrupt Descriptor Table (IDT) in memory.
+  For Itanium and ARM CPUs, a the PEI Services Table Pointer is stored in
+  a dedicated CPU register.  This means that there is no memory storage 
+  associated with storing the PEI Services Table pointer, so no additional 
+  migration actions are required for Itanium or ARM CPUs.
+
+  If The cached PEI Services Table pointer is NULL, then ASSERT().
+  If the permanent memory is allocated failed, then ASSERT().
+**/
+VOID
+EFIAPI
+MigratePeiServicesTablePointer (
+  VOID
+  )
+{
+  EFI_STATUS             Status;
+  IA32_DESCRIPTOR        Idtr;
+  EFI_PHYSICAL_ADDRESS   IdtBase;
+  CONST EFI_PEI_SERVICES  **PeiServices;
+
+  //
+  // Get PEI Services Table pointer
+  //
+  AsmReadIdtr (&Idtr);
+  PeiServices = (CONST EFI_PEI_SERVICES **) (*(UINTN*)(Idtr.Base - sizeof (UINTN)));
+  ASSERT (PeiServices != NULL);
+  //
+  // Allocate the permanent memory.
+  //
+  Status = (*PeiServices)->AllocatePages (
+                            PeiServices, 
+                            EfiBootServicesCode,
+                            EFI_SIZE_TO_PAGES(Idtr.Limit + 1 + sizeof (UINTN)),
+                            &IdtBase
+                            );
+  ASSERT_EFI_ERROR (Status);
+  //
+  // Idt table needs to be migrated into memory.
+  //
+  CopyMem ((VOID *) (UINTN) IdtBase, (VOID *) (Idtr.Base - sizeof (UINTN)), Idtr.Limit + 1 + sizeof (UINTN));
+  Idtr.Base = (UINTN) IdtBase + sizeof (UINTN);
+  AsmWriteIdtr (&Idtr);
+  
+  return;
+}
+
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf	(revision 58459)
@@ -5,5 +5,5 @@
 # Services Table from the IDT on IA-32 and x64.
 #
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = PeiServicesTablePointerLibIdt
+  MODULE_UNI_FILE                = PeiServicesTablePointerLibIdt.uni
   FILE_GUID                      = DED3F743-CE2C-4ba6-92A2-FFCE2A6D72D9
   MODULE_TYPE                    = PEIM
@@ -40,5 +41,3 @@
   DebugLib
   BaseLib
-
-
-
+  BaseMemoryLib
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesTablePointerLibKr7/PeiServicesTablePointer.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesTablePointerLibKr7/PeiServicesTablePointer.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesTablePointerLibKr7/PeiServicesTablePointer.c	(revision 58459)
@@ -3,5 +3,5 @@
   Register 7 to store the pointer.
 
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -67,5 +67,25 @@
 }
   
+/**
+  Perform CPU specific actions required to migrate the PEI Services Table 
+  pointer from temporary RAM to permanent RAM.
 
+  For IA32 CPUs, the PEI Services Table pointer is stored in the 4 bytes 
+  immediately preceding the Interrupt Descriptor Table (IDT) in memory.
+  For X64 CPUs, the PEI Services Table pointer is stored in the 8 bytes 
+  immediately preceding the Interrupt Descriptor Table (IDT) in memory.
+  For Itanium and ARM CPUs, a the PEI Services Table Pointer is stored in
+  a dedicated CPU register.  This means that there is no memory storage 
+  associated with storing the PEI Services Table pointer, so no additional 
+  migration actions are required for Itanium or ARM CPUs.
 
+**/
+VOID
+EFIAPI
+MigratePeiServicesTablePointer (
+  VOID
+  )
+{
+  return;
+}
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesTablePointerLibKr7/PeiServicesTablePointerLibKr7.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesTablePointerLibKr7/PeiServicesTablePointerLibKr7.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiServicesTablePointerLibKr7/PeiServicesTablePointerLibKr7.inf	(revision 58459)
@@ -5,5 +5,5 @@
 # Services Table from KR7 on IPF.
 #
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = PeiServicesTablePointerLibKr7
+  MODULE_UNI_FILE                = PeiServicesTablePointerLibKr7.uni
   FILE_GUID                      = E0E7D776-E7EB-4e5f-9AA8-54CF3AA64A43
   MODULE_TYPE                    = PEIM
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLibSmbus2Ppi.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLibSmbus2Ppi.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLibSmbus2Ppi.inf	(revision 58459)
@@ -2,5 +2,5 @@
 # SMBUS library that layers on top of the SMBUS2 PPI.
 #
-# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -17,4 +17,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = PeiSmbusLibSmbus2Ppi
+  MODULE_UNI_FILE                = PeiSmbusLibSmbus2Ppi.uni
   FILE_GUID                      = 2A1E1C92-AABA-4d62-AC40-F3A4C3387356
   MODULE_TYPE                    = PEIM
@@ -47,2 +48,3 @@
 [Depex.common.PEIM]
   gEfiPeiSmbus2PpiGuid 
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf	(revision 58459)
@@ -2,5 +2,5 @@
 # Module entry point library for PEIM.
 #
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -17,4 +17,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = PeimEntryPoint
+  MODULE_UNI_FILE                = PeimEntryPoint.uni
   FILE_GUID                      = fa177ff7-1fc7-458d-a358-d9d62ae61cec
   MODULE_TYPE                    = PEIM
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf	(revision 58459)
@@ -14,5 +14,5 @@
 # support is desired, the SecPeiDxeTimerLibUefiCpu library can be used.
 #
-# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -29,4 +29,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = SecPeiDxeTimerLibCpu
+  MODULE_UNI_FILE                = SecPeiDxeTimerLibCpu.uni
   FILE_GUID                      = b5a05743-9b71-489b-a0ed-a0eb3950d23b
   MODULE_TYPE                    = BASE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SecPeiDxeTimerLibCpu/X86TimerLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SecPeiDxeTimerLibCpu/X86TimerLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SecPeiDxeTimerLibCpu/X86TimerLib.c	(revision 58459)
@@ -2,5 +2,5 @@
   Timer Library functions built upon local APIC on IA32/x64.
 
-  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -89,4 +89,20 @@
 
 /**
+  Internal function to read the initial timer count of local APIC.
+
+  @param  ApicBase  The base address of memory mapped registers of local APIC.
+
+  @return The initial timer count read.
+
+**/
+UINT32
+InternalX86GetInitTimerCount (
+  IN      UINTN                     ApicBase
+  )
+{
+  return MmioRead32 (ApicBase + APIC_TMICT);
+}
+
+/**
   Stalls the CPU for at least the given number of ticks.
 
@@ -106,20 +122,47 @@
 {
   INT32                             Ticks;
-  UINT32                            PowerOfTwoCounter;
-
-  //
-  // The target timer count is calculated here
-  //
-  Ticks = InternalX86GetTimerTick (ApicBase) - Delay;
-
-  //
-  // Wait until time out
-  // Delay > 2^31 could not be handled by this function
-  // Timer wrap-arounds are handled correctly by this function
-  //
-  PowerOfTwoCounter = GetPowerOfTwo32 (MmioRead32 (ApicBase + APIC_TMICT));
-  while (((UINT32)(InternalX86GetTimerTick (ApicBase) - Ticks) & PowerOfTwoCounter) == 0) {
-    CpuPause ();
-  }
+  UINT32                            Times;
+  UINT32                            InitCount;
+  UINT32                            StartTick;
+
+  //
+  // In case Delay is too larger, separate it into several small delay slot.
+  // Devided Delay by half value of Init Count is to avoid Delay close to
+  // the Init Count, timeout maybe missing if the time consuming between 2
+  // GetApicTimerCurrentCount() invoking is larger than the time gap between
+  // Delay and the Init Count.
+  //
+  InitCount = InternalX86GetInitTimerCount (ApicBase);
+  Times     = Delay / (InitCount / 2);
+  Delay     = Delay % (InitCount / 2);
+
+  //
+  // Get Start Tick and do delay
+  //
+  StartTick  = InternalX86GetTimerTick (ApicBase);
+  do {
+    //
+    // Wait until time out by Delay value
+    //
+    do {
+      CpuPause ();
+      //
+      // Get Ticks from Start to Current.
+      //
+      Ticks = StartTick - InternalX86GetTimerTick (ApicBase);
+      //
+      // Ticks < 0 means Timer wrap-arounds happens.
+      //
+      if (Ticks < 0) {
+        Ticks += InitCount;
+      }
+    } while ((UINT32)Ticks < Delay);
+
+    //
+    // Update StartTick and Delay for next delay slot
+    //
+    StartTick -= (StartTick > Delay) ?  Delay : (Delay - InitCount);
+    Delay      = InitCount / 2;
+  } while (Times-- > 0);
 }
 
@@ -243,9 +286,5 @@
 
   if (StartValue != NULL) {
-    *StartValue = MmioRead32 (ApicBase + APIC_TMICT);
-    //
-    // make sure StartValue is all 1s from High Bit
-    //
-    ASSERT ((*StartValue & (*StartValue + 1)) == 0);
+    *StartValue = (UINT64)InternalX86GetInitTimerCount (ApicBase);
   }
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmIoLibSmmCpuIo2/IoHighLevel.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmIoLibSmmCpuIo2/IoHighLevel.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmIoLibSmmCpuIo2/IoHighLevel.c	(revision 58459)
@@ -5,5 +5,5 @@
   Base Library.
 
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -154,4 +154,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -194,4 +195,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -234,4 +236,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -276,4 +279,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -434,4 +439,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -474,4 +480,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -514,4 +521,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -556,4 +564,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -714,4 +724,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -754,4 +765,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -794,4 +806,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -836,4 +849,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -994,4 +1009,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1034,4 +1050,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1074,4 +1091,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1116,4 +1134,6 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Port      The I/O port to write.
@@ -1274,4 +1294,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1315,4 +1336,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1356,4 +1378,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1398,4 +1421,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1556,4 +1581,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1597,4 +1623,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1638,4 +1665,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1680,4 +1708,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1838,4 +1868,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1879,4 +1910,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1920,4 +1952,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -1962,4 +1995,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -2120,4 +2155,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -2161,4 +2197,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -2202,4 +2239,5 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
@@ -2244,4 +2282,6 @@
   If EndBit is greater than 63, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The MMIO register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmIoLibSmmCpuIo2/SmmIoLibSmmCpuIo2.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmIoLibSmmCpuIo2/SmmIoLibSmmCpuIo2.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmIoLibSmmCpuIo2/SmmIoLibSmmCpuIo2.inf	(revision 58459)
@@ -1,8 +1,8 @@
 ## @file
-# Component description file for Cpu Io SMM Io Library.
+# SMM Instance of I/O Library using SMM CPU I/O 2 Protocol.
 #
-# I/O Library implementation that uses the CPU I/O Protocol for I/O
+# I/O Library SMM implementation that uses SMM CPU I/O 2 Protocol for I/O
 #  and MMIO operations.
-# Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -18,4 +18,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = SmmIoLibSmmCpuIo2
+  MODULE_UNI_FILE                = SmmIoLibSmmCpuIo2.uni
   FILE_GUID                      = DEEEA15E-4A77-4513-BA75-71D26FEF78A1
   MODULE_TYPE                    = DXE_SMM_DRIVER
@@ -44,7 +45,5 @@
   SmmServicesTableLib
 
-[Protocols]
-  gEfiSmmCpuIo2ProtocolGuid                         ## CONSUMES
-
 [Depex.common.DXE_SMM_DRIVER]
   gEfiSmmCpuIo2ProtocolGuid
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmLibNull/SmmLibNull.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmLibNull/SmmLibNull.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmLibNull/SmmLibNull.inf	(revision 58459)
@@ -2,5 +2,5 @@
 # NULL instance of SMM Library.
 #
-#  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -17,4 +17,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = SmmLibNull
+  MODULE_UNI_FILE                = SmmLibNull.uni
   FILE_GUID                      = DDADFC93-FBC5-4389-B20F-EC99E4A6AE52
   MODULE_TYPE                    = BASE
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmMemoryAllocationLib/MemoryAllocationLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmMemoryAllocationLib/MemoryAllocationLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmMemoryAllocationLib/MemoryAllocationLib.c	(revision 58459)
@@ -12,5 +12,5 @@
   will always return NULL.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -286,4 +286,5 @@
   specified alignment remaining to satisfy the request, then NULL is returned.
   If Alignment is not a power of two and Alignment is not zero, then ASSERT().
+  If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
 
   @param  MemoryType            The type of memory to allocate.
@@ -373,4 +374,5 @@
   
   If Alignment is not a power of two and Alignment is not zero, then ASSERT().
+  If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
 
   @param  Pages                 The number of 4 KB pages to allocate.
@@ -401,4 +403,5 @@
   
   If Alignment is not a power of two and Alignment is not zero, then ASSERT().
+  If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
 
   @param  Pages                 The number of 4 KB pages to allocate.
@@ -429,4 +432,5 @@
   
   If Alignment is not a power of two and Alignment is not zero, then ASSERT().
+  If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
 
   @param  Pages                 The number of 4 KB pages to allocate.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf	(revision 58459)
@@ -5,5 +5,5 @@
 # allocate and free memory.
 #
-# Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD License
@@ -18,4 +18,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = SmmMemoryAllocationLib
+  MODULE_UNI_FILE                = SmmMemoryAllocationLib.uni
   FILE_GUID                      = 4DF30A5D-D5B0-4f85-80ED-6B16CD343C8E
   MODULE_TYPE                    = DXE_SMM_DRIVER
@@ -47,2 +48,3 @@
 [Depex]
   gEfiSmmAccess2ProtocolGuid
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmPciLibPciRootBridgeIo/PciLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmPciLibPciRootBridgeIo/PciLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmPciLibPciRootBridgeIo/PciLib.c	(revision 58459)
@@ -2,5 +2,5 @@
   PCI Library using SMM PCI Root Bridge I/O Protocol.
 
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials are
   licensed and made available under the terms and conditions of
@@ -363,4 +363,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -404,4 +405,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -445,4 +447,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -488,4 +491,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -714,4 +719,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -756,4 +762,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -798,4 +805,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -842,4 +850,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1068,4 +1078,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1110,4 +1121,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1152,4 +1164,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1196,4 +1209,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmPciLibPciRootBridgeIo/SmmPciLibPciRootBridgeIo.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmPciLibPciRootBridgeIo/SmmPciLibPciRootBridgeIo.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmPciLibPciRootBridgeIo/SmmPciLibPciRootBridgeIo.inf	(revision 58459)
@@ -3,10 +3,10 @@
 #
 # This library produces the APIs from the PCI Library and implements these APIs
-#  by calling into the PCI Root Bridge I/O Protocol. The PCI Root Bridge I/O Protocol is
-#  typically produced by a chipset specific DXE driver.
-#  This library binds to the first PCI Root Bridge I/O Protocol in the platform. As a result,
+#  by calling into SMM PCI Root Bridge I/O Protocol. SMM PCI Root Bridge I/O Protocol is
+#  typically produced by a chipset specific SMM driver.
+#  This library binds to the first SMM PCI Root Bridge I/O Protocol in the platform. As a result,
 #  it should only be used on platforms that contain a single PCI root bridge.
 #
-# Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -23,4 +23,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = SmmPciLibPciRootBridgeIo
+  MODULE_UNI_FILE                = SmmPciLibPciRootBridgeIo.uni
   FILE_GUID                      = F6994CBA-2351-4ebc-A2DA-20BAC2FE2CF3
   MODULE_TYPE                    = DXE_SMM_DRIVER
@@ -52,2 +53,3 @@
 [Depex.common.DXE_SMM_DRIVER]
   gEfiSmmPciRootBridgeIoProtocolGuid
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.inf	(revision 58459)
@@ -2,5 +2,5 @@
 # SMM Periodic SMI Library.
 #
-# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -17,4 +17,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = SmmPeriodicSmiLib
+  MODULE_UNI_FILE                = SmmPeriodicSmiLib.uni
   FILE_GUID                      = AED5F3FB-4CFF-4b60-9E43-1541B55C8267
   MODULE_TYPE                    = DXE_SMM_DRIVER
@@ -45,6 +46,7 @@
   
 [Protocols]
-  gEfiSmmPeriodicTimerDispatch2ProtocolGuid
+  gEfiSmmPeriodicTimerDispatch2ProtocolGuid  ## CONSUMES
   
 [Depex]
   gEfiSmmPeriodicTimerDispatch2ProtocolGuid
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf	(revision 58459)
@@ -2,5 +2,5 @@
 # SMM Services Table Library.
 #
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -17,4 +17,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = SmmServicesTableLib
+  MODULE_UNI_FILE                = SmmServicesTableLib.uni
   FILE_GUID                      = 064B4C5B-C5EF-4eff-85DF-65518EF1314D
   MODULE_TYPE                    = DXE_SMM_DRIVER
@@ -42,2 +43,3 @@
 [Depex]
   gEfiSmmBase2ProtocolGuid
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf	(revision 58459)
@@ -2,5 +2,5 @@
 # Module entry point library for UEFI Application.
 #
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -17,4 +17,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = UefiApplicationEntryPoint
+  MODULE_UNI_FILE                = UefiApplicationEntryPoint.uni
   FILE_GUID                      = DADE8301-CB29-4fd5-8148-56FD246C5B88
   MODULE_TYPE                    = UEFI_APPLICATION
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf	(revision 58459)
@@ -2,5 +2,5 @@
 # UEFI Boot Services Table Library implementation.
 # 
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -17,4 +17,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = UefiBootServicesTableLib
+  MODULE_UNI_FILE                = UefiBootServicesTableLib.uni
   FILE_GUID                      = ff5c7a2c-ab7a-4366-8616-11c6e53247b6
   MODULE_TYPE                    = UEFI_DRIVER
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDebugLibConOut/DebugLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDebugLibConOut/DebugLib.c	(revision 58459)
@@ -2,5 +2,5 @@
   UEFI Debug Library that sends messages to the Console Output Device in the EFI System Table.
 
-  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -121,5 +121,5 @@
   UnicodeSPrintAsciiFormat (
     Buffer, 
-    MAX_DEBUG_MESSAGE_LENGTH, 
+    sizeof (Buffer), 
     "ASSERT %a(%d): %a\n", 
     FileName, 
@@ -258,2 +258,20 @@
   return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
 }
+
+/**
+  Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
+
+  This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
+
+  @retval  TRUE    Current ErrorLevel is supported.
+  @retval  FALSE   Current ErrorLevel is not supported.
+
+**/
+BOOLEAN
+EFIAPI
+DebugPrintLevelEnabled (
+  IN  CONST UINTN        ErrorLevel
+  )
+{
+  return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0);
+}
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf	(revision 58459)
@@ -4,5 +4,5 @@
 #  Debug Lib that sends messages to the Console Output Device in the EFI System Table.
 #
-#  Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -19,4 +19,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = UefiDebugLibConOut
+  MODULE_UNI_FILE                = UefiDebugLibConOut.uni
   FILE_GUID                      = 5cddfaf3-e9a7-4d16-bdce-1e002df475bb
   MODULE_TYPE                    = UEFI_DRIVER
@@ -48,5 +49,6 @@
 
 [Pcd]
-  gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue        ## CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue        ## SOMETIMES_CONSUMES
   gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask            ## CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel    ## CONSUMES
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c	(revision 58459)
@@ -2,5 +2,5 @@
   UEFI Debug Lib that sends messages to the Standard Error Device in the EFI System Table.
 
-  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -122,5 +122,5 @@
   UnicodeSPrintAsciiFormat (
     Buffer, 
-    MAX_DEBUG_MESSAGE_LENGTH,
+    sizeof (Buffer),
     "ASSERT %a(%d): %a\n", 
     FileName, 
@@ -259,2 +259,20 @@
   return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
 }
+
+/**
+  Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
+
+  This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
+
+  @retval  TRUE    Current ErrorLevel is supported.
+  @retval  FALSE   Current ErrorLevel is not supported.
+
+**/
+BOOLEAN
+EFIAPI
+DebugPrintLevelEnabled (
+  IN  CONST UINTN        ErrorLevel
+  )
+{
+  return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0);
+}
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf	(revision 58459)
@@ -4,5 +4,5 @@
 #  Debug Lib that sends messages to the the Standard Error Device in the EFI System Table.
 #
-#  Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -19,4 +19,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = UefiDebugLibStdErr
+  MODULE_UNI_FILE                = UefiDebugLibStdErr.uni
   FILE_GUID                      = b57a1df6-ffdb-4247-a3df-3a562176751a
   MODULE_TYPE                    = UEFI_DRIVER
@@ -46,5 +47,6 @@
 
 [Pcd]
-  gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue   ## CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue   ## SOMETIMES_CONSUMES
   gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask       ## CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel ## CONSUMES
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c	(revision 58459)
@@ -9,5 +9,5 @@
   on a Handle.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -21,256 +21,5 @@
 
 
-#include <Uefi.h>
-
-#include <Library/DevicePathLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/BaseLib.h>
-
-//
-// Template for an end-of-device path node.
-//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_PROTOCOL  mUefiDevicePathLibEndDevicePath = {
-  END_DEVICE_PATH_TYPE,
-  END_ENTIRE_DEVICE_PATH_SUBTYPE,
-  {
-    END_DEVICE_PATH_LENGTH,
-    0
-  }
-};
-
-/**
-  Returns the Type field of a device path node.
-
-  Returns the Type field of the device path node specified by Node.
-
-  If Node is NULL, then ASSERT().
-
-  @param  Node      A pointer to a device path node data structure.
-
-  @return The Type field of the device path node specified by Node.
-
-**/
-UINT8
-EFIAPI
-DevicePathType (
-  IN CONST VOID  *Node
-  )
-{
-  ASSERT (Node != NULL);
-  return ((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Type;
-}
-
-/**
-  Returns the SubType field of a device path node.
-
-  Returns the SubType field of the device path node specified by Node.
-
-  If Node is NULL, then ASSERT().
-
-  @param  Node      A pointer to a device path node data structure.
-
-  @return The SubType field of the device path node specified by Node.
-
-**/
-UINT8
-EFIAPI
-DevicePathSubType (
-  IN CONST VOID  *Node
-  )
-{
-  ASSERT (Node != NULL);
-  return ((EFI_DEVICE_PATH_PROTOCOL *)(Node))->SubType;
-}
-
-/**
-  Returns the 16-bit Length field of a device path node.
-
-  Returns the 16-bit Length field of the device path node specified by Node.  
-  Node is not required to be aligned on a 16-bit boundary, so it is recommended
-  that a function such as ReadUnaligned16() be used to extract the contents of 
-  the Length field.
-
-  If Node is NULL, then ASSERT().
-
-  @param  Node      A pointer to a device path node data structure.
-
-  @return The 16-bit Length field of the device path node specified by Node.
-
-**/
-UINTN
-EFIAPI
-DevicePathNodeLength (
-  IN CONST VOID  *Node
-  )
-{
-  ASSERT (Node != NULL);
-  return ReadUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0]);
-}
-
-/**
-  Returns a pointer to the next node in a device path.
-
-  Returns a pointer to the device path node that follows the device path node 
-  specified by Node.
-
-  If Node is NULL, then ASSERT().
-
-  @param  Node      A pointer to a device path node data structure.
-
-  @return a pointer to the device path node that follows the device path node 
-  specified by Node.
-
-**/
-EFI_DEVICE_PATH_PROTOCOL *
-EFIAPI
-NextDevicePathNode (
-  IN CONST VOID  *Node
-  )
-{
-  ASSERT (Node != NULL);
-  return (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)(Node) + DevicePathNodeLength(Node));
-}
-
-/**
-  Determines if a device path node is an end node of a device path.
-  This includes nodes that are the end of a device path instance and nodes that 
-  are the end of an entire device path.
-
-  Determines if the device path node specified by Node is an end node of a device path.  
-  This includes nodes that are the end of a device path instance and nodes that are the 
-  end of an entire device path.  If Node represents an end node of a device path, 
-  then TRUE is returned.  Otherwise, FALSE is returned.
-
-  If Node is NULL, then ASSERT().
-
-  @param  Node      A pointer to a device path node data structure.
-
-  @retval TRUE      The device path node specified by Node is an end node of a 
-                    device path.
-  @retval FALSE     The device path node specified by Node is not an end node of 
-                    a device path.
-  
-**/
-BOOLEAN
-EFIAPI
-IsDevicePathEndType (
-  IN CONST VOID  *Node
-  )
-{
-  ASSERT (Node != NULL);
-  return (BOOLEAN) (DevicePathType (Node) == END_DEVICE_PATH_TYPE);
-}
-
-/**
-  Determines if a device path node is an end node of an entire device path.
-
-  Determines if a device path node specified by Node is an end node of an entire 
-  device path. If Node represents the end of an entire device path, then TRUE is 
-  returned.  Otherwise, FALSE is returned.
-
-  If Node is NULL, then ASSERT().
-
-  @param  Node      A pointer to a device path node data structure.
-
-  @retval TRUE      The device path node specified by Node is the end of an entire 
-                    device path.
-  @retval FALSE     The device path node specified by Node is not the end of an 
-                    entire device path.
-
-**/
-BOOLEAN
-EFIAPI
-IsDevicePathEnd (
-  IN CONST VOID  *Node
-  )
-{
-  ASSERT (Node != NULL);
-  return (BOOLEAN) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_ENTIRE_DEVICE_PATH_SUBTYPE);
-}
-
-/**
-  Determines if a device path node is an end node of a device path instance.
-
-  Determines if a device path node specified by Node is an end node of a device 
-  path instance. If Node represents the end of a device path instance, then TRUE 
-  is returned.  Otherwise, FALSE is returned.
-
-  If Node is NULL, then ASSERT().
-
-  @param  Node      A pointer to a device path node data structure.
-
-  @retval TRUE      The device path node specified by Node is the end of a device 
-                    path instance.
-  @retval FALSE     The device path node specified by Node is not the end of a 
-                    device path instance.
-
-**/
-BOOLEAN
-EFIAPI
-IsDevicePathEndInstance (
-  IN CONST VOID  *Node
-  )
-{
-  ASSERT (Node != NULL);
-  return (BOOLEAN) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_INSTANCE_DEVICE_PATH_SUBTYPE);
-}
-
-/**
-  Sets the length, in bytes, of a device path node.
-
-  Sets the length of the device path node specified by Node to the value specified 
-  by NodeLength.  NodeLength is returned.  Node is not required to be aligned on 
-  a 16-bit boundary, so it is recommended that a function such as WriteUnaligned16()
-  be used to set the contents of the Length field.
-
-  If Node is NULL, then ASSERT().
-  If NodeLength >= 0x10000, then ASSERT().
-
-  @param  Node      A pointer to a device path node data structure.
-  @param  Length    The length, in bytes, of the device path node.
-
-  @return Length
-
-**/
-UINT16
-EFIAPI
-SetDevicePathNodeLength (
-  IN OUT VOID  *Node,
-  IN UINTN     Length
-  )
-{
-  ASSERT (Node != NULL);
-  ASSERT (Length < 0x10000);
-  return WriteUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0], (UINT16)(Length));
-}
-
-/**
-  Fills in all the fields of a device path node that is the end of an entire device path.
-
-  Fills in all the fields of a device path node specified by Node so Node represents 
-  the end of an entire device path.  The Type field of Node is set to 
-  END_DEVICE_PATH_TYPE, the SubType field of Node is set to 
-  END_ENTIRE_DEVICE_PATH_SUBTYPE, and the Length field of Node is set to 
-  END_DEVICE_PATH_LENGTH.  Node is not required to be aligned on a 16-bit boundary, 
-  so it is recommended that a function such as WriteUnaligned16() be used to set 
-  the contents of the Length field. 
-
-  If Node is NULL, then ASSERT(). 
-
-  @param  Node      A pointer to a device path node data structure.
-
-**/
-VOID
-EFIAPI
-SetDevicePathEndNode (
-  OUT VOID  *Node
-  )
-{
-  ASSERT (Node != NULL);
-  CopyMem (Node, &mUefiDevicePathLibEndDevicePath, sizeof (mUefiDevicePathLibEndDevicePath));
-}
+#include "UefiDevicePathLib.h"
 
 /**
@@ -278,10 +27,10 @@
 
   This function returns the size, in bytes, of the device path data structure 
-  specified by DevicePath including the end of device path node.  If DevicePath 
-  is NULL, then 0 is returned.
+  specified by DevicePath including the end of device path node.
+  If DevicePath is NULL or invalid, then 0 is returned.
 
   @param  DevicePath  A pointer to a device path data structure.
-  
-  @retval 0           If DevicePath is NULL.
+
+  @retval 0           If DevicePath is NULL or invalid.
   @retval Others      The size of a device path in bytes.
 
@@ -293,22 +42,5 @@
   )
 {
-  CONST EFI_DEVICE_PATH_PROTOCOL  *Start;
-
-  if (DevicePath == NULL) {
-    return 0;
-  }
-
-  //
-  // Search for the end of the device path structure
-  //
-  Start = DevicePath;
-  while (!IsDevicePathEnd (DevicePath)) {
-    DevicePath = NextDevicePathNode (DevicePath);
-  }
-
-  //
-  // Compute the size and add back in the size of the end device path structure
-  //
-  return ((UINTN) DevicePath - (UINTN) Start) + DevicePathNodeLength (DevicePath);
+  return UefiDevicePathLibGetDevicePathSize (DevicePath);
 }
 
@@ -325,5 +57,5 @@
   @param  DevicePath    A pointer to a device path data structure.
 
-  @retval NULL          If DevicePath is NULL.
+  @retval NULL          DevicePath is NULL or invalid.
   @retval Others        A pointer to the duplicated device path.
   
@@ -335,19 +67,5 @@
   )
 {
-  UINTN                     Size;
-
-  //
-  // Compute the size
-  //
-  Size = GetDevicePathSize (DevicePath);
-  if (Size == 0) {
-    return NULL;
-  }
-
-  //
-  // Allocate space for duplicate device path
-  //
-
-  return AllocateCopyPool (Size, DevicePath);
+  return UefiDevicePathLibDuplicateDevicePath (DevicePath);
 }
 
@@ -371,4 +89,5 @@
   
   @retval NULL      If there is not enough memory for the newly allocated buffer.
+  @retval NULL      If FirstDevicePath or SecondDevicePath is invalid.
   @retval Others    A pointer to the new device path if success.
                     Or a copy an end-of-device-path if both FirstDevicePath and SecondDevicePath are NULL.
@@ -382,42 +101,5 @@
   )
 {
-  UINTN                     Size;
-  UINTN                     Size1;
-  UINTN                     Size2;
-  EFI_DEVICE_PATH_PROTOCOL  *NewDevicePath;
-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath2;
-
-  //
-  // If there's only 1 path, just duplicate it.
-  //
-  if (FirstDevicePath == NULL) {
-    return DuplicateDevicePath ((SecondDevicePath != NULL) ? SecondDevicePath : &mUefiDevicePathLibEndDevicePath);
-  }
-
-  if (SecondDevicePath == NULL) {
-    return DuplicateDevicePath (FirstDevicePath);
-  }
-
-  //
-  // Allocate space for the combined device path. It only has one end node of
-  // length EFI_DEVICE_PATH_PROTOCOL.
-  //
-  Size1         = GetDevicePathSize (FirstDevicePath);
-  Size2         = GetDevicePathSize (SecondDevicePath);
-  Size          = Size1 + Size2 - END_DEVICE_PATH_LENGTH;
-
-  NewDevicePath = AllocatePool (Size);
-
-  if (NewDevicePath != NULL) {
-    NewDevicePath = CopyMem (NewDevicePath, FirstDevicePath, Size1);
-    //
-    // Over write FirstDevicePath EndNode and do the copy
-    //
-    DevicePath2 = (EFI_DEVICE_PATH_PROTOCOL *) ((CHAR8 *) NewDevicePath +
-                  (Size1 - END_DEVICE_PATH_LENGTH));
-    CopyMem (DevicePath2, SecondDevicePath, Size2);
-  }
-
-  return NewDevicePath;
+  return UefiDevicePathLibAppendDevicePath (FirstDevicePath, SecondDevicePath);
 }
 
@@ -457,35 +139,5 @@
   )
 {
-  EFI_DEVICE_PATH_PROTOCOL  *TempDevicePath;
-  EFI_DEVICE_PATH_PROTOCOL  *NextNode;
-  EFI_DEVICE_PATH_PROTOCOL  *NewDevicePath;
-  UINTN                     NodeLength;
-
-  if (DevicePathNode == NULL) {
-    return DuplicateDevicePath ((DevicePath != NULL) ? DevicePath : &mUefiDevicePathLibEndDevicePath);
-  }
-  //
-  // Build a Node that has a terminator on it
-  //
-  NodeLength = DevicePathNodeLength (DevicePathNode);
-
-  TempDevicePath = AllocatePool (NodeLength + END_DEVICE_PATH_LENGTH);
-  if (TempDevicePath == NULL) {
-    return NULL;
-  }
-  TempDevicePath = CopyMem (TempDevicePath, DevicePathNode, NodeLength);
-  //
-  // Add and end device path node to convert Node to device path
-  //
-  NextNode = NextDevicePathNode (TempDevicePath);
-  SetDevicePathEndNode (NextNode);
-  //
-  // Append device paths
-  //
-  NewDevicePath = AppendDevicePath (DevicePath, TempDevicePath);
-
-  FreePool (TempDevicePath);
-
-  return NewDevicePath;
+  return UefiDevicePathLibAppendDevicePathNode (DevicePath, DevicePathNode);
 }
 
@@ -501,4 +153,5 @@
   If DevicePath is NULL, then a copy if DevicePathInstance is returned.
   If DevicePathInstance is NULL, then NULL is returned.
+  If DevicePath or DevicePathInstance is invalid, then NULL is returned.
   If there is not enough memory to allocate space for the new device path, then 
   NULL is returned.  
@@ -519,35 +172,5 @@
   )
 {
-  EFI_DEVICE_PATH_PROTOCOL  *NewDevicePath;
-  EFI_DEVICE_PATH_PROTOCOL  *TempDevicePath;
-  UINTN                     SrcSize;
-  UINTN                     InstanceSize;
-
-  if (DevicePath == NULL) {
-    return DuplicateDevicePath (DevicePathInstance);
-  }
-
-  if (DevicePathInstance == NULL) {
-    return NULL;
-  }
-
-  SrcSize       = GetDevicePathSize (DevicePath);
-  InstanceSize  = GetDevicePathSize (DevicePathInstance);
-
-  NewDevicePath = AllocatePool (SrcSize + InstanceSize);
-  if (NewDevicePath != NULL) {
-    
-    TempDevicePath = CopyMem (NewDevicePath, DevicePath, SrcSize);;
- 
-    while (!IsDevicePathEnd (TempDevicePath)) {
-      TempDevicePath = NextDevicePathNode (TempDevicePath);
-    }
-    
-    TempDevicePath->SubType  = END_INSTANCE_DEVICE_PATH_SUBTYPE;
-    TempDevicePath           = NextDevicePathNode (TempDevicePath);
-    CopyMem (TempDevicePath, DevicePathInstance, InstanceSize);
-  }
-
-  return NewDevicePath;
+  return UefiDevicePathLibAppendDevicePathInstance (DevicePath, DevicePathInstance);
 }
 
@@ -560,4 +183,5 @@
   if no more) and updates Size to hold the size of the device path instance copy.
   If DevicePath is NULL, then NULL is returned.
+  If DevicePath points to a invalid device path, then NULL is returned.
   If there is not enough memory to allocate space for the new device path, then 
   NULL is returned.  
@@ -586,47 +210,5 @@
   )
 {
-  EFI_DEVICE_PATH_PROTOCOL  *DevPath;
-  EFI_DEVICE_PATH_PROTOCOL  *ReturnValue;
-  UINT8                     Temp;
-
-  ASSERT (Size != NULL);
-
-  if (DevicePath == NULL || *DevicePath == NULL) {
-    *Size = 0;
-    return NULL;
-  }
-
-  //
-  // Find the end of the device path instance
-  //
-  DevPath = *DevicePath;
-  while (!IsDevicePathEndType (DevPath)) {
-    DevPath = NextDevicePathNode (DevPath);
-  }
-
-  //
-  // Compute the size of the device path instance
-  //
-  *Size = ((UINTN) DevPath - (UINTN) (*DevicePath)) + sizeof (EFI_DEVICE_PATH_PROTOCOL);
- 
-  //
-  // Make a copy and return the device path instance
-  //
-  Temp              = DevPath->SubType;
-  DevPath->SubType  = END_ENTIRE_DEVICE_PATH_SUBTYPE;
-  ReturnValue       = DuplicateDevicePath (*DevicePath);
-  DevPath->SubType  = Temp;
-
-  //
-  // If DevPath is the end of an entire device path, then another instance
-  // does not follow, so *DevicePath is set to NULL.
-  //
-  if (DevicePathSubType (DevPath) == END_ENTIRE_DEVICE_PATH_SUBTYPE) {
-    *DevicePath = NULL;
-  } else {
-    *DevicePath = NextDevicePathNode (DevPath);
-  }
-
-  return ReturnValue;
+  return UefiDevicePathLibGetNextDevicePathInstance (DevicePath, Size);
 }
 
@@ -658,21 +240,5 @@
   )
 {
-  EFI_DEVICE_PATH_PROTOCOL      *DevicePath;
-
-  if (NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {
-    //
-    // NodeLength is less than the size of the header.
-    //
-    return NULL;
-  }
- 
-  DevicePath = AllocateZeroPool (NodeLength);
-  if (DevicePath != NULL) {
-     DevicePath->Type    = NodeType;
-     DevicePath->SubType = NodeSubType;
-     SetDevicePathNodeLength (DevicePath, NodeLength);
-  }
-
-  return DevicePath;
+  return UefiDevicePathLibCreateDeviceNode (NodeType, NodeSubType, NodeLength);
 }
 
@@ -682,11 +248,12 @@
   This function returns TRUE if the device path specified by DevicePath is
   multi-instance.
-  Otherwise, FALSE is returned.  If DevicePath is NULL, then FALSE is returned.
+  Otherwise, FALSE is returned.
+  If DevicePath is NULL or invalid, then FALSE is returned.
 
   @param  DevicePath                 A pointer to a device path data structure.
 
   @retval  TRUE                      DevicePath is multi-instance.
-  @retval  FALSE                     DevicePath is not multi-instance or DevicePath 
-                                     is NULL.
+  @retval  FALSE                     DevicePath is not multi-instance, or DevicePath 
+                                     is NULL or invalid.
 
 **/
@@ -697,111 +264,97 @@
   )
 {
-  CONST EFI_DEVICE_PATH_PROTOCOL     *Node;
-
-  if (DevicePath == NULL) {
-    return FALSE;
-  }
-
-  Node = DevicePath;
-  while (!IsDevicePathEnd (Node)) {
-    if (IsDevicePathEndInstance (Node)) {
-      return TRUE;
-    }
-
-    Node = NextDevicePathNode (Node);
-  }
-
-  return FALSE;
-}
-
-
-/**
-  Retrieves the device path protocol from a handle.
-
-  This function returns the device path protocol from the handle specified by Handle.  
-  If Handle is NULL or Handle does not contain a device path protocol, then NULL 
-  is returned.
- 
-  @param  Handle                     The handle from which to retrieve the device 
-                                     path protocol.
-
-  @return The device path protocol from the handle specified by Handle.
-
-**/
-EFI_DEVICE_PATH_PROTOCOL *
-EFIAPI
-DevicePathFromHandle (
-  IN EFI_HANDLE                      Handle
-  )
-{
-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
-  EFI_STATUS                Status;
-
-  Status = gBS->HandleProtocol (
-                  Handle,
-                  &gEfiDevicePathProtocolGuid,
-                  (VOID *) &DevicePath
-                  );
-  if (EFI_ERROR (Status)) {
-    DevicePath = NULL;
-  }
-  return DevicePath;
-}
-
-/**
-  Allocates a device path for a file and appends it to an existing device path.
-
-  If Device is a valid device handle that contains a device path protocol, then a device path for
-  the file specified by FileName  is allocated and appended to the device path associated with the
-  handle Device.  The allocated device path is returned.  If Device is NULL or Device is a handle
-  that does not support the device path protocol, then a device path containing a single device
-  path node for the file specified by FileName is allocated and returned.
-  The memory for the new device path is allocated from EFI boot services memory. It is the responsibility
-  of the caller to free the memory allocated.
-  
-  If FileName is NULL, then ASSERT().
-  If FileName is not aligned on a 16-bit boundary, then ASSERT().
-
-  @param  Device                     A pointer to a device handle.  This parameter 
-                                     is optional and may be NULL.
-  @param  FileName                   A pointer to a Null-terminated Unicode string.
-
-  @return The allocated device path.
-
-**/
-EFI_DEVICE_PATH_PROTOCOL *
-EFIAPI
-FileDevicePath (
-  IN EFI_HANDLE                      Device,     OPTIONAL
-  IN CONST CHAR16                    *FileName
-  )
-{
-  UINT16                    Size;
-  FILEPATH_DEVICE_PATH      *FilePath;
-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
-  EFI_DEVICE_PATH_PROTOCOL  *FileDevicePath;
-
-  DevicePath = NULL;
-
-  Size = (UINT16) StrSize (FileName);
-  
-  FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + END_DEVICE_PATH_LENGTH);
-  if (FileDevicePath != NULL) {
-    FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePath;
-    FilePath->Header.Type    = MEDIA_DEVICE_PATH;
-    FilePath->Header.SubType = MEDIA_FILEPATH_DP;
-    CopyMem (&FilePath->PathName, FileName, Size);
-    SetDevicePathNodeLength (&FilePath->Header, Size + SIZE_OF_FILEPATH_DEVICE_PATH);
-    SetDevicePathEndNode (NextDevicePathNode (&FilePath->Header));
-
-    if (Device != NULL) {
-      DevicePath = DevicePathFromHandle (Device);
-    }
-
-    DevicePath = AppendDevicePath (DevicePath, FileDevicePath);
-    FreePool (FileDevicePath);
-  }
-
-  return DevicePath;
-}
-
+  return UefiDevicePathLibIsDevicePathMultiInstance (DevicePath);
+}
+
+/**
+  Converts a device node to its string representation.
+
+  @param DeviceNode        A Pointer to the device node to be converted.
+  @param DisplayOnly       If DisplayOnly is TRUE, then the shorter text representation
+                           of the display node is used, where applicable. If DisplayOnly
+                           is FALSE, then the longer text representation of the display node
+                           is used.
+  @param AllowShortcuts    If AllowShortcuts is TRUE, then the shortcut forms of text
+                           representation for a device node can be used, where applicable.
+
+  @return A pointer to the allocated text representation of the device node or NULL if DeviceNode
+          is NULL or there was insufficient memory.
+
+**/
+CHAR16 *
+EFIAPI
+ConvertDeviceNodeToText (
+  IN CONST EFI_DEVICE_PATH_PROTOCOL  *DeviceNode,
+  IN BOOLEAN                         DisplayOnly,
+  IN BOOLEAN                         AllowShortcuts
+  )
+{
+  return UefiDevicePathLibConvertDeviceNodeToText (DeviceNode, DisplayOnly, AllowShortcuts);
+}
+
+/**
+  Converts a device path to its text representation.
+
+  @param DevicePath      A Pointer to the device to be converted.
+  @param DisplayOnly     If DisplayOnly is TRUE, then the shorter text representation
+                         of the display node is used, where applicable. If DisplayOnly
+                         is FALSE, then the longer text representation of the display node
+                         is used.
+  @param AllowShortcuts  If AllowShortcuts is TRUE, then the shortcut forms of text
+                         representation for a device node can be used, where applicable.
+
+  @return A pointer to the allocated text representation of the device path or
+          NULL if DeviceNode is NULL or there was insufficient memory.
+
+**/
+CHAR16 *
+EFIAPI
+ConvertDevicePathToText (
+  IN CONST EFI_DEVICE_PATH_PROTOCOL   *DevicePath,
+  IN BOOLEAN                          DisplayOnly,
+  IN BOOLEAN                          AllowShortcuts
+  )
+{
+  return UefiDevicePathLibConvertDevicePathToText (DevicePath, DisplayOnly, AllowShortcuts);
+}
+
+/**
+  Convert text to the binary representation of a device node.
+
+  @param TextDeviceNode  TextDeviceNode points to the text representation of a device
+                         node. Conversion starts with the first character and continues
+                         until the first non-device node character.
+
+  @return A pointer to the EFI device node or NULL if TextDeviceNode is NULL or there was
+          insufficient memory or text unsupported.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+EFIAPI
+ConvertTextToDeviceNode (
+  IN CONST CHAR16 *TextDeviceNode
+  )
+{
+  return UefiDevicePathLibConvertTextToDeviceNode (TextDeviceNode);
+}
+
+/**
+  Convert text to the binary representation of a device path.
+
+
+  @param TextDevicePath  TextDevicePath points to the text representation of a device
+                         path. Conversion starts with the first character and continues
+                         until the first non-device node character.
+
+  @return A pointer to the allocated device path or NULL if TextDeviceNode is NULL or
+          there was insufficient memory.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+EFIAPI
+ConvertTextToDevicePath (
+  IN CONST CHAR16 *TextDevicePath
+  )
+{
+  return UefiDevicePathLibConvertTextToDevicePath (TextDevicePath);
+}
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf	(revision 58459)
@@ -4,5 +4,5 @@
 # Device Path Library that layers on top of the Memory Allocation Library.
 #
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -19,4 +19,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = UefiDevicePathLib
+  MODULE_UNI_FILE                = UefiDevicePathLib.uni
   FILE_GUID                      = 91c1677a-e57f-4191-8b8e-eb7711a716e0
   MODULE_TYPE                    = UEFI_DRIVER
@@ -30,6 +31,9 @@
 
 [Sources]
+  DevicePathUtilities.c
+  DevicePathToText.c
+  DevicePathFromText.c
   UefiDevicePathLib.c
-
+  UefiDevicePathLib.h
 
 [Packages]
@@ -39,11 +43,29 @@
 [LibraryClasses]
   BaseLib
-  UefiBootServicesTableLib
   MemoryAllocationLib
   DebugLib
   BaseMemoryLib
+  PcdLib
+  PrintLib
 
+[Guids]
+  ## SOMETIMES_CONSUMES  ## GUID
+  gEfiVTUTF8Guid
+  ## SOMETIMES_CONSUMES  ## GUID
+  gEfiVT100Guid
+  ## SOMETIMES_CONSUMES  ## GUID
+  gEfiVT100PlusGuid
+  ## SOMETIMES_CONSUMES  ## GUID
+  gEfiPcAnsiGuid
+  ## SOMETIMES_CONSUMES  ## GUID
+  gEfiUartDevicePathGuid
+  ## SOMETIMES_CONSUMES  ## GUID
+  gEfiSasDevicePathGuid
 
 [Protocols]
-  gEfiDevicePathProtocolGuid                    ## CONSUMES
+  gEfiDevicePathProtocolGuid                    ## SOMETIMES_CONSUMES
+  gEfiDebugPortProtocolGuid                     ## UNDEFINED
 
+[Pcd]
+  gEfiMdePkgTokenSpaceGuid.PcdMaximumDevicePathNodeCount    ## SOMETIMES_CONSUMES
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c	(revision 58459)
@@ -3,5 +3,5 @@
   gEfiDevicePathUtilitiesProtocolGuid.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -18,4 +18,6 @@
 
 #include <Protocol/DevicePathUtilities.h>
+#include <Protocol/DevicePathToText.h>
+#include <Protocol/DevicePathFromText.h>
 
 #include <Library/DevicePathLib.h>
@@ -25,6 +27,9 @@
 #include <Library/BaseMemoryLib.h>
 #include <Library/UefiBootServicesTableLib.h>
-
-EFI_DEVICE_PATH_UTILITIES_PROTOCOL          *mDevicePathUtilities = NULL;
+#include <Library/PcdLib.h>
+
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_UTILITIES_PROTOCOL *mDevicePathLibDevicePathUtilities = NULL;
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_TO_TEXT_PROTOCOL   *mDevicePathLibDevicePathToText    = NULL;
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *mDevicePathLibDevicePathFromText  = NULL;
 
 //
@@ -64,10 +69,64 @@
                   &gEfiDevicePathUtilitiesProtocolGuid,
                   NULL,
-                  (VOID**) &mDevicePathUtilities
+                  (VOID**) &mDevicePathLibDevicePathUtilities
                   );
   ASSERT_EFI_ERROR (Status);
-  ASSERT (mDevicePathUtilities != NULL);
-
+  ASSERT (mDevicePathLibDevicePathUtilities != NULL);
   return Status;
+}
+
+/**
+  Determine whether a given device path is valid.
+  If DevicePath is NULL, then ASSERT().
+
+  @param  DevicePath  A pointer to a device path data structure.
+  @param  MaxSize     The maximum size of the device path data structure.
+
+  @retval TRUE        DevicePath is valid.
+  @retval FALSE       The length of any node node in the DevicePath is less
+                      than sizeof (EFI_DEVICE_PATH_PROTOCOL).
+  @retval FALSE       If MaxSize is not zero, the size of the DevicePath
+                      exceeds MaxSize.
+  @retval FALSE       If PcdMaximumDevicePathNodeCount is not zero, the node
+                      count of the DevicePath exceeds PcdMaximumDevicePathNodeCount.
+**/
+BOOLEAN
+EFIAPI
+IsDevicePathValid (
+  IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+  IN       UINTN                    MaxSize
+  )
+{
+  UINTN Count;
+  UINTN Size;
+  UINTN NodeLength;
+
+  ASSERT (DevicePath != NULL);
+
+  for (Count = 0, Size = 0; !IsDevicePathEnd (DevicePath); DevicePath = NextDevicePathNode (DevicePath)) {
+    NodeLength = DevicePathNodeLength (DevicePath);
+    if (NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {
+      return FALSE;
+    }
+
+    if (MaxSize > 0) {
+      Size += NodeLength;
+      if (Size + END_DEVICE_PATH_LENGTH > MaxSize) {
+        return FALSE;
+      }
+    }
+
+    if (PcdGet32 (PcdMaximumDevicePathNodeCount) > 0) {
+      Count++;
+      if (Count >= PcdGet32 (PcdMaximumDevicePathNodeCount)) {
+        return FALSE;
+      }
+    }
+  }
+
+  //
+  // Only return TRUE when the End Device Path node is valid.
+  //
+  return (BOOLEAN) (DevicePathNodeLength (DevicePath) == END_DEVICE_PATH_LENGTH);
 }
 
@@ -257,5 +316,6 @@
 
   If Node is NULL, then ASSERT().
-  If NodeLength >= 0x10000, then ASSERT().
+  If NodeLength >= SIZE_64KB, then ASSERT().
+  If NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL), then ASSERT().
 
   @param  Node      A pointer to a device path node data structure.
@@ -273,5 +333,5 @@
 {
   ASSERT (Node != NULL);
-  ASSERT (Length < 0x10000);
+  ASSERT ((Length >= sizeof (EFI_DEVICE_PATH_PROTOCOL)) && (Length < SIZE_64KB));
   return WriteUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0], (UINT16)(Length));
 }
@@ -306,11 +366,12 @@
   Returns the size of a device path in bytes.
 
-  This function returns the size, in bytes, of the device path data structure specified by
-  DevicePath including the end of device path node.  If DevicePath is NULL, then 0 is returned.
-
-  @param  DevicePath                 A pointer to a device path data structure.
-  
-  @retval 0       If DevicePath is NULL.
-  @retval Others  The size of a device path in bytes.
+  This function returns the size, in bytes, of the device path data structure 
+  specified by DevicePath including the end of device path node.
+  If DevicePath is NULL or invalid, then 0 is returned.
+
+  @param  DevicePath  A pointer to a device path data structure.
+
+  @retval 0           If DevicePath is NULL or invalid.
+  @retval Others      The size of a device path in bytes.
 
 **/
@@ -321,5 +382,5 @@
   )
 {
-  return mDevicePathUtilities->GetDevicePathSize (DevicePath);
+  return mDevicePathLibDevicePathUtilities->GetDevicePathSize (DevicePath);
 }
 
@@ -337,5 +398,5 @@
   @param  DevicePath                 A pointer to a device path data structure.
 
-  @retval NULL    If DevicePath is NULL.
+  @retval NULL    If DevicePath is NULL or invalid.
   @retval Others  A pointer to the duplicated device path.
   
@@ -347,5 +408,5 @@
   )
 {
-  return mDevicePathUtilities->DuplicateDevicePath (DevicePath);
+  return mDevicePathLibDevicePathUtilities->DuplicateDevicePath (DevicePath);
 }
 
@@ -368,4 +429,5 @@
   
   @retval NULL      If there is not enough memory for the newly allocated buffer.
+  @retval NULL      If FirstDevicePath or SecondDevicePath is invalid.
   @retval Others    A pointer to the new device path if success.
                     Or a copy an end-of-device-path if both FirstDevicePath and 
@@ -380,5 +442,5 @@
   )
 {
-  return mDevicePathUtilities->AppendDevicePath (FirstDevicePath, SecondDevicePath);
+  return mDevicePathLibDevicePathUtilities->AppendDevicePath (FirstDevicePath, SecondDevicePath);
 }
 
@@ -418,5 +480,5 @@
   )
 {
-  return mDevicePathUtilities->AppendDeviceNode (DevicePath, DevicePathNode);
+  return mDevicePathLibDevicePathUtilities->AppendDeviceNode (DevicePath, DevicePathNode);
 }
 
@@ -432,4 +494,5 @@
   If DevicePath is NULL, then a copy if DevicePathInstance is returned.
   If DevicePathInstance is NULL, then NULL is returned.
+  If DevicePath or DevicePathInstance is invalid, then NULL is returned.
   If there is not enough memory to allocate space for the new device path, then 
   NULL is returned.   
@@ -450,5 +513,5 @@
   )
 {
-  return mDevicePathUtilities->AppendDevicePathInstance (DevicePath, DevicePathInstance);
+  return mDevicePathLibDevicePathUtilities->AppendDevicePathInstance (DevicePath, DevicePathInstance);
 }
 
@@ -488,5 +551,5 @@
 {
   ASSERT (Size != NULL);
-  return mDevicePathUtilities->GetNextDevicePathInstance (DevicePath, Size);
+  return mDevicePathLibDevicePathUtilities->GetNextDevicePathInstance (DevicePath, Size);
 }
 
@@ -501,6 +564,5 @@
   NULL is returned.  
   The memory is allocated from EFI boot services memory. It is the responsibility 
-  of the caller to
-  free the memory allocated.
+  of the caller to free the memory allocated.
 
   @param  NodeType                   The device node type for the new device node.
@@ -519,5 +581,5 @@
   )
 {
-  return mDevicePathUtilities->CreateDeviceNode (NodeType, NodeSubType, NodeLength);
+  return mDevicePathLibDevicePathUtilities->CreateDeviceNode (NodeType, NodeSubType, NodeLength);
 }
 
@@ -525,13 +587,14 @@
   Determines if a device path is single or multi-instance.
 
-  This function returns TRUE if the device path specified by DevicePath is 
+  This function returns TRUE if the device path specified by DevicePath is
   multi-instance.
-  Otherwise, FALSE is returned.  If DevicePath is NULL, then FALSE is returned.
+  Otherwise, FALSE is returned.
+  If DevicePath is NULL or invalid, then FALSE is returned.
 
   @param  DevicePath                 A pointer to a device path data structure.
 
   @retval  TRUE                      DevicePath is multi-instance.
-  @retval  FALSE                     DevicePath is not multi-instance or DevicePath 
-                                     is NULL.
+  @retval  FALSE                     DevicePath is not multi-instance, or DevicePath 
+                                     is NULL or invalid.
 
 **/
@@ -542,5 +605,5 @@
   )
 {
-  return mDevicePathUtilities->IsDevicePathMultiInstance (DevicePath);
+  return mDevicePathLibDevicePathUtilities->IsDevicePathMultiInstance (DevicePath);
 }
 
@@ -634,2 +697,150 @@
   return DevicePath;
 }
+
+/**
+  Locate and return the protocol instance identified by the ProtocolGuid.
+
+  @param ProtocolGuid     The GUID of the protocol.
+
+  @return A pointer to the protocol instance or NULL when absent.
+**/
+VOID *
+UefiDevicePathLibLocateProtocol (
+  EFI_GUID                         *ProtocolGuid
+  )
+{
+  EFI_STATUS Status;
+  VOID       *Protocol;
+  Status = gBS->LocateProtocol (
+                  ProtocolGuid,
+                  NULL,
+                  (VOID**) &Protocol
+                  );
+  if (EFI_ERROR (Status)) {
+    return NULL;
+  } else {
+    return Protocol;
+  }
+}
+
+/**
+  Converts a device node to its string representation.
+
+  @param DeviceNode        A Pointer to the device node to be converted.
+  @param DisplayOnly       If DisplayOnly is TRUE, then the shorter text representation
+                           of the display node is used, where applicable. If DisplayOnly
+                           is FALSE, then the longer text representation of the display node
+                           is used.
+  @param AllowShortcuts    If AllowShortcuts is TRUE, then the shortcut forms of text
+                           representation for a device node can be used, where applicable.
+
+  @return A pointer to the allocated text representation of the device node or NULL if DeviceNode
+          is NULL or there was insufficient memory.
+
+**/
+CHAR16 *
+EFIAPI
+ConvertDeviceNodeToText (
+  IN CONST EFI_DEVICE_PATH_PROTOCOL  *DeviceNode,
+  IN BOOLEAN                         DisplayOnly,
+  IN BOOLEAN                         AllowShortcuts
+  )
+{
+  if (mDevicePathLibDevicePathToText == NULL) {
+    mDevicePathLibDevicePathToText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathToTextProtocolGuid);
+  }
+  if (mDevicePathLibDevicePathToText != NULL) {
+    return mDevicePathLibDevicePathToText->ConvertDeviceNodeToText (DeviceNode, DisplayOnly, AllowShortcuts);
+  } else {
+    return NULL;
+  }
+}
+
+/**
+  Converts a device path to its text representation.
+
+  @param DevicePath      A Pointer to the device to be converted.
+  @param DisplayOnly     If DisplayOnly is TRUE, then the shorter text representation
+                         of the display node is used, where applicable. If DisplayOnly
+                         is FALSE, then the longer text representation of the display node
+                         is used.
+  @param AllowShortcuts  If AllowShortcuts is TRUE, then the shortcut forms of text
+                         representation for a device node can be used, where applicable.
+
+  @return A pointer to the allocated text representation of the device path or
+          NULL if DeviceNode is NULL or there was insufficient memory.
+
+**/
+CHAR16 *
+EFIAPI
+ConvertDevicePathToText (
+  IN CONST EFI_DEVICE_PATH_PROTOCOL   *DevicePath,
+  IN BOOLEAN                          DisplayOnly,
+  IN BOOLEAN                          AllowShortcuts
+  )
+{
+  if (mDevicePathLibDevicePathToText == NULL) {
+    mDevicePathLibDevicePathToText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathToTextProtocolGuid);
+  }
+  if (mDevicePathLibDevicePathToText != NULL) {
+    return mDevicePathLibDevicePathToText->ConvertDevicePathToText (DevicePath, DisplayOnly, AllowShortcuts);
+  } else {
+    return NULL;
+  }
+}
+
+/**
+  Convert text to the binary representation of a device node.
+
+  @param TextDeviceNode  TextDeviceNode points to the text representation of a device
+                         node. Conversion starts with the first character and continues
+                         until the first non-device node character.
+
+  @return A pointer to the EFI device node or NULL if TextDeviceNode is NULL or there was
+          insufficient memory or text unsupported.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+EFIAPI
+ConvertTextToDeviceNode (
+  IN CONST CHAR16 *TextDeviceNode
+  )
+{
+  if (mDevicePathLibDevicePathFromText == NULL) {
+    mDevicePathLibDevicePathFromText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathFromTextProtocolGuid);
+  }
+  if (mDevicePathLibDevicePathFromText != NULL) {
+    return mDevicePathLibDevicePathFromText->ConvertTextToDeviceNode (TextDeviceNode);
+  } else {
+    return NULL;
+  }
+}
+
+/**
+  Convert text to the binary representation of a device path.
+
+
+  @param TextDevicePath  TextDevicePath points to the text representation of a device
+                         path. Conversion starts with the first character and continues
+                         until the first non-device node character.
+
+  @return A pointer to the allocated device path or NULL if TextDeviceNode is NULL or
+          there was insufficient memory.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+EFIAPI
+ConvertTextToDevicePath (
+  IN CONST CHAR16 *TextDevicePath
+  )
+{
+  if (mDevicePathLibDevicePathFromText == NULL) {
+    mDevicePathLibDevicePathFromText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathFromTextProtocolGuid);
+  }
+  if (mDevicePathLibDevicePathFromText != NULL) {
+    return mDevicePathLibDevicePathFromText->ConvertTextToDevicePath (TextDevicePath);
+  } else {
+    return NULL;
+  }
+}
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf	(revision 58459)
@@ -1,9 +1,9 @@
 ## @file
-# Instance of Device Path Library based on Device Path Protocol.
+# Instance of Device Path Library based on Device Path Utilities Protocol.
 #
-#  Device Path Library that layers on top of the UEFI 2.0 Device Path Protocol.
+#  Device Path Library that layers on top of the UEFI 2.0 Device Path Utilities Protocol.
 #  This library is not available for EFI 1.10 modules.
 #
-#  Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,8 +20,9 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = UefiDevicePathLibDevicePathProtocol
+  MODULE_UNI_FILE                = UefiDevicePathLibDevicePathProtocol.uni
   FILE_GUID                      = 050EB8C6-C12E-4b86-892B-40985E8B3137
   MODULE_TYPE                    = UEFI_DRIVER
   VERSION_STRING                 = 1.0
-  LIBRARY_CLASS                  = DevicePathLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 
+  LIBRARY_CLASS                  = DevicePathLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE
 
   CONSTRUCTOR                    = DevicePathLibConstructor
@@ -45,10 +46,16 @@
   BaseLib
   DebugLib
-
+  PcdLib
 
 [Protocols]
-  gEfiDevicePathProtocolGuid                    ## CONSUMES
+  gEfiDevicePathProtocolGuid                    ## SOMETIMES_CONSUMES
   gEfiDevicePathUtilitiesProtocolGuid           ## CONSUMES
+  gEfiDevicePathToTextProtocolGuid              ## SOMETIMES_CONSUMES
+  gEfiDevicePathFromTextProtocolGuid            ## SOMETIMES_CONSUMES
+
+[Pcd]
+  gEfiMdePkgTokenSpaceGuid.PcdMaximumDevicePathNodeCount    ## SOMETIMES_CONSUMES
 
 [Depex.common.DXE_DRIVER, Depex.common.DXE_RUNTIME_DRIVER, Depex.common.DXE_SAL_DRIVER, Depex.common.DXE_SMM_DRIVER]
   gEfiDevicePathUtilitiesProtocolGuid
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf	(revision 58459)
@@ -1,6 +1,6 @@
 ## @file
-# Module entry point library for UEFI driver.
+# Module entry point library for UEFI driver, DXE driver and SMM driver.
 #
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -17,4 +17,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = UefiDriverEntryPoint
+  MODULE_UNI_FILE                = UefiDriverEntryPoint.uni
   FILE_GUID                      = 331deb15-454b-48d8-9b74-70d01f3f3556
   MODULE_TYPE                    = UEFI_DRIVER
@@ -44,5 +45,5 @@
 
 [Protocols]
-  gEfiLoadedImageProtocolGuid                   ## CONSUMES
+  gEfiLoadedImageProtocolGuid                   ## SOMETIMES_CONSUMES
 
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiLib/Console.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiLib/Console.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiLib/Console.c	(revision 58459)
@@ -2,5 +2,5 @@
   This module provide help function for displaying unicode string.
 
-  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -22,4 +22,7 @@
   UINT32  Width;
 } UNICODE_WIDTH_ENTRY;
+
+#define NARROW_CHAR         0xFFF0
+#define WIDE_CHAR           0xFFF1
 
 GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = {
@@ -290,4 +293,87 @@
 
 /**
+  Count the storage space of a Unicode string. 
+
+  This function handles the Unicode string with NARROW_CHAR
+  and WIDE_CHAR control characters. NARROW_HCAR and WIDE_CHAR
+  does not count in the resultant output. If a WIDE_CHAR is
+  hit, then 2 Unicode character will consume an output storage
+  space with size of CHAR16 till a NARROW_CHAR is hit.
+
+  @param String          The input string to be counted.
+  @param LimitLen        Whether need to limit the string length.
+  @param MaxWidth        The max length this function supported.
+  @param Offset          The max index of the string can be show out. 
+
+  @return Storage space for the input string.
+
+**/
+UINTN
+UefiLibGetStringWidth (
+  IN  CHAR16               *String,
+  IN  BOOLEAN              LimitLen,
+  IN  UINTN                MaxWidth,
+  OUT UINTN                *Offset
+  )
+{
+  UINTN Index;
+  UINTN Count;
+  UINTN IncrementValue;
+
+  if (String == NULL) {
+    return 0;
+  }
+
+  Index           = 0;
+  Count           = 0;
+  IncrementValue  = 1;
+
+  do {
+    //
+    // Advance to the null-terminator or to the first width directive
+    //
+    for (;(String[Index] != NARROW_CHAR) && (String[Index] != WIDE_CHAR) && (String[Index] != 0); Index++) {
+      Count = Count + IncrementValue;
+
+      if (LimitLen && Count > MaxWidth) {
+        break;
+      }
+    }
+
+    //
+    // We hit the null-terminator, we now have a count
+    //
+    if (String[Index] == 0) {
+      break;
+    }
+
+    if (LimitLen && Count > MaxWidth) {
+      *Offset = Index;
+      break;
+    }
+
+    //
+    // We encountered a narrow directive - strip it from the size calculation since it doesn't get printed
+    // and also set the flag that determines what we increment by.(if narrow, increment by 1, if wide increment by 2)
+    //
+    if (String[Index] == NARROW_CHAR) {
+      //
+      // Skip to the next character
+      //
+      Index++;
+      IncrementValue = 1;
+    } else {
+      //
+      // Skip to the next character
+      //
+      Index++;
+      IncrementValue = 2;
+    }
+  } while (String[Index] != 0);
+
+  return Count * sizeof (CHAR16);
+}
+
+/**
   Draws a dialog box to the console output device specified by 
   ConOut defined in the EFI_SYSTEM_TABLE and waits for a keystroke
@@ -315,4 +401,5 @@
   )
 {
+  EFI_STATUS                       Status;
   VA_LIST                          Args;
   EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *ConOut;
@@ -328,4 +415,5 @@
   CHAR16                           *Line;
   UINTN                            EventIndex;
+  CHAR16                           *TmpString;
 
   //
@@ -337,5 +425,5 @@
   NumberOfLines = 0;
   while ((String = VA_ARG (Args, CHAR16 *)) != NULL) {
-    MaxLength = MAX (MaxLength, StrLen (String));
+    MaxLength = MAX (MaxLength, UefiLibGetStringWidth (String, FALSE, 0, NULL) / 2);
     NumberOfLines++;
   }
@@ -410,22 +498,31 @@
   VA_START (Args, Key);
   while ((String = VA_ARG (Args, CHAR16 *)) != NULL && NumberOfLines > 0) {
-    Length = StrLen (String);
     SetMem16 (Line, (MaxLength + 2) * 2, L' ');
-    if (Length <= MaxLength) {
-      //
-      // Length <= MaxLength
-      //
-      CopyMem (Line + 1 + (MaxLength - Length) / 2, String , Length * sizeof (CHAR16));
-    } else {
-      //
-      // Length > MaxLength
-      //
-      CopyMem (Line + 1, String + (Length - MaxLength) / 2 , MaxLength * sizeof (CHAR16));
-    }
     Line[0]             = BOXDRAW_VERTICAL;
     Line[MaxLength + 1] = BOXDRAW_VERTICAL;
     Line[MaxLength + 2] = L'\0';
-    ConOut->SetCursorPosition (ConOut, Column, Row++);
+    ConOut->SetCursorPosition (ConOut, Column, Row);
     ConOut->OutputString (ConOut, Line);
+    Length = UefiLibGetStringWidth (String, FALSE, 0, NULL) / 2;
+    if (Length <= MaxLength) {
+      //
+      // Length <= MaxLength
+      //
+      ConOut->SetCursorPosition (ConOut, Column + 1 + (MaxLength - Length) / 2, Row++);
+      ConOut->OutputString (ConOut, String);
+    } else {
+      //
+      // Length > MaxLength
+      //
+      UefiLibGetStringWidth (String, TRUE, MaxLength, &Length);
+      TmpString = AllocateZeroPool ((Length + 1) * sizeof (CHAR16));
+      ASSERT (TmpString != NULL);
+      StrnCpy(TmpString, String, Length - 3);
+      StrCat (TmpString, L"...");
+
+      ConOut->SetCursorPosition (ConOut, Column + 1, Row++);
+      ConOut->OutputString (ConOut, TmpString);
+      FreePool (TmpString);
+    }
     NumberOfLines--;
   }
@@ -458,6 +555,18 @@
   //
   if (Key != NULL) {
-    gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
-    gST->ConIn->ReadKeyStroke (gST->ConIn, Key);
+    while (TRUE) {
+      Status = gST->ConIn->ReadKeyStroke (gST->ConIn, Key);
+      if (!EFI_ERROR (Status)) {
+        break;
+      }
+
+      //
+      // If we encounter error, continue to read another key in.
+      //
+      if (Status != EFI_NOT_READY) {
+        continue;
+      }
+      gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
+    }
   }
 }
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiLib/UefiDriverModel.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiLib/UefiDriverModel.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiLib/UefiDriverModel.c	(revision 58459)
@@ -3,5 +3,5 @@
   installation.
 
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials are
   licensed and made available under the terms and conditions of the BSD License
@@ -52,6 +52,12 @@
   ASSERT (DriverBinding != NULL);
 
+  //
+  // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol
+  //
+  DriverBinding->ImageHandle         = ImageHandle;
+  DriverBinding->DriverBindingHandle = DriverBindingHandle;
+
   Status = gBS->InstallMultipleProtocolInterfaces (
-                  &DriverBindingHandle,
+                  &DriverBinding->DriverBindingHandle,
                   &gEfiDriverBindingProtocolGuid, DriverBinding,
                   NULL
@@ -61,10 +67,4 @@
   //
   ASSERT_EFI_ERROR (Status);
-
-  //
-  // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol
-  //
-  DriverBinding->ImageHandle         = ImageHandle;
-  DriverBinding->DriverBindingHandle = DriverBindingHandle;
 
   return Status;
@@ -114,9 +114,15 @@
   ASSERT (DriverBinding != NULL);
 
+  //
+  // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol
+  //
+  DriverBinding->ImageHandle         = ImageHandle;
+  DriverBinding->DriverBindingHandle = DriverBindingHandle;
+  
   if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
     if (DriverConfiguration == NULL) {
       if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
         Status = gBS->InstallMultipleProtocolInterfaces (
-                        &DriverBindingHandle,
+                        &DriverBinding->DriverBindingHandle,
                         &gEfiDriverBindingProtocolGuid, DriverBinding,
                         NULL
@@ -124,5 +130,5 @@
       } else {
         Status = gBS->InstallMultipleProtocolInterfaces (
-                        &DriverBindingHandle,
+                        &DriverBinding->DriverBindingHandle,
                         &gEfiDriverBindingProtocolGuid, DriverBinding,
                         &gEfiComponentNameProtocolGuid, ComponentName,
@@ -133,5 +139,5 @@
       if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
         Status = gBS->InstallMultipleProtocolInterfaces (
-                        &DriverBindingHandle,
+                        &DriverBinding->DriverBindingHandle,
                         &gEfiDriverBindingProtocolGuid,       DriverBinding,
                         &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
@@ -140,5 +146,5 @@
       } else {
         Status = gBS->InstallMultipleProtocolInterfaces (
-                        &DriverBindingHandle,
+                        &DriverBinding->DriverBindingHandle,
                         &gEfiDriverBindingProtocolGuid,       DriverBinding,
                         &gEfiComponentNameProtocolGuid,       ComponentName,
@@ -152,5 +158,5 @@
       if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
         Status = gBS->InstallMultipleProtocolInterfaces (
-                        &DriverBindingHandle,
+                        &DriverBinding->DriverBindingHandle,
                         &gEfiDriverBindingProtocolGuid,     DriverBinding,
                         &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
@@ -159,5 +165,5 @@
       } else {
         Status = gBS->InstallMultipleProtocolInterfaces (
-                        &DriverBindingHandle,
+                        &DriverBinding->DriverBindingHandle,
                         &gEfiDriverBindingProtocolGuid,     DriverBinding,
                         &gEfiComponentNameProtocolGuid,     ComponentName,
@@ -169,5 +175,5 @@
       if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
        Status = gBS->InstallMultipleProtocolInterfaces (
-                        &DriverBindingHandle,
+                        &DriverBinding->DriverBindingHandle,
                         &gEfiDriverBindingProtocolGuid,       DriverBinding,
                         &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
@@ -177,5 +183,5 @@
       } else {
         Status = gBS->InstallMultipleProtocolInterfaces (
-                        &DriverBindingHandle,
+                        &DriverBinding->DriverBindingHandle,
                         &gEfiDriverBindingProtocolGuid,       DriverBinding,
                         &gEfiComponentNameProtocolGuid,       ComponentName,
@@ -192,10 +198,4 @@
   //
   ASSERT_EFI_ERROR (Status);
-
-  //
-  // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol
-  //
-  DriverBinding->ImageHandle         = ImageHandle;
-  DriverBinding->DriverBindingHandle = DriverBindingHandle;
 
   return Status;
@@ -242,8 +242,14 @@
   ASSERT (DriverBinding != NULL);
 
+  //
+  // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol
+  //
+  DriverBinding->ImageHandle         = ImageHandle;
+  DriverBinding->DriverBindingHandle = DriverBindingHandle;
+
   if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
     if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
       Status = gBS->InstallMultipleProtocolInterfaces (
-                      &DriverBindingHandle,
+                      &DriverBinding->DriverBindingHandle,
                       &gEfiDriverBindingProtocolGuid, DriverBinding,
                       NULL
@@ -251,5 +257,5 @@
       } else {
       Status = gBS->InstallMultipleProtocolInterfaces (
-                      &DriverBindingHandle,
+                      &DriverBinding->DriverBindingHandle,
                       &gEfiDriverBindingProtocolGuid, DriverBinding,
                       &gEfiComponentName2ProtocolGuid, ComponentName2,
@@ -260,5 +266,5 @@
      if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
        Status = gBS->InstallMultipleProtocolInterfaces (
-                       &DriverBindingHandle,
+                       &DriverBinding->DriverBindingHandle,
                        &gEfiDriverBindingProtocolGuid, DriverBinding,
                        &gEfiComponentNameProtocolGuid, ComponentName,
@@ -267,5 +273,5 @@
      } else {
        Status = gBS->InstallMultipleProtocolInterfaces (
-                       &DriverBindingHandle,
+                       &DriverBinding->DriverBindingHandle,
                        &gEfiDriverBindingProtocolGuid, DriverBinding,
                        &gEfiComponentNameProtocolGuid, ComponentName,
@@ -275,14 +281,9 @@
     }
   }
+
   //
   // ASSERT if the call to InstallMultipleProtocolInterfaces() failed
   //
   ASSERT_EFI_ERROR (Status);
-
-  //
-  // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol
-  //
-  DriverBinding->ImageHandle         = ImageHandle;
-  DriverBinding->DriverBindingHandle = DriverBindingHandle;
 
   return Status;
@@ -339,4 +340,10 @@
   ASSERT (DriverBinding != NULL); 
 
+  //
+  // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol
+  //
+  DriverBinding->ImageHandle         = ImageHandle;
+  DriverBinding->DriverBindingHandle = DriverBindingHandle;
+  
   if (DriverConfiguration2 == NULL) {
     if (DriverConfiguration == NULL) {
@@ -346,27 +353,27 @@
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
               Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
                               &gEfiDriverBindingProtocolGuid, DriverBinding,
                               &gEfiComponentNameProtocolGuid, ComponentName,
@@ -380,30 +387,30 @@
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
               Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
                               &gEfiDriverBindingProtocolGuid, DriverBinding,
                               &gEfiComponentNameProtocolGuid, ComponentName,
@@ -420,30 +427,30 @@
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
               Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
                               &gEfiDriverBindingProtocolGuid, DriverBinding,
                               &gEfiComponentNameProtocolGuid, ComponentName,
@@ -458,33 +465,33 @@
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
               Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
                               &gEfiDriverBindingProtocolGuid, DriverBinding,
                               &gEfiComponentNameProtocolGuid, ComponentName,
@@ -504,30 +511,30 @@
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
               Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
                               &gEfiDriverBindingProtocolGuid, DriverBinding,
                               &gEfiComponentNameProtocolGuid, ComponentName,
@@ -542,33 +549,33 @@
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
               Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
                               &gEfiDriverBindingProtocolGuid, DriverBinding,
                               &gEfiComponentNameProtocolGuid, ComponentName,
@@ -586,33 +593,33 @@
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
               Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
                               &gEfiDriverBindingProtocolGuid, DriverBinding,
                               &gEfiComponentNameProtocolGuid, ComponentName,
@@ -628,36 +635,36 @@
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
               Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
                               &gEfiDriverBindingProtocolGuid, DriverBinding,
                               &gEfiComponentNameProtocolGuid, ComponentName,
@@ -680,30 +687,30 @@
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
               Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
                               &gEfiDriverBindingProtocolGuid, DriverBinding,
                               &gEfiComponentNameProtocolGuid, ComponentName,
@@ -718,33 +725,33 @@
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
               Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
                               &gEfiDriverBindingProtocolGuid, DriverBinding,
                               &gEfiComponentNameProtocolGuid, ComponentName,
@@ -762,33 +769,33 @@
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
               Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
                               &gEfiDriverBindingProtocolGuid, DriverBinding,
                               &gEfiComponentNameProtocolGuid, ComponentName,
@@ -804,36 +811,36 @@
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
               Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
                               &gEfiDriverBindingProtocolGuid, DriverBinding,
                               &gEfiComponentNameProtocolGuid, ComponentName,
@@ -854,33 +861,33 @@
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
               Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
                               &gEfiDriverBindingProtocolGuid, DriverBinding,
                               &gEfiComponentNameProtocolGuid, ComponentName,
@@ -896,36 +903,36 @@
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
               Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
                               &gEfiDriverBindingProtocolGuid, DriverBinding,
                               &gEfiComponentNameProtocolGuid, ComponentName,
@@ -944,36 +951,36 @@
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
               Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
                               &gEfiDriverBindingProtocolGuid, DriverBinding,
                               &gEfiComponentNameProtocolGuid, ComponentName,
@@ -990,39 +997,39 @@
             if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
               Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentName2ProtocolGuid, ComponentName2,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            }
-          } else {
-            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
-                              &gEfiDriverBindingProtocolGuid, DriverBinding,
-                              &gEfiComponentNameProtocolGuid, ComponentName,
-                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
-                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
-                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
-                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
-                              NULL
-                              );
-            } else {
-              Status = gBS->InstallMultipleProtocolInterfaces (
-                              &DriverBindingHandle,
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentName2ProtocolGuid, ComponentName2,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            }
+          } else {
+            if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
+                              &gEfiDriverBindingProtocolGuid, DriverBinding,
+                              &gEfiComponentNameProtocolGuid, ComponentName,
+                              &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
+                              &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
+                              &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
+                              &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
+                              NULL
+                              );
+            } else {
+              Status = gBS->InstallMultipleProtocolInterfaces (
+                              &DriverBinding->DriverBindingHandle,
                               &gEfiDriverBindingProtocolGuid, DriverBinding,
                               &gEfiComponentNameProtocolGuid, ComponentName,
@@ -1041,18 +1048,9 @@
   }
 
-
   //
   // ASSERT if the call to InstallMultipleProtocolInterfaces() failed
   //
   ASSERT_EFI_ERROR (Status);
-
-  //
-  // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol
-  //
-  DriverBinding->ImageHandle         = ImageHandle;
-  DriverBinding->DriverBindingHandle = DriverBindingHandle;
 
   return Status;
 }
-
-
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiLib/UefiLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiLib/UefiLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiLib/UefiLib.c	(revision 58459)
@@ -6,5 +6,5 @@
   and print messages on the console output and standard error devices.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -1213,5 +1213,9 @@
 }
 
-/**
+#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
+
+/**
+  [ATTENTION] This function will be deprecated for security reason.
+
   Returns a pointer to an allocated buffer that contains the contents of a 
   variable retrieved through the UEFI Runtime Service GetVariable().  The 
@@ -1274,6 +1278,7 @@
 }
 
-
-/**
+/**
+  [ATTENTION] This function will be deprecated for security reason.
+
   Returns a pointer to an allocated buffer that contains the contents of a 
   variable retrieved through the UEFI Runtime Service GetVariable().  This 
@@ -1299,5 +1304,108 @@
   return GetVariable (Name, &gEfiGlobalVariableGuid);
 }
-
+#endif
+
+/**
+  Returns the status whether get the variable success. The function retrieves 
+  variable  through the UEFI Runtime Service GetVariable().  The 
+  returned buffer is allocated using AllocatePool().  The caller is responsible
+  for freeing this buffer with FreePool().
+
+  If Name  is NULL, then ASSERT().
+  If Guid  is NULL, then ASSERT().
+  If Value is NULL, then ASSERT().
+
+  @param[in]  Name  The pointer to a Null-terminated Unicode string.
+  @param[in]  Guid  The pointer to an EFI_GUID structure
+  @param[out] Value The buffer point saved the variable info.
+  @param[out] Size  The buffer size of the variable.
+
+  @return EFI_OUT_OF_RESOURCES      Allocate buffer failed.
+  @return EFI_SUCCESS               Find the specified variable.
+  @return Others Errors             Return errors from call to gRT->GetVariable.
+
+**/
+EFI_STATUS
+EFIAPI
+GetVariable2 (
+  IN CONST CHAR16    *Name,
+  IN CONST EFI_GUID  *Guid,
+  OUT VOID           **Value,
+  OUT UINTN          *Size OPTIONAL
+  )
+{
+  EFI_STATUS  Status;
+  UINTN       BufferSize;
+
+  ASSERT (Name != NULL && Guid != NULL && Value != NULL);
+
+  //
+  // Try to get the variable size.
+  //
+  BufferSize = 0;
+  *Value     = NULL;
+  if (Size != NULL) {
+    *Size  = 0;
+  }
+  
+  Status = gRT->GetVariable ((CHAR16 *) Name, (EFI_GUID *) Guid, NULL, &BufferSize, *Value);
+  if (Status != EFI_BUFFER_TOO_SMALL) {
+    return Status;
+  }
+
+  //
+  // Allocate buffer to get the variable.
+  //
+  *Value = AllocatePool (BufferSize);
+  ASSERT (*Value != NULL);
+  if (*Value == NULL) {
+    return EFI_OUT_OF_RESOURCES;
+  }
+
+  //
+  // Get the variable data.
+  //
+  Status = gRT->GetVariable ((CHAR16 *) Name, (EFI_GUID *) Guid, NULL, &BufferSize, *Value);
+  if (EFI_ERROR (Status)) {
+    FreePool(*Value);
+    *Value = NULL;
+  }
+
+  if (Size != NULL) {
+    *Size = BufferSize;
+  }
+
+  return Status;
+}
+
+/**
+  Returns a pointer to an allocated buffer that contains the contents of a 
+  variable retrieved through the UEFI Runtime Service GetVariable().  This 
+  function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables.
+  The returned buffer is allocated using AllocatePool().  The caller is 
+  responsible for freeing this buffer with FreePool().
+
+  If Name is NULL, then ASSERT().
+  If Value is NULL, then ASSERT().
+
+  @param[in]  Name  The pointer to a Null-terminated Unicode string.
+  @param[out] Value The buffer point saved the variable info.
+  @param[out] Size  The buffer size of the variable.
+
+  @return EFI_OUT_OF_RESOURCES      Allocate buffer failed.
+  @return EFI_SUCCESS               Find the specified variable.
+  @return Others Errors             Return errors from call to gRT->GetVariable.
+
+**/
+EFI_STATUS
+EFIAPI
+GetEfiGlobalVariable2 (
+  IN CONST CHAR16    *Name,
+  OUT VOID           **Value,
+  OUT UINTN          *Size OPTIONAL
+  )
+{
+  return GetVariable2 (Name, &gEfiGlobalVariableGuid, Value, Size);
+}
 
 /**
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiLib/UefiLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiLib/UefiLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiLib/UefiLib.inf	(revision 58459)
@@ -8,5 +8,5 @@
 #  and print messages on the console output and standard error devices.
 #
-# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -23,4 +23,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = UefiLib
+  MODULE_UNI_FILE                = UefiLib.uni
   FILE_GUID                      = 3a004ba5-efe0-4a61-9f1a-267a46ae5ba9
   MODULE_TYPE                    = UEFI_DRIVER
@@ -59,24 +60,24 @@
   
 [Guids]
-  gEfiEventReadyToBootGuid                      ## CONSUMES  ## Event
-  gEfiEventLegacyBootGuid                       ## CONSUMES  ## Event
-  gEfiGlobalVariableGuid                        ## CONSUMES  ## Variable
+  gEfiEventReadyToBootGuid                      ## SOMETIMES_CONSUMES  ## Event
+  gEfiEventLegacyBootGuid                       ## SOMETIMES_CONSUMES  ## Event
+  gEfiGlobalVariableGuid                        ## SOMETIMES_CONSUMES  ## Variable
 
 [Protocols]
-  gEfiDriverBindingProtocolGuid                   ## PRODUCES
-  gEfiSimpleTextOutProtocolGuid                   ## CONSUMES
-  gEfiGraphicsOutputProtocolGuid                  ## CONSUMES
-  gEfiHiiFontProtocolGuid                         ## CONSUMES
-  gEfiUgaDrawProtocolGuid | gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport                 ## SOMETIMES_CONSUMES (Consumes if gEfiGraphicsOutputProtocolGuid uninstalled)
-  gEfiComponentNameProtocolGuid  | NOT gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable   ## SOMETIMES_PRODUCES (User chooses to produce it)
-  gEfiComponentName2ProtocolGuid | NOT gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable  ## SOMETIMES_PRODUCES (User chooses to produce it)
-  gEfiDriverConfigurationProtocolGuid                            ## SOMETIMES_CONSUMES (User chooses to produce it)
-  gEfiDriverConfiguration2ProtocolGuid                           ## SOMETIMES_CONSUMES (User chooses to produce it)
-  gEfiDriverDiagnosticsProtocolGuid | NOT gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnosticsDisable  ## SOMETIMES_CONSUMES (User chooses to produce it)
-  gEfiDriverDiagnostics2ProtocolGuid| NOT gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable ## SOMETIMES_CONSUMES (User chooses to produce it)
+  gEfiDriverBindingProtocolGuid                   ## SOMETIMES_PRODUCES
+  gEfiSimpleTextOutProtocolGuid                   ## SOMETIMES_CONSUMES
+  gEfiGraphicsOutputProtocolGuid                  ## SOMETIMES_CONSUMES
+  gEfiHiiFontProtocolGuid                         ## SOMETIMES_CONSUMES
+  gEfiUgaDrawProtocolGuid | gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport                 ## SOMETIMES_CONSUMES # Consumes if gEfiGraphicsOutputProtocolGuid uninstalled
+  gEfiComponentNameProtocolGuid  | NOT gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable   ## SOMETIMES_PRODUCES # User chooses to produce it
+  gEfiComponentName2ProtocolGuid | NOT gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable  ## SOMETIMES_PRODUCES # User chooses to produce it
+  gEfiDriverConfigurationProtocolGuid                            ## SOMETIMES_PRODUCES # User chooses to produce it
+  gEfiDriverConfiguration2ProtocolGuid                           ## SOMETIMES_PRODUCES # User chooses to produce it
+  gEfiDriverDiagnosticsProtocolGuid | NOT gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnosticsDisable  ## SOMETIMES_PRODUCES # User chooses to produce it
+  gEfiDriverDiagnostics2ProtocolGuid| NOT gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable ## SOMETIMES_PRODUCES # User chooses to produce it
 
 
 [Pcd]
-  gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize   ## CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize   ## SOMETIMES_CONSUMES
 
 [FeaturePcd]
@@ -87,3 +88,2 @@
   gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport           ## CONSUMES
 
-
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiLib/UefiNotTiano.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiLib/UefiNotTiano.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiLib/UefiNotTiano.c	(revision 58459)
@@ -35,5 +35,5 @@
 VOID
 EFIAPI
-InternalEmptyFuntion (
+InternalEmptyFunction (
   IN EFI_EVENT                Event,
   IN VOID                     *Context
@@ -68,5 +68,5 @@
   return EfiCreateEventLegacyBootEx (
            TPL_CALLBACK,
-           InternalEmptyFuntion,
+           InternalEmptyFunction,
            NULL,
            LegacyBootEvent
@@ -102,5 +102,6 @@
   )
 {
-  EFI_STATUS    Status;
+  EFI_STATUS        Status;
+  EFI_EVENT_NOTIFY  WorkerNotifyFunction;
 
   ASSERT (LegacyBootEvent != NULL);
@@ -115,8 +116,17 @@
     // For UEFI 2.0 and the future use an Event Group
     //
+    if (NotifyFunction == NULL) {
+      //
+      // CreateEventEx will check NotifyFunction is NULL or not and return error.
+      // Use dummy routine for the case NotifyFunction is NULL.
+      //
+      WorkerNotifyFunction = InternalEmptyFunction;
+    } else {
+      WorkerNotifyFunction = NotifyFunction;
+    }
     Status = gBS->CreateEventEx (
                     EVT_NOTIFY_SIGNAL,
                     NotifyTpl,
-                    NotifyFunction,
+                    WorkerNotifyFunction,
                     NotifyContext,
                     &gEfiEventLegacyBootGuid,
@@ -153,5 +163,5 @@
   return EfiCreateEventReadyToBootEx (
            TPL_CALLBACK,
-           InternalEmptyFuntion,
+           InternalEmptyFunction,
            NULL,
            ReadyToBootEvent
@@ -187,5 +197,6 @@
   )
 {
-  EFI_STATUS    Status;
+  EFI_STATUS        Status;
+  EFI_EVENT_NOTIFY  WorkerNotifyFunction;
 
   ASSERT (ReadyToBootEvent != NULL);
@@ -200,8 +211,17 @@
     // For UEFI 2.0 and the future use an Event Group
     //
+    if (NotifyFunction == NULL) {
+      //
+      // CreateEventEx will check NotifyFunction is NULL or not and return error.
+      // Use dummy routine for the case NotifyFunction is NULL.
+      //
+      WorkerNotifyFunction = InternalEmptyFunction;
+    } else {
+      WorkerNotifyFunction = NotifyFunction;
+    }
     Status = gBS->CreateEventEx (
                     EVT_NOTIFY_SIGNAL,
                     NotifyTpl,
-                    NotifyFunction,
+                    WorkerNotifyFunction,
                     NotifyContext,
                     &gEfiEventReadyToBootGuid,
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c	(revision 58459)
@@ -3,5 +3,5 @@
   on boot services for Dxe phase drivers.
 
-  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
@@ -161,4 +161,5 @@
   NULL is returned.
   If Alignment is not a power of two and Alignment is not zero, then ASSERT().
+  If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
 
   @param  MemoryType            The type of memory to allocate.
@@ -247,4 +248,5 @@
   
   If Alignment is not a power of two and Alignment is not zero, then ASSERT().
+  If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
 
   @param  Pages                 The number of 4 KB pages to allocate.
@@ -274,4 +276,5 @@
   
   If Alignment is not a power of two and Alignment is not zero, then ASSERT().
+  If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
 
   @param  Pages                 The number of 4 KB pages to allocate.
@@ -301,4 +304,5 @@
   
   If Alignment is not a power of two and Alignment is not zero, then ASSERT().
+  If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
 
   @param  Pages                 The number of 4 KB pages to allocate.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf	(revision 58459)
@@ -5,5 +5,5 @@
 #  and free memory.
 #
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = UefiMemoryAllocationLib
+  MODULE_UNI_FILE                = UefiMemoryAllocationLib.uni
   FILE_GUID                      = 4674739d-3195-4fb2-8094-ac1d22d00194
   MODULE_TYPE                    = UEFI_DRIVER
@@ -39,2 +40,3 @@
   BaseMemoryLib
   UefiBootServicesTableLib
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiMemoryLib/UefiMemoryLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiMemoryLib/UefiMemoryLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiMemoryLib/UefiMemoryLib.inf	(revision 58459)
@@ -5,5 +5,5 @@
 #  where possible for size reduction.
 #
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = UefiMemoryLib
+  MODULE_UNI_FILE                = UefiMemoryLib.uni
   FILE_GUID                      = f1bbe03d-2f28-4dee-bec7-d98d7a30c36a
   MODULE_TYPE                    = UEFI_DRIVER
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiPalLib/UefiPalLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiPalLib/UefiPalLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiPalLib/UefiPalLib.inf	(revision 58459)
@@ -5,5 +5,5 @@
 # register in the EFI System Confguration Table.
 #
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = UefiPalLib
+  MODULE_UNI_FILE                = UefiPalLib.uni
   FILE_GUID                      = B7F30170-9E5F-482a-B553-A145A5787003
   MODULE_TYPE                    = UEFI_DRIVER
@@ -45,3 +46,4 @@
 
 [Guids]
-  gEfiSalSystemTableGuid        ## CONSUMES ## GUID
+  gEfiSalSystemTableGuid        ## CONSUMES ## SystemTable
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiPciLibPciRootBridgeIo/PciLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiPciLibPciRootBridgeIo/PciLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiPciLibPciRootBridgeIo/PciLib.c	(revision 58459)
@@ -2,5 +2,5 @@
   PCI Library using PCI Root Bridge I/O Protocol.
 
-  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials are
   licensed and made available under the terms and conditions of
@@ -365,4 +365,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -406,4 +407,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -447,4 +449,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -490,4 +493,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -716,4 +721,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -758,4 +764,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -800,4 +807,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -844,4 +852,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1070,4 +1080,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1112,4 +1123,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1154,4 +1166,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1198,4 +1211,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiPciLibPciRootBridgeIo/UefiPciLibPciRootBridgeIo.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiPciLibPciRootBridgeIo/UefiPciLibPciRootBridgeIo.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiPciLibPciRootBridgeIo/UefiPciLibPciRootBridgeIo.inf	(revision 58459)
@@ -8,5 +8,5 @@
 #  it should only be used on platforms that contain a single PCI root bridge.
 #
-# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -23,4 +23,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = UefiPciLibPciRootBridgeIo
+  MODULE_UNI_FILE                = UefiPciLibPciRootBridgeIo.uni
   FILE_GUID                      = 90EC42CB-B780-4eb8-8E99-C8E3E5F37530
   MODULE_TYPE                    = UEFI_DRIVER
@@ -54,2 +55,3 @@
 [Depex.common.DXE_DRIVER, Depex.common.DXE_RUNTIME_DRIVER, Depex.common.DXE_SAL_DRIVER, Depex.common.DXE_SMM_DRIVER]
   gEfiPciRootBridgeIoProtocolGuid
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/PciSegmentLib.c	(revision 58459)
@@ -2,5 +2,5 @@
   PCI Segment Library implementation using PCI Root Bridge I/O Protocol.
 
-  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials are
   licensed and made available under the terms and conditions of
@@ -447,4 +447,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -488,4 +489,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -529,4 +531,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -572,4 +575,6 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -789,4 +794,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -825,4 +831,5 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -867,4 +874,5 @@
   If EndBit is greater than 7, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The address that encodes the PCI Segment, Bus, Device, Function, and Register.
@@ -910,4 +918,6 @@
   If EndBit is greater than 15, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1124,4 +1134,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1165,4 +1176,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1206,5 +1218,5 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
-  
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
@@ -1250,4 +1262,6 @@
   If EndBit is greater than 31, then ASSERT().
   If EndBit is less than StartBit, then ASSERT().
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
 
   @param  Address   The PCI configuration register to write.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/UefiPciSegmentLibPciRootBridgeIo.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/UefiPciSegmentLibPciRootBridgeIo.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiPciSegmentLibPciRootBridgeIo/UefiPciSegmentLibPciRootBridgeIo.inf	(revision 58459)
@@ -8,5 +8,5 @@
 #  the translation from a PCI segment number into a specific PCI Root Bridge I/O Protocol.
 #
-# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -23,4 +23,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = UefiPciSegmentLibPciRootBridgeIo
+  MODULE_UNI_FILE                = UefiPciSegmentLibPciRootBridgeIo.uni
   FILE_GUID                      = C6068612-B6E0-48a3-BB92-60E4A4F89EDF
   MODULE_TYPE                    = UEFI_DRIVER
@@ -57,2 +58,3 @@
 [Depex.common.DXE_DRIVER, Depex.common.DXE_RUNTIME_DRIVER, Depex.common.DXE_SAL_DRIVER, Depex.common.DXE_SMM_DRIVER]
   gEfiPciRootBridgeIoProtocolGuid
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf	(revision 58459)
@@ -6,5 +6,5 @@
 # This instance also supports SAL drivers for better performance.
 #
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -21,4 +21,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = UefiRuntimeLib
+  MODULE_UNI_FILE                = UefiRuntimeLib.uni
   FILE_GUID                      = b1ee6c28-54aa-4d17-b705-3e28ccb27b2e
   MODULE_TYPE                    = DXE_RUNTIME_DRIVER
@@ -46,5 +47,5 @@
  
 [Guids]
-  gEfiEventExitBootServicesGuid             ## PRODUCES ## Event
-  gEfiEventVirtualAddressChangeGuid         ## PRODUCES ## Event
+  gEfiEventExitBootServicesGuid             ## CONSUMES ## Event
+  gEfiEventVirtualAddressChangeGuid         ## CONSUMES ## Event
 
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf	(revision 58459)
@@ -2,5 +2,5 @@
 # UEFI Runtime Services Table Library implementation.
 #
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -17,4 +17,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = UefiRuntimeServicesTableLib
+  MODULE_UNI_FILE                = UefiRuntimeServicesTableLib.uni
   FILE_GUID                      = 19cbbb97-ff61-45ff-8c3f-dfa66dd118c8
   MODULE_TYPE                    = UEFI_DRIVER
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiSalLib/UefiSalLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiSalLib/UefiSalLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiSalLib/UefiSalLib.inf	(revision 58459)
@@ -5,5 +5,5 @@
 # register in the EFI System Confguration Table.
 #
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = UefiSalLib
+  MODULE_UNI_FILE                = UefiSalLib.uni
   FILE_GUID                      = 4ABCFD77-4A33-4089-B003-5F09BCA940A2
   MODULE_TYPE                    = UEFI_DRIVER
@@ -43,3 +44,4 @@
 
 [Guids]
-  gEfiSalSystemTableGuid        ## CONSUMES ## GUID
+  gEfiSalSystemTableGuid        ## CONSUMES ## SystemTable
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiScsiLib/UefiScsiLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiScsiLib/UefiScsiLib.c	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiScsiLib/UefiScsiLib.c	(revision 58459)
@@ -875,5 +875,5 @@
   @param[in, out] DataLength           The length of data buffer.
   @param[in]      StartLba             The start address of LBA.
-  @param[in]      SectorSize           The sector size.
+  @param[in]      SectorSize           The number of contiguous logical blocks of data that shall be transferred.
 
   @retval  EFI_SUCCESS          The command is executed successfully.
@@ -973,5 +973,5 @@
   @param[in, out] DataLength           The length of data buffer.
   @param[in]      StartLba             The start address of LBA.
-  @param[in]      SectorSize           The sector size.
+  @param[in]      SectorSize           The number of contiguous logical blocks of data that shall be transferred.
 
   @retval  EFI_SUCCESS          The command executed successfully.
@@ -1071,5 +1071,5 @@
   @param[in, out] DataLength           The length of data buffer.
   @param[in]      StartLba             The start address of LBA.
-  @param[in]      SectorSize           The sector size.
+  @param[in]      SectorSize           The number of contiguous logical blocks of data that shall be transferred.
 
   @retval  EFI_SUCCESS          The command executed successfully.
@@ -1169,5 +1169,5 @@
   @param[in, out] DataLength           The length of data buffer.
   @param[in]      StartLba             The start address of LBA.
-  @param[in]      SectorSize           The sector size.
+  @param[in]      SectorSize           The number of contiguous logical blocks of data that shall be transferred.
 
   @retval  EFI_SUCCESS          The command is executed successfully.
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiScsiLib/UefiScsiLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiScsiLib/UefiScsiLib.inf	(revision 58459)
@@ -1,9 +1,9 @@
 ## @file
-# Instance of Scsi Library.
+# Uefi Scsi Library Instance.
 #
 # This libarary provides the functions to submit Scsi commands defined
 # in SCSI-2 specification for scsi device.
 #
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = UefiScsiLib
+  MODULE_UNI_FILE                = UefiScsiLib.uni
   FILE_GUID                      = 280E42C3-826E-4573-9772-B74EF1086D95
   MODULE_TYPE                    = UEFI_DRIVER
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiUsbLib/UefiUsbLib.inf	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiUsbLib/UefiUsbLib.inf	(revision 58459)
@@ -1,9 +1,9 @@
 ## @file
-# Instance of Usb Library.
+# Uefi Usb Library instance.
 #
 # This library instance provides most usb APIs to support the Hid requests defined in
 # Usb Hid 1.1 spec and the standard requests defined in Usb 1.1 spec.
 #
-# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
@@ -20,4 +20,5 @@
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = UefiUsbLib
+  MODULE_UNI_FILE                = UefiUsbLib.uni
   FILE_GUID                      = 87eb5df9-722a-4241-ad7f-370d0b3a56d7
   MODULE_TYPE                    = UEFI_DRIVER
@@ -44,3 +45,4 @@
 
 [Pcd]
-  gEfiMdePkgTokenSpaceGuid.PcdUsbTransferTimeoutValue
+  gEfiMdePkgTokenSpaceGuid.PcdUsbTransferTimeoutValue  ## CONSUMES
+
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/MdePkg.dec
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/MdePkg.dec	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/MdePkg.dec	(revision 58459)
@@ -1,10 +1,9 @@
 ## @file  MdePkg.dec
+# This Package provides all definitions, library classes and libraries instances.
 #
-# This Package provides all definitions(including functions, MACROs, structures and library classes)
-# and libraries instances, which are defined in MDE Specification.
 # It also provides the definitions(including PPIs/PROTOCOLs/GUIDs) of
-# EFI1.10/UEFI2.3.1/PI1.2 and some Industry Standards.
+# EFI1.10/UEFI2.4/PI1.3 and some Industry Standards.
 #
-# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
 # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
 #
@@ -23,6 +22,7 @@
   DEC_SPECIFICATION              = 0x00010005
   PACKAGE_NAME                   = MdePkg
+  PACKAGE_UNI_FILE               = MdePkg.uni
   PACKAGE_GUID                   = 1E73767F-8F52-4603-AEB4-F29B510B6766
-  PACKAGE_VERSION                = 1.03
+  PACKAGE_VERSION                = 1.05
 
 
@@ -44,4 +44,7 @@
 [Includes.ARM]
   Include/Arm
+
+[Includes.AARCH64]
+  Include/AArch64
 
 [LibraryClasses]
@@ -98,4 +101,7 @@
   PrintLib|Include/Library/PrintLib.h
 
+  ##  @libraryclass  Provides an ordered collection data structure.
+  OrderedCollectionLib|Include/Library/OrderedCollectionLib.h
+
   ##  @libraryclass  Provides services to send progress/error codes to a POST card.
   PostCodeLib|Include/Library/PostCodeLib.h
@@ -145,4 +151,7 @@
   ##  @libraryclass  Provide services to access I/O Ports and MMIO registers.
   IoLib|Include/Library/IoLib.h
+  
+  ##  @libraryclass  Provide services to create, get and update HSTI table in AIP protocol.
+  HstiLib|Include/Library/HstiLib.h
 
   ##  @libraryclass  Provides services to create and parse HOBs. Only available for PEI and DXE module types.
@@ -229,4 +238,8 @@
   #                  Only available to SMM/DXE Combined and SMM module types.
   SmmServicesTableLib|Include/Library/SmmServicesTableLib.h
+
+  ##  @libraryclass  Provides services for Smm Memory Operation.
+  #
+  SmmMemLib|Include/Library/SmmMemLib.h
 
   ##  @libraryclass  Provides services to enable/disable periodic SMI handlers.
@@ -508,4 +521,33 @@
   gEfiCertPkcs7Guid              = { 0x4aafd29d, 0x68df, 0x49ee, {0x8a, 0xa9, 0x34, 0x7d, 0x37, 0x56, 0x65, 0xa7 }}
 
+  ## Include/Protocol/Hash.h
+  gEfiHashAlgorithmSha1NoPadGuid = { 0x24c5dc2f, 0x53e2, 0x40ca, { 0x9e, 0xd6, 0xa5, 0xd9, 0xa4, 0x9f, 0x46, 0x3b }}
+  gEfiHashAlgorithmSha256NoPadGuid = { 0x8628752a, 0x6cb7, 0x4814, { 0x96, 0xfc, 0x24, 0xa8, 0x15, 0xac, 0x22, 0x26 }}
+
+  #
+  # GUIDs defined in UEFI2.4
+  #
+  ## Include/Guid/FmpCapsule.h
+  gEfiFmpCapsuleGuid             =  { 0x6dcbd5ed, 0xe82d, 0x4c44, {0xbd, 0xa1, 0x71, 0x94, 0x19, 0x9a, 0xd9, 0x2a }}
+
+  ## Include/Protocol/Rng.h
+  gEfiRngAlgorithmSp80090Hash256Guid = { 0xa7af67cb, 0x603b, 0x4d42, {0xba, 0x21, 0x70, 0xbf, 0xb6, 0x29, 0x3f, 0x96 }}
+  gEfiRngAlgorithmSp80090Hmac256Guid = { 0xc5149b43, 0xae85, 0x4f53, {0x99, 0x82, 0xb9, 0x43, 0x35, 0xd3, 0xa9, 0xe7 }}
+  gEfiRngAlgorithmSp80090Ctr256Guid  = { 0x44f0de6e, 0x4d8c, 0x4045, {0xa8, 0xc7, 0x4d, 0xd1, 0x68, 0x85, 0x6b, 0x9e }}
+  gEfiRngAlgorithmX9313DesGuid       = { 0x63c4785a, 0xca34, 0x4012, {0xa3, 0xc8, 0x0b, 0x6a, 0x32, 0x4f, 0x55, 0x46 }}
+  gEfiRngAlgorithmX931AesGuid        = { 0xacd03321, 0x777e, 0x4d3d, {0xb1, 0xc8, 0x20, 0xcf, 0xd8, 0x88, 0x20, 0xc9 }}
+  gEfiRngAlgorithmRaw                = { 0xe43176d7, 0xb6e8, 0x4827, {0xb7, 0x84, 0x7f, 0xfd, 0xc4, 0xb6, 0x85, 0x61 }}
+
+  ## Include/Protocol/AdapterInformation.h
+  gEfiAdapterInfoMediaStateGuid       = { 0xD7C74207, 0xA831, 0x4A26, {0xB1, 0xF5, 0xD1, 0x93, 0x06, 0x5C, 0xE8, 0xB6 }}
+  gEfiAdapterInfoNetworkBootGuid      = { 0x1FBD2960, 0x4130, 0x41E5, {0x94, 0xAC, 0xD2, 0xCF, 0x03, 0x7F, 0xB3, 0x7C }}
+  gEfiAdapterInfoSanMacAddressGuid    = { 0x114da5ef, 0x2cf1, 0x4e12, {0x9b, 0xbb, 0xc4, 0x70, 0xb5, 0x52, 0x5, 0xd9 }}
+	
+  #
+  # GUIDs defined in UEFI2.5
+  #
+  ## Include/Guid/SystemResourceTable.h
+  gEfiSystemResourceTableGuid    = { 0xb122a263, 0x3661, 0x4f68, {0x99, 0x29, 0x78, 0xf8, 0xb0, 0xd6, 0x21, 0x80 }}
+
   #
   # GUID defined in PI1.0
@@ -578,4 +620,36 @@
   gEfiFirmwareFileSystem3Guid      = { 0x5473c07a, 0x3dcb, 0x4dca, { 0xbd, 0x6f, 0x1e, 0x96, 0x89, 0xe7, 0x34, 0x9a }}
 
+  #
+  # GUID defined in PI1.2.1
+  #
+  ## Include/Guid/EventGroup.h
+  gEfiEndOfDxeEventGroupGuid        = { 0x2ce967a, 0xdd7e, 0x4ffc, { 0x9e, 0xe7, 0x81, 0xc, 0xf0, 0x47, 0x8, 0x80 }}
+  
+  ## Include/Guid/FirmwareContentsSigned.h
+  gEfiFirmwareContentsSignedGuid    = { 0xf9d89e8, 0x9259, 0x4f76, { 0xa5, 0xaf, 0xc, 0x89, 0xe3, 0x40, 0x23, 0xdf }}
+
+  ## Include/Guid/VectorHandoffTable.h
+  gEfiVectorHandoffTableGuid        = { 0x996ec11c, 0x5397, 0x4e73, { 0xb5, 0x8f, 0x82, 0x7e, 0x52, 0x90, 0x6d, 0xef }}
+
+  ## Include/IndustryStandard/Hsti.h
+  gAdapterInfoPlatformSecurityGuid  = {0x6be272c7, 0x1320, 0x4ccd, { 0x90, 0x17, 0xd4, 0x61, 0x2c, 0x01, 0x2b, 0x25 }}
+
+  #
+  # GUID defined in PI1.3
+  #
+  ## Guid for EFI_DISK_INFO_PROTOCOL.Interface to specify Nvme interface.
+  ## Include/Protocol/DiskInfo.h
+  gEfiDiskInfoNvmeInterfaceGuid  = { 0x3ab14680, 0x5d3f, 0x4a4d, { 0xbc, 0xdc, 0xcc, 0x38, 0x0, 0x18, 0xc7, 0xf7 }}
+  
+  #
+  # GUID defined in PI1.4
+  #
+  ## Include/Guid/GraphicsInfoHob.h
+  gEfiGraphicsInfoHobGuid           = { 0x39f62cce, 0x6825, 0x4669, { 0xbb, 0x56, 0x54, 0x1a, 0xba, 0x75, 0x3a, 0x07 }}
+
+  ## Guid for EFI_DISK_INFO_PROTOCOL.Interface to specify UFS interface.
+  ## Include/Protocol/DiskInfo.h
+  gEfiDiskInfoUfsInterfaceGuid   = { 0x4b3029cc, 0x6b98, 0x47fb, { 0xbc, 0x96, 0x76, 0xdc, 0xb8, 0x4, 0x41, 0xf0 }}
+
 [Guids.IA32, Guids.X64]
   ## Include/Guid/Cper.h
@@ -652,4 +726,7 @@
   gPcdPpiGuid = { 0x6e81c58, 0x4ad7, 0x44bc, { 0x83, 0x90, 0xf1, 0x2, 0x65, 0xf7, 0x24, 0x80 } }
 
+  ## Include/Ppi/PcdInfo.h
+  gGetPcdInfoPpiGuid                 = { 0x4d8b155b, 0xc059, 0x4c8f, { 0x89, 0x26,  0x6, 0xfd, 0x43, 0x31, 0xdb, 0x8a } }
+
   #
   # PPIs defined in PI 1.2.
@@ -674,5 +751,46 @@
   gEfiPeiPcdPpiGuid                  = { 0x1f34d25, 0x4de2, 0x23ad, { 0x3f, 0xf3, 0x36, 0x35, 0x3f, 0xf3, 0x23, 0xf1 } }
 
+  #
+  # PPIs defined in PI 1.2.1.
+  #
+
+  ## Include/Ppi/PiPcdInfo.h
+  gEfiGetPcdInfoPpiGuid              = { 0xa60c6b59, 0xe459, 0x425d, { 0x9c, 0x69,  0xb, 0xcc, 0x9c, 0xb2, 0x7d, 0x81 } }
+
+  ## Include/Ppi/TemporaryRamDone.h
+  gEfiTemporaryRamDonePpiGuid        = { 0xceab683c, 0xec56, 0x4a2d, { 0xa9, 0x6, 0x40, 0x53, 0xfa, 0x4e, 0x9c, 0x16 } }
+
+  ## Include/Ppi/VectorHandoffInfo.h
+  gEfiVectorHandoffInfoPpiGuid       = { 0x3cd652b4, 0x6d33, 0x4dce, { 0x89, 0xdb, 0x83, 0xdf, 0x97, 0x66, 0xfc, 0xca }}
+
+  #
+  # PPIs defined in PI 1.3.
+  #
+  
+  ## Include/Ppi/I2cMaster.h
+  gEfiPeiI2cMasterPpiGuid            = { 0xb3bfab9b, 0x9f9c, 0x4e8b, { 0xad, 0x37, 0x7f, 0x8c, 0x51, 0xfc, 0x62, 0x80 }}
+
+  ## Include/Ppi/FirmwareVolumeInfo2.h
+  gEfiPeiFirmwareVolumeInfo2PpiGuid  = { 0xea7ca24b, 0xded5, 0x4dad, { 0xa3, 0x89, 0xbf, 0x82, 0x7e, 0x8f, 0x9b, 0x38 } }
+
+  #
+  # PPIs defined in PI 1.4.
+  #
+
+  ## Include/Ppi/Graphics.h
+  gEfiPeiGraphicsPpiGuid             = { 0x6ecd1463, 0x4a4a, 0x461b, { 0xaf, 0x5f, 0x5a, 0x33, 0xe3, 0xb2, 0x16, 0x2b } }
+  
+  ## Include/Ppi/MpServices.h
+  gEfiPeiMpServicesPpiGuid           = { 0xee16160a, 0xe8be, 0x47a6, { 0x82, 0xa, 0xc6, 0x90, 0xd, 0xb0, 0x25, 0xa } }
+
+
+
 [Protocols]
+  ## Include/Protocol/Pcd.h
+  gPcdProtocolGuid               = { 0x11B34006, 0xD85B, 0x4D0A, { 0xA2, 0x90, 0xD5, 0xA5, 0x71, 0x31, 0x0E, 0xF7 }}
+
+  ## Include/Protocol/PcdInfo.h
+  gGetPcdInfoProtocolGuid        = { 0x5be40f57, 0xfa68, 0x4610, { 0xbb, 0xbf, 0xe9, 0xc5, 0xfc, 0xda, 0xd3, 0x65 } }
+
   #
   # Protocols defined in PI1.0.
@@ -884,4 +1002,36 @@
 
   #
+  # Protocols defined in PI 1.2.1
+  #
+
+  ## Include/Protocol/Security2.h
+  gEfiSecurity2ArchProtocolGuid   = { 0x94ab2f58, 0x1438, 0x4ef1, {0x91, 0x52, 0x18, 0x94, 0x1a, 0x3a, 0x0e, 0x68 } }
+
+  ## Include/Protocol/SmmEndOfDxe.h
+  gEfiSmmEndOfDxeProtocolGuid = { 0x24e70042, 0xd5c5, 0x4260, { 0x8c, 0x39, 0xa, 0xd3, 0xaa, 0x32, 0xe9, 0x3d }}
+
+  ## Include/Protocol/PiPcdInfo.h
+  gEfiGetPcdInfoProtocolGuid      = { 0xfd0f4478,  0xefd, 0x461d, { 0xba, 0x2d, 0xe5, 0x8c, 0x45, 0xfd, 0x5f, 0x5e } }
+
+  #
+  # Protocols defined in PI 1.3.
+  #
+
+  ## Include/Protocol/I2cMaster.h
+  gEfiI2cMasterProtocolGuid = { 0xcd72881f, 0x45b5, 0x4feb, { 0x98, 0xc8, 0x31, 0x3d, 0xa8, 0x11, 0x74, 0x62 }}
+
+  ## Include/Protocol/I2cIo.h
+  gEfiI2cIoProtocolGuid = { 0xb60a3e6b, 0x18c4, 0x46e5, { 0xa2, 0x9a, 0xc9, 0xa1, 0x06, 0x65, 0xa2, 0x8e }}
+
+  ## Include/Protocol/I2cEnumerate.h
+  gEfiI2cEnumerateProtocolGuid = { 0xda8cd7c4, 0x1c00, 0x49e2, { 0x80, 0x3e, 0x52, 0x14, 0xe7, 0x01, 0x89, 0x4c }}
+
+  ## Include/Protocol/I2cHost.h
+  gEfiI2cHostProtocolGuid = { 0xa5aab9e3, 0xc727, 0x48cd, { 0x8b, 0xbf, 0x42, 0x72, 0x33, 0x85, 0x49, 0x48 }}
+
+  ## Include/Protocol/I2cBusConfigurationManagement.h
+  gEfiI2cBusConfigurationManagementProtocolGuid = { 0x55b71fb5, 0x17c6, 0x410e, { 0xb5, 0xbd, 0x5f, 0xa2, 0xe3, 0xd4, 0x46, 0x6b }}
+
+  #
   # Protocols defined in UEFI2.1/UEFI2.0/EFI1.1
   #
@@ -1118,9 +1268,9 @@
   gEfiHashProtocolGuid           = { 0xC5184932, 0xDBA5, 0x46DB, { 0xA5, 0xBA, 0xCC, 0x0B, 0xDA, 0x9C, 0x14, 0x35 }}
 
-  ## Include/Protocol/Pcd.h
-  gPcdProtocolGuid               = { 0x11B34006, 0xD85B, 0x4D0A, { 0xA2, 0x90, 0xD5, 0xA5, 0x71, 0x31, 0x0E, 0xF7 }}
-
   ## Include/Protocol/TcgService.h
   gEfiTcgProtocolGuid            = { 0xf541796d, 0xa62e, 0x4954, { 0xa7, 0x75, 0x95, 0x84, 0xf6, 0x1b, 0x9c, 0xdd }}
+
+  ## Include/Protocol/TrEEProtocol.h
+  gEfiTrEEProtocolGuid           = {0x607f766c, 0x7455, 0x42be, { 0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f }}
 
   ## Include/Protocol/FormBrowser2.h
@@ -1239,230 +1389,462 @@
 
   ## Include/Protocol/StorageSecurityCommand.h
-  gEfiStorageSecurityCommandProtocolGuid    = { 0xc88b0b6d, 0x0dfc, 0x49a7, {0x9c, 0xb4, 0x49, 0x7, 0x4b, 0x4c, 0x3a, 0x78 }}
+  gEfiStorageSecurityCommandProtocolGuid = { 0xc88b0b6d, 0x0dfc, 0x49a7, {0x9c, 0xb4, 0x49, 0x7, 0x4b, 0x4c, 0x3a, 0x78 }}
 
   ## Include/Protocol/UserCredential2.h
-  gEfiUserCredential2ProtocolGuid       = { 0xe98adb03, 0xb8b9, 0x4af8, {0xba, 0x20, 0x26, 0xe9, 0x11, 0x4c, 0xbc, 0xe5 }}
+  gEfiUserCredential2ProtocolGuid      = { 0xe98adb03, 0xb8b9, 0x4af8, {0xba, 0x20, 0x26, 0xe9, 0x11, 0x4c, 0xbc, 0xe5 }}
+
+  #
+  # Protocols defined in UEFI2.4
+  #
+  ## Include/Protocol/DiskIo2.h
+  gEfiDiskIo2ProtocolGuid              = { 0x151c8eae, 0x7f2c, 0x472c, { 0x9e, 0x54, 0x98, 0x28, 0x19, 0x4f, 0x6a, 0x88 }}
+
+  ## Include/Protocol/Timestamp.h
+  gEfiTimestampProtocolGuid            = { 0xafbfde41, 0x2e6e, 0x4262, {0xba, 0x65, 0x62, 0xb9, 0x23, 0x6e, 0x54, 0x95 }}
+
+  ## Include/Protocol/Rng.h
+  gEfiRngProtocolGuid                  = { 0x3152bca5, 0xeade, 0x433d, {0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44 }}
+  
+  ## Include/Protocol/AdapterInformation.h
+  gEfiAdapterInformationProtocolGuid	 = { 0xE5DD1403, 0xD622, 0xC24E, {0x84, 0x88, 0xC7, 0x1B, 0x17, 0xF5, 0xE8, 0x02 }}
+
+#
+# [Error.gEfiMdePkgTokenSpaceGuid]
+#   0x80000001 | Invalid value provided.
+#   0x80000002 | Reserved bits must be set to zero.
+#   0x80000003 | Incorrect progress code provided.
+#
 
 [PcdsFeatureFlag]
-  ## If TRUE, the component name protocol will not be installed.
+  ## Indicates if the component name protocol will be installed.<BR><BR>
+  #   TRUE  - Does not install component name protocol.<BR>
+  #   FALSE - Install component name protocol.<BR>
+  # @Prompt Disable Component Name Protocol.
   gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable|FALSE|BOOLEAN|0x0000000d
 
-  ## If TRUE, the driver diagnostics protocol will not be installed.
+  ## Indicates if the diagnostics name protocol will be installed.<BR><BR>
+  #   TRUE  - Does not install diagnostics name protocol.<BR>
+  #   FALSE - Install diagnostics name protocol.<BR>
+  # @Prompt Disable Diagnostics Name protocol.
   gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnosticsDisable|FALSE|BOOLEAN|0x0000000e
 
-  ## If TRUE, the component name2 protocol will not be installed.
+  ## Indicates if the component name2 protocol will be installed.<BR><BR>
+  #   TRUE  - Does not install component name2 protocol.<BR>
+  #   FALSE - Install component name2 protocol.<BR>
+  # @Prompt Disable Component Name2 Protocol.
   gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable|FALSE|BOOLEAN|0x00000010
 
-  ## If TRUE, the driver diagnostics2 protocol will not be installed.
+  ## Indicates if the diagnostics2 name protocol will be installed.<BR><BR>
+  #   TRUE  - Does not install diagnostics2 name protocol.<BR>
+  #   FALSE - Install diagnostics2 name protocol.<BR>
+  # @Prompt Disable Diagnostics2 Name Protocol.
   gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable|FALSE|BOOLEAN|0x00000011
 
-  ## Indicates whether EFI 1.1 ISO 639-2 language supports are obsolete
+  ## Indicates if EFI 1.1 ISO 639-2 language supports are obsolete<BR><BR>
+  #   TRUE  - Deprecate global variable LangCodes.<BR>
+  #   FALSE - Does not deprecate global variable LangCodes.<BR>
+  # @Prompt Deprecate Global Variable LangCodes.
   gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDeprecate|FALSE|BOOLEAN|0x00000012
 
-  ## If TRUE, UGA Draw Protocol is still consumed.
+  ## Indicates if UGA Draw Protocol is still consumed.<BR><BR>
+  #   TRUE  - Consume UGA Draw protocol.<BR>
+  #   FALSE - Does not consume UGA Draw protocol.<BR>
+  # @Prompt Consume UGA Draw Protocol.
   gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport|TRUE|BOOLEAN|0x00000027
 
-  ## If TRUE, a check will be made to see if a specified node is a member of  linked list
-  #  in the following BaseLib fucntions: GetNextNode(), IsNull(), IsNodeAtEnd(),
-  #  SwapListEntries()
+  ## Indicates if a check will be made to see if a specified node is a member of linked list
+  #  in the following BaseLib functions: GetNextNode(), IsNull(), IsNodeAtEnd(), SwapListEntries().<BR><BR>
+  #   TRUE  - Verify a specified node is a member of linked list.<BR>
+  #   FALSE - Does not verify a specified node is a member of linked list.<BR>
+  # @Prompt Verify Node In List.
   gEfiMdePkgTokenSpaceGuid.PcdVerifyNodeInList|FALSE|BOOLEAN|0x00000028
 
+  ## If TRUE, OrderedCollectionLib is instructed to validate the
+  #  ORDERED_COLLECTION structure at the end of such operations (typically
+  #  structure modifications) that justify validation of the structure for unit
+  #  testing purposes.
+  # @Prompt Validate ORDERED_COLLECTION structure
+  gEfiMdePkgTokenSpaceGuid.PcdValidateOrderedCollection|FALSE|BOOLEAN|0x0000002a
+
 [PcdsFixedAtBuild]
-  ## Indicates the maximum length of unicode string
-  gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000|UINT32|0x00000001
-
-  ## Indicates the maximum length of ascii string
-  gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000|UINT32|0x00000002
-
-  ## Indicates the maximum node number of linked list
-  gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000|UINT32|0x00000003
-
-  ## Indicates the timeout tick of holding spin lock
-  gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000|UINT32|0x00000004
-
-  ## The mask is used to control DebugLib behavior
-  gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0|UINT8|0x00000005
-
-  ## The mask is used to control ReportStatusCodeLib behavior
-  gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0|UINT8|0x00000007
-
-  ## This value is used to fill a segment of memory
-  gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF|UINT8|0x00000008
-
-  ## The mask is used to control PerformanceLib behavior
-  gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|0|UINT8|0x00000009
-
-  ## The mask is used to control PostCodeLib behavior
-  gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0|UINT8|0x0000000b
-
-  ## This value is used to set the FSB clock
-  gEfiMdePkgTokenSpaceGuid.PcdFSBClock|200000000|UINT32|0x0000000c
-
-  ## The maxium allowable size of formatted unicode string
-  gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320|UINT32|0x101
-
-  ## Status code value for indicating a watchdog timer is expired
+  ## Status code value for indicating a watchdog timer has expired.
   # EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_TIMER_EXPIRED
+  # @Prompt Progress Code for WatchDog Timer Expired.
+  # @ValidList  0x80000003 | 0x00011003
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueEfiWatchDogTimerExpired|0x00011003|UINT32|0x00000013
 
   ## Status code value for indicating the invocation of SetVirtualAddressMap()
   # EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_RS_PC_SET_VIRTUAL_ADDRESS_MAP
+  # @Prompt Progress Code for Invocation of SetVirtualAddressMap.
+  # @ValidList  0x80000003 | 0x03111004
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueSetVirtualAddressMap|0x03111004|UINT32|0x00000014
 
   ## Status code value for indicating the start of memory test
   # EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_TEST
+  # @Prompt Progress Code for Memory Test Start.
+  # @ValidList  0x80000003 | 0x00051006
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMemoryTestStarted|0x00051006|UINT32|0x00000015
 
   ## Status code value for indicating memory error in memory test
   # EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_UNCORRECTABLE
+  # @Prompt Progress Code for Memory Error.
+  # @ValidList  0x80000003 | 0x00051003
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueUncorrectableMemoryError|0x00051003|UINT32|0x00000016
 
-  ## Status code value for indicating the failure of console operation
+  ## Status code value for console operation failure.
   # EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_CONTROLLER_ERROR
+  # @Prompt Progress Code for Console Error.
+  # @ValidList  0x80000003 | 0x01040006
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueRemoteConsoleError|0x01040006|UINT32|0x00000017
 
-  ## Status code value for indicating the failure of console reset operation
+  ## Status code value for console reset operation failure.
   # EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_PC_RESET
+  # @Prompt Progress Code for Console Reset.
+  # @ValidList  0x80000003 | 0x01040001
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueRemoteConsoleReset|0x01040001|UINT32|0x00000018
 
-  ## Status code value for indicating the failure of console input operation
+  ## Status code value for console input operation failure.
   # EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_INPUT_ERROR
+  # @Prompt Progress Code for Console Input Error.
+  # @ValidList  0x80000003 | 0x01040007
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueRemoteConsoleInputError|0x01040007|UINT32|0x00000019
 
-  ## Status code value for indicating the failure of console output operation
+  ## Status code value for console output operation failure.
   # EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_OUTPUT_ERROR
+  # @Prompt Progress Code for Console Output Error.
+  # @ValidList  0x80000003 | 0x01040008
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueRemoteConsoleOutputError|0x01040008|UINT32|0x0000001a
 
-  ## Status code value for indicating the failure of mouse operation
+  ## Status code value for mouse operation failure.
   # EFI_PERIPHERAL_MOUSE | EFI_P_EC_INTERFACE_ERROR
+  # @Prompt Progress Code for Module Device Failure.
+  # @ValidList  0x80000003 | 0x01020005
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseInterfaceError|0x01020005|UINT32|0x30001000
 
-  ## Status code value for indicating the enable of mouse device
+  ## Status code value for indicating mouse device has been enabled.
   # EFI_PERIPHERAL_MOUSE | EFI_P_PC_ENABLE
+  # @Prompt Progress Code for Enable Mouse Device.
+  # @ValidList  0x80000003 | 0x01020004
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseEnable|0x01020004|UINT32|0x30001001
 
-  ## Status code value for indicating the disable of mouse device
+  ## Status code value for indicating mouse device has been disabled.
   # EFI_PERIPHERAL_MOUSE | EFI_P_PC_DISABLE
+  # @Prompt Progress Code for Disable Mouse Device.
+  # @ValidList  0x80000003 | 0x01020002
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseDisable|0x01020002|UINT32|0x30001002
 
-  ## Status code value for indicating the enable of keyboard device
+  ## Status code value for enabling keyboard device.
   # EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_ENABLE
+  # @Prompt Progress Code for Enable Keyboard Device.
+  # @ValidList  0x80000003 | 0x01010004
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueKeyboardEnable|0x01010004|UINT32|0x30001003
 
-  ## Status code value for indicating the disable of keyboard device
+  ## Status code value for disabling keyboard device.
   # EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_DISABLE
+  # @Prompt Progress Code for Disable Keyboard Device.
+  # @ValidList  0x80000003 | 0x01010002
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueKeyboardDisable|0x01010002|UINT32|0x30001004
 
-  ## Status code value for indicating whether keboard device is present
+  ## Status code value for indicating presence of keyboard.
   # EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_PRESENCE_DETECT
+  # @Prompt Progress Code for Detect Keyboard Device.
+  # @ValidList  0x80000003 | 0x01010003
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueKeyboardPresenceDetect|0x01010003|UINT32|0x30001005
 
-  ## Status code value for indicating the reset operation of keyboard device
+  ## Status code value for keyboard operation reset operation.
   # EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_RESET
+  # @Prompt Progress Code for Keyboard Device Reset.
+  # @ValidList  0x80000003 | 0x01010001
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueKeyboardReset|0x01010001|UINT32|0x30001006
 
-  ## Status code value for indicating the clear buffer operation of keyboard device
+  ## Status code value for keyboard clear buffer operation.
   # EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_PC_CLEAR_BUFFER
+  # @Prompt Progress Code for Keyboard Device Clear Buffer.
+  # @ValidList  0x80000003 | 0x01011000
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueKeyboardClearBuffer|0x01011000|UINT32|0x30001007
 
-  ## Status code value for indicating the self test of keyboard device
+  ## Status code value for keyboard device self-test.
   # EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_PC_SELF_TEST
+  # @Prompt Progress Code for Keyboard Device SelfTest.
+  # @ValidList  0x80000003 | 0x01011001
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueKeyboardSelfTest|0x01011001|UINT32|0x30001008
 
-  ## Status code value for indicating the operation of keyboard device is failed
+  ## Status code value for indicating keyboard device failure.
   # EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_INTERFACE_ERROR
+  # @Prompt Progress Code for Keyboard Device Failure.
+  # @ValidList  0x80000003 | 0x01010005
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueKeyboardInterfaceError|0x01010005|UINT32|0x30001009
 
-  ## Status code value for indicating the failure of keyboard input handler
+  ## Status code value for indicating keyboard input handler failure.
   # EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_INPUT_ERROR
+  # @Prompt Progress Code for Keyboard Input Failure.
+  # @ValidList  0x80000003 | 0x01010007
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueKeyboardInputError|0x01010007|UINT32|0x3000100a
 
-  ## Status code value for indicating the failure of mouse input handler
+  ## Status code value for mouse input handler failure.
   # EFI_PERIPHERAL_MOUSE | EFI_P_EC_INPUT_ERROR
+  # @Prompt Progress Code for Mouse Input Failure.
+  # @ValidList  0x80000003 | 0x01020007
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseInputError|0x01020007|UINT32|0x3000100b
 
-  ## Status code value for indicating the reset operation of mouse device
+  ## Status code value for mouse device reset operation.
   # EFI_PERIPHERAL_MOUSE | EFI_P_PC_RESET
+  # @Prompt Progress Code for Mouse Device Reset.
+  # @ValidList  0x80000003 | 0x01020001
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseReset|0x01020001|UINT32|0x3000100c
 
-  ## Status code value for indicating the handoff from Pei phase to Dxe phase
+  ## Status code value for indicating the handoff from PEI phase to DXE phase.
   # EFI_SOFTWARE_PEI_CORE | EFI_SW_PEI_CORE_PC_HANDOFF_TO_NEXT
+  # @Prompt Progress Code for Handoff from Pei phase to Dxe phase.
+  # @ValidList  0x80000003 | 0x3021001
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValuePeiHandoffToDxe|0x3021001|UINT32|0x3000100d
 
   ## Status code value for indicating one PEIM is dispatched.
   #  EFI_SOFTWARE_PEI_CORE | EFI_SW_PC_INIT_BEGIN
+  # @Prompt Progress Code for Dispatching One PEIM.
+  # @ValidList  0x80000003 | 0x3020002
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValuePeimDispatch|0x3020002|UINT32|0x3000100e
 
-  ## Status code value for indicating entering PeiCore
+  ## Status code value for PeiCore entry.
   #  EFI_SOFTWARE_PEI_CORE | EFI_SW_PC_INIT
+  # @Prompt Progress Code for PeiCore Entry.
+  # @ValidList  0x80000003 | 0x3020000
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValuePeiCoreEntry|0x3020000|UINT32|0x3000100f
 
-  ## Status code value for indicating entering DxeCore
+  ## Status code value for DxeCore entry.
   # EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_ENTRY_POINT
+  # @Prompt Progress Code for DxeCore Entry.
+  # @ValidList  0x80000003 | 0x3041000
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueDxeCoreEntry|0x3041000|UINT32|0x30001010
 
-  ## Status code value for indicating the handoff from DxeCore to Bds
+  ## Status code value for handoff from DxeCore to BDS.
   # EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_HANDOFF_TO_NEXT
+  # @Prompt Progress Code for Handoff from DxeCore to BDS.
+  # @ValidList  0x80000003 | 0x3041001
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueDxeCoreHandoffToBds|0x3041001|UINT32|0x30001011
 
-  ## Status code value for indicating the exit of boot service
+  ## Status code value for indicating boot service exit.
   # EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES
+  # @Prompt Progress Code for Exit of Boot Service.
+  # @ValidList  0x80000003 | 0x3101019
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueBootServiceExit|0x3101019|UINT32|0x30001012
 
-  ## Status code value for indicating the begin of Dxe driver
+  ## Status code value for indicating the beginning of DXE driver.
   # EFI_SOFTWARE_DXE_CORE | EFI_SW_PC_INIT_BEGIN
+  # @Prompt Progress Code for Begin of DXE Driver.
+  # @ValidList  0x80000003 | 0x3040002
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueDxeDriverBegin|0x3040002|UINT32|0x30001013
 
-  ## Status code value for indicating the end of Dxe driver
+  ## Status code value for indicating the end of DXE drive.
   # EFI_SOFTWARE_DXE_CORE | EFI_SW_PC_INIT_END
+  # @Prompt Progress Code for End of DXE Driver.
+  # @ValidList  0x80000003 | 0x3040003
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueDxeDriverEnd|0x3040003|UINT32|0x30001014
+
+  ## This flag is used to control build time optimization based on debug print level.
+  #  Its default value is 0xFFFFFFFF to expose all debug print level.
+  #  BIT0  - Initialization message.<BR>
+  #  BIT1  - Warning message.<BR>
+  #  BIT2  - Load Event message.<BR>
+  #  BIT3  - File System message.<BR>
+  #  BIT4  - Allocate or Free Pool message.<BR>
+  #  BIT5  - Allocate or Free Page message.<BR>
+  #  BIT6  - Information message.<BR>
+  #  BIT7  - Dispatcher message.<BR>
+  #  BIT8  - Variable message.<BR>
+  #  BIT10 - Boot Manager message.<BR>
+  #  BIT12 - BlockIo Driver message.<BR>
+  #  BIT14 - Network Driver message.<BR>
+  #  BIT16 - UNDI Driver message.<BR>
+  #  BIT17 - LoadFile message.<BR>
+  #  BIT19 - Event message.<BR>
+  #  BIT20 - Global Coherency Database changes message.<BR>
+  #  BIT21 - Memory range cachability changes message.<BR>
+  #  BIT22 - Detailed debug message.<BR>
+  #  BIT31 - Error message.<BR>
+  # @Prompt Fixed Debug Message Print Level.
+  gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel|0xFFFFFFFF|UINT32|0x30001016
+
+[PcdsFixedAtBuild,PcdsPatchableInModule]
+  ## Indicates the maximum length of unicode string used in the following
+  #  BaseLib functions: StrLen(), StrSize(), StrCmp(), StrnCmp(), StrCpy(), StrnCpy()<BR><BR>
+  #  0  - No length check for unicode string.<BR>
+  #  >0 - Maximum length of unicode string.<BR>
+  # @Prompt Maximum Length of Unicode String.
+  gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000|UINT32|0x00000001
+
+  ## Indicates the maximum length of ascii string used in the following
+  #  BaseLib functions: AsciiStrLen(), AsciiStrSize(), AsciiStrCmp(), AsciiStrnCmp(),
+  #  AsciiStrCpy(), AsciiStrnCpy(). <BR><BR>
+  #  0  - No length check for ascii string.<BR>
+  #  >0 - Maximum length of ascii string.<BR>
+  # @Prompt Maximum Length of Ascii String.
+  gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000|UINT32|0x00000002
+
+  ## Indicates the maximum node number of linked list.<BR><BR>
+  #  0  - No node number check for linked list.<BR>
+  #  >0 - Maximum node number of linked list.<BR>
+  # @Prompt Maximum Length of Linked List.
+  gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000|UINT32|0x00000003
+
+  ## Indicates the maximum node number of device path.<BR><BR>
+  #  0  - No node number check for device path.<BR>
+  #  >0 - Maximum node number of device path.<BR>
+  # @Prompt Maximum node number of device path.
+  gEfiMdePkgTokenSpaceGuid.PcdMaximumDevicePathNodeCount|0|UINT32|0x00000029
+
+  ## Indicates the timeout tick of holding spin lock.<BR><BR>
+  #  0  - No timeout.<BR>
+  #  >0 - Timeout tick of holding spin lock.<BR>
+  # @Prompt Spin Lock Timeout (us).
+  gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000|UINT32|0x00000004
+
+  ## The mask is used to control DebugLib behavior.<BR><BR>
+  #  BIT0 - Enable Debug Assert.<BR>
+  #  BIT1 - Enable Debug Print.<BR>
+  #  BIT2 - Enable Debug Code.<BR>
+  #  BIT3 - Enable Clear Memory.<BR>
+  #  BIT4 - Enable BreakPoint as ASSERT.<BR>
+  #  BIT5 - Enable DeadLoop as ASSERT.<BR>
+  # @Prompt Debug Property.
+  # @Expression  0x80000002 | (gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask & 0xC0) == 0
+  gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0|UINT8|0x00000005
+
+  ## This flag is used to control the print out Debug message.<BR><BR>
+  #  BIT0  - Initialization message.<BR>
+  #  BIT1  - Warning message.<BR>
+  #  BIT2  - Load Event message.<BR>
+  #  BIT3  - File System message.<BR>
+  #  BIT4  - Allocate or Free Pool message.<BR>
+  #  BIT5  - Allocate or Free Page message.<BR>
+  #  BIT6  - Information message.<BR>
+  #  BIT7  - Dispatcher message.<BR>
+  #  BIT8  - Variable message.<BR>
+  #  BIT10 - Boot Manager message.<BR>
+  #  BIT12 - BlockIo Driver message.<BR>
+  #  BIT14 - Network Driver message.<BR>
+  #  BIT16 - UNDI Driver message.<BR>
+  #  BIT17 - LoadFile message.<BR>
+  #  BIT19 - Event message.<BR>
+  #  BIT20 - Global Coherency Database changes message.<BR>
+  #  BIT21 - Memory range cachability changes message.<BR>
+  #  BIT22 - Detailed debug message.<BR>
+  #  BIT31 - Error message.<BR>
+  # @Prompt Debug Message Print Level.
+  # @Expression  0x80000002 | (gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel & 0x7F84AA00) == 0
+  gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000000|UINT32|0x00000006
+
+  ## The mask is used to control ReportStatusCodeLib behavior.<BR><BR>
+  #  BIT0 - Enable Progress Code.<BR>
+  #  BIT1 - Enable Error Code.<BR>
+  #  BIT2 - Enable Debug Code.<BR>
+  # @Prompt Report Status Code Property.
+  # @Expression  0x80000002 | (gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask & 0xF8) == 0
+  gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0|UINT8|0x00000007
+
+  ## This value is used to fill a segment of memory when PcdDebugPropertyMask Clear Memory is enabled.
+  # @Prompt Value to Clear Memory.
+  gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF|UINT8|0x00000008
+
+  ## The mask is used to control PerformanceLib behavior.<BR><BR>
+  #  BIT0 - Enable Performance Measurement.<BR>
+  # @Prompt Performance Measurement Property.
+  # @Expression  0x80000002 | (gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask & 0xFE) == 0
+  gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|0|UINT8|0x00000009
+
+  ## The mask is used to control PostCodeLib behavior.<BR><BR>
+  #  BIT0 - Enable Post Code.<BR>
+  #  BIT1 - Enable Post Code with Description.<BR>
+  # @Prompt Post Code Property.
+  # @Expression  0x80000002 | (gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask & 0xFC) == 0
+  gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0|UINT8|0x0000000b
+
+  ## This value is used to configure X86 Processor FSB clock.
+  # @Prompt FSB Clock.
+  gEfiMdePkgTokenSpaceGuid.PcdFSBClock|200000000|UINT32|0x0000000c
+
+  ## The maximum printable number of characters. UefLib functions: AsciiPrint(), AsciiErrorPrint(),
+  #  PrintXY(), AsciiPrintXY(), Print(), ErrorPrint() base on this PCD value to print characters.
+  # @Prompt Maximum Printable Number of Characters.
+  gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320|UINT32|0x101
+
+  ## Indicates the allowable maximum number in extract handler table.
+  # @Prompt Maximum Number of GuidedExtractHandler.
+  gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10|UINT32|0x00000025
+
+  ## Indicates the default timeouts for USB transfers in milliseconds.
+  # @Prompt USB Transfer Timeout (ms).
+  gEfiMdePkgTokenSpaceGuid.PcdUsbTransferTimeoutValue|3000|UINT32|0x00000026
 
   ## This value is used to set the available memory address to store Guided Extract Handlers.
   #  The required memory space is decided by the value of PcdMaximumGuidedExtractHandler.
+  # @Prompt Memory Address of GuidedExtractHandler Table.
   gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x1000000|UINT64|0x30001015
 
-[PcdsFixedAtBuild.IPF]
-  ## The base address of IO port space for IA64 arch
+[PcdsFixedAtBuild.IPF, PcdsPatchableInModule.IPF]
+  ## The base address of IO port space for IA64 arch.
+  # @Prompt IA64 IO Port Space Base Address.
   gEfiMdePkgTokenSpaceGuid.PcdIoBlockBaseAddressForIpf|0x0ffffc000000|UINT64|0x0000000f
 
-[PcdsFixedAtBuild,PcdsPatchableInModule]
-  ## This flag is used to control the printout of DebugLib
-  gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000000|UINT32|0x00000006
-
-  ## Indicates the allowable maximum number in extract handler table
-  gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10|UINT32|0x00000025
-
-  ## Indicates the default timeouts for USB transfers in milliseconds
-  gEfiMdePkgTokenSpaceGuid.PcdUsbTransferTimeoutValue|3000|UINT32|0x00000026
-
 [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
-  ## This value is used to set the base address of pci express hierarchy
+  ## This value is used to set the base address of PCI express hierarchy.
+  # @Prompt PCI Express Base Address.
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xE0000000|UINT64|0x0000000a
 
-  ## Default current ISO 639-2 language: English & French
+  ## Default current ISO 639-2 language: English & French.
+  # @Prompt Default Value of LangCodes Variable.
   gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangCodes|"engfraengfra"|VOID*|0x0000001c
 
-  ## Default current ISO 639-2 language: English
+  ## Default current ISO 639-2 language: English.
+  # @Prompt Default Value of Lang Variable.
   gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLang|"eng"|VOID*|0x0000001d
 
-  ## Default platform supported RFC 4646 languages: (American) English & French
+  ## Default platform supported RFC 4646 languages: (American) English & French.
+  # @Prompt Default Value of PlatformLangCodes Variable.
   gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLangCodes|"en;fr;en-US;fr-FR"|VOID*|0x0000001e
 
-  ## Defualt current RFC 4646 language: (American) English
+  ## Default current RFC 4646 language: (American) English.
+  # @Prompt Default Value of PlatformLang Variable.
   gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang|"en-US"|VOID*|0x0000001f
 
-  ## Indicates the default baud rate of UART
+  ## Indicates the default baud rate of UART.
+  # @Prompt Default UART Baud Rate.
+  # @ValidList  0x80000001 | 115200, 57600, 38400, 19200, 9600, 7200, 4800, 3600, 2400, 2000, 1800, 1200, 600, 300, 150, 134, 110, 75, 50
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200|UINT64|0x00000020
 
-  ## Indicates the number of efficient data bit in UART transaction
+  ## Indicates the number of efficient data bit in UART transaction.
+  # @Prompt Default UART Data Bit.
+  # @ValidRange 0x80000001 | 5 - 8
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits|8|UINT8|0x00000021
 
-  ## Indicates the setting of data parity in UART transaction
+  ## Indicates the setting of data parity in UART transaction.<BR><BR>
+  # 0 - Default Parity.<BR>
+  # 1 - No Parity.<BR>
+  # 2 - Even Parity.<BR>
+  # 3 - Odd Parity.<BR>
+  # 4 - Mark Parity.<BR>
+  # 5 - Space Parity.<BR>
+  # @Prompt Default UART Parity.
+  # @ValidRange 0x80000001 | 0 - 5
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity|1|UINT8|0x00000022
 
-  ## Indicates the setting of stop bit in UART transaction
+  ## Indicates the setting of stop bit in UART transaction.<BR><BR>
+  # 0 - Default Stop Bits.<BR>
+  # 1 - One Stop Bit.<BR>
+  # 2 - One Five Stop Bits.<BR>
+  # 3 - Two Stop Bits.<BR>
+  # @Prompt Default UART Stop Bits.
+  # @ValidRange 0x80000001 | 0 - 3
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits|1|UINT8|0x00000023
 
-  ## Indicates the usable type of terminal
-  #  0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8
+  ## Indicates the usable type of terminal.<BR><BR>
+  #  0 - PCANSI<BR>
+  #  1 - VT100<BR>
+  #  2 - VT100+<BR>
+  #  3 - UTF8<BR>
+  # @Prompt Default Terminal Type.
+  # @ValidRange 0x80000001 | 0 - 3
   gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|0|UINT8|0x00000024
+
+[UserExtensions.TianoCore."ExtraFiles"]
+  MdePkgExtra.uni
Index: trunk/src/VBox/Devices/EFI/Firmware/MdePkg/MdePkg.dsc
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware/MdePkg/MdePkg.dsc	(revision 53620)
+++ trunk/src/VBox/Devices/EFI/Firmware/MdePkg/MdePkg.dsc	(revision 58459)
@@ -2,5 +2,5 @@
 # EFI/PI MdePkg Package
 #
-# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
 # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
 #
@@ -18,8 +18,8 @@
   PLATFORM_NAME                  = Mde
   PLATFORM_GUID                  = 082F8BFC-0455-4859-AE3C-ECD64FB81642
-  PLATFORM_VERSION               = 1.03
+  PLATFORM_VERSION               = 1.05
   DSC_SPECIFICATION              = 0x00010005
   OUTPUT_DIRECTORY               = Build/Mde
-  SUPPORTED_ARCHITECTURES        = IA32|IPF|X64|EBC|ARM
+  SUPPORTED_ARCHITECTURES        = IA32|IPF|X64|EBC|ARM|AARCH64
   BUILD_TARGETS                  = DEBUG|RELEASE
   SKUID_IDENTIFIER               = DEFAULT
@@ -63,4 +63,5 @@
   MdePkg/Library/BaseLib/BaseLib.inf
   MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+  MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
   MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
   MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
@@ -80,4 +81,5 @@
   MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
   MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
+  MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
 
   MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
@@ -90,4 +92,5 @@
   MdePkg/Library/DxeSmbusLib/DxeSmbusLib.inf
   MdePkg/Library/DxeIoLibCpuIo2/DxeIoLibCpuIo2.inf
+  MdePkg/Library/DxeHstiLib/DxeHstiLib.inf
 
   MdePkg/Library/DxeRuntimePciExpressLib/DxeRuntimePciExpressLib.inf
@@ -114,4 +117,5 @@
   MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf
   MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+  MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.inf
   MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf
   MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
@@ -147,4 +151,5 @@
   MdePkg/Library/BaseS3SmbusLib/BaseS3SmbusLib.inf
   MdePkg/Library/BaseS3StallLib/BaseS3StallLib.inf
+  MdePkg/Library/SmmMemLib/SmmMemLib.inf
 
 [Components.IPF]
@@ -167,2 +172,5 @@
 [Components.EBC]
   MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
+
+[Components.ARM, Components.AARCH64]
+  MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
