]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/DxeMain.h
MdeModulePkg: Apply uncrustify changes
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / DxeMain.h
index 6a005be8d12d7e9fed94985a46dc1744adc389f8..815a6b4bd844a452ace09c2e3932cfa03e3ecf2e 100644 (file)
@@ -2,22 +2,14 @@
   The internal header file includes the common header files, defines\r
   internal structure and functions used by DxeCore module.\r
 \r
   The internal header file includes the common header files, defines\r
   internal structure and functions used by DxeCore module.\r
 \r
-Copyright (c) 2006 - 2010, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
 #ifndef _DXE_MAIN_H_\r
 #define _DXE_MAIN_H_\r
 \r
 \r
 **/\r
 \r
 #ifndef _DXE_MAIN_H_\r
 #define _DXE_MAIN_H_\r
 \r
-\r
-\r
 #include <PiDxe.h>\r
 \r
 #include <Protocol/LoadedImage.h>\r
 #include <PiDxe.h>\r
 \r
 #include <Protocol/LoadedImage.h>\r
@@ -41,18 +33,21 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/Decompress.h>\r
 #include <Protocol/LoadPe32Image.h>\r
 #include <Protocol/Security.h>\r
 #include <Protocol/Decompress.h>\r
 #include <Protocol/LoadPe32Image.h>\r
 #include <Protocol/Security.h>\r
-#include <Protocol/Ebc.h>\r
+#include <Protocol/Security2.h>\r
 #include <Protocol/Reset.h>\r
 #include <Protocol/Cpu.h>\r
 #include <Protocol/Metronome.h>\r
 #include <Protocol/FirmwareVolumeBlock.h>\r
 #include <Protocol/Capsule.h>\r
 #include <Protocol/BusSpecificDriverOverride.h>\r
 #include <Protocol/Reset.h>\r
 #include <Protocol/Cpu.h>\r
 #include <Protocol/Metronome.h>\r
 #include <Protocol/FirmwareVolumeBlock.h>\r
 #include <Protocol/Capsule.h>\r
 #include <Protocol/BusSpecificDriverOverride.h>\r
+#include <Protocol/DriverFamilyOverride.h>\r
 #include <Protocol/TcgService.h>\r
 #include <Protocol/HiiPackageList.h>\r
 #include <Protocol/SmmBase2.h>\r
 #include <Protocol/TcgService.h>\r
 #include <Protocol/HiiPackageList.h>\r
 #include <Protocol/SmmBase2.h>\r
+#include <Protocol/PeCoffImageEmulator.h>\r
 #include <Guid/MemoryTypeInformation.h>\r
 #include <Guid/FirmwareFileSystem2.h>\r
 #include <Guid/MemoryTypeInformation.h>\r
 #include <Guid/FirmwareFileSystem2.h>\r
+#include <Guid/FirmwareFileSystem3.h>\r
 #include <Guid/HobList.h>\r
 #include <Guid/DebugImageInfoTable.h>\r
 #include <Guid/FileInfo.h>\r
 #include <Guid/HobList.h>\r
 #include <Guid/DebugImageInfoTable.h>\r
 #include <Guid/FileInfo.h>\r
@@ -61,7 +56,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Guid/MemoryAllocationHob.h>\r
 #include <Guid/EventLegacyBios.h>\r
 #include <Guid/EventGroup.h>\r
 #include <Guid/MemoryAllocationHob.h>\r
 #include <Guid/EventLegacyBios.h>\r
 #include <Guid/EventGroup.h>\r
+#include <Guid/EventExitBootServiceFailed.h>\r
 #include <Guid/LoadModuleAtFixedAddress.h>\r
 #include <Guid/LoadModuleAtFixedAddress.h>\r
+#include <Guid/IdleLoopEvent.h>\r
+#include <Guid/VectorHandoffTable.h>\r
+#include <Ppi/VectorHandoffInfo.h>\r
+#include <Guid/MemoryProfile.h>\r
 \r
 #include <Library/DxeCoreEntryPoint.h>\r
 #include <Library/DebugLib.h>\r
 \r
 #include <Library/DxeCoreEntryPoint.h>\r
 #include <Library/DebugLib.h>\r
@@ -74,14 +74,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/CacheMaintenanceLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/PeCoffLib.h>\r
 #include <Library/CacheMaintenanceLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/PeCoffLib.h>\r
+#include <Library/PeCoffGetEntryPointLib.h>\r
+#include <Library/PeCoffExtraActionLib.h>\r
 #include <Library/PcdLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/DevicePathLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/ReportStatusCodeLib.h>\r
 #include <Library/PcdLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/DevicePathLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/ReportStatusCodeLib.h>\r
-#include <Library/TimerLib.h>\r
 #include <Library/DxeServicesLib.h>\r
 #include <Library/DxeServicesLib.h>\r
-\r
+#include <Library/DebugAgentLib.h>\r
+#include <Library/CpuExceptionHandlerLib.h>\r
 \r
 //\r
 // attributes for reserved memory before it is promoted to system memory\r
 \r
 //\r
 // attributes for reserved memory before it is promoted to system memory\r
@@ -95,10 +97,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 //\r
 #define EFI_MEMORY_PORT_IO  0x4000000000000000ULL\r
 \r
 //\r
 #define EFI_MEMORY_PORT_IO  0x4000000000000000ULL\r
 \r
-\r
 ///\r
 ///\r
-/// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependecy expression\r
-///                        to save time.  A EFI_DEP_PUSH is evauated one an\r
+/// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependency expression\r
+///                        to save time.  A EFI_DEP_PUSH is evaluated one an\r
 ///                        replaced with EFI_DEP_REPLACE_TRUE. If PI spec's Vol 2\r
 ///                        Driver Execution Environment Core Interface use 0xff\r
 ///                        as new DEPEX opcode. EFI_DEP_REPLACE_TRUE should be\r
 ///                        replaced with EFI_DEP_REPLACE_TRUE. If PI spec's Vol 2\r
 ///                        Driver Execution Environment Core Interface use 0xff\r
 ///                        as new DEPEX opcode. EFI_DEP_REPLACE_TRUE should be\r
@@ -112,13 +113,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define DEPEX_STACK_SIZE_INCREMENT  0x1000\r
 \r
 typedef struct {\r
 #define DEPEX_STACK_SIZE_INCREMENT  0x1000\r
 \r
 typedef struct {\r
-  EFI_GUID                    *ProtocolGuid;\r
-  VOID                        **Protocol;\r
-  EFI_EVENT                   Event;\r
-  VOID                        *Registration;\r
-  BOOLEAN                     Present;\r
-  BOOLEAN                     ArchitecturalProtocol;\r
-} ARCHITECTURAL_PROTOCOL_ENTRY;\r
+  EFI_GUID     *ProtocolGuid;\r
+  VOID         **Protocol;\r
+  EFI_EVENT    Event;\r
+  VOID         *Registration;\r
+  BOOLEAN      Present;\r
+} EFI_CORE_PROTOCOL_NOTIFY_ENTRY;\r
 \r
 //\r
 // DXE Dispatcher Data structures\r
 \r
 //\r
 // DXE Dispatcher Data structures\r
@@ -126,96 +126,166 @@ typedef struct {
 \r
 #define KNOWN_HANDLE_SIGNATURE  SIGNATURE_32('k','n','o','w')\r
 typedef struct {\r
 \r
 #define KNOWN_HANDLE_SIGNATURE  SIGNATURE_32('k','n','o','w')\r
 typedef struct {\r
-  UINTN           Signature;\r
-  LIST_ENTRY      Link;         // mFvHandleList\r
-  EFI_HANDLE      Handle;\r
+  UINTN         Signature;\r
+  LIST_ENTRY    Link;           // mFvHandleList\r
+  EFI_HANDLE    Handle;\r
+  EFI_GUID      FvNameGuid;\r
 } KNOWN_HANDLE;\r
 \r
 } KNOWN_HANDLE;\r
 \r
-\r
-#define EFI_CORE_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('d','r','v','r')\r
+#define EFI_CORE_DRIVER_ENTRY_SIGNATURE  SIGNATURE_32('d','r','v','r')\r
 typedef struct {\r
 typedef struct {\r
-  UINTN                           Signature;\r
-  LIST_ENTRY                      Link;             // mDriverList\r
+  UINTN                            Signature;\r
+  LIST_ENTRY                       Link;            // mDriverList\r
 \r
 \r
-  LIST_ENTRY                      ScheduledLink;    // mScheduledQueue\r
+  LIST_ENTRY                       ScheduledLink;   // mScheduledQueue\r
 \r
 \r
-  EFI_HANDLE                      FvHandle;\r
-  EFI_GUID                        FileName;\r
-  EFI_DEVICE_PATH_PROTOCOL        *FvFileDevicePath;\r
-  EFI_FIRMWARE_VOLUME2_PROTOCOL   *Fv;\r
+  EFI_HANDLE                       FvHandle;\r
+  EFI_GUID                         FileName;\r
+  EFI_DEVICE_PATH_PROTOCOL         *FvFileDevicePath;\r
+  EFI_FIRMWARE_VOLUME2_PROTOCOL    *Fv;\r
 \r
 \r
-  VOID                            *Depex;\r
-  UINTN                           DepexSize;\r
+  VOID                             *Depex;\r
+  UINTN                            DepexSize;\r
 \r
 \r
-  BOOLEAN                         Before;\r
-  BOOLEAN                         After;\r
-  EFI_GUID                        BeforeAfterGuid;\r
+  BOOLEAN                          Before;\r
+  BOOLEAN                          After;\r
+  EFI_GUID                         BeforeAfterGuid;\r
 \r
 \r
-  BOOLEAN                         Dependent;\r
-  BOOLEAN                         Unrequested;\r
-  BOOLEAN                         Scheduled;\r
-  BOOLEAN                         Untrusted;\r
-  BOOLEAN                         Initialized;\r
-  BOOLEAN                         DepexProtocolError;\r
-\r
-  EFI_HANDLE                      ImageHandle;\r
+  BOOLEAN                          Dependent;\r
+  BOOLEAN                          Unrequested;\r
+  BOOLEAN                          Scheduled;\r
+  BOOLEAN                          Untrusted;\r
+  BOOLEAN                          Initialized;\r
+  BOOLEAN                          DepexProtocolError;\r
 \r
 \r
+  EFI_HANDLE                       ImageHandle;\r
+  BOOLEAN                          IsFvImage;\r
 } EFI_CORE_DRIVER_ENTRY;\r
 \r
 //\r
 } EFI_CORE_DRIVER_ENTRY;\r
 \r
 //\r
-//The data structure of GCD memory map entry\r
+// The data structure of GCD memory map entry\r
 //\r
 #define EFI_GCD_MAP_SIGNATURE  SIGNATURE_32('g','c','d','m')\r
 typedef struct {\r
 //\r
 #define EFI_GCD_MAP_SIGNATURE  SIGNATURE_32('g','c','d','m')\r
 typedef struct {\r
-  UINTN                 Signature;\r
-  LIST_ENTRY            Link;\r
-  EFI_PHYSICAL_ADDRESS  BaseAddress;\r
-  UINT64                EndAddress;\r
-  UINT64                Capabilities;\r
-  UINT64                Attributes;\r
-  EFI_GCD_MEMORY_TYPE   GcdMemoryType;\r
-  EFI_GCD_IO_TYPE       GcdIoType;\r
-  EFI_HANDLE            ImageHandle;\r
-  EFI_HANDLE            DeviceHandle;\r
+  UINTN                   Signature;\r
+  LIST_ENTRY              Link;\r
+  EFI_PHYSICAL_ADDRESS    BaseAddress;\r
+  UINT64                  EndAddress;\r
+  UINT64                  Capabilities;\r
+  UINT64                  Attributes;\r
+  EFI_GCD_MEMORY_TYPE     GcdMemoryType;\r
+  EFI_GCD_IO_TYPE         GcdIoType;\r
+  EFI_HANDLE              ImageHandle;\r
+  EFI_HANDLE              DeviceHandle;\r
 } EFI_GCD_MAP_ENTRY;\r
 \r
 } EFI_GCD_MAP_ENTRY;\r
 \r
+#define LOADED_IMAGE_PRIVATE_DATA_SIGNATURE  SIGNATURE_32('l','d','r','i')\r
+\r
+typedef struct {\r
+  UINTN                                   Signature;\r
+  /// Image handle\r
+  EFI_HANDLE                              Handle;\r
+  /// Image type\r
+  UINTN                                   Type;\r
+  /// If entrypoint has been called\r
+  BOOLEAN                                 Started;\r
+  /// The image's entry point\r
+  EFI_IMAGE_ENTRY_POINT                   EntryPoint;\r
+  /// loaded image protocol\r
+  EFI_LOADED_IMAGE_PROTOCOL               Info;\r
+  /// Location in memory\r
+  EFI_PHYSICAL_ADDRESS                    ImageBasePage;\r
+  /// Number of pages\r
+  UINTN                                   NumberOfPages;\r
+  /// Original fixup data\r
+  CHAR8                                   *FixupData;\r
+  /// Tpl of started image\r
+  EFI_TPL                                 Tpl;\r
+  /// Status returned by started image\r
+  EFI_STATUS                              Status;\r
+  /// Size of ExitData from started image\r
+  UINTN                                   ExitDataSize;\r
+  /// Pointer to exit data from started image\r
+  VOID                                    *ExitData;\r
+  /// Pointer to pool allocation for context save/restore\r
+  VOID                                    *JumpBuffer;\r
+  /// Pointer to buffer for context save/restore\r
+  BASE_LIBRARY_JUMP_BUFFER                *JumpContext;\r
+  /// Machine type from PE image\r
+  UINT16                                  Machine;\r
+  /// PE/COFF Image Emulator Protocol pointer\r
+  EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL    *PeCoffEmu;\r
+  /// Runtime image list\r
+  EFI_RUNTIME_IMAGE_ENTRY                 *RuntimeData;\r
+  /// Pointer to Loaded Image Device Path Protocol\r
+  EFI_DEVICE_PATH_PROTOCOL                *LoadedImageDevicePath;\r
+  /// PeCoffLoader ImageContext\r
+  PE_COFF_LOADER_IMAGE_CONTEXT            ImageContext;\r
+  /// Status returned by LoadImage() service.\r
+  EFI_STATUS                              LoadImageStatus;\r
+} LOADED_IMAGE_PRIVATE_DATA;\r
+\r
+#define LOADED_IMAGE_PRIVATE_DATA_FROM_THIS(a) \\r
+          CR(a, LOADED_IMAGE_PRIVATE_DATA, Info, LOADED_IMAGE_PRIVATE_DATA_SIGNATURE)\r
+\r
+#define IMAGE_PROPERTIES_RECORD_CODE_SECTION_SIGNATURE  SIGNATURE_32 ('I','P','R','C')\r
+\r
+typedef struct {\r
+  UINT32                  Signature;\r
+  LIST_ENTRY              Link;\r
+  EFI_PHYSICAL_ADDRESS    CodeSegmentBase;\r
+  UINT64                  CodeSegmentSize;\r
+} IMAGE_PROPERTIES_RECORD_CODE_SECTION;\r
+\r
+#define IMAGE_PROPERTIES_RECORD_SIGNATURE  SIGNATURE_32 ('I','P','R','D')\r
+\r
+typedef struct {\r
+  UINT32                  Signature;\r
+  LIST_ENTRY              Link;\r
+  EFI_PHYSICAL_ADDRESS    ImageBase;\r
+  UINT64                  ImageSize;\r
+  UINTN                   CodeSegmentCount;\r
+  LIST_ENTRY              CodeSegmentList;\r
+} IMAGE_PROPERTIES_RECORD;\r
+\r
 //\r
 // DXE Core Global Variables\r
 //\r
 //\r
 // DXE Core Global Variables\r
 //\r
-extern EFI_SYSTEM_TABLE                         *gDxeCoreST;\r
-extern EFI_RUNTIME_SERVICES                     *gDxeCoreRT;\r
-extern EFI_DXE_SERVICES                         *gDxeCoreDS;\r
-extern EFI_HANDLE                               gDxeCoreImageHandle;\r
+extern EFI_SYSTEM_TABLE      *gDxeCoreST;\r
+extern EFI_RUNTIME_SERVICES  *gDxeCoreRT;\r
+extern EFI_DXE_SERVICES      *gDxeCoreDS;\r
+extern EFI_HANDLE            gDxeCoreImageHandle;\r
 \r
 \r
-extern EFI_DECOMPRESS_PROTOCOL                  gEfiDecompress;\r
+extern BOOLEAN  gMemoryMapTerminated;\r
 \r
 \r
-extern EFI_RUNTIME_ARCH_PROTOCOL                *gRuntime;\r
-extern EFI_CPU_ARCH_PROTOCOL                    *gCpu;\r
-extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL         *gWatchdogTimer;\r
-extern EFI_METRONOME_ARCH_PROTOCOL              *gMetronome;\r
-extern EFI_TIMER_ARCH_PROTOCOL                  *gTimer;\r
-extern EFI_SECURITY_ARCH_PROTOCOL               *gSecurity;\r
-extern EFI_BDS_ARCH_PROTOCOL                    *gBds;\r
-extern EFI_SMM_BASE2_PROTOCOL                   *gSmmBase2;\r
+extern EFI_DECOMPRESS_PROTOCOL  gEfiDecompress;\r
 \r
 \r
-extern EFI_TPL                                  gEfiCurrentTpl;\r
+extern EFI_RUNTIME_ARCH_PROTOCOL         *gRuntime;\r
+extern EFI_CPU_ARCH_PROTOCOL             *gCpu;\r
+extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL  *gWatchdogTimer;\r
+extern EFI_METRONOME_ARCH_PROTOCOL       *gMetronome;\r
+extern EFI_TIMER_ARCH_PROTOCOL           *gTimer;\r
+extern EFI_SECURITY_ARCH_PROTOCOL        *gSecurity;\r
+extern EFI_SECURITY2_ARCH_PROTOCOL       *gSecurity2;\r
+extern EFI_BDS_ARCH_PROTOCOL             *gBds;\r
+extern EFI_SMM_BASE2_PROTOCOL            *gSmmBase2;\r
 \r
 \r
-extern EFI_GUID                                 *gDxeCoreFileName;\r
-extern EFI_LOADED_IMAGE_PROTOCOL                *gDxeCoreLoadedImage;\r
+extern EFI_TPL  gEfiCurrentTpl;\r
 \r
 \r
-extern EFI_MEMORY_TYPE_INFORMATION              gMemoryTypeInformation[EfiMaxMemoryType + 1];\r
+extern EFI_GUID                   *gDxeCoreFileName;\r
+extern EFI_LOADED_IMAGE_PROTOCOL  *gDxeCoreLoadedImage;\r
 \r
 \r
-extern BOOLEAN                                  gDispatcherRunning;\r
-extern EFI_RUNTIME_ARCH_PROTOCOL                gRuntimeTemplate;\r
+extern EFI_MEMORY_TYPE_INFORMATION  gMemoryTypeInformation[EfiMaxMemoryType + 1];\r
 \r
 \r
-extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE    gLoadModuleAtFixAddressConfigurationTable;\r
-extern BOOLEAN                                       gLoadFixedAddressCodeMemoryReady;\r
+extern BOOLEAN                    gDispatcherRunning;\r
+extern EFI_RUNTIME_ARCH_PROTOCOL  gRuntimeTemplate;\r
+\r
+extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE  gLoadModuleAtFixAddressConfigurationTable;\r
+extern BOOLEAN                                     gLoadFixedAddressCodeMemoryReady;\r
 //\r
 // Service Initialization Functions\r
 //\r
 \r
 //\r
 // Service Initialization Functions\r
 //\r
 \r
-\r
-\r
 /**\r
   Called to initialize the pool.\r
 \r
 /**\r
   Called to initialize the pool.\r
 \r
@@ -225,7 +295,6 @@ CoreInitializePool (
   VOID\r
   );\r
 \r
   VOID\r
   );\r
 \r
-\r
 /**\r
   Called to initialize the memory map and add descriptors to\r
   the current descriptor list.\r
 /**\r
   Called to initialize the memory map and add descriptors to\r
   the current descriptor list.\r
@@ -249,7 +318,6 @@ CoreAddMemoryDescriptor (
   IN UINT64                Attribute\r
   );\r
 \r
   IN UINT64                Attribute\r
   );\r
 \r
-\r
 /**\r
   Release memory lock on mGcdMemorySpaceLock.\r
 \r
 /**\r
   Release memory lock on mGcdMemorySpaceLock.\r
 \r
@@ -259,7 +327,6 @@ CoreReleaseGcdMemoryLock (
   VOID\r
   );\r
 \r
   VOID\r
   );\r
 \r
-\r
 /**\r
   Acquire memory lock on mGcdMemorySpaceLock.\r
 \r
 /**\r
   Acquire memory lock on mGcdMemorySpaceLock.\r
 \r
@@ -269,7 +336,6 @@ CoreAcquireGcdMemoryLock (
   VOID\r
   );\r
 \r
   VOID\r
   );\r
 \r
-\r
 /**\r
   External function. Initializes memory services based on the memory\r
   descriptor HOBs.  This function is responsible for priming the memory\r
 /**\r
   External function. Initializes memory services based on the memory\r
   descriptor HOBs.  This function is responsible for priming the memory\r
@@ -292,8 +358,6 @@ CoreInitializeMemoryServices (
   OUT UINT64                *MemoryLength\r
   );\r
 \r
   OUT UINT64                *MemoryLength\r
   );\r
 \r
-\r
-\r
 /**\r
   External function. Initializes the GCD and memory services based on the memory\r
   descriptor HOBs.  This function is responsible for priming the GCD map and the\r
 /**\r
   External function. Initializes the GCD and memory services based on the memory\r
   descriptor HOBs.  This function is responsible for priming the GCD map and the\r
@@ -315,7 +379,6 @@ CoreInitializeGcdServices (
   IN UINT64                MemoryLength\r
   );\r
 \r
   IN UINT64                MemoryLength\r
   );\r
 \r
-\r
 /**\r
   Initializes "event" support.\r
 \r
 /**\r
   Initializes "event" support.\r
 \r
@@ -327,7 +390,6 @@ CoreInitializeEventServices (
   VOID\r
   );\r
 \r
   VOID\r
   );\r
 \r
-\r
 /**\r
   Add the Image Services to EFI Boot Services Table and install the protocol\r
   interfaces for this image.\r
 /**\r
   Add the Image Services to EFI Boot Services Table and install the protocol\r
   interfaces for this image.\r
@@ -339,22 +401,20 @@ CoreInitializeEventServices (
 **/\r
 EFI_STATUS\r
 CoreInitializeImageServices (\r
 **/\r
 EFI_STATUS\r
 CoreInitializeImageServices (\r
-  IN  VOID *HobStart\r
+  IN  VOID  *HobStart\r
   );\r
 \r
   );\r
 \r
-\r
 /**\r
   Creates an event that is fired everytime a Protocol of a specific type is installed.\r
 \r
 **/\r
 VOID\r
 /**\r
   Creates an event that is fired everytime a Protocol of a specific type is installed.\r
 \r
 **/\r
 VOID\r
-CoreNotifyOnArchProtocolInstallation (\r
+CoreNotifyOnProtocolInstallation (\r
   VOID\r
   );\r
 \r
   VOID\r
   );\r
 \r
-\r
 /**\r
 /**\r
-  Return TRUE if all AP services are availible.\r
+  Return TRUE if all AP services are available.\r
 \r
   @retval EFI_SUCCESS    All AP services are available\r
   @retval EFI_NOT_FOUND  At least one AP service is not available\r
 \r
   @retval EFI_SUCCESS    All AP services are available\r
   @retval EFI_NOT_FOUND  At least one AP service is not available\r
@@ -365,7 +425,6 @@ CoreAllEfiServicesAvailable (
   VOID\r
   );\r
 \r
   VOID\r
   );\r
 \r
-\r
 /**\r
   Calcualte the 32-bit CRC in a EFI table using the service provided by the\r
   gRuntime service.\r
 /**\r
   Calcualte the 32-bit CRC in a EFI table using the service provided by the\r
   gRuntime service.\r
@@ -375,24 +434,22 @@ CoreAllEfiServicesAvailable (
 **/\r
 VOID\r
 CalculateEfiHdrCrc (\r
 **/\r
 VOID\r
 CalculateEfiHdrCrc (\r
-  IN  OUT EFI_TABLE_HEADER    *Hdr\r
+  IN  OUT EFI_TABLE_HEADER  *Hdr\r
   );\r
 \r
   );\r
 \r
-\r
 /**\r
   Called by the platform code to process a tick.\r
 \r
 /**\r
   Called by the platform code to process a tick.\r
 \r
-  @param  Duration               The number of 100ns elasped since the last call\r
+  @param  Duration               The number of 100ns elapsed since the last call\r
                                  to TimerTick\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
 CoreTimerTick (\r
                                  to TimerTick\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
 CoreTimerTick (\r
-  IN UINT64   Duration\r
+  IN UINT64  Duration\r
   );\r
 \r
   );\r
 \r
-\r
 /**\r
   Initialize the dispatcher. Initialize the notification function that runs when\r
   an FV2 protocol is added to the system.\r
 /**\r
   Initialize the dispatcher. Initialize the notification function that runs when\r
   an FV2 protocol is added to the system.\r
@@ -403,7 +460,6 @@ CoreInitializeDispatcher (
   VOID\r
   );\r
 \r
   VOID\r
   );\r
 \r
-\r
 /**\r
   This is the POSTFIX version of the dependency evaluator.  This code does\r
   not need to handle Before or After, as it is not valid to call this\r
 /**\r
   This is the POSTFIX version of the dependency evaluator.  This code does\r
   not need to handle Before or After, as it is not valid to call this\r
@@ -419,10 +475,9 @@ CoreInitializeDispatcher (
 **/\r
 BOOLEAN\r
 CoreIsSchedulable (\r
 **/\r
 BOOLEAN\r
 CoreIsSchedulable (\r
-  IN  EFI_CORE_DRIVER_ENTRY   *DriverEntry\r
+  IN  EFI_CORE_DRIVER_ENTRY  *DriverEntry\r
   );\r
 \r
   );\r
 \r
-\r
 /**\r
   Preprocess dependency expression and update DriverEntry to reflect the\r
   state of  Before, After, and SOR dependencies. If DriverEntry->Before\r
 /**\r
   Preprocess dependency expression and update DriverEntry to reflect the\r
   state of  Before, After, and SOR dependencies. If DriverEntry->Before\r
@@ -437,11 +492,9 @@ CoreIsSchedulable (
 **/\r
 EFI_STATUS\r
 CorePreProcessDepex (\r
 **/\r
 EFI_STATUS\r
 CorePreProcessDepex (\r
-  IN  EFI_CORE_DRIVER_ENTRY   *DriverEntry\r
+  IN  EFI_CORE_DRIVER_ENTRY  *DriverEntry\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   Terminates all boot services.\r
 \r
 /**\r
   Terminates all boot services.\r
 \r
@@ -455,11 +508,10 @@ CorePreProcessDepex (
 EFI_STATUS\r
 EFIAPI\r
 CoreExitBootServices (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreExitBootServices (\r
-  IN EFI_HANDLE   ImageHandle,\r
-  IN UINTN        MapKey\r
+  IN EFI_HANDLE  ImageHandle,\r
+  IN UINTN       MapKey\r
   );\r
 \r
   );\r
 \r
-\r
 /**\r
   Make sure the memory map is following all the construction rules,\r
   it is the last time to check memory map error before exit boot services.\r
 /**\r
   Make sure the memory map is following all the construction rules,\r
   it is the last time to check memory map error before exit boot services.\r
@@ -473,10 +525,9 @@ CoreExitBootServices (
 **/\r
 EFI_STATUS\r
 CoreTerminateMemoryMap (\r
 **/\r
 EFI_STATUS\r
 CoreTerminateMemoryMap (\r
-  IN UINTN          MapKey\r
+  IN UINTN  MapKey\r
   );\r
 \r
   );\r
 \r
-\r
 /**\r
   Signals all events in the EventGroup.\r
 \r
 /**\r
   Signals all events in the EventGroup.\r
 \r
@@ -485,11 +536,9 @@ CoreTerminateMemoryMap (
 **/\r
 VOID\r
 CoreNotifySignalList (\r
 **/\r
 VOID\r
 CoreNotifySignalList (\r
-  IN EFI_GUID     *EventGroup\r
+  IN EFI_GUID  *EventGroup\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   Boot Service called to add, modify, or remove a system configuration table from\r
   the EFI System Table.\r
 /**\r
   Boot Service called to add, modify, or remove a system configuration table from\r
   the EFI System Table.\r
@@ -508,12 +557,10 @@ CoreNotifySignalList (
 EFI_STATUS\r
 EFIAPI\r
 CoreInstallConfigurationTable (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreInstallConfigurationTable (\r
-  IN EFI_GUID *Guid,\r
-  IN VOID     *Table\r
+  IN EFI_GUID  *Guid,\r
+  IN VOID      *Table\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   Raise the task priority level to the new level.\r
   High level is implemented by disabling processor interrupts.\r
 /**\r
   Raise the task priority level to the new level.\r
   High level is implemented by disabling processor interrupts.\r
@@ -526,11 +573,9 @@ CoreInstallConfigurationTable (
 EFI_TPL\r
 EFIAPI\r
 CoreRaiseTpl (\r
 EFI_TPL\r
 EFIAPI\r
 CoreRaiseTpl (\r
-  IN EFI_TPL      NewTpl\r
+  IN EFI_TPL  NewTpl\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   Lowers the task priority to the previous value.   If the new\r
   priority unmasks events at a higher priority, they are dispatched.\r
 /**\r
   Lowers the task priority to the previous value.   If the new\r
   priority unmasks events at a higher priority, they are dispatched.\r
@@ -541,11 +586,9 @@ CoreRaiseTpl (
 VOID\r
 EFIAPI\r
 CoreRestoreTpl (\r
 VOID\r
 EFIAPI\r
 CoreRestoreTpl (\r
-  IN EFI_TPL NewTpl\r
+  IN EFI_TPL  NewTpl\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   Introduces a fine-grained stall.\r
 \r
 /**\r
   Introduces a fine-grained stall.\r
 \r
@@ -559,11 +602,9 @@ CoreRestoreTpl (
 EFI_STATUS\r
 EFIAPI\r
 CoreStall (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreStall (\r
-  IN UINTN            Microseconds\r
+  IN UINTN  Microseconds\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   Sets the system's watchdog timer.\r
 \r
 /**\r
   Sets the system's watchdog timer.\r
 \r
@@ -589,14 +630,12 @@ CoreStall (
 EFI_STATUS\r
 EFIAPI\r
 CoreSetWatchdogTimer (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreSetWatchdogTimer (\r
-  IN UINTN    Timeout,\r
-  IN UINT64   WatchdogCode,\r
-  IN UINTN    DataSize,\r
-  IN CHAR16   *WatchdogData OPTIONAL\r
+  IN UINTN   Timeout,\r
+  IN UINT64  WatchdogCode,\r
+  IN UINTN   DataSize,\r
+  IN CHAR16  *WatchdogData OPTIONAL\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   Wrapper function to CoreInstallProtocolInterfaceNotify.  This is the public API which\r
   Calls the private one which contains a BOOLEAN parameter for notifications\r
 /**\r
   Wrapper function to CoreInstallProtocolInterfaceNotify.  This is the public API which\r
   Calls the private one which contains a BOOLEAN parameter for notifications\r
@@ -614,13 +653,12 @@ CoreSetWatchdogTimer (
 EFI_STATUS\r
 EFIAPI\r
 CoreInstallProtocolInterface (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreInstallProtocolInterface (\r
-  IN OUT EFI_HANDLE     *UserHandle,\r
-  IN EFI_GUID           *Protocol,\r
-  IN EFI_INTERFACE_TYPE InterfaceType,\r
-  IN VOID               *Interface\r
+  IN OUT EFI_HANDLE      *UserHandle,\r
+  IN EFI_GUID            *Protocol,\r
+  IN EFI_INTERFACE_TYPE  InterfaceType,\r
+  IN VOID                *Interface\r
   );\r
 \r
   );\r
 \r
-\r
 /**\r
   Installs a protocol interface into the boot services environment.\r
 \r
 /**\r
   Installs a protocol interface into the boot services environment.\r
 \r
@@ -640,15 +678,13 @@ CoreInstallProtocolInterface (
 **/\r
 EFI_STATUS\r
 CoreInstallProtocolInterfaceNotify (\r
 **/\r
 EFI_STATUS\r
 CoreInstallProtocolInterfaceNotify (\r
-  IN OUT EFI_HANDLE     *UserHandle,\r
-  IN EFI_GUID           *Protocol,\r
-  IN EFI_INTERFACE_TYPE InterfaceType,\r
-  IN VOID               *Interface,\r
-  IN BOOLEAN            Notify\r
+  IN OUT EFI_HANDLE      *UserHandle,\r
+  IN EFI_GUID            *Protocol,\r
+  IN EFI_INTERFACE_TYPE  InterfaceType,\r
+  IN VOID                *Interface,\r
+  IN BOOLEAN             Notify\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   Installs a list of protocol interface into the boot services environment.\r
   This function calls InstallProtocolInterface() in a loop. If any error\r
 /**\r
   Installs a list of protocol interface into the boot services environment.\r
   This function calls InstallProtocolInterface() in a loop. If any error\r
@@ -662,19 +698,21 @@ CoreInstallProtocolInterfaceNotify (
                                  arguments to InstallProtocolInterface(). All the\r
                                  protocols are added to Handle.\r
 \r
                                  arguments to InstallProtocolInterface(). All the\r
                                  protocols are added to Handle.\r
 \r
+  @retval EFI_SUCCESS            All the protocol interface was installed.\r
+  @retval EFI_OUT_OF_RESOURCES   There was not enough memory in pool to install all the protocols.\r
+  @retval EFI_ALREADY_STARTED    A Device Path Protocol instance was passed in that is already present in\r
+                                 the handle database.\r
   @retval EFI_INVALID_PARAMETER  Handle is NULL.\r
   @retval EFI_INVALID_PARAMETER  Handle is NULL.\r
-  @retval EFI_SUCCESS            Protocol interfaces successfully installed.\r
+  @retval EFI_INVALID_PARAMETER  Protocol is already installed on the handle specified by Handle.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 CoreInstallMultipleProtocolInterfaces (\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 CoreInstallMultipleProtocolInterfaces (\r
-  IN OUT EFI_HANDLE           *Handle,\r
+  IN OUT EFI_HANDLE  *Handle,\r
   ...\r
   );\r
 \r
   ...\r
   );\r
 \r
-\r
-\r
 /**\r
   Uninstalls a list of protocol interface in the boot services environment.\r
   This function calls UnisatllProtocolInterface() in a loop. This is\r
 /**\r
   Uninstalls a list of protocol interface in the boot services environment.\r
   This function calls UnisatllProtocolInterface() in a loop. This is\r
@@ -692,12 +730,10 @@ CoreInstallMultipleProtocolInterfaces (
 EFI_STATUS\r
 EFIAPI\r
 CoreUninstallMultipleProtocolInterfaces (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreUninstallMultipleProtocolInterfaces (\r
-  IN EFI_HANDLE           Handle,\r
+  IN EFI_HANDLE  Handle,\r
   ...\r
   );\r
 \r
   ...\r
   );\r
 \r
-\r
-\r
 /**\r
   Reinstall a protocol interface on a device handle.  The OldInterface for Protocol is replaced by the NewInterface.\r
 \r
 /**\r
   Reinstall a protocol interface on a device handle.  The OldInterface for Protocol is replaced by the NewInterface.\r
 \r
@@ -715,14 +751,12 @@ CoreUninstallMultipleProtocolInterfaces (
 EFI_STATUS\r
 EFIAPI\r
 CoreReinstallProtocolInterface (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreReinstallProtocolInterface (\r
-  IN EFI_HANDLE     UserHandle,\r
-  IN EFI_GUID       *Protocol,\r
-  IN VOID           *OldInterface,\r
-  IN VOID           *NewInterface\r
+  IN EFI_HANDLE  UserHandle,\r
+  IN EFI_GUID    *Protocol,\r
+  IN VOID        *OldInterface,\r
+  IN VOID        *NewInterface\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   Uninstalls all instances of a protocol:interfacer from a handle.\r
   If the last protocol interface is remove from the handle, the\r
 /**\r
   Uninstalls all instances of a protocol:interfacer from a handle.\r
   If the last protocol interface is remove from the handle, the\r
@@ -739,13 +773,11 @@ CoreReinstallProtocolInterface (
 EFI_STATUS\r
 EFIAPI\r
 CoreUninstallProtocolInterface (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreUninstallProtocolInterface (\r
-  IN EFI_HANDLE       UserHandle,\r
-  IN EFI_GUID         *Protocol,\r
-  IN VOID             *Interface\r
+  IN EFI_HANDLE  UserHandle,\r
+  IN EFI_GUID    *Protocol,\r
+  IN VOID        *Interface\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   Queries a handle to determine if it supports a specified protocol.\r
 \r
 /**\r
   Queries a handle to determine if it supports a specified protocol.\r
 \r
@@ -760,13 +792,11 @@ CoreUninstallProtocolInterface (
 EFI_STATUS\r
 EFIAPI\r
 CoreHandleProtocol (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreHandleProtocol (\r
-  IN EFI_HANDLE       UserHandle,\r
-  IN EFI_GUID         *Protocol,\r
-  OUT VOID            **Interface\r
+  IN EFI_HANDLE  UserHandle,\r
+  IN EFI_GUID    *Protocol,\r
+  OUT VOID       **Interface\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   Locates the installed protocol handler for the handle, and\r
   invokes it to obtain the protocol interface. Usage information\r
 /**\r
   Locates the installed protocol handler for the handle, and\r
   invokes it to obtain the protocol interface. Usage information\r
@@ -790,16 +820,14 @@ CoreHandleProtocol (
 EFI_STATUS\r
 EFIAPI\r
 CoreOpenProtocol (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreOpenProtocol (\r
-  IN  EFI_HANDLE                UserHandle,\r
-  IN  EFI_GUID                  *Protocol,\r
-  OUT VOID                      **Interface OPTIONAL,\r
-  IN  EFI_HANDLE                ImageHandle,\r
-  IN  EFI_HANDLE                ControllerHandle,\r
-  IN  UINT32                    Attributes\r
+  IN  EFI_HANDLE  UserHandle,\r
+  IN  EFI_GUID    *Protocol,\r
+  OUT VOID        **Interface OPTIONAL,\r
+  IN  EFI_HANDLE  ImageHandle,\r
+  IN  EFI_HANDLE  ControllerHandle,\r
+  IN  UINT32      Attributes\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   Return information about Opened protocols in the system\r
 \r
 /**\r
   Return information about Opened protocols in the system\r
 \r
@@ -814,14 +842,12 @@ CoreOpenProtocol (
 EFI_STATUS\r
 EFIAPI\r
 CoreOpenProtocolInformation (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreOpenProtocolInformation (\r
-  IN  EFI_HANDLE                          UserHandle,\r
-  IN  EFI_GUID                            *Protocol,\r
-  OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,\r
-  OUT UINTN                               *EntryCount\r
+  IN  EFI_HANDLE                           UserHandle,\r
+  IN  EFI_GUID                             *Protocol,\r
+  OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY  **EntryBuffer,\r
+  OUT UINTN                                *EntryCount\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   Closes a protocol on a handle that was opened using OpenProtocol().\r
 \r
 /**\r
   Closes a protocol on a handle that was opened using OpenProtocol().\r
 \r
@@ -850,14 +876,12 @@ CoreOpenProtocolInformation (
 EFI_STATUS\r
 EFIAPI\r
 CoreCloseProtocol (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreCloseProtocol (\r
-  IN  EFI_HANDLE                UserHandle,\r
-  IN  EFI_GUID                  *Protocol,\r
-  IN  EFI_HANDLE                AgentHandle,\r
-  IN  EFI_HANDLE                ControllerHandle\r
+  IN  EFI_HANDLE  UserHandle,\r
+  IN  EFI_GUID    *Protocol,\r
+  IN  EFI_HANDLE  AgentHandle,\r
+  IN  EFI_HANDLE  ControllerHandle\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated\r
   from pool.\r
 /**\r
   Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated\r
   from pool.\r
@@ -884,13 +908,11 @@ CoreCloseProtocol (
 EFI_STATUS\r
 EFIAPI\r
 CoreProtocolsPerHandle (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreProtocolsPerHandle (\r
-  IN EFI_HANDLE       UserHandle,\r
-  OUT EFI_GUID        ***ProtocolBuffer,\r
-  OUT UINTN           *ProtocolBufferCount\r
+  IN EFI_HANDLE  UserHandle,\r
+  OUT EFI_GUID   ***ProtocolBuffer,\r
+  OUT UINTN      *ProtocolBufferCount\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   Add a new protocol notification record for the request protocol.\r
 \r
 /**\r
   Add a new protocol notification record for the request protocol.\r
 \r
@@ -907,12 +929,11 @@ CoreProtocolsPerHandle (
 EFI_STATUS\r
 EFIAPI\r
 CoreRegisterProtocolNotify (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreRegisterProtocolNotify (\r
-  IN EFI_GUID       *Protocol,\r
-  IN EFI_EVENT      Event,\r
-  OUT  VOID         **Registration\r
+  IN EFI_GUID   *Protocol,\r
+  IN EFI_EVENT  Event,\r
+  OUT  VOID     **Registration\r
   );\r
 \r
   );\r
 \r
-\r
 /**\r
   Removes all the events in the protocol database that match Event.\r
 \r
 /**\r
   Removes all the events in the protocol database that match Event.\r
 \r
@@ -924,10 +945,9 @@ CoreRegisterProtocolNotify (
 **/\r
 EFI_STATUS\r
 CoreUnregisterProtocolNotify (\r
 **/\r
 EFI_STATUS\r
 CoreUnregisterProtocolNotify (\r
-  IN EFI_EVENT      Event\r
+  IN EFI_EVENT  Event\r
   );\r
 \r
   );\r
 \r
-\r
 /**\r
   Locates the requested handle(s) and returns them in Buffer.\r
 \r
 /**\r
   Locates the requested handle(s) and returns them in Buffer.\r
 \r
@@ -949,15 +969,13 @@ CoreUnregisterProtocolNotify (
 EFI_STATUS\r
 EFIAPI\r
 CoreLocateHandle (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreLocateHandle (\r
-  IN EFI_LOCATE_SEARCH_TYPE   SearchType,\r
-  IN EFI_GUID                 *Protocol   OPTIONAL,\r
-  IN VOID                     *SearchKey  OPTIONAL,\r
-  IN OUT UINTN                *BufferSize,\r
-  OUT EFI_HANDLE              *Buffer\r
+  IN EFI_LOCATE_SEARCH_TYPE  SearchType,\r
+  IN EFI_GUID                *Protocol   OPTIONAL,\r
+  IN VOID                    *SearchKey  OPTIONAL,\r
+  IN OUT UINTN               *BufferSize,\r
+  OUT EFI_HANDLE             *Buffer\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   Locates the handle to a device on the device path that best matches the specified protocol.\r
 \r
 /**\r
   Locates the handle to a device on the device path that best matches the specified protocol.\r
 \r
@@ -976,13 +994,11 @@ CoreLocateHandle (
 EFI_STATUS\r
 EFIAPI\r
 CoreLocateDevicePath (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreLocateDevicePath (\r
-  IN EFI_GUID                       *Protocol,\r
-  IN OUT EFI_DEVICE_PATH_PROTOCOL   **DevicePath,\r
-  OUT EFI_HANDLE                    *Device\r
+  IN EFI_GUID                      *Protocol,\r
+  IN OUT EFI_DEVICE_PATH_PROTOCOL  **DevicePath,\r
+  OUT EFI_HANDLE                   *Device\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   Function returns an array of handles that support the requested protocol\r
   in a buffer allocated from pool. This is a version of CoreLocateHandle()\r
 /**\r
   Function returns an array of handles that support the requested protocol\r
   in a buffer allocated from pool. This is a version of CoreLocateHandle()\r
@@ -1002,21 +1018,19 @@ CoreLocateDevicePath (
   @retval EFI_NOT_FOUND          No handles match the search.\r
   @retval EFI_OUT_OF_RESOURCES   There is not enough pool memory to store the\r
                                  matching results.\r
   @retval EFI_NOT_FOUND          No handles match the search.\r
   @retval EFI_OUT_OF_RESOURCES   There is not enough pool memory to store the\r
                                  matching results.\r
-  @retval EFI_INVALID_PARAMETER  One or more paramters are not valid.\r
+  @retval EFI_INVALID_PARAMETER  One or more parameters are not valid.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 CoreLocateHandleBuffer (\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 CoreLocateHandleBuffer (\r
-  IN EFI_LOCATE_SEARCH_TYPE       SearchType,\r
-  IN EFI_GUID                     *Protocol OPTIONAL,\r
-  IN VOID                         *SearchKey OPTIONAL,\r
-  IN OUT UINTN                    *NumberHandles,\r
-  OUT EFI_HANDLE                  **Buffer\r
+  IN EFI_LOCATE_SEARCH_TYPE  SearchType,\r
+  IN EFI_GUID                *Protocol OPTIONAL,\r
+  IN VOID                    *SearchKey OPTIONAL,\r
+  IN OUT UINTN               *NumberHandles,\r
+  OUT EFI_HANDLE             **Buffer\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   Return the first Protocol Interface that matches the Protocol GUID. If\r
   Registration is passed in, return a Protocol Instance that was just add\r
 /**\r
   Return the first Protocol Interface that matches the Protocol GUID. If\r
   Registration is passed in, return a Protocol Instance that was just add\r
@@ -1041,7 +1055,6 @@ CoreLocateProtocol (
   OUT VOID      **Interface\r
   );\r
 \r
   OUT VOID      **Interface\r
   );\r
 \r
-\r
 /**\r
   return handle database key.\r
 \r
 /**\r
   return handle database key.\r
 \r
@@ -1054,7 +1067,6 @@ CoreGetHandleDatabaseKey (
   VOID\r
   );\r
 \r
   VOID\r
   );\r
 \r
-\r
 /**\r
   Go connect any handles that were created or modified while a image executed.\r
 \r
 /**\r
   Go connect any handles that were created or modified while a image executed.\r
 \r
@@ -1067,24 +1079,30 @@ CoreConnectHandlesByKey (
   UINT64  Key\r
   );\r
 \r
   UINT64  Key\r
   );\r
 \r
-\r
-\r
 /**\r
   Connects one or more drivers to a controller.\r
 \r
 /**\r
   Connects one or more drivers to a controller.\r
 \r
-  @param  ControllerHandle                      Handle of the controller to be\r
-                                                connected.\r
-  @param  DriverImageHandle                     DriverImageHandle A pointer to an\r
-                                                ordered list of driver image\r
-                                                handles.\r
-  @param  RemainingDevicePath                   RemainingDevicePath A pointer to\r
-                                                the device path that specifies a\r
-                                                child of the controller specified\r
-                                                by ControllerHandle.\r
-  @param  Recursive                             Whether the function would be\r
-                                                called recursively or not.\r
+  @param  ControllerHandle      The handle of the controller to which driver(s) are to be connected.\r
+  @param  DriverImageHandle     A pointer to an ordered list handles that support the\r
+                                EFI_DRIVER_BINDING_PROTOCOL.\r
+  @param  RemainingDevicePath   A pointer to the device path that specifies a child of the\r
+                                controller specified by ControllerHandle.\r
+  @param  Recursive             If TRUE, then ConnectController() is called recursively\r
+                                until the entire tree of controllers below the controller specified\r
+                                by ControllerHandle have been created. If FALSE, then\r
+                                the tree of controllers is only expanded one level.\r
 \r
 \r
-  @return Status code.\r
+  @retval EFI_SUCCESS           1) One or more drivers were connected to ControllerHandle.\r
+                                2) No drivers were connected to ControllerHandle, but\r
+                                RemainingDevicePath is not NULL, and it is an End Device\r
+                                Path Node.\r
+  @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
+  @retval EFI_NOT_FOUND         1) There are no EFI_DRIVER_BINDING_PROTOCOL instances\r
+                                present in the system.\r
+                                2) No drivers were connected to ControllerHandle.\r
+  @retval EFI_SECURITY_VIOLATION\r
+                                The user has no permission to start UEFI device drivers on the device path\r
+                                associated with the ControllerHandle or specified by the RemainingDevicePath.\r
 \r
 **/\r
 EFI_STATUS\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1096,8 +1114,6 @@ CoreConnectController (
   IN  BOOLEAN                   Recursive\r
   );\r
 \r
   IN  BOOLEAN                   Recursive\r
   );\r
 \r
-\r
-\r
 /**\r
   Disonnects a controller from a driver\r
 \r
 /**\r
   Disonnects a controller from a driver\r
 \r
@@ -1117,8 +1133,7 @@ CoreConnectController (
   @retval EFI_SUCCESS                           DriverImageHandle is not NULL,\r
                                                 and on entry DriverImageHandle is\r
                                                 not managing ControllerHandle.\r
   @retval EFI_SUCCESS                           DriverImageHandle is not NULL,\r
                                                 and on entry DriverImageHandle is\r
                                                 not managing ControllerHandle.\r
-  @retval EFI_INVALID_PARAMETER                 ControllerHandle is not a valid\r
-                                                EFI_HANDLE.\r
+  @retval EFI_INVALID_PARAMETER                 ControllerHandle is NULL.\r
   @retval EFI_INVALID_PARAMETER                 DriverImageHandle is not NULL,\r
                                                 and it is not a valid EFI_HANDLE.\r
   @retval EFI_INVALID_PARAMETER                 ChildHandle is not NULL, and it\r
   @retval EFI_INVALID_PARAMETER                 DriverImageHandle is not NULL,\r
                                                 and it is not a valid EFI_HANDLE.\r
   @retval EFI_INVALID_PARAMETER                 ChildHandle is not NULL, and it\r
@@ -1139,8 +1154,6 @@ CoreDisconnectController (
   IN  EFI_HANDLE  ChildHandle        OPTIONAL\r
   );\r
 \r
   IN  EFI_HANDLE  ChildHandle        OPTIONAL\r
   );\r
 \r
-\r
-\r
 /**\r
   Allocates pages from the memory map.\r
 \r
 /**\r
   Allocates pages from the memory map.\r
 \r
@@ -1162,14 +1175,12 @@ CoreDisconnectController (
 EFI_STATUS\r
 EFIAPI\r
 CoreAllocatePages (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreAllocatePages (\r
-  IN EFI_ALLOCATE_TYPE      Type,\r
-  IN EFI_MEMORY_TYPE        MemoryType,\r
-  IN UINTN                  NumberOfPages,\r
+  IN EFI_ALLOCATE_TYPE         Type,\r
+  IN EFI_MEMORY_TYPE           MemoryType,\r
+  IN UINTN                     NumberOfPages,\r
   IN OUT EFI_PHYSICAL_ADDRESS  *Memory\r
   );\r
 \r
   IN OUT EFI_PHYSICAL_ADDRESS  *Memory\r
   );\r
 \r
-\r
-\r
 /**\r
   Frees previous allocated pages.\r
 \r
 /**\r
   Frees previous allocated pages.\r
 \r
@@ -1184,12 +1195,10 @@ CoreAllocatePages (
 EFI_STATUS\r
 EFIAPI\r
 CoreFreePages (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreFreePages (\r
-  IN EFI_PHYSICAL_ADDRESS   Memory,\r
-  IN UINTN                  NumberOfPages\r
+  IN EFI_PHYSICAL_ADDRESS  Memory,\r
+  IN UINTN                 NumberOfPages\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   This function returns a copy of the current memory map. The map is an array of\r
   memory descriptors, each of which describes a contiguous block of memory.\r
 /**\r
   This function returns a copy of the current memory map. The map is an array of\r
   memory descriptors, each of which describes a contiguous block of memory.\r
@@ -1230,8 +1239,6 @@ CoreGetMemoryMap (
   OUT UINT32                    *DescriptorVersion\r
   );\r
 \r
   OUT UINT32                    *DescriptorVersion\r
   );\r
 \r
-\r
-\r
 /**\r
   Allocate pool of a particular type.\r
 \r
 /**\r
   Allocate pool of a particular type.\r
 \r
@@ -1240,7 +1247,7 @@ CoreGetMemoryMap (
   @param  Buffer                 The address to return a pointer to the allocated\r
                                  pool\r
 \r
   @param  Buffer                 The address to return a pointer to the allocated\r
                                  pool\r
 \r
-  @retval EFI_INVALID_PARAMETER  PoolType not valid\r
+  @retval EFI_INVALID_PARAMETER  PoolType not valid or Buffer is NULL\r
   @retval EFI_OUT_OF_RESOURCES   Size exceeds max pool size or allocation failed.\r
   @retval EFI_SUCCESS            Pool successfully allocated.\r
 \r
   @retval EFI_OUT_OF_RESOURCES   Size exceeds max pool size or allocation failed.\r
   @retval EFI_SUCCESS            Pool successfully allocated.\r
 \r
@@ -1253,7 +1260,26 @@ CoreAllocatePool (
   OUT VOID            **Buffer\r
   );\r
 \r
   OUT VOID            **Buffer\r
   );\r
 \r
+/**\r
+  Allocate pool of a particular type.\r
+\r
+  @param  PoolType               Type of pool to allocate\r
+  @param  Size                   The amount of pool to allocate\r
+  @param  Buffer                 The address to return a pointer to the allocated\r
+                                 pool\r
+\r
+  @retval EFI_INVALID_PARAMETER  PoolType not valid or Buffer is NULL\r
+  @retval EFI_OUT_OF_RESOURCES   Size exceeds max pool size or allocation failed.\r
+  @retval EFI_SUCCESS            Pool successfully allocated.\r
 \r
 \r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CoreInternalAllocatePool (\r
+  IN EFI_MEMORY_TYPE  PoolType,\r
+  IN UINTN            Size,\r
+  OUT VOID            **Buffer\r
+  );\r
 \r
 /**\r
   Frees pool.\r
 \r
 /**\r
   Frees pool.\r
@@ -1267,10 +1293,25 @@ CoreAllocatePool (
 EFI_STATUS\r
 EFIAPI\r
 CoreFreePool (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreFreePool (\r
-  IN VOID        *Buffer\r
+  IN VOID  *Buffer\r
   );\r
 \r
   );\r
 \r
+/**\r
+  Frees pool.\r
 \r
 \r
+  @param  Buffer                 The allocated pool entry to free\r
+  @param  PoolType               Pointer to pool type\r
+\r
+  @retval EFI_INVALID_PARAMETER  Buffer is not a valid value.\r
+  @retval EFI_SUCCESS            Pool successfully freed.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CoreInternalFreePool (\r
+  IN VOID              *Buffer,\r
+  OUT EFI_MEMORY_TYPE  *PoolType OPTIONAL\r
+  );\r
 \r
 /**\r
   Loads an EFI image into memory and returns a handle to the image.\r
 \r
 /**\r
   Loads an EFI image into memory and returns a handle to the image.\r
@@ -1296,21 +1337,27 @@ CoreFreePool (
                                   protocol for loading the file.\r
   @retval EFI_OUT_OF_RESOURCES    Image was not loaded due to insufficient\r
                                   resources.\r
                                   protocol for loading the file.\r
   @retval EFI_OUT_OF_RESOURCES    Image was not loaded due to insufficient\r
                                   resources.\r
+  @retval EFI_LOAD_ERROR          Image was not loaded because the image format was corrupt or not\r
+                                  understood.\r
+  @retval EFI_DEVICE_ERROR        Image was not loaded because the device returned a read error.\r
+  @retval EFI_ACCESS_DENIED       Image was not loaded because the platform policy prohibits the\r
+                                  image from being loaded. NULL is returned in *ImageHandle.\r
+  @retval EFI_SECURITY_VIOLATION  Image was loaded and an ImageHandle was created with a\r
+                                  valid EFI_LOADED_IMAGE_PROTOCOL. However, the current\r
+                                  platform policy specifies that the image should not be started.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 CoreLoadImage (\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 CoreLoadImage (\r
-  IN BOOLEAN                    BootPolicy,\r
-  IN EFI_HANDLE                 ParentImageHandle,\r
-  IN EFI_DEVICE_PATH_PROTOCOL   *FilePath,\r
-  IN VOID                       *SourceBuffer   OPTIONAL,\r
-  IN UINTN                      SourceSize,\r
-  OUT EFI_HANDLE                *ImageHandle\r
+  IN BOOLEAN                   BootPolicy,\r
+  IN EFI_HANDLE                ParentImageHandle,\r
+  IN EFI_DEVICE_PATH_PROTOCOL  *FilePath,\r
+  IN VOID                      *SourceBuffer   OPTIONAL,\r
+  IN UINTN                     SourceSize,\r
+  OUT EFI_HANDLE               *ImageHandle\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   Unloads an image.\r
 \r
 /**\r
   Unloads an image.\r
 \r
@@ -1318,7 +1365,7 @@ CoreLoadImage (
                                   unloaded.\r
 \r
   @retval EFI_SUCCESS             The image has been unloaded.\r
                                   unloaded.\r
 \r
   @retval EFI_SUCCESS             The image has been unloaded.\r
-  @retval EFI_UNSUPPORTED         The image has been sarted, and does not support\r
+  @retval EFI_UNSUPPORTED         The image has been started, and does not support\r
                                   unload.\r
   @retval EFI_INVALID_PARAMPETER  ImageHandle is not a valid image handle.\r
 \r
                                   unload.\r
   @retval EFI_INVALID_PARAMPETER  ImageHandle is not a valid image handle.\r
 \r
@@ -1329,15 +1376,13 @@ CoreUnloadImage (
   IN EFI_HANDLE  ImageHandle\r
   );\r
 \r
   IN EFI_HANDLE  ImageHandle\r
   );\r
 \r
-\r
-\r
 /**\r
   Transfer control to a loaded image's entry point.\r
 \r
   @param  ImageHandle             Handle of image to be started.\r
   @param  ExitDataSize            Pointer of the size to ExitData\r
   @param  ExitData                Pointer to a pointer to a data buffer that\r
 /**\r
   Transfer control to a loaded image's entry point.\r
 \r
   @param  ImageHandle             Handle of image to be started.\r
   @param  ExitDataSize            Pointer of the size to ExitData\r
   @param  ExitData                Pointer to a pointer to a data buffer that\r
-                                  includes a Null-terminated Unicode string,\r
+                                  includes a Null-terminated string,\r
                                   optionally followed by additional binary data.\r
                                   The string is a description that the caller may\r
                                   use to further indicate the reason for the\r
                                   optionally followed by additional binary data.\r
                                   The string is a description that the caller may\r
                                   use to further indicate the reason for the\r
@@ -1345,6 +1390,7 @@ CoreUnloadImage (
 \r
   @retval EFI_INVALID_PARAMETER   Invalid parameter\r
   @retval EFI_OUT_OF_RESOURCES    No enough buffer to allocate\r
 \r
   @retval EFI_INVALID_PARAMETER   Invalid parameter\r
   @retval EFI_OUT_OF_RESOURCES    No enough buffer to allocate\r
+  @retval EFI_SECURITY_VIOLATION  The current platform policy specifies that the image should not be started.\r
   @retval EFI_SUCCESS             Successfully transfer control to the image's\r
                                   entry point.\r
 \r
   @retval EFI_SUCCESS             Successfully transfer control to the image's\r
                                   entry point.\r
 \r
@@ -1357,8 +1403,6 @@ CoreStartImage (
   OUT CHAR16     **ExitData  OPTIONAL\r
   );\r
 \r
   OUT CHAR16     **ExitData  OPTIONAL\r
   );\r
 \r
-\r
-\r
 /**\r
   Terminates the currently loaded EFI image and returns control to boot services.\r
 \r
 /**\r
   Terminates the currently loaded EFI image and returns control to boot services.\r
 \r
@@ -1391,10 +1435,8 @@ CoreExit (
   IN CHAR16      *ExitData  OPTIONAL\r
   );\r
 \r
   IN CHAR16      *ExitData  OPTIONAL\r
   );\r
 \r
-\r
-\r
 /**\r
 /**\r
-  Creates a general-purpose event structure.\r
+  Creates an event.\r
 \r
   @param  Type                   The type of event to create and its mode and\r
                                  attributes\r
 \r
   @param  Type                   The type of event to create and its mode and\r
                                  attributes\r
@@ -1414,17 +1456,15 @@ CoreExit (
 EFI_STATUS\r
 EFIAPI\r
 CoreCreateEvent (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreCreateEvent (\r
-  IN UINT32                   Type,\r
-  IN EFI_TPL                  NotifyTpl,\r
-  IN EFI_EVENT_NOTIFY         NotifyFunction, OPTIONAL\r
-  IN VOID                     *NotifyContext, OPTIONAL\r
-  OUT EFI_EVENT               *Event\r
+  IN UINT32            Type,\r
+  IN EFI_TPL           NotifyTpl,\r
+  IN EFI_EVENT_NOTIFY  NotifyFunction  OPTIONAL,\r
+  IN VOID              *NotifyContext  OPTIONAL,\r
+  OUT EFI_EVENT        *Event\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
 /**\r
-  Creates a general-purpose event structure\r
+  Creates an event in a group.\r
 \r
   @param  Type                   The type of event to create and its mode and\r
                                  attributes\r
 \r
   @param  Type                   The type of event to create and its mode and\r
                                  attributes\r
@@ -1446,15 +1486,44 @@ CoreCreateEvent (
 EFI_STATUS\r
 EFIAPI\r
 CoreCreateEventEx (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreCreateEventEx (\r
-  IN UINT32                   Type,\r
-  IN EFI_TPL                  NotifyTpl,\r
-  IN EFI_EVENT_NOTIFY         NotifyFunction, OPTIONAL\r
-  IN CONST VOID               *NotifyContext, OPTIONAL\r
-  IN CONST EFI_GUID           *EventGroup,    OPTIONAL\r
-  OUT EFI_EVENT               *Event\r
+  IN UINT32            Type,\r
+  IN EFI_TPL           NotifyTpl,\r
+  IN EFI_EVENT_NOTIFY  NotifyFunction  OPTIONAL,\r
+  IN CONST VOID        *NotifyContext  OPTIONAL,\r
+  IN CONST EFI_GUID    *EventGroup     OPTIONAL,\r
+  OUT EFI_EVENT        *Event\r
   );\r
 \r
   );\r
 \r
+/**\r
+  Creates a general-purpose event structure\r
 \r
 \r
+  @param  Type                   The type of event to create and its mode and\r
+                                 attributes\r
+  @param  NotifyTpl              The task priority level of event notifications\r
+  @param  NotifyFunction         Pointer to the events notification function\r
+  @param  NotifyContext          Pointer to the notification functions context;\r
+                                 corresponds to parameter "Context" in the\r
+                                 notification function\r
+  @param  EventGroup             GUID for EventGroup if NULL act the same as\r
+                                 gBS->CreateEvent().\r
+  @param  Event                  Pointer to the newly created event if the call\r
+                                 succeeds; undefined otherwise\r
+\r
+  @retval EFI_SUCCESS            The event structure was created\r
+  @retval EFI_INVALID_PARAMETER  One of the parameters has an invalid value\r
+  @retval EFI_OUT_OF_RESOURCES   The event could not be allocated\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CoreCreateEventInternal (\r
+  IN UINT32            Type,\r
+  IN EFI_TPL           NotifyTpl,\r
+  IN EFI_EVENT_NOTIFY  NotifyFunction  OPTIONAL,\r
+  IN CONST VOID        *NotifyContext  OPTIONAL,\r
+  IN CONST EFI_GUID    *EventGroup     OPTIONAL,\r
+  OUT EFI_EVENT        *Event\r
+  );\r
 \r
 /**\r
   Sets the type of timer and the trigger time for a timer event.\r
 \r
 /**\r
   Sets the type of timer and the trigger time for a timer event.\r
@@ -1474,13 +1543,11 @@ CoreCreateEventEx (
 EFI_STATUS\r
 EFIAPI\r
 CoreSetTimer (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreSetTimer (\r
-  IN EFI_EVENT            UserEvent,\r
-  IN EFI_TIMER_DELAY      Type,\r
-  IN UINT64               TriggerTime\r
+  IN EFI_EVENT        UserEvent,\r
+  IN EFI_TIMER_DELAY  Type,\r
+  IN UINT64           TriggerTime\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   Signals the event.  Queues the event to be notified if needed.\r
 \r
 /**\r
   Signals the event.  Queues the event to be notified if needed.\r
 \r
@@ -1493,11 +1560,9 @@ CoreSetTimer (
 EFI_STATUS\r
 EFIAPI\r
 CoreSignalEvent (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreSignalEvent (\r
-  IN EFI_EVENT    UserEvent\r
+  IN EFI_EVENT  UserEvent\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   Stops execution until an event is signaled.\r
 \r
 /**\r
   Stops execution until an event is signaled.\r
 \r
@@ -1515,13 +1580,11 @@ CoreSignalEvent (
 EFI_STATUS\r
 EFIAPI\r
 CoreWaitForEvent (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreWaitForEvent (\r
-  IN UINTN        NumberOfEvents,\r
-  IN EFI_EVENT    *UserEvents,\r
-  OUT UINTN       *UserIndex\r
+  IN UINTN      NumberOfEvents,\r
+  IN EFI_EVENT  *UserEvents,\r
+  OUT UINTN     *UserIndex\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   Closes an event and frees the event structure.\r
 \r
 /**\r
   Closes an event and frees the event structure.\r
 \r
@@ -1534,11 +1597,9 @@ CoreWaitForEvent (
 EFI_STATUS\r
 EFIAPI\r
 CoreCloseEvent (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreCloseEvent (\r
-  IN EFI_EVENT    UserEvent\r
+  IN EFI_EVENT  UserEvent\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   Check the status of an event.\r
 \r
 /**\r
   Check the status of an event.\r
 \r
@@ -1552,10 +1613,9 @@ CoreCloseEvent (
 EFI_STATUS\r
 EFIAPI\r
 CoreCheckEvent (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreCheckEvent (\r
-  IN EFI_EVENT        UserEvent\r
+  IN EFI_EVENT  UserEvent\r
   );\r
 \r
   );\r
 \r
-\r
 /**\r
   Adds reserved memory, system memory, or memory-mapped I/O resources to the\r
   global coherency domain of the processor.\r
 /**\r
   Adds reserved memory, system memory, or memory-mapped I/O resources to the\r
   global coherency domain of the processor.\r
@@ -1577,7 +1637,6 @@ CoreAddMemorySpace (
   IN UINT64                Capabilities\r
   );\r
 \r
   IN UINT64                Capabilities\r
   );\r
 \r
-\r
 /**\r
   Allocates nonexistent memory, reserved memory, system memory, or memorymapped\r
   I/O resources from the global coherency domain of the processor.\r
 /**\r
   Allocates nonexistent memory, reserved memory, system memory, or memorymapped\r
   I/O resources from the global coherency domain of the processor.\r
@@ -1607,7 +1666,6 @@ CoreAllocateMemorySpace (
   IN     EFI_HANDLE             DeviceHandle OPTIONAL\r
   );\r
 \r
   IN     EFI_HANDLE             DeviceHandle OPTIONAL\r
   );\r
 \r
-\r
 /**\r
   Frees nonexistent memory, reserved memory, system memory, or memory-mapped\r
   I/O resources from the global coherency domain of the processor.\r
 /**\r
   Frees nonexistent memory, reserved memory, system memory, or memory-mapped\r
   I/O resources from the global coherency domain of the processor.\r
@@ -1625,7 +1683,6 @@ CoreFreeMemorySpace (
   IN UINT64                Length\r
   );\r
 \r
   IN UINT64                Length\r
   );\r
 \r
-\r
 /**\r
   Removes reserved memory, system memory, or memory-mapped I/O resources from\r
   the global coherency domain of the processor.\r
 /**\r
   Removes reserved memory, system memory, or memory-mapped I/O resources from\r
   the global coherency domain of the processor.\r
@@ -1643,7 +1700,6 @@ CoreRemoveMemorySpace (
   IN UINT64                Length\r
   );\r
 \r
   IN UINT64                Length\r
   );\r
 \r
-\r
 /**\r
   Retrieves the descriptor for a memory region containing a specified address.\r
 \r
 /**\r
   Retrieves the descriptor for a memory region containing a specified address.\r
 \r
@@ -1661,7 +1717,6 @@ CoreGetMemorySpaceDescriptor (
   OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR  *Descriptor\r
   );\r
 \r
   OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR  *Descriptor\r
   );\r
 \r
-\r
 /**\r
   Modifies the attributes for a memory region in the global coherency domain of the\r
   processor.\r
 /**\r
   Modifies the attributes for a memory region in the global coherency domain of the\r
   processor.\r
@@ -1670,8 +1725,18 @@ CoreGetMemorySpaceDescriptor (
   @param  Length                 Specified length\r
   @param  Attributes             Specified attributes\r
 \r
   @param  Length                 Specified length\r
   @param  Attributes             Specified attributes\r
 \r
-  @retval EFI_SUCCESS            Successfully set attribute of a segment of\r
-                                 memory space.\r
+  @retval EFI_SUCCESS           The attributes were set for the memory region.\r
+  @retval EFI_INVALID_PARAMETER Length is zero.\r
+  @retval EFI_UNSUPPORTED       The processor does not support one or more bytes of the memory\r
+                                resource range specified by BaseAddress and Length.\r
+  @retval EFI_UNSUPPORTED       The bit mask of attributes is not support for the memory resource\r
+                                range specified by BaseAddress and Length.\r
+  @retval EFI_ACCESS_DENIED     The attributes for the memory resource range specified by\r
+                                BaseAddress and Length cannot be modified.\r
+  @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to modify the attributes of\r
+                                the memory resource range.\r
+  @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol is\r
+                                not available yet.\r
 \r
 **/\r
 EFI_STATUS\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1682,6 +1747,30 @@ CoreSetMemorySpaceAttributes (
   IN UINT64                Attributes\r
   );\r
 \r
   IN UINT64                Attributes\r
   );\r
 \r
+/**\r
+  Modifies the capabilities for a memory region in the global coherency domain of the\r
+  processor.\r
+\r
+  @param  BaseAddress      The physical address that is the start address of a memory region.\r
+  @param  Length           The size in bytes of the memory region.\r
+  @param  Capabilities     The bit mask of capabilities that the memory region supports.\r
+\r
+  @retval EFI_SUCCESS           The capabilities were set for the memory region.\r
+  @retval EFI_INVALID_PARAMETER Length is zero.\r
+  @retval EFI_UNSUPPORTED       The capabilities specified by Capabilities do not include the\r
+                                memory region attributes currently in use.\r
+  @retval EFI_ACCESS_DENIED     The capabilities for the memory resource range specified by\r
+                                BaseAddress and Length cannot be modified.\r
+  @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to modify the capabilities\r
+                                of the memory resource range.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CoreSetMemorySpaceCapabilities (\r
+  IN EFI_PHYSICAL_ADDRESS  BaseAddress,\r
+  IN UINT64                Length,\r
+  IN UINT64                Capabilities\r
+  );\r
 \r
 /**\r
   Returns a map of the memory resources in the global coherency domain of the\r
 \r
 /**\r
   Returns a map of the memory resources in the global coherency domain of the\r
@@ -1702,7 +1791,6 @@ CoreGetMemorySpaceMap (
   OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR  **MemorySpaceMap\r
   );\r
 \r
   OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR  **MemorySpaceMap\r
   );\r
 \r
-\r
 /**\r
   Adds reserved I/O or I/O resources to the global coherency domain of the processor.\r
 \r
 /**\r
   Adds reserved I/O or I/O resources to the global coherency domain of the processor.\r
 \r
@@ -1722,7 +1810,6 @@ CoreAddIoSpace (
   IN UINT64                Length\r
   );\r
 \r
   IN UINT64                Length\r
   );\r
 \r
-\r
 /**\r
   Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency\r
   domain of the processor.\r
 /**\r
   Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency\r
   domain of the processor.\r
@@ -1752,7 +1839,6 @@ CoreAllocateIoSpace (
   IN     EFI_HANDLE             DeviceHandle OPTIONAL\r
   );\r
 \r
   IN     EFI_HANDLE             DeviceHandle OPTIONAL\r
   );\r
 \r
-\r
 /**\r
   Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency\r
   domain of the processor.\r
 /**\r
   Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency\r
   domain of the processor.\r
@@ -1770,7 +1856,6 @@ CoreFreeIoSpace (
   IN UINT64                Length\r
   );\r
 \r
   IN UINT64                Length\r
   );\r
 \r
-\r
 /**\r
   Removes reserved I/O or I/O resources from the global coherency domain of the\r
   processor.\r
 /**\r
   Removes reserved I/O or I/O resources from the global coherency domain of the\r
   processor.\r
@@ -1788,7 +1873,6 @@ CoreRemoveIoSpace (
   IN UINT64                Length\r
   );\r
 \r
   IN UINT64                Length\r
   );\r
 \r
-\r
 /**\r
   Retrieves the descriptor for an I/O region containing a specified address.\r
 \r
 /**\r
   Retrieves the descriptor for an I/O region containing a specified address.\r
 \r
@@ -1806,7 +1890,6 @@ CoreGetIoSpaceDescriptor (
   OUT EFI_GCD_IO_SPACE_DESCRIPTOR  *Descriptor\r
   );\r
 \r
   OUT EFI_GCD_IO_SPACE_DESCRIPTOR  *Descriptor\r
   );\r
 \r
-\r
 /**\r
   Returns a map of the I/O resources in the global coherency domain of the processor.\r
 \r
 /**\r
   Returns a map of the I/O resources in the global coherency domain of the processor.\r
 \r
@@ -1825,7 +1908,6 @@ CoreGetIoSpaceMap (
   OUT EFI_GCD_IO_SPACE_DESCRIPTOR  **IoSpaceMap\r
   );\r
 \r
   OUT EFI_GCD_IO_SPACE_DESCRIPTOR  **IoSpaceMap\r
   );\r
 \r
-\r
 /**\r
   This is the main Dispatcher for DXE and it exits when there are no more\r
   drivers to run. Drain the mScheduledQueue and load and start a PE\r
 /**\r
   This is the main Dispatcher for DXE and it exits when there are no more\r
   drivers to run. Drain the mScheduledQueue and load and start a PE\r
@@ -1867,7 +1949,6 @@ CoreSchedule (
   IN  EFI_GUID    *DriverName\r
   );\r
 \r
   IN  EFI_GUID    *DriverName\r
   );\r
 \r
-\r
 /**\r
   Convert a driver from the Untrused back to the Scheduled state.\r
 \r
 /**\r
   Convert a driver from the Untrused back to the Scheduled state.\r
 \r
@@ -1887,7 +1968,6 @@ CoreTrust (
   IN  EFI_GUID    *DriverName\r
   );\r
 \r
   IN  EFI_GUID    *DriverName\r
   );\r
 \r
-\r
 /**\r
   This routine is the driver initialization entry point.  It initializes the\r
   libraries, and registers two notification functions.  These notification\r
 /**\r
   This routine is the driver initialization entry point.  It initializes the\r
   libraries, and registers two notification functions.  These notification\r
@@ -1902,11 +1982,10 @@ CoreTrust (
 EFI_STATUS\r
 EFIAPI\r
 FwVolDriverInit (\r
 EFI_STATUS\r
 EFIAPI\r
 FwVolDriverInit (\r
-  IN EFI_HANDLE                   ImageHandle,\r
-  IN EFI_SYSTEM_TABLE             *SystemTable\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
   );\r
 \r
   );\r
 \r
-\r
 /**\r
   Entry point of the section extraction code. Initializes an instance of the\r
   section extraction interface and installs it on a new handle.\r
 /**\r
   Entry point of the section extraction code. Initializes an instance of the\r
   section extraction interface and installs it on a new handle.\r
@@ -1921,11 +2000,10 @@ FwVolDriverInit (
 EFI_STATUS\r
 EFIAPI\r
 InitializeSectionExtraction (\r
 EFI_STATUS\r
 EFIAPI\r
 InitializeSectionExtraction (\r
-  IN EFI_HANDLE                   ImageHandle,\r
-  IN EFI_SYSTEM_TABLE             *SystemTable\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
   );\r
 \r
   );\r
 \r
-\r
 /**\r
   This DXE service routine is used to process a firmware volume. In\r
   particular, it can be called by BDS to process a single firmware\r
 /**\r
   This DXE service routine is used to process a firmware volume. In\r
   particular, it can be called by BDS to process a single firmware\r
@@ -1946,13 +2024,13 @@ InitializeSectionExtraction (
 EFI_STATUS\r
 EFIAPI\r
 CoreProcessFirmwareVolume (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreProcessFirmwareVolume (\r
-  IN VOID                             *FvHeader,\r
-  IN UINTN                            Size,\r
-  OUT EFI_HANDLE                      *FVProtocolHandle\r
+  IN VOID         *FvHeader,\r
+  IN UINTN        Size,\r
+  OUT EFI_HANDLE  *FVProtocolHandle\r
   );\r
 \r
 //\r
   );\r
 \r
 //\r
-//Functions used during debug buils\r
+// Functions used during debug buils\r
 //\r
 \r
 /**\r
 //\r
 \r
 /**\r
@@ -1965,7 +2043,6 @@ CoreDisplayMissingArchProtocols (
   VOID\r
   );\r
 \r
   VOID\r
   );\r
 \r
-\r
 /**\r
   Traverse the discovered list for any drivers that were discovered but not loaded\r
   because the dependency experessions evaluated to false.\r
 /**\r
   Traverse the discovered list for any drivers that were discovered but not loaded\r
   because the dependency experessions evaluated to false.\r
@@ -1976,21 +2053,6 @@ CoreDisplayDiscoveredNotDispatched (
   VOID\r
   );\r
 \r
   VOID\r
   );\r
 \r
-\r
-/**\r
-  Place holder function until all the Boot Services and Runtime Services are\r
-  available.\r
-\r
-  @return EFI_NOT_AVAILABLE_YET\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-CoreEfiNotAvailableYetArg0 (\r
-  VOID\r
-  );\r
-\r
-\r
 /**\r
   Place holder function until all the Boot Services and Runtime Services are\r
   available.\r
 /**\r
   Place holder function until all the Boot Services and Runtime Services are\r
   available.\r
@@ -2003,10 +2065,9 @@ CoreEfiNotAvailableYetArg0 (
 EFI_STATUS\r
 EFIAPI\r
 CoreEfiNotAvailableYetArg1 (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreEfiNotAvailableYetArg1 (\r
-  UINTN Arg1\r
+  UINTN  Arg1\r
   );\r
 \r
   );\r
 \r
-\r
 /**\r
   Place holder function until all the Boot Services and Runtime Services are available.\r
 \r
 /**\r
   Place holder function until all the Boot Services and Runtime Services are available.\r
 \r
@@ -2019,11 +2080,10 @@ CoreEfiNotAvailableYetArg1 (
 EFI_STATUS\r
 EFIAPI\r
 CoreEfiNotAvailableYetArg2 (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreEfiNotAvailableYetArg2 (\r
-  UINTN Arg1,\r
-  UINTN Arg2\r
+  UINTN  Arg1,\r
+  UINTN  Arg2\r
   );\r
 \r
   );\r
 \r
-\r
 /**\r
   Place holder function until all the Boot Services and Runtime Services are available.\r
 \r
 /**\r
   Place holder function until all the Boot Services and Runtime Services are available.\r
 \r
@@ -2037,12 +2097,11 @@ CoreEfiNotAvailableYetArg2 (
 EFI_STATUS\r
 EFIAPI\r
 CoreEfiNotAvailableYetArg3 (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreEfiNotAvailableYetArg3 (\r
-  UINTN Arg1,\r
-  UINTN Arg2,\r
-  UINTN Arg3\r
+  UINTN  Arg1,\r
+  UINTN  Arg2,\r
+  UINTN  Arg3\r
   );\r
 \r
   );\r
 \r
-\r
 /**\r
   Place holder function until all the Boot Services and Runtime Services are available.\r
 \r
 /**\r
   Place holder function until all the Boot Services and Runtime Services are available.\r
 \r
@@ -2057,13 +2116,12 @@ CoreEfiNotAvailableYetArg3 (
 EFI_STATUS\r
 EFIAPI\r
 CoreEfiNotAvailableYetArg4 (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreEfiNotAvailableYetArg4 (\r
-  UINTN Arg1,\r
-  UINTN Arg2,\r
-  UINTN Arg3,\r
-  UINTN Arg4\r
+  UINTN  Arg1,\r
+  UINTN  Arg2,\r
+  UINTN  Arg3,\r
+  UINTN  Arg4\r
   );\r
 \r
   );\r
 \r
-\r
 /**\r
   Place holder function until all the Boot Services and Runtime Services are available.\r
 \r
 /**\r
   Place holder function until all the Boot Services and Runtime Services are available.\r
 \r
@@ -2079,14 +2137,13 @@ CoreEfiNotAvailableYetArg4 (
 EFI_STATUS\r
 EFIAPI\r
 CoreEfiNotAvailableYetArg5 (\r
 EFI_STATUS\r
 EFIAPI\r
 CoreEfiNotAvailableYetArg5 (\r
-  UINTN Arg1,\r
-  UINTN Arg2,\r
-  UINTN Arg3,\r
-  UINTN Arg4,\r
-  UINTN Arg5\r
+  UINTN  Arg1,\r
+  UINTN  Arg2,\r
+  UINTN  Arg3,\r
+  UINTN  Arg4,\r
+  UINTN  Arg5\r
   );\r
 \r
   );\r
 \r
-\r
 /**\r
   Given a compressed source buffer, this function retrieves the size of the\r
   uncompressed buffer and the size of the scratch buffer required to decompress\r
 /**\r
   Given a compressed source buffer, this function retrieves the size of the\r
   uncompressed buffer and the size of the scratch buffer required to decompress\r
@@ -2129,14 +2186,13 @@ CoreEfiNotAvailableYetArg5 (
 EFI_STATUS\r
 EFIAPI\r
 DxeMainUefiDecompressGetInfo (\r
 EFI_STATUS\r
 EFIAPI\r
 DxeMainUefiDecompressGetInfo (\r
-  IN EFI_DECOMPRESS_PROTOCOL            *This,\r
-  IN   VOID                             *Source,\r
-  IN   UINT32                           SourceSize,\r
-  OUT  UINT32                           *DestinationSize,\r
-  OUT  UINT32                           *ScratchSize\r
+  IN EFI_DECOMPRESS_PROTOCOL  *This,\r
+  IN   VOID                   *Source,\r
+  IN   UINT32                 SourceSize,\r
+  OUT  UINT32                 *DestinationSize,\r
+  OUT  UINT32                 *ScratchSize\r
   );\r
 \r
   );\r
 \r
-\r
 /**\r
   Decompresses a compressed source buffer.\r
 \r
 /**\r
   Decompresses a compressed source buffer.\r
 \r
@@ -2174,13 +2230,13 @@ DxeMainUefiDecompressGetInfo (
 EFI_STATUS\r
 EFIAPI\r
 DxeMainUefiDecompress (\r
 EFI_STATUS\r
 EFIAPI\r
 DxeMainUefiDecompress (\r
-  IN     EFI_DECOMPRESS_PROTOCOL          *This,\r
-  IN     VOID                             *Source,\r
-  IN     UINT32                           SourceSize,\r
-  IN OUT VOID                             *Destination,\r
-  IN     UINT32                           DestinationSize,\r
-  IN OUT VOID                             *Scratch,\r
-  IN     UINT32                           ScratchSize\r
+  IN     EFI_DECOMPRESS_PROTOCOL  *This,\r
+  IN     VOID                     *Source,\r
+  IN     UINT32                   SourceSize,\r
+  IN OUT VOID                     *Destination,\r
+  IN     UINT32                   DestinationSize,\r
+  IN OUT VOID                     *Scratch,\r
+  IN     UINT32                   ScratchSize\r
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r
@@ -2201,13 +2257,11 @@ DxeMainUefiDecompress (
 EFI_STATUS\r
 EFIAPI\r
 OpenSectionStream (\r
 EFI_STATUS\r
 EFIAPI\r
 OpenSectionStream (\r
-  IN     UINTN                                     SectionStreamLength,\r
-  IN     VOID                                      *SectionStream,\r
-     OUT UINTN                                     *SectionStreamHandle\r
+  IN     UINTN  SectionStreamLength,\r
+  IN     VOID   *SectionStream,\r
+  OUT UINTN     *SectionStreamHandle\r
   );\r
 \r
   );\r
 \r
-\r
-\r
 /**\r
   SEP member function.  Retrieves requested section from section stream.\r
 \r
 /**\r
   SEP member function.  Retrieves requested section from section stream.\r
 \r
@@ -2223,7 +2277,7 @@ OpenSectionStream (
                                 non-null on input, then the buffer is caller\r
                                 allocated.  If Buffer is NULL, then the buffer\r
                                 is callee allocated.  In either case, the\r
                                 non-null on input, then the buffer is caller\r
                                 allocated.  If Buffer is NULL, then the buffer\r
                                 is callee allocated.  In either case, the\r
-                                requried buffer size is returned in *BufferSize.\r
+                                required buffer size is returned in *BufferSize.\r
   @param  BufferSize            On input, indicates the size of *Buffer if\r
                                 *Buffer is non-null on input.  On output,\r
                                 indicates the required size (allocated size if\r
   @param  BufferSize            On input, indicates the size of *Buffer if\r
                                 *Buffer is non-null on input.  On output,\r
                                 indicates the required size (allocated size if\r
@@ -2244,6 +2298,7 @@ OpenSectionStream (
                                 function returns anything other than\r
                                 EFI_SUCCESS, the value of *AuthenticationStatus\r
                                 is undefined.\r
                                 function returns anything other than\r
                                 EFI_SUCCESS, the value of *AuthenticationStatus\r
                                 is undefined.\r
+  @param  IsFfs3Fv              Indicates the FV format.\r
 \r
   @retval EFI_SUCCESS           Section was retrieved successfully\r
   @retval EFI_PROTOCOL_ERROR    A GUID defined section was encountered in the\r
 \r
   @retval EFI_SUCCESS           Section was retrieved successfully\r
   @retval EFI_PROTOCOL_ERROR    A GUID defined section was encountered in the\r
@@ -2268,20 +2323,22 @@ OpenSectionStream (
 EFI_STATUS\r
 EFIAPI\r
 GetSection (\r
 EFI_STATUS\r
 EFIAPI\r
 GetSection (\r
-  IN UINTN                                              SectionStreamHandle,\r
-  IN EFI_SECTION_TYPE                                   *SectionType,\r
-  IN EFI_GUID                                           *SectionDefinitionGuid,\r
-  IN UINTN                                              SectionInstance,\r
-  IN VOID                                               **Buffer,\r
-  IN OUT UINTN                                          *BufferSize,\r
-  OUT UINT32                                            *AuthenticationStatus\r
+  IN UINTN             SectionStreamHandle,\r
+  IN EFI_SECTION_TYPE  *SectionType,\r
+  IN EFI_GUID          *SectionDefinitionGuid,\r
+  IN UINTN             SectionInstance,\r
+  IN VOID              **Buffer,\r
+  IN OUT UINTN         *BufferSize,\r
+  OUT UINT32           *AuthenticationStatus,\r
+  IN BOOLEAN           IsFfs3Fv\r
   );\r
 \r
   );\r
 \r
-\r
 /**\r
   SEP member function.  Deletes an existing section stream\r
 \r
   @param  StreamHandleToClose    Indicates the stream to close\r
 /**\r
   SEP member function.  Deletes an existing section stream\r
 \r
   @param  StreamHandleToClose    Indicates the stream to close\r
+  @param  FreeStreamBuffer       TRUE - Need to free stream buffer;\r
+                                 FALSE - No need to free stream buffer.\r
 \r
   @retval EFI_SUCCESS            The section stream is closed sucessfully.\r
   @retval EFI_OUT_OF_RESOURCES   Memory allocation failed.\r
 \r
   @retval EFI_SUCCESS            The section stream is closed sucessfully.\r
   @retval EFI_OUT_OF_RESOURCES   Memory allocation failed.\r
@@ -2292,7 +2349,8 @@ GetSection (
 EFI_STATUS\r
 EFIAPI\r
 CloseSectionStream (\r
 EFI_STATUS\r
 EFIAPI\r
 CloseSectionStream (\r
-  IN  UINTN                                     StreamHandleToClose\r
+  IN  UINTN    StreamHandleToClose,\r
+  IN  BOOLEAN  FreeStreamBuffer\r
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r
@@ -2311,7 +2369,6 @@ CoreInitializeDebugImageInfoTable (
   VOID\r
   );\r
 \r
   VOID\r
   );\r
 \r
-\r
 /**\r
   Update the CRC32 in the Debug Table.\r
   Since the CRC32 service is made available by the Runtime driver, we have to\r
 /**\r
   Update the CRC32 in the Debug Table.\r
   Since the CRC32 service is made available by the Runtime driver, we have to\r
@@ -2325,7 +2382,6 @@ CoreUpdateDebugTableCrc32 (
   VOID\r
   );\r
 \r
   VOID\r
   );\r
 \r
-\r
 /**\r
   Adds a new DebugImageInfo structure to the DebugImageInfo Table.  Re-Allocates\r
   the table if it's not large enough to accomidate another entry.\r
 /**\r
   Adds a new DebugImageInfo structure to the DebugImageInfo Table.  Re-Allocates\r
   the table if it's not large enough to accomidate another entry.\r
@@ -2338,12 +2394,11 @@ CoreUpdateDebugTableCrc32 (
 **/\r
 VOID\r
 CoreNewDebugImageInfoEntry (\r
 **/\r
 VOID\r
 CoreNewDebugImageInfoEntry (\r
-  IN  UINT32                      ImageInfoType,\r
-  IN  EFI_LOADED_IMAGE_PROTOCOL   *LoadedImage,\r
-  IN  EFI_HANDLE                  ImageHandle\r
+  IN  UINT32                     ImageInfoType,\r
+  IN  EFI_LOADED_IMAGE_PROTOCOL  *LoadedImage,\r
+  IN  EFI_HANDLE                 ImageHandle\r
   );\r
 \r
   );\r
 \r
-\r
 /**\r
   Removes and frees an entry from the DebugImageInfo Table.\r
 \r
 /**\r
   Removes and frees an entry from the DebugImageInfo Table.\r
 \r
@@ -2352,10 +2407,9 @@ CoreNewDebugImageInfoEntry (
 **/\r
 VOID\r
 CoreRemoveDebugImageInfoEntry (\r
 **/\r
 VOID\r
 CoreRemoveDebugImageInfoEntry (\r
-  EFI_HANDLE ImageHandle\r
+  EFI_HANDLE  ImageHandle\r
   );\r
 \r
   );\r
 \r
-\r
 /**\r
   This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.\r
 \r
 /**\r
   This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.\r
 \r
@@ -2369,10 +2423,23 @@ CoreRemoveDebugImageInfoEntry (
 EFI_STATUS\r
 EFIAPI\r
 FwVolBlockDriverInit (\r
 EFI_STATUS\r
 EFIAPI\r
 FwVolBlockDriverInit (\r
-  IN EFI_HANDLE                 ImageHandle,\r
-  IN EFI_SYSTEM_TABLE           *SystemTable\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
   );\r
 \r
   );\r
 \r
+/**\r
+\r
+  Get FVB authentication status\r
+\r
+  @param FvbProtocol    FVB protocol.\r
+\r
+  @return Authentication status.\r
+\r
+**/\r
+UINT32\r
+GetFvbAuthenticationStatus (\r
+  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *FvbProtocol\r
+  );\r
 \r
 /**\r
   This routine produces a firmware volume block protocol on a given\r
 \r
 /**\r
   This routine produces a firmware volume block protocol on a given\r
@@ -2381,8 +2448,10 @@ FwVolBlockDriverInit (
   @param  BaseAddress            base address of the firmware volume image\r
   @param  Length                 length of the firmware volume image\r
   @param  ParentHandle           handle of parent firmware volume, if this image\r
   @param  BaseAddress            base address of the firmware volume image\r
   @param  Length                 length of the firmware volume image\r
   @param  ParentHandle           handle of parent firmware volume, if this image\r
-                                 came from an FV image file in another firmware\r
+                                 came from an FV image file and section in another firmware\r
                                  volume (ala capsules)\r
                                  volume (ala capsules)\r
+  @param  AuthenticationStatus   Authentication status inherited, if this image\r
+                                 came from an FV image file and section in another firmware volume.\r
   @param  FvProtocol             Firmware volume block protocol produced.\r
 \r
   @retval EFI_VOLUME_CORRUPTED   Volume corrupted.\r
   @param  FvProtocol             Firmware volume block protocol produced.\r
 \r
   @retval EFI_VOLUME_CORRUPTED   Volume corrupted.\r
@@ -2393,13 +2462,13 @@ FwVolBlockDriverInit (
 **/\r
 EFI_STATUS\r
 ProduceFVBProtocolOnBuffer (\r
 **/\r
 EFI_STATUS\r
 ProduceFVBProtocolOnBuffer (\r
-  IN EFI_PHYSICAL_ADDRESS   BaseAddress,\r
-  IN UINT64                 Length,\r
-  IN EFI_HANDLE             ParentHandle,\r
-  OUT EFI_HANDLE            *FvProtocol  OPTIONAL\r
+  IN EFI_PHYSICAL_ADDRESS  BaseAddress,\r
+  IN UINT64                Length,\r
+  IN EFI_HANDLE            ParentHandle,\r
+  IN UINT32                AuthenticationStatus,\r
+  OUT EFI_HANDLE           *FvProtocol  OPTIONAL\r
   );\r
 \r
   );\r
 \r
-\r
 /**\r
   Raising to the task priority level of the mutual exclusion\r
   lock, and then acquires ownership of the lock.\r
 /**\r
   Raising to the task priority level of the mutual exclusion\r
   lock, and then acquires ownership of the lock.\r
@@ -2414,7 +2483,6 @@ CoreAcquireLock (
   IN EFI_LOCK  *Lock\r
   );\r
 \r
   IN EFI_LOCK  *Lock\r
   );\r
 \r
-\r
 /**\r
   Initialize a basic mutual exclusion lock.   Each lock\r
   provides mutual exclusion access at it's task priority\r
 /**\r
   Initialize a basic mutual exclusion lock.   Each lock\r
   provides mutual exclusion access at it's task priority\r
@@ -2433,7 +2501,6 @@ CoreAcquireLockOrFail (
   IN EFI_LOCK  *Lock\r
   );\r
 \r
   IN EFI_LOCK  *Lock\r
   );\r
 \r
-\r
 /**\r
   Releases ownership of the mutual exclusion lock, and\r
   restores the previous task priority level.\r
 /**\r
   Releases ownership of the mutual exclusion lock, and\r
   restores the previous task priority level.\r
@@ -2448,4 +2515,291 @@ CoreReleaseLock (
   IN EFI_LOCK  *Lock\r
   );\r
 \r
   IN EFI_LOCK  *Lock\r
   );\r
 \r
+/**\r
+  Read data from Firmware Block by FVB protocol Read.\r
+  The data may cross the multi block ranges.\r
+\r
+  @param  Fvb                   The FW_VOL_BLOCK_PROTOCOL instance from which to read data.\r
+  @param  StartLba              Pointer to StartLba.\r
+                                On input, the start logical block index from which to read.\r
+                                On output,the end logical block index after reading.\r
+  @param  Offset                Pointer to Offset\r
+                                On input, offset into the block at which to begin reading.\r
+                                On output, offset into the end block after reading.\r
+  @param  DataSize              Size of data to be read.\r
+  @param  Data                  Pointer to Buffer that the data will be read into.\r
+\r
+  @retval EFI_SUCCESS           Successfully read data from firmware block.\r
+  @retval others\r
+**/\r
+EFI_STATUS\r
+ReadFvbData (\r
+  IN     EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *Fvb,\r
+  IN OUT EFI_LBA                             *StartLba,\r
+  IN OUT UINTN                               *Offset,\r
+  IN     UINTN                               DataSize,\r
+  OUT    UINT8                               *Data\r
+  );\r
+\r
+/**\r
+  Given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and\r
+  copy the real length volume header into it.\r
+\r
+  @param  Fvb                   The FW_VOL_BLOCK_PROTOCOL instance from which to\r
+                                read the volume header\r
+  @param  FwVolHeader           Pointer to pointer to allocated buffer in which\r
+                                the volume header is returned.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  No enough buffer could be allocated.\r
+  @retval EFI_SUCCESS           Successfully read volume header to the allocated\r
+                                buffer.\r
+  @retval EFI_INVALID_PARAMETER The FV Header signature is not as expected or\r
+                                the file system could not be understood.\r
+\r
+**/\r
+EFI_STATUS\r
+GetFwVolHeader (\r
+  IN     EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *Fvb,\r
+  OUT    EFI_FIRMWARE_VOLUME_HEADER          **FwVolHeader\r
+  );\r
+\r
+/**\r
+  Verify checksum of the firmware volume header.\r
+\r
+  @param  FvHeader       Points to the firmware volume header to be checked\r
+\r
+  @retval TRUE           Checksum verification passed\r
+  @retval FALSE          Checksum verification failed\r
+\r
+**/\r
+BOOLEAN\r
+VerifyFvHeaderChecksum (\r
+  IN EFI_FIRMWARE_VOLUME_HEADER  *FvHeader\r
+  );\r
+\r
+/**\r
+  Initialize memory profile.\r
+\r
+  @param HobStart   The start address of the HOB.\r
+\r
+**/\r
+VOID\r
+MemoryProfileInit (\r
+  IN VOID  *HobStart\r
+  );\r
+\r
+/**\r
+  Install memory profile protocol.\r
+\r
+**/\r
+VOID\r
+MemoryProfileInstallProtocol (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Register image to memory profile.\r
+\r
+  @param DriverEntry    Image info.\r
+  @param FileType       Image file type.\r
+\r
+  @return EFI_SUCCESS           Register successfully.\r
+  @return EFI_UNSUPPORTED       Memory profile unsupported,\r
+                                or memory profile for the image is not required.\r
+  @return EFI_OUT_OF_RESOURCES  No enough resource for this register.\r
+\r
+**/\r
+EFI_STATUS\r
+RegisterMemoryProfileImage (\r
+  IN LOADED_IMAGE_PRIVATE_DATA  *DriverEntry,\r
+  IN EFI_FV_FILETYPE            FileType\r
+  );\r
+\r
+/**\r
+  Unregister image from memory profile.\r
+\r
+  @param DriverEntry    Image info.\r
+\r
+  @return EFI_SUCCESS           Unregister successfully.\r
+  @return EFI_UNSUPPORTED       Memory profile unsupported,\r
+                                or memory profile for the image is not required.\r
+  @return EFI_NOT_FOUND         The image is not found.\r
+\r
+**/\r
+EFI_STATUS\r
+UnregisterMemoryProfileImage (\r
+  IN LOADED_IMAGE_PRIVATE_DATA  *DriverEntry\r
+  );\r
+\r
+/**\r
+  Update memory profile information.\r
+\r
+  @param CallerAddress  Address of caller who call Allocate or Free.\r
+  @param Action         This Allocate or Free action.\r
+  @param MemoryType     Memory type.\r
+                        EfiMaxMemoryType means the MemoryType is unknown.\r
+  @param Size           Buffer size.\r
+  @param Buffer         Buffer address.\r
+  @param ActionString   String for memory profile action.\r
+                        Only needed for user defined allocate action.\r
+\r
+  @return EFI_SUCCESS           Memory profile is updated.\r
+  @return EFI_UNSUPPORTED       Memory profile is unsupported,\r
+                                or memory profile for the image is not required,\r
+                                or memory profile for the memory type is not required.\r
+  @return EFI_ACCESS_DENIED     It is during memory profile data getting.\r
+  @return EFI_ABORTED           Memory profile recording is not enabled.\r
+  @return EFI_OUT_OF_RESOURCES  No enough resource to update memory profile for allocate action.\r
+  @return EFI_NOT_FOUND         No matched allocate info found for free action.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CoreUpdateProfile (\r
+  IN EFI_PHYSICAL_ADDRESS   CallerAddress,\r
+  IN MEMORY_PROFILE_ACTION  Action,\r
+  IN EFI_MEMORY_TYPE        MemoryType,\r
+  IN UINTN                  Size,       // Valid for AllocatePages/FreePages/AllocatePool\r
+  IN VOID                   *Buffer,\r
+  IN CHAR8                  *ActionString OPTIONAL\r
+  );\r
+\r
+/**\r
+  Internal function.  Converts a memory range to use new attributes.\r
+\r
+  @param  Start                  The first address of the range Must be page\r
+                                 aligned\r
+  @param  NumberOfPages          The number of pages to convert\r
+  @param  NewAttributes          The new attributes value for the range.\r
+\r
+**/\r
+VOID\r
+CoreUpdateMemoryAttributes (\r
+  IN EFI_PHYSICAL_ADDRESS  Start,\r
+  IN UINT64                NumberOfPages,\r
+  IN UINT64                NewAttributes\r
+  );\r
+\r
+/**\r
+  Initialize MemoryAttrubutesTable support.\r
+**/\r
+VOID\r
+EFIAPI\r
+CoreInitializeMemoryAttributesTable (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Initialize Memory Protection support.\r
+**/\r
+VOID\r
+EFIAPI\r
+CoreInitializeMemoryProtection (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Install MemoryAttributesTable on memory allocation.\r
+\r
+  @param[in] MemoryType EFI memory type.\r
+**/\r
+VOID\r
+InstallMemoryAttributesTableOnMemoryAllocation (\r
+  IN EFI_MEMORY_TYPE  MemoryType\r
+  );\r
+\r
+/**\r
+  Insert image record.\r
+\r
+  @param  RuntimeImage    Runtime image information\r
+**/\r
+VOID\r
+InsertImageRecord (\r
+  IN EFI_RUNTIME_IMAGE_ENTRY  *RuntimeImage\r
+  );\r
+\r
+/**\r
+  Remove Image record.\r
+\r
+  @param  RuntimeImage    Runtime image information\r
+**/\r
+VOID\r
+RemoveImageRecord (\r
+  IN EFI_RUNTIME_IMAGE_ENTRY  *RuntimeImage\r
+  );\r
+\r
+/**\r
+  Protect UEFI image.\r
+\r
+  @param[in]  LoadedImage              The loaded image protocol\r
+  @param[in]  LoadedImageDevicePath    The loaded image device path protocol\r
+**/\r
+VOID\r
+ProtectUefiImage (\r
+  IN EFI_LOADED_IMAGE_PROTOCOL  *LoadedImage,\r
+  IN EFI_DEVICE_PATH_PROTOCOL   *LoadedImageDevicePath\r
+  );\r
+\r
+/**\r
+  Unprotect UEFI image.\r
+\r
+  @param[in]  LoadedImage              The loaded image protocol\r
+  @param[in]  LoadedImageDevicePath    The loaded image device path protocol\r
+**/\r
+VOID\r
+UnprotectUefiImage (\r
+  IN EFI_LOADED_IMAGE_PROTOCOL  *LoadedImage,\r
+  IN EFI_DEVICE_PATH_PROTOCOL   *LoadedImageDevicePath\r
+  );\r
+\r
+/**\r
+  ExitBootServices Callback function for memory protection.\r
+**/\r
+VOID\r
+MemoryProtectionExitBootServicesCallback (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Manage memory permission attributes on a memory range, according to the\r
+  configured DXE memory protection policy.\r
+\r
+  @param  OldType           The old memory type of the range\r
+  @param  NewType           The new memory type of the range\r
+  @param  Memory            The base address of the range\r
+  @param  Length            The size of the range (in bytes)\r
+\r
+  @return EFI_SUCCESS       If the the CPU arch protocol is not installed yet\r
+  @return EFI_SUCCESS       If no DXE memory protection policy has been configured\r
+  @return EFI_SUCCESS       If OldType and NewType use the same permission attributes\r
+  @return other             Return value of gCpu->SetMemoryAttributes()\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ApplyMemoryProtectionPolicy (\r
+  IN  EFI_MEMORY_TYPE       OldType,\r
+  IN  EFI_MEMORY_TYPE       NewType,\r
+  IN  EFI_PHYSICAL_ADDRESS  Memory,\r
+  IN  UINT64                Length\r
+  );\r
+\r
+/**\r
+  Merge continous memory map entries whose have same attributes.\r
+\r
+  @param  MemoryMap       A pointer to the buffer in which firmware places\r
+                          the current memory map.\r
+  @param  MemoryMapSize   A pointer to the size, in bytes, of the\r
+                          MemoryMap buffer. On input, this is the size of\r
+                          the current memory map.  On output,\r
+                          it is the size of new memory map after merge.\r
+  @param  DescriptorSize  Size, in bytes, of an individual EFI_MEMORY_DESCRIPTOR.\r
+**/\r
+VOID\r
+MergeMemoryMap (\r
+  IN OUT EFI_MEMORY_DESCRIPTOR  *MemoryMap,\r
+  IN OUT UINTN                  *MemoryMapSize,\r
+  IN UINTN                      DescriptorSize\r
+  );\r
+\r
 #endif\r
 #endif\r