public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch 0/2] Add Management Mode infrastructure support.
@ 2017-08-14  8:32 Eric Dong
  2017-08-14  8:32 ` [Patch 1/2] MdePkg: Add new definitions for Management Mode Eric Dong
  2017-08-14  8:32 ` [Patch 2/2] MdePkg: Update exited SMM related definition Eric Dong
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Dong @ 2017-08-14  8:32 UTC (permalink / raw)
  To: edk2-devel

In PI spec 1.5, System Management Mode name has been changed to Management
mode, it also change all SMM related driver name to avoid use SMI/SmRam/SMM
keywords. 

This patch series add new definition which use Management mode nomenclature. 
Also in order to maintain continuity, this patch also use typedefs and 
#define statements that allow code developed with these earlier versions of 
the specification to compile unchanged.

Eric Dong (2):
  MdePkg: Add new definitions for Management Mode.
  MdePkg: Update exited SMM related definition.

 MdePkg/Include/Pi/PiMmCis.h                        | 350 +++++++++++++++++++++
 MdePkg/Include/Pi/PiMultiPhase.h                   |  26 +-
 MdePkg/Include/Pi/PiSmmCis.h                       | 183 ++---------
 MdePkg/Include/PiMm.h                              |  25 ++
 MdePkg/Include/Protocol/DxeMmReadyToLock.h         |  41 +++
 MdePkg/Include/Protocol/DxeSmmReadyToLock.h        |   9 +-
 MdePkg/Include/Protocol/MmAccess.h                 | 133 ++++++++
 MdePkg/Include/Protocol/MmBase.h                   |  87 +++++
 MdePkg/Include/Protocol/MmCommunication.h          |  83 +++++
 MdePkg/Include/Protocol/MmConfiguration.h          |  86 +++++
 MdePkg/Include/Protocol/MmControl.h                | 106 +++++++
 MdePkg/Include/Protocol/MmCpu.h                    | 247 +++++++++++++++
 MdePkg/Include/Protocol/MmCpuIo.h                  |  96 ++++++
 MdePkg/Include/Protocol/MmEndOfDxe.h               |  33 ++
 MdePkg/Include/Protocol/MmGpiDispatch.h            | 125 ++++++++
 MdePkg/Include/Protocol/MmIoTrapDispatch.h         | 136 ++++++++
 MdePkg/Include/Protocol/MmPciRootBridgeIo.h        |  37 +++
 MdePkg/Include/Protocol/MmPeriodicTimerDispatch.h  | 170 ++++++++++
 MdePkg/Include/Protocol/MmPowerButtonDispatch.h    | 117 +++++++
 MdePkg/Include/Protocol/MmReadyToLock.h            |  35 +++
 .../Include/Protocol/MmReportStatusCodeHandler.h   |  81 +++++
 MdePkg/Include/Protocol/MmStandbyButtonDispatch.h  | 119 +++++++
 MdePkg/Include/Protocol/MmStatusCode.h             |  65 ++++
 MdePkg/Include/Protocol/MmSwDispatch.h             | 136 ++++++++
 MdePkg/Include/Protocol/MmSxDispatch.h             | 135 ++++++++
 MdePkg/Include/Protocol/MmUsbDispatch.h            | 130 ++++++++
 MdePkg/Include/Protocol/SmmAccess2.h               | 103 +-----
 MdePkg/Include/Protocol/SmmBase2.h                 |   8 +-
 MdePkg/Include/Protocol/SmmCommunication.h         |  58 +---
 MdePkg/Include/Protocol/SmmConfiguration.h         |   8 +-
 MdePkg/Include/Protocol/SmmControl2.h              |  79 +----
 MdePkg/Include/Protocol/SmmCpu.h                   | 309 ++++++------------
 MdePkg/Include/Protocol/SmmCpuIo2.h                |  79 +----
 MdePkg/Include/Protocol/SmmEndOfDxe.h              |   9 +-
 MdePkg/Include/Protocol/SmmGpiDispatch2.h          |  98 +-----
 MdePkg/Include/Protocol/SmmIoTrapDispatch2.h       | 105 +------
 MdePkg/Include/Protocol/SmmPciRootBridgeIo.h       |  11 +-
 .../Include/Protocol/SmmPeriodicTimerDispatch2.h   |  16 +-
 MdePkg/Include/Protocol/SmmPowerButtonDispatch2.h  |  89 +-----
 MdePkg/Include/Protocol/SmmReadyToLock.h           |   7 +-
 .../Include/Protocol/SmmReportStatusCodeHandler.h  |  63 +---
 .../Include/Protocol/SmmStandbyButtonDispatch2.h   |  89 +-----
 MdePkg/Include/Protocol/SmmStatusCode.h            |  42 +--
 MdePkg/Include/Protocol/SmmSwDispatch2.h           |   8 +-
 MdePkg/Include/Protocol/SmmSxDispatch2.h           | 111 +------
 MdePkg/Include/Protocol/SmmUsbDispatch2.h          | 101 +-----
 MdePkg/MdePkg.dec                                  |  63 ++++
 47 files changed, 2890 insertions(+), 1357 deletions(-)
 create mode 100644 MdePkg/Include/Pi/PiMmCis.h
 create mode 100644 MdePkg/Include/PiMm.h
 create mode 100644 MdePkg/Include/Protocol/DxeMmReadyToLock.h
 create mode 100644 MdePkg/Include/Protocol/MmAccess.h
 create mode 100644 MdePkg/Include/Protocol/MmBase.h
 create mode 100644 MdePkg/Include/Protocol/MmCommunication.h
 create mode 100644 MdePkg/Include/Protocol/MmConfiguration.h
 create mode 100644 MdePkg/Include/Protocol/MmControl.h
 create mode 100644 MdePkg/Include/Protocol/MmCpu.h
 create mode 100644 MdePkg/Include/Protocol/MmCpuIo.h
 create mode 100644 MdePkg/Include/Protocol/MmEndOfDxe.h
 create mode 100644 MdePkg/Include/Protocol/MmGpiDispatch.h
 create mode 100644 MdePkg/Include/Protocol/MmIoTrapDispatch.h
 create mode 100644 MdePkg/Include/Protocol/MmPciRootBridgeIo.h
 create mode 100644 MdePkg/Include/Protocol/MmPeriodicTimerDispatch.h
 create mode 100644 MdePkg/Include/Protocol/MmPowerButtonDispatch.h
 create mode 100644 MdePkg/Include/Protocol/MmReadyToLock.h
 create mode 100644 MdePkg/Include/Protocol/MmReportStatusCodeHandler.h
 create mode 100644 MdePkg/Include/Protocol/MmStandbyButtonDispatch.h
 create mode 100644 MdePkg/Include/Protocol/MmStatusCode.h
 create mode 100644 MdePkg/Include/Protocol/MmSwDispatch.h
 create mode 100644 MdePkg/Include/Protocol/MmSxDispatch.h
 create mode 100644 MdePkg/Include/Protocol/MmUsbDispatch.h

-- 
2.7.0.windows.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Patch 1/2] MdePkg: Add new definitions for Management Mode.
  2017-08-14  8:32 [Patch 0/2] Add Management Mode infrastructure support Eric Dong
@ 2017-08-14  8:32 ` Eric Dong
  2017-08-25  9:30   ` Gao, Liming
  2017-08-14  8:32 ` [Patch 2/2] MdePkg: Update exited SMM related definition Eric Dong
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Dong @ 2017-08-14  8:32 UTC (permalink / raw)
  To: edk2-devel; +Cc: Michael D Kinney, Liming Gao

In PI 1.5 version, system management mode name(SMM) has been changed
to Management Mode(MM). It impacts the current code which still use
SMM/Smram/SMI keywords. This patch add new definition which use
MM/MmRam/MMI keywords to follow new spec definitions.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
 MdePkg/Include/Pi/PiMmCis.h                        | 350 +++++++++++++++++++++
 MdePkg/Include/PiMm.h                              |  25 ++
 MdePkg/Include/Protocol/DxeMmReadyToLock.h         |  41 +++
 MdePkg/Include/Protocol/MmAccess.h                 | 133 ++++++++
 MdePkg/Include/Protocol/MmBase.h                   |  87 +++++
 MdePkg/Include/Protocol/MmCommunication.h          |  83 +++++
 MdePkg/Include/Protocol/MmConfiguration.h          |  86 +++++
 MdePkg/Include/Protocol/MmControl.h                | 106 +++++++
 MdePkg/Include/Protocol/MmCpu.h                    | 247 +++++++++++++++
 MdePkg/Include/Protocol/MmCpuIo.h                  |  96 ++++++
 MdePkg/Include/Protocol/MmEndOfDxe.h               |  33 ++
 MdePkg/Include/Protocol/MmGpiDispatch.h            | 125 ++++++++
 MdePkg/Include/Protocol/MmIoTrapDispatch.h         | 136 ++++++++
 MdePkg/Include/Protocol/MmPciRootBridgeIo.h        |  37 +++
 MdePkg/Include/Protocol/MmPeriodicTimerDispatch.h  | 170 ++++++++++
 MdePkg/Include/Protocol/MmPowerButtonDispatch.h    | 117 +++++++
 MdePkg/Include/Protocol/MmReadyToLock.h            |  35 +++
 .../Include/Protocol/MmReportStatusCodeHandler.h   |  81 +++++
 MdePkg/Include/Protocol/MmStandbyButtonDispatch.h  | 119 +++++++
 MdePkg/Include/Protocol/MmStatusCode.h             |  65 ++++
 MdePkg/Include/Protocol/MmSwDispatch.h             | 136 ++++++++
 MdePkg/Include/Protocol/MmSxDispatch.h             | 135 ++++++++
 MdePkg/Include/Protocol/MmUsbDispatch.h            | 130 ++++++++
 MdePkg/MdePkg.dec                                  |  63 ++++
 24 files changed, 2636 insertions(+)
 create mode 100644 MdePkg/Include/Pi/PiMmCis.h
 create mode 100644 MdePkg/Include/PiMm.h
 create mode 100644 MdePkg/Include/Protocol/DxeMmReadyToLock.h
 create mode 100644 MdePkg/Include/Protocol/MmAccess.h
 create mode 100644 MdePkg/Include/Protocol/MmBase.h
 create mode 100644 MdePkg/Include/Protocol/MmCommunication.h
 create mode 100644 MdePkg/Include/Protocol/MmConfiguration.h
 create mode 100644 MdePkg/Include/Protocol/MmControl.h
 create mode 100644 MdePkg/Include/Protocol/MmCpu.h
 create mode 100644 MdePkg/Include/Protocol/MmCpuIo.h
 create mode 100644 MdePkg/Include/Protocol/MmEndOfDxe.h
 create mode 100644 MdePkg/Include/Protocol/MmGpiDispatch.h
 create mode 100644 MdePkg/Include/Protocol/MmIoTrapDispatch.h
 create mode 100644 MdePkg/Include/Protocol/MmPciRootBridgeIo.h
 create mode 100644 MdePkg/Include/Protocol/MmPeriodicTimerDispatch.h
 create mode 100644 MdePkg/Include/Protocol/MmPowerButtonDispatch.h
 create mode 100644 MdePkg/Include/Protocol/MmReadyToLock.h
 create mode 100644 MdePkg/Include/Protocol/MmReportStatusCodeHandler.h
 create mode 100644 MdePkg/Include/Protocol/MmStandbyButtonDispatch.h
 create mode 100644 MdePkg/Include/Protocol/MmStatusCode.h
 create mode 100644 MdePkg/Include/Protocol/MmSwDispatch.h
 create mode 100644 MdePkg/Include/Protocol/MmSxDispatch.h
 create mode 100644 MdePkg/Include/Protocol/MmUsbDispatch.h

diff --git a/MdePkg/Include/Pi/PiMmCis.h b/MdePkg/Include/Pi/PiMmCis.h
new file mode 100644
index 0000000..6f41fa9
--- /dev/null
+++ b/MdePkg/Include/Pi/PiMmCis.h
@@ -0,0 +1,350 @@
+/** @file
+  Common definitions in the Platform Initialization Specification version 1.6
+  VOLUME 4 Management Mode Core Interface version.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _PI_MMCIS_H_
+#define _PI_MMCIS_H_
+
+#include <Protocol/MmCpuIo.h>
+
+typedef struct _EFI_MM_SYSTEM_TABLE  EFI_MM_SYSTEM_TABLE;
+
+///
+/// The Management Mode System Table (MMST) signature
+///
+#define MM_MMST_SIGNATURE            SIGNATURE_32 ('S', 'M', 'S', 'T')
+///
+/// The Management Mode System Table (MMST) revision is 1.6
+///
+#define MM_SPECIFICATION_MAJOR_REVISION  1
+#define MM_SPECIFICATION_MINOR_REVISION  60
+#define EFI_MM_SYSTEM_TABLE_REVISION    ((MM_SPECIFICATION_MAJOR_REVISION<<16) | (MM_SPECIFICATION_MINOR_REVISION))
+
+/**
+  Adds, updates, or removes a configuration table entry from the Management Mode System Table.
+
+  The MmInstallConfigurationTable() function is used to maintain the list
+  of configuration tables that are stored in the Management Mode System
+  Table.  The list is stored as an array of (GUID, Pointer) pairs.  The list
+  must be allocated from pool memory with PoolType set to EfiRuntimeServicesData.
+
+  @param[in] SystemTable         A pointer to the MM System Table (MMST).
+  @param[in] Guid                A pointer to the GUID for the entry to add, update, or remove.
+  @param[in] Table               A pointer to the buffer of the table to add.
+  @param[in] TableSize           The size of the table to install.
+
+  @retval EFI_SUCCESS            The (Guid, Table) pair was added, updated, or removed.
+  @retval EFI_INVALID_PARAMETER  Guid is not valid.
+  @retval EFI_NOT_FOUND          An attempt was made to delete a non-existent entry.
+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory available to complete the operation.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_INSTALL_CONFIGURATION_TABLE)(
+  IN CONST EFI_MM_SYSTEM_TABLE    *SystemTable,
+  IN CONST EFI_GUID               *Guid,
+  IN VOID                         *Table,
+  IN UINTN                        TableSize
+  );
+
+/**
+  This service lets the caller to get one distinct application processor (AP) to execute
+  a caller-provided code stream while in MM.
+
+  @param[in]     Procedure       A pointer to the code stream to be run on the designated
+                                 AP of the system.
+  @param[in]     CpuNumber       The zero-based index of the processor number of the AP
+                                 on which the code stream is supposed to run.
+  @param[in,out] ProcArguments   Allows the caller to pass a list of parameters to the code
+                                 that is run by the AP.
+
+  @retval EFI_SUCCESS            The call was successful and the return parameters are valid.
+  @retval EFI_INVALID_PARAMETER  The input arguments are out of range.
+  @retval EFI_INVALID_PARAMETER  The CPU requested is not available on this SMI invocation.
+  @retval EFI_INVALID_PARAMETER  The CPU cannot support an additional service invocation.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_STARTUP_THIS_AP)(
+  IN EFI_AP_PROCEDURE  Procedure,
+  IN UINTN             CpuNumber,
+  IN OUT VOID          *ProcArguments OPTIONAL
+  );
+
+/**
+  Function prototype for protocol install notification.
+
+  @param[in] Protocol   Points to the protocol's unique identifier.
+  @param[in] Interface  Points to the interface instance.
+  @param[in] Handle     The handle on which the interface was installed.
+
+  @return Status Code
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_NOTIFY_FN)(
+  IN CONST EFI_GUID  *Protocol,
+  IN VOID            *Interface,
+  IN EFI_HANDLE      Handle
+  );
+
+/**
+  Register a callback function be called when a particular protocol interface is installed.
+
+  The MmRegisterProtocolNotify() function creates a registration Function that is to be 
+  called whenever a protocol interface is installed for Protocol by 
+  MmInstallProtocolInterface().
+  If Function == NULL and Registration is an existing registration, then the callback is unhooked.
+
+  @param[in]  Protocol          The unique ID of the protocol for which the event is to be registered.
+  @param[in]  Function          Points to the notification function.
+  @param[out] Registration      A pointer to a memory location to receive the registration value.
+
+  @retval EFI_SUCCESS           Successfully returned the registration record
+                                that has been added or unhooked.
+  @retval EFI_INVALID_PARAMETER Protocol is NULL or Registration is NULL.
+  @retval EFI_OUT_OF_RESOURCES  Not enough memory resource to finish the request.
+  @retval EFI_NOT_FOUND         If the registration is not found when Function == NULL.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_REGISTER_PROTOCOL_NOTIFY)(
+  IN  CONST EFI_GUID     *Protocol,
+  IN  EFI_MM_NOTIFY_FN   Function,
+  OUT VOID               **Registration
+  );
+
+/**
+  Manage MMI of a particular type.
+
+  @param[in]     HandlerType     Points to the handler type or NULL for root MMI handlers.
+  @param[in]     Context         Points to an optional context buffer.
+  @param[in,out] CommBuffer      Points to the optional communication buffer.
+  @param[in,out] CommBufferSize  Points to the size of the optional communication buffer.
+
+  @retval EFI_WARN_INTERRUPT_SOURCE_PENDING  Interrupt source was processed successfully but not quiesced.
+  @retval EFI_INTERRUPT_PENDING              One or more SMI sources could not be quiesced.
+  @retval EFI_NOT_FOUND                      Interrupt source was not handled or quiesced.
+  @retval EFI_SUCCESS                        Interrupt source was handled and quiesced.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_INTERRUPT_MANAGE)(
+  IN CONST EFI_GUID  *HandlerType,
+  IN CONST VOID      *Context         OPTIONAL,
+  IN OUT VOID        *CommBuffer      OPTIONAL,
+  IN OUT UINTN       *CommBufferSize  OPTIONAL
+  );
+
+/**
+  Main entry point for an MM handler dispatch or communicate-based callback.
+
+  @param[in]     DispatchHandle  The unique handle assigned to this handler by MmiHandlerRegister().
+  @param[in]     Context         Points to an optional handler context which was specified when the
+                                 handler was registered.
+  @param[in,out] CommBuffer      A pointer to a collection of data in memory that will
+                                 be conveyed from a non-MM environment into an MM environment.
+  @param[in,out] CommBufferSize  The size of the CommBuffer.
+
+  @retval EFI_SUCCESS                         The interrupt was handled and quiesced. No other handlers 
+                                              should still be called.
+  @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED  The interrupt has been quiesced but other handlers should 
+                                              still be called.
+  @retval EFI_WARN_INTERRUPT_SOURCE_PENDING   The interrupt is still pending and other handlers should still 
+                                              be called.
+  @retval EFI_INTERRUPT_PENDING               The interrupt could not be quiesced.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_HANDLER_ENTRY_POINT)(
+  IN EFI_HANDLE  DispatchHandle,
+  IN CONST VOID  *Context         OPTIONAL,
+  IN OUT VOID    *CommBuffer      OPTIONAL,
+  IN OUT UINTN   *CommBufferSize  OPTIONAL
+  );
+
+/**
+  Registers a handler to execute within MM.
+
+  @param[in]  Handler            Handler service function pointer.
+  @param[in]  HandlerType        Points to the handler type or NULL for root MMI handlers.
+  @param[out] DispatchHandle     On return, contains a unique handle which can be used to later
+                                 unregister the handler function.
+
+  @retval EFI_SUCCESS            MMI handler added successfully.
+  @retval EFI_INVALID_PARAMETER  Handler is NULL or DispatchHandle is NULL.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_INTERRUPT_REGISTER)(
+  IN  EFI_MM_HANDLER_ENTRY_POINT    Handler,
+  IN  CONST EFI_GUID                *HandlerType OPTIONAL,
+  OUT EFI_HANDLE                    *DispatchHandle
+  );
+
+/**
+  Unregister a handler in MM.
+
+  @param[in] DispatchHandle      The handle that was specified when the handler was registered.
+
+  @retval EFI_SUCCESS            Handler function was successfully unregistered.
+  @retval EFI_INVALID_PARAMETER  DispatchHandle does not refer to a valid handle.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_INTERRUPT_UNREGISTER)(
+  IN EFI_HANDLE  DispatchHandle
+  );
+
+///
+/// Processor information and functionality needed by MM Foundation.
+///
+typedef struct _EFI_MM_ENTRY_CONTEXT {
+  EFI_MM_STARTUP_THIS_AP   MmStartupThisAp;
+  ///
+  /// A number between zero and the NumberOfCpus field. This field designates which 
+  /// processor is executing the SMM Foundation.
+  ///
+  UINTN                    CurrentlyExecutingCpu;
+  ///
+  /// The number of possible processors in the platform.  This is a 1 based 
+  /// counter.  This does not indicate the number of processors that entered SMM.
+  ///
+  UINTN                    NumberOfCpus;
+  ///
+  /// Points to an array, where each element describes the number of bytes in the 
+  /// corresponding save state specified by CpuSaveState. There are always 
+  /// NumberOfCpus entries in the array. 
+  ///
+  UINTN                    *CpuSaveStateSize;
+  ///
+  /// Points to an array, where each element is a pointer to a CPU save state. The 
+  /// corresponding element in CpuSaveStateSize specifies the number of bytes in the 
+  /// save state area. There are always NumberOfCpus entries in the array.
+  ///
+  VOID                     **CpuSaveState;
+} EFI_MM_ENTRY_CONTEXT;
+
+/**
+  This function is the main entry point to the MM Foundation.
+
+  @param[in] MmEntryContext  Processor information and functionality needed by MM Foundation.
+**/
+typedef
+VOID
+(EFIAPI *EFI_MM_ENTRY_POINT)(
+  IN CONST EFI_MM_ENTRY_CONTEXT  *MmEntryContext
+  );
+
+///
+/// Management Mode System Table (MMST)
+///
+/// The Management Mode System Table (MMST) is a table that contains a collection of common 
+/// services for managing MMRAM allocation and providing basic I/O services. These services are 
+/// intended for both preboot and runtime usage.
+///
+struct _EFI_MM_SYSTEM_TABLE {
+  ///
+  /// The table header for the SMST.
+  ///
+  EFI_TABLE_HEADER                     Hdr;
+  ///
+  /// A pointer to a NULL-terminated Unicode string containing the vendor name.
+  /// It is permissible for this pointer to be NULL.
+  ///
+  CHAR16                               *MmFirmwareVendor;
+  ///
+  /// The particular revision of the firmware.
+  ///
+  UINT32                               MmFirmwareRevision;
+
+  EFI_MM_INSTALL_CONFIGURATION_TABLE   MmInstallConfigurationTable;
+
+  ///
+  /// I/O Service
+  ///
+  EFI_MM_CPU_IO_PROTOCOL               MmIo;
+
+  ///
+  /// Runtime memory services
+  ///
+  EFI_ALLOCATE_POOL                    MmAllocatePool;
+  EFI_FREE_POOL                        MmFreePool;
+  EFI_ALLOCATE_PAGES                   MmAllocatePages;
+  EFI_FREE_PAGES                       MmFreePages;
+
+  ///
+  /// MP service
+  ///
+  EFI_MM_STARTUP_THIS_AP               MmStartupThisAp;
+
+  ///
+  /// CPU information records
+  ///
+
+  ///
+  /// A number between zero and and the NumberOfCpus field. This field designates 
+  /// which processor is executing the SMM infrastructure.
+  ///
+  UINTN                                CurrentlyExecutingCpu;
+  ///
+  /// The number of possible processors in the platform.  This is a 1 based counter.
+  ///
+  UINTN                                NumberOfCpus;
+  ///
+  /// Points to an array, where each element describes the number of bytes in the 
+  /// corresponding save state specified by CpuSaveState. There are always 
+  /// NumberOfCpus entries in the array. 
+  ///
+  UINTN                                *CpuSaveStateSize;
+  ///
+  /// Points to an array, where each element is a pointer to a CPU save state. The 
+  /// corresponding element in CpuSaveStateSize specifies the number of bytes in the 
+  /// save state area. There are always NumberOfCpus entries in the array.
+  ///
+  VOID                                 **CpuSaveState;
+
+  ///
+  /// Extensibility table
+  ///
+
+  ///
+  /// The number of UEFI Configuration Tables in the buffer SmmConfigurationTable.
+  ///
+  UINTN                                NumberOfTableEntries;
+  ///
+  /// A pointer to the UEFI Configuration Tables. The number of entries in the table is 
+  /// NumberOfTableEntries. 
+  ///
+  EFI_CONFIGURATION_TABLE              *MmConfigurationTable;
+
+  ///
+  /// Protocol services
+  ///
+  EFI_INSTALL_PROTOCOL_INTERFACE       MmInstallProtocolInterface;
+  EFI_UNINSTALL_PROTOCOL_INTERFACE     MmUninstallProtocolInterface;
+  EFI_HANDLE_PROTOCOL                  MmHandleProtocol;
+  EFI_MM_REGISTER_PROTOCOL_NOTIFY      MmRegisterProtocolNotify;
+  EFI_LOCATE_HANDLE                    MmLocateHandle;
+  EFI_LOCATE_PROTOCOL                  MmLocateProtocol;
+
+  ///
+  /// MMI Management functions
+  ///
+  EFI_MM_INTERRUPT_MANAGE              MmiManage;
+  EFI_MM_INTERRUPT_REGISTER            MmiHandlerRegister;
+  EFI_MM_INTERRUPT_UNREGISTER          MmiHandlerUnRegister;
+};
+
+#endif
diff --git a/MdePkg/Include/PiMm.h b/MdePkg/Include/PiMm.h
new file mode 100644
index 0000000..fdb7d27
--- /dev/null
+++ b/MdePkg/Include/PiMm.h
@@ -0,0 +1,25 @@
+/** @file
+
+  Root include file for Mde Package MM modules.
+
+Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+This program and the accompanying materials are licensed and made available under 
+the terms and conditions of the BSD License that accompanies this distribution.  
+The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php.                                          
+    
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __PI_MM_H__
+#define __PI_MM_H__
+
+#include <Uefi/UefiBaseType.h>
+#include <Uefi/UefiSpec.h>
+
+#include <Pi/PiMmCis.h>
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/DxeMmReadyToLock.h b/MdePkg/Include/Protocol/DxeMmReadyToLock.h
new file mode 100644
index 0000000..9101101
--- /dev/null
+++ b/MdePkg/Include/Protocol/DxeMmReadyToLock.h
@@ -0,0 +1,41 @@
+/** @file
+  DXE MM Ready To Lock protocol introduced in the PI 1.2 specification.
+
+  According to PI 1.4a specification, this UEFI protocol indicates that
+  resources and services that should not be used by the third party code
+  are about to be locked.
+  This protocol is a mandatory protocol published by PI platform code.
+  This protocol in tandem with the End of DXE Event facilitates transition
+  of the platform from the environment where all of the components are
+  under the authority of the platform manufacturer to the environment where
+  third party extensible modules such as UEFI drivers and UEFI applications
+  are executed. The protocol is published immediately after signaling of the
+  End of DXE Event. PI modules that need to lock or protect their resources
+  in anticipation of the invocation of 3rd party extensible modules should
+  register for notification on installation of this protocol and effect the
+  appropriate protections in their notification handlers. For example, PI
+  platform code may choose to use notification handler to lock MM by invoking
+  EFI_MM_ACCESS_PROTOCOL.Lock() function.
+
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _DXE_MM_READY_TO_LOCK_H_
+#define _DXE_MM_READY_TO_LOCK_H_
+
+#define EFI_DXE_MM_READY_TO_LOCK_PROTOCOL_GUID \
+  { \
+    0x60ff8964, 0xe906, 0x41d0, { 0xaf, 0xed, 0xf2, 0x41, 0xe9, 0x74, 0xe0, 0x8e } \
+  }
+
+extern EFI_GUID gEfiDxeMmReadyToLockProtocolGuid;
+
+#endif
diff --git a/MdePkg/Include/Protocol/MmAccess.h b/MdePkg/Include/Protocol/MmAccess.h
new file mode 100644
index 0000000..b59c798
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmAccess.h
@@ -0,0 +1,133 @@
+/** @file
+  EFI MM Access Protocol as defined in the PI 1.2 specification.
+
+  This protocol is used to control the visibility of the MMRAM on the platform.
+  It abstracts the location and characteristics of MMRAM.  The expectation is
+  that the north bridge or memory controller would publish this protocol.
+
+  The principal functionality found in the memory controller includes the following: 
+  - Exposing the MMRAM to all non-MM agents, or the "open" state
+  - Shrouding the MMRAM to all but the MM agents, or the "closed" state
+  - Preserving the system integrity, or "locking" the MMRAM, such that the settings cannot be 
+    perturbed by either boot service or runtime agents 
+
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials                          
+  are licensed and made available under the terms and conditions of the BSD License         
+  which accompanies this distribution.  The full text of the license may be found at        
+  http://opensource.org/licenses/bsd-license.php                                            
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             
+
+**/
+
+#ifndef _MM_ACCESS_H_
+#define _MM_ACCESS_H_
+
+#define EFI_MM_ACCESS_PROTOCOL_GUID \
+  { \
+     0xc2702b74, 0x800c, 0x4131, {0x87, 0x46, 0x8f, 0xb5, 0xb8, 0x9c, 0xe4, 0xac } \
+  }
+
+
+typedef struct _EFI_MM_ACCESS_PROTOCOL  EFI_MM_ACCESS_PROTOCOL;
+
+/**
+  Opens the MMRAM area to be accessible by a boot-service driver.
+
+  This function "opens" MMRAM so that it is visible while not inside of MM. The function should 
+  return EFI_UNSUPPORTED if the hardware does not support hiding of MMRAM. The function 
+  should return EFI_DEVICE_ERROR if the MMRAM configuration is locked.
+
+  @param[in] This           The EFI_MM_ACCESS_PROTOCOL instance.
+
+  @retval EFI_SUCCESS       The operation was successful.
+  @retval EFI_UNSUPPORTED   The system does not support opening and closing of MMRAM.
+  @retval EFI_DEVICE_ERROR  MMRAM cannot be opened, perhaps because it is locked.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_OPEN)(
+  IN EFI_MM_ACCESS_PROTOCOL  *This
+  );
+
+/**
+  Inhibits access to the MMRAM.
+
+  This function "closes" MMRAM so that it is not visible while outside of MM. The function should 
+  return EFI_UNSUPPORTED if the hardware does not support hiding of MMRAM.
+
+  @param[in] This           The EFI_MM_ACCESS_PROTOCOL instance.
+
+  @retval EFI_SUCCESS       The operation was successful.
+  @retval EFI_UNSUPPORTED   The system does not support opening and closing of MMRAM.
+  @retval EFI_DEVICE_ERROR  MMRAM cannot be closed.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_CLOSE)(
+  IN EFI_MM_ACCESS_PROTOCOL  *This
+  );
+
+/**
+  Inhibits access to the MMRAM.
+
+  This function prohibits access to the MMRAM region.  This function is usually implemented such 
+  that it is a write-once operation. 
+
+  @param[in] This          The EFI_MM_ACCESS_PROTOCOL instance.
+
+  @retval EFI_SUCCESS      The device was successfully locked.
+  @retval EFI_UNSUPPORTED  The system does not support locking of MMRAM.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_LOCK)(
+  IN EFI_MM_ACCESS_PROTOCOL  *This
+  );
+
+/**
+  Queries the memory controller for the possible regions that will support MMRAM.
+
+  @param[in]     This           The EFI_MM_ACCESS_PROTOCOL instance.
+  @param[in,out] MmramMapSize   A pointer to the size, in bytes, of the MmramMemoryMap buffer.
+  @param[in,out] MmramMap       A pointer to the buffer in which firmware places the current memory map.
+
+  @retval EFI_SUCCESS           The chipset supported the given resource.
+  @retval EFI_BUFFER_TOO_SMALL  The MmramMap parameter was too small.  The current buffer size 
+                                needed to hold the memory map is returned in MmramMapSize.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_CAPABILITIES)(
+  IN CONST EFI_MM_ACCESS_PROTOCOL    *This,
+  IN OUT UINTN                       *MmramMapSize,
+  IN OUT EFI_MMRAM_DESCRIPTOR        *MmramMap
+  );
+
+///
+///  EFI MM Access Protocol is used to control the visibility of the MMRAM on the platform.
+///  It abstracts the location and characteristics of MMRAM. The platform should report all 
+///  MMRAM via EFI_MM_ACCESS_PROTOCOL. The expectation is that the north bridge or memory 
+///  controller would publish this protocol.
+/// 
+struct _EFI_MM_ACCESS_PROTOCOL {
+  EFI_MM_OPEN          Open;
+  EFI_MM_CLOSE         Close;
+  EFI_MM_LOCK          Lock;
+  EFI_MM_CAPABILITIES  GetCapabilities;
+  ///
+  /// Indicates the current state of the MMRAM. Set to TRUE if MMRAM is locked.
+  ///
+  BOOLEAN               LockState;
+  ///
+  /// Indicates the current state of the MMRAM. Set to TRUE if MMRAM is open.
+  ///
+  BOOLEAN               OpenState;
+};
+
+extern EFI_GUID gEfiMmAccessProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmBase.h b/MdePkg/Include/Protocol/MmBase.h
new file mode 100644
index 0000000..23c3bf4
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmBase.h
@@ -0,0 +1,87 @@
+/** @file
+  EFI MM Base Protocol as defined in the PI 1.2 specification.
+
+  This protocol is utilized by all MM drivers to locate the MM infrastructure services and determine
+  whether the driver is being invoked inside MMRAM or outside of MMRAM.
+
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials                          
+  are licensed and made available under the terms and conditions of the BSD License         
+  which accompanies this distribution.  The full text of the license may be found at        
+  http://opensource.org/licenses/bsd-license.php                                            
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             
+
+**/
+
+#ifndef _MM_BASE_H_
+#define _MM_BASE_H_
+
+#include <Pi/PiMmCis.h>
+
+#define EFI_MM_BASE_PROTOCOL_GUID \
+  { \
+    0xf4ccbfb7, 0xf6e0, 0x47fd, {0x9d, 0xd4, 0x10, 0xa8, 0xf1, 0x50, 0xc1, 0x91 }  \
+  }
+
+typedef struct _EFI_MM_BASE_PROTOCOL  EFI_MM_BASE_PROTOCOL;
+
+/**
+  Service to indicate whether the driver is currently executing in the MM Initialization phase.
+  
+  This service is used to indicate whether the driver is currently executing in the MM Initialization 
+  phase. For MM drivers, this will return TRUE in InMmram while inside the driver's entry point and 
+  otherwise FALSE. For combination MM/DXE drivers, this will return FALSE in the DXE launch. For the
+  MM launch, it behaves as an MM driver.
+
+  @param[in]  This               The EFI_MM_BASE_PROTOCOL instance. 
+  @param[out] InMmram            Pointer to a Boolean which, on return, indicates that the driver is
+                                 currently executing inside of MMRAM (TRUE) or outside of MMRAM (FALSE).
+
+  @retval EFI_SUCCESS            The call returned successfully.
+  @retval EFI_INVALID_PARAMETER  InMmram was NULL.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_INSIDE_OUT)(
+  IN CONST EFI_MM_BASE_PROTOCOL    *This,
+  OUT BOOLEAN                      *InMmram
+  )
+;
+
+/**
+  Returns the location of the Management Mode Service Table (MMST).
+
+  This function returns the location of the Management Mode Service Table (MMST).  The use of the 
+  API is such that a driver can discover the location of the MMST in its entry point and then cache it in 
+  some driver global variable so that the MMST can be invoked in subsequent handlers.
+
+  @param[in]     This            The EFI_MM_BASE_PROTOCOL instance.
+  @param[in,out] Mmst            On return, points to a pointer to the Management Mode Service Table (MMST).
+
+  @retval EFI_SUCCESS            The operation was successful.
+  @retval EFI_INVALID_PARAMETER  Mmst was invalid.
+  @retval EFI_UNSUPPORTED        Not in MM.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_GET_MMST_LOCATION)(
+  IN CONST EFI_MM_BASE_PROTOCOL  *This,
+  IN OUT EFI_MM_SYSTEM_TABLE     **Mmst
+  )
+;
+
+///
+/// EFI MM Base Protocol is utilized by all MM drivers to locate the MM infrastructure
+/// services and determine whether the driver is being invoked inside MMRAM or outside of MMRAM.
+///
+struct _EFI_MM_BASE_PROTOCOL {
+  EFI_MM_INSIDE_OUT         InMm;
+  EFI_MM_GET_MMST_LOCATION  GetMmstLocation;
+};
+
+extern EFI_GUID gEfiMmBaseProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmCommunication.h b/MdePkg/Include/Protocol/MmCommunication.h
new file mode 100644
index 0000000..5dbb38e
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmCommunication.h
@@ -0,0 +1,83 @@
+/** @file
+  EFI MM Communication Protocol as defined in the PI 1.2 specification.
+
+  This protocol provides a means of communicating between drivers outside of MM and MMI 
+  handlers inside of MM.  
+
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials                          
+  are licensed and made available under the terms and conditions of the BSD License         
+  which accompanies this distribution.  The full text of the license may be found at        
+  http://opensource.org/licenses/bsd-license.php                                            
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             
+
+**/
+
+#ifndef _MM_COMMUNICATION_H_
+#define _MM_COMMUNICATION_H_
+
+#pragma pack(1)
+
+///
+/// To avoid confusion in interpreting frames, the communication buffer should always 
+/// begin with EFI_MM_COMMUNICATE_HEADER
+///
+typedef struct {
+  ///
+  /// Allows for disambiguation of the message format.
+  ///
+  EFI_GUID  HeaderGuid;
+  ///
+  /// Describes the size of Data (in bytes) and does not include the size of the header.
+  ///
+  UINTN     MessageLength;
+  ///
+  /// Designates an array of bytes that is MessageLength in size.
+  ///
+  UINT8     Data[1];
+} EFI_MM_COMMUNICATE_HEADER;
+
+#pragma pack()
+
+#define EFI_MM_COMMUNICATION_PROTOCOL_GUID \
+  { \
+    0xc68ed8e2, 0x9dc6, 0x4cbd, { 0x9d, 0x94, 0xdb, 0x65, 0xac, 0xc5, 0xc3, 0x32 } \
+  }
+
+typedef struct _EFI_MM_COMMUNICATION_PROTOCOL  EFI_MM_COMMUNICATION_PROTOCOL;
+
+/**
+  Communicates with a registered handler.
+  
+  This function provides a service to send and receive messages from a registered UEFI service.
+
+  @param[in] This                The EFI_MM_COMMUNICATION_PROTOCOL instance.
+  @param[in] CommBuffer          A pointer to the buffer to convey into MMRAM.
+  @param[in] CommSize            The size of the data buffer being passed in.On exit, the size of data
+                                 being returned. Zero if the handler does not wish to reply with any data.
+
+  @retval EFI_SUCCESS            The message was successfully posted.
+  @retval EFI_INVALID_PARAMETER  The CommBuffer was NULL.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_COMMUNICATE)(
+  IN CONST EFI_MM_COMMUNICATION_PROTOCOL   *This,
+  IN OUT VOID                              *CommBuffer,
+  IN OUT UINTN                             *CommSize
+  );
+
+///
+/// EFI MM Communication Protocol provides runtime services for communicating
+/// between DXE drivers and a registered MMI handler.
+///
+struct _EFI_MM_COMMUNICATION_PROTOCOL {
+  EFI_MM_COMMUNICATE  Communicate;
+};
+
+extern EFI_GUID gEfiMmCommunicationProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmConfiguration.h b/MdePkg/Include/Protocol/MmConfiguration.h
new file mode 100644
index 0000000..aacd96c
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmConfiguration.h
@@ -0,0 +1,86 @@
+/** @file
+  EFI MM Configuration Protocol as defined in the PI 1.2 specification.
+
+  This protocol is used to:
+  1) report the portions of MMRAM regions which cannot be used for the MMRAM heap.
+  2) register the MM Foundation entry point with the processor code. The entry
+     point will be invoked by the MM processor entry code.
+  
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials                          
+  are licensed and made available under the terms and conditions of the BSD License         
+  which accompanies this distribution.  The full text of the license may be found at        
+  http://opensource.org/licenses/bsd-license.php                                            
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             
+
+**/
+
+#ifndef _MM_CONFIGURATION_H_
+#define _MM_CONFIGURATION_H_
+
+#include <Pi/PiMmCis.h>
+
+#define EFI_MM_CONFIGURATION_PROTOCOL_GUID \
+  { \
+    0x26eeb3de, 0xb689, 0x492e, {0x80, 0xf0, 0xbe, 0x8b, 0xd7, 0xda, 0x4b, 0xa7 }  \
+  }
+
+///
+/// Structure describing a MMRAM region which cannot be used for the MMRAM heap.
+///
+typedef struct _EFI_MM_RESERVED_MMRAM_REGION {
+  ///
+  /// Starting address of the reserved MMRAM area, as it appears while MMRAM is open. 
+  /// Ignored if MmramReservedSize is 0.
+  ///
+  EFI_PHYSICAL_ADDRESS    MmramReservedStart;
+  ///
+  /// Number of bytes occupied by the reserved MMRAM area. A size of zero indicates the 
+  /// last MMRAM area.
+  ///
+  UINT64                  MmramReservedSize;
+} EFI_MM_RESERVED_MMRAM_REGION;
+
+typedef struct _EFI_MM_CONFIGURATION_PROTOCOL  EFI_MM_CONFIGURATION_PROTOCOL;
+
+/**
+  Register the MM Foundation entry point.
+  
+  This function registers the MM Foundation entry point with the processor code. This entry point 
+  will be invoked by the MM Processor entry code.
+
+  @param[in] This                The EFI_MM_CONFIGURATION_PROTOCOL instance.
+  @param[in] MmEntryPoint        MM Foundation entry point.
+  
+  @retval EFI_SUCCESS            Success to register MM Entry Point.
+  @retval EFI_INVALID_PARAMETER  MmEntryPoint is NULL.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_REGISTER_MM_ENTRY)(
+  IN CONST EFI_MM_CONFIGURATION_PROTOCOL  *This,
+  IN EFI_MM_ENTRY_POINT                   MmEntryPoint
+  );
+
+///
+/// The EFI MM Configuration Protocol is a mandatory protocol published by a DXE CPU driver to
+/// indicate which areas within MMRAM are reserved for use by the CPU for any purpose, 
+/// such as stack, save state or MM entry point.
+///
+/// The RegistermmEntry() function allows the MM IPL DXE driver to register the MM 
+/// Foundation entry point with the MM entry vector code.
+///
+struct _EFI_MM_CONFIGURATION_PROTOCOL {
+  ///
+  /// A pointer to an array MMRAM ranges used by the initial MM entry code.
+  ///
+  EFI_MM_RESERVED_MMRAM_REGION  *MmramReservedRegions;
+  EFI_MM_REGISTER_MM_ENTRY      RegisterMmEntry;
+};
+
+extern EFI_GUID gEfiMmConfigurationProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmControl.h b/MdePkg/Include/Protocol/MmControl.h
new file mode 100644
index 0000000..c8672c5
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmControl.h
@@ -0,0 +1,106 @@
+/** @file
+  EFI MM Control Protocol as defined in the PI 1.2 specification.
+
+  This protocol is used initiate synchronous MMI activations. This protocol could be published by a
+  processor driver to abstract the MMI IPI or a driver which abstracts the ASIC that is supporting the
+  APM port. Because of the possibility of performing MMI IPI transactions, the ability to generate this 
+  event from a platform chipset agent is an optional capability for both IA-32 and x64-based systems.
+
+  The EFI_MM_CONTROL_PROTOCOL is produced by a runtime driver. It provides  an 
+  abstraction of the platform hardware that generates an MMI.  There are often I/O ports that, when 
+  accessed, will generate the MMI.  Also, the hardware optionally supports the periodic generation of 
+  these signals.
+
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials                          
+  are licensed and made available under the terms and conditions of the BSD License         
+  which accompanies this distribution.  The full text of the license may be found at        
+  http://opensource.org/licenses/bsd-license.php                                            
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             
+
+**/
+
+#ifndef _MM_CONTROL_H_
+#define _MM_CONTROL_H_
+
+#include <PiDxe.h>
+
+#define EFI_MM_CONTROL_PROTOCOL_GUID \
+  { \
+    0x843dc720, 0xab1e, 0x42cb, {0x93, 0x57, 0x8a, 0x0, 0x78, 0xf3, 0x56, 0x1b}  \
+  }
+
+typedef struct _EFI_MM_CONTROL_PROTOCOL  EFI_MM_CONTROL_PROTOCOL;
+typedef UINTN  EFI_MM_PERIOD;
+
+/**
+  Invokes MMI activation from either the preboot or runtime environment.
+
+  This function generates an MMI.
+
+  @param[in]     This                The EFI_MM_CONTROL_PROTOCOL instance.
+  @param[in,out] CommandPort         The value written to the command port.
+  @param[in,out] DataPort            The value written to the data port.
+  @param[in]     Periodic            Optional mechanism to engender a periodic stream.
+  @param[in]     ActivationInterval  Optional parameter to repeat at this period one
+                                     time or, if the Periodic Boolean is set, periodically.
+
+  @retval EFI_SUCCESS            The MMI/PMI has been engendered.
+  @retval EFI_DEVICE_ERROR       The timing is unsupported.
+  @retval EFI_INVALID_PARAMETER  The activation period is unsupported.
+  @retval EFI_INVALID_PARAMETER  The last periodic activation has not been cleared. 
+  @retval EFI_NOT_STARTED        The MM base service has not been initialized.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_ACTIVATE)(
+  IN CONST EFI_MM_CONTROL_PROTOCOL    *This,
+  IN OUT UINT8                        *CommandPort       OPTIONAL,
+  IN OUT UINT8                        *DataPort          OPTIONAL,
+  IN BOOLEAN                          Periodic           OPTIONAL,
+  IN UINTN                            ActivationInterval OPTIONAL
+  );
+
+/**
+  Clears any system state that was created in response to the Trigger() call.
+
+  This function acknowledges and causes the deassertion of the MMI activation source.
+
+  @param[in] This                The EFI_MM_CONTROL_PROTOCOL instance.
+  @param[in] Periodic            Optional parameter to repeat at this period one time
+
+  @retval EFI_SUCCESS            The MMI/PMI has been engendered.
+  @retval EFI_DEVICE_ERROR       The source could not be cleared.
+  @retval EFI_INVALID_PARAMETER  The service did not support the Periodic input argument.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_DEACTIVATE)(
+  IN CONST EFI_MM_CONTROL_PROTOCOL    *This,
+  IN BOOLEAN                          Periodic OPTIONAL
+  );
+
+///
+/// The EFI_MM_CONTROL_PROTOCOL is produced by a runtime driver. It provides  an 
+/// abstraction of the platform hardware that generates an MMI.  There are often I/O ports that, when 
+/// accessed, will generate the MMI.  Also, the hardware optionally supports the periodic generation of 
+/// these signals.
+///
+struct _EFI_MM_CONTROL_PROTOCOL {
+  EFI_MM_ACTIVATE    Trigger;
+  EFI_MM_DEACTIVATE  Clear;
+  ///
+  /// Minimum interval at which the platform can set the period.  A maximum is not 
+  /// specified in that the MM infrastructure code can emulate a maximum interval that is 
+  /// greater than the hardware capabilities by using software emulation in the MM 
+  /// infrastructure code.
+  ///
+  EFI_MM_PERIOD      MinimumTriggerPeriod;
+};
+
+extern EFI_GUID gEfiMmControlProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmCpu.h b/MdePkg/Include/Protocol/MmCpu.h
new file mode 100644
index 0000000..d6ddbcd
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmCpu.h
@@ -0,0 +1,247 @@
+/** @file
+  EFI MM CPU Protocol as defined in the PI 1.2 specification.
+
+  This protocol allows MM drivers to access architecture-standard registers from any of the CPU 
+  save state areas. In some cases, difference processors provide the same information in the save state, 
+  but not in the same format. These so-called pseudo-registers provide this information in a standard 
+  format.  
+
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials                          
+  are licensed and made available under the terms and conditions of the BSD License         
+  which accompanies this distribution.  The full text of the license may be found at        
+  http://opensource.org/licenses/bsd-license.php                                            
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             
+
+**/
+
+#ifndef _MM_CPU_H_
+#define _MM_CPU_H_
+
+#define EFI_MM_CPU_PROTOCOL_GUID \
+  { \
+    0xeb346b97, 0x975f, 0x4a9f, { 0x8b, 0x22, 0xf8, 0xe9, 0x2b, 0xb3, 0xd5, 0x69 } \
+  }
+
+///
+/// Save State register index
+///
+typedef enum {
+  ///
+  /// x86/X64 standard registers
+  ///
+  EFI_MM_SAVE_STATE_REGISTER_GDTBASE       = 4,
+  EFI_MM_SAVE_STATE_REGISTER_IDTBASE       = 5,
+  EFI_MM_SAVE_STATE_REGISTER_LDTBASE       = 6,
+  EFI_MM_SAVE_STATE_REGISTER_GDTLIMIT      = 7,
+  EFI_MM_SAVE_STATE_REGISTER_IDTLIMIT      = 8,
+  EFI_MM_SAVE_STATE_REGISTER_LDTLIMIT      = 9,
+  EFI_MM_SAVE_STATE_REGISTER_LDTINFO       = 10,
+  EFI_MM_SAVE_STATE_REGISTER_ES            = 20,
+  EFI_MM_SAVE_STATE_REGISTER_CS            = 21,
+  EFI_MM_SAVE_STATE_REGISTER_SS            = 22,
+  EFI_MM_SAVE_STATE_REGISTER_DS            = 23,
+  EFI_MM_SAVE_STATE_REGISTER_FS            = 24,
+  EFI_MM_SAVE_STATE_REGISTER_GS            = 25,
+  EFI_MM_SAVE_STATE_REGISTER_LDTR_SEL      = 26,
+  EFI_MM_SAVE_STATE_REGISTER_TR_SEL        = 27,
+  EFI_MM_SAVE_STATE_REGISTER_DR7           = 28,
+  EFI_MM_SAVE_STATE_REGISTER_DR6           = 29,
+  EFI_MM_SAVE_STATE_REGISTER_R8            = 30,
+  EFI_MM_SAVE_STATE_REGISTER_R9            = 31,
+  EFI_MM_SAVE_STATE_REGISTER_R10           = 32,
+  EFI_MM_SAVE_STATE_REGISTER_R11           = 33,
+  EFI_MM_SAVE_STATE_REGISTER_R12           = 34,
+  EFI_MM_SAVE_STATE_REGISTER_R13           = 35,
+  EFI_MM_SAVE_STATE_REGISTER_R14           = 36,
+  EFI_MM_SAVE_STATE_REGISTER_R15           = 37,  
+  EFI_MM_SAVE_STATE_REGISTER_RAX           = 38,
+  EFI_MM_SAVE_STATE_REGISTER_RBX           = 39,
+  EFI_MM_SAVE_STATE_REGISTER_RCX           = 40,
+  EFI_MM_SAVE_STATE_REGISTER_RDX           = 41,
+  EFI_MM_SAVE_STATE_REGISTER_RSP           = 42,
+  EFI_MM_SAVE_STATE_REGISTER_RBP           = 43,
+  EFI_MM_SAVE_STATE_REGISTER_RSI           = 44,
+  EFI_MM_SAVE_STATE_REGISTER_RDI           = 45,
+  EFI_MM_SAVE_STATE_REGISTER_RIP           = 46,
+  EFI_MM_SAVE_STATE_REGISTER_RFLAGS        = 51,
+  EFI_MM_SAVE_STATE_REGISTER_CR0           = 52,
+  EFI_MM_SAVE_STATE_REGISTER_CR3           = 53,
+  EFI_MM_SAVE_STATE_REGISTER_CR4           = 54,
+  EFI_MM_SAVE_STATE_REGISTER_FCW           = 256,
+  EFI_MM_SAVE_STATE_REGISTER_FSW           = 257,
+  EFI_MM_SAVE_STATE_REGISTER_FTW           = 258,  
+  EFI_MM_SAVE_STATE_REGISTER_OPCODE        = 259,
+  EFI_MM_SAVE_STATE_REGISTER_FP_EIP        = 260,
+  EFI_MM_SAVE_STATE_REGISTER_FP_CS         = 261,
+  EFI_MM_SAVE_STATE_REGISTER_DATAOFFSET    = 262,
+  EFI_MM_SAVE_STATE_REGISTER_FP_DS         = 263,
+  EFI_MM_SAVE_STATE_REGISTER_MM0           = 264,
+  EFI_MM_SAVE_STATE_REGISTER_MM1           = 265,
+  EFI_MM_SAVE_STATE_REGISTER_MM2           = 266,
+  EFI_MM_SAVE_STATE_REGISTER_MM3           = 267,
+  EFI_MM_SAVE_STATE_REGISTER_MM4           = 268,
+  EFI_MM_SAVE_STATE_REGISTER_MM5           = 269,
+  EFI_MM_SAVE_STATE_REGISTER_MM6           = 270,
+  EFI_MM_SAVE_STATE_REGISTER_MM7           = 271,
+  EFI_MM_SAVE_STATE_REGISTER_XMM0          = 272,
+  EFI_MM_SAVE_STATE_REGISTER_XMM1          = 273,
+  EFI_MM_SAVE_STATE_REGISTER_XMM2          = 274,
+  EFI_MM_SAVE_STATE_REGISTER_XMM3          = 275,
+  EFI_MM_SAVE_STATE_REGISTER_XMM4          = 276,
+  EFI_MM_SAVE_STATE_REGISTER_XMM5          = 277,
+  EFI_MM_SAVE_STATE_REGISTER_XMM6          = 278,
+  EFI_MM_SAVE_STATE_REGISTER_XMM7          = 279,
+  EFI_MM_SAVE_STATE_REGISTER_XMM8          = 280,
+  EFI_MM_SAVE_STATE_REGISTER_XMM9          = 281,
+  EFI_MM_SAVE_STATE_REGISTER_XMM10         = 282,
+  EFI_MM_SAVE_STATE_REGISTER_XMM11         = 283,
+  EFI_MM_SAVE_STATE_REGISTER_XMM12         = 284,
+  EFI_MM_SAVE_STATE_REGISTER_XMM13         = 285,
+  EFI_MM_SAVE_STATE_REGISTER_XMM14         = 286,
+  EFI_MM_SAVE_STATE_REGISTER_XMM15         = 287,  
+  ///
+  /// Pseudo-Registers
+  ///
+  EFI_MM_SAVE_STATE_REGISTER_IO            = 512,
+  EFI_MM_SAVE_STATE_REGISTER_LMA           = 513,
+  EFI_MM_SAVE_STATE_REGISTER_PROCESSOR_ID  = 514
+} EFI_MM_SAVE_STATE_REGISTER;  
+
+///
+/// The EFI_MM_SAVE_STATE_REGISTER_LMA pseudo-register values
+/// If the processor acts in 32-bit mode at the time the MMI occurred, the pseudo register value 
+/// EFI_MM_SAVE_STATE_REGISTER_LMA_32BIT is returned in Buffer. Otherwise, 
+/// EFI_MM_SAVE_STATE_REGISTER_LMA_64BIT is returned in Buffer.
+///
+#define EFI_MM_SAVE_STATE_REGISTER_LMA_32BIT  32
+#define EFI_MM_SAVE_STATE_REGISTER_LMA_64BIT  64
+
+///
+/// Size width of I/O instruction
+///
+typedef enum {
+  EFI_MM_SAVE_STATE_IO_WIDTH_UINT8      = 0,
+  EFI_MM_SAVE_STATE_IO_WIDTH_UINT16     = 1,
+  EFI_MM_SAVE_STATE_IO_WIDTH_UINT32     = 2,
+  EFI_MM_SAVE_STATE_IO_WIDTH_UINT64     = 3
+} EFI_MM_SAVE_STATE_IO_WIDTH;
+
+///
+/// Types of I/O instruction
+///
+typedef enum {
+  EFI_MM_SAVE_STATE_IO_TYPE_INPUT       = 1,
+  EFI_MM_SAVE_STATE_IO_TYPE_OUTPUT      = 2,
+  EFI_MM_SAVE_STATE_IO_TYPE_STRING      = 4,
+  EFI_MM_SAVE_STATE_IO_TYPE_REP_PREFIX  = 8
+} EFI_MM_SAVE_STATE_IO_TYPE;
+
+///
+/// Structure of the data which is returned when ReadSaveState() is called with 
+/// EFI_MM_SAVE_STATE_REGISTER_IO. If there was no I/O then ReadSaveState() will 
+/// return EFI_NOT_FOUND.
+///
+/// This structure describes the I/O operation which was in process when the MMI was generated.
+///
+typedef struct _EFI_MM_SAVE_STATE_IO_INFO {
+  ///
+  /// For input instruction (IN, INS), this is data read before the MMI occurred. For output 
+  /// instructions (OUT, OUTS) this is data that was written before the MMI occurred. The 
+  /// width of the data is specified by IoWidth.
+  ///
+  UINT64                        IoData;
+  ///
+  /// The I/O port that was being accessed when the MMI was triggered.
+  ///
+  UINT16                        IoPort;
+  ///
+  /// Defines the size width (UINT8, UINT16, UINT32, UINT64) for IoData.
+  ///
+  EFI_MM_SAVE_STATE_IO_WIDTH    IoWidth;
+  ///
+  /// Defines type of I/O instruction.
+  ///
+  EFI_MM_SAVE_STATE_IO_TYPE     IoType;
+} EFI_MM_SAVE_STATE_IO_INFO;
+  
+typedef struct _EFI_MM_CPU_PROTOCOL  EFI_MM_CPU_PROTOCOL;
+
+/**
+  Read data from the CPU save state.
+
+  This function is used to read the specified number of bytes of the specified register from the CPU 
+  save state of the specified CPU and place the value into the buffer. If the CPU does not support the
+  specified register Register, then EFI_NOT_FOUND  should be returned. If the CPU does not 
+  support the specified register width Width, then EFI_INVALID_PARAMETER is returned.
+
+  @param[in]  This               The EFI_MM_CPU_PROTOCOL instance.
+  @param[in]  Width              The number of bytes to read from the CPU save state.
+  @param[in]  Register           Specifies the CPU register to read form the save state.
+  @param[in]  CpuIndex           Specifies the zero-based index of the CPU save state.
+  @param[out] Buffer             Upon return, this holds the CPU register value read from the save state.
+    
+  @retval EFI_SUCCESS            The register was read from Save State.
+  @retval EFI_NOT_FOUND          The register is not defined for the Save State of Processor.
+  @retval EFI_INVALID_PARAMETER  Input parameters are not valid, for example, Processor No or register width 
+                                 is not correct.This or Buffer is NULL.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_READ_SAVE_STATE)(
+  IN CONST EFI_MM_CPU_PROTOCOL    *This,
+  IN UINTN                        Width,
+  IN EFI_MM_SAVE_STATE_REGISTER   Register,
+  IN UINTN                        CpuIndex,
+  OUT VOID                        *Buffer
+  );
+
+
+/**
+  Write data to the CPU save state.
+
+  This function is used to write the specified number of bytes of the specified register to the CPU save 
+  state of the specified CPU and place the value into the buffer. If the CPU does not support the 
+  specified register Register, then EFI_UNSUPPORTED should be returned. If the CPU does not 
+  support the specified register width Width, then EFI_INVALID_PARAMETER is returned.
+
+  @param[in]  This               The EFI_MM_CPU_PROTOCOL instance.
+  @param[in]  Width              The number of bytes to write to the CPU save state.
+  @param[in]  Register           Specifies the CPU register to write to the save state.
+  @param[in]  CpuIndex           Specifies the zero-based index of the CPU save state.
+  @param[in]  Buffer             Upon entry, this holds the new CPU register value.
+  
+  @retval EFI_SUCCESS            The register was written to Save State.
+  @retval EFI_NOT_FOUND          The register is not defined for the Save State of Processor.
+  @retval EFI_INVALID_PARAMETER  Input parameters are not valid. For example: 
+                                 ProcessorIndex or Width is not correct.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_WRITE_SAVE_STATE)(
+  IN CONST EFI_MM_CPU_PROTOCOL    *This,
+  IN UINTN                        Width, 
+  IN EFI_MM_SAVE_STATE_REGISTER   Register,
+  IN UINTN                        CpuIndex,
+  IN CONST VOID                   *Buffer
+  );
+
+///
+/// EFI MM CPU Protocol provides access to CPU-related information while in MM.
+///
+/// This protocol allows MM drivers to access architecture-standard registers from any of the CPU 
+/// save state areas. In some cases, difference processors provide the same information in the save state, 
+/// but not in the same format. These so-called pseudo-registers provide this information in a standard 
+/// format.  
+///
+struct _EFI_MM_CPU_PROTOCOL {
+  EFI_MM_READ_SAVE_STATE   ReadSaveState;
+  EFI_MM_WRITE_SAVE_STATE  WriteSaveState;
+};
+
+extern EFI_GUID gEfiMmCpuProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmCpuIo.h b/MdePkg/Include/Protocol/MmCpuIo.h
new file mode 100644
index 0000000..9fda26c
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmCpuIo.h
@@ -0,0 +1,96 @@
+/** @file
+  MM CPU I/O 2 protocol as defined in the PI 1.2 specification.
+
+  This protocol provides CPU I/O and memory access within MM.
+
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _MM_CPU_IO_H_
+#define _MM_CPU_IO_H_
+
+#define EFI_MM_CPU_IO_PROTOCOL_GUID \
+  { \
+    0x3242A9D8, 0xCE70, 0x4AA0, { 0x95, 0x5D, 0x5E, 0x7B, 0x14, 0x0D, 0xE4, 0xD2 } \
+  }
+
+typedef struct _EFI_MM_CPU_IO_PROTOCOL  EFI_MM_CPU_IO_PROTOCOL;
+
+///
+/// Width of the MM CPU I/O operations
+///
+typedef enum {
+  MM_IO_UINT8  = 0,
+  MM_IO_UINT16 = 1,
+  MM_IO_UINT32 = 2,
+  MM_IO_UINT64 = 3
+} EFI_MM_IO_WIDTH;
+
+/**
+  Provides the basic memory and I/O interfaces used toabstract accesses to devices.
+
+  The I/O operations are carried out exactly as requested.  The caller is 
+  responsible for any alignment and I/O width issues that the bus, device, 
+  platform, or type of I/O might require.
+
+  @param[in]      This     The EFI_MM_CPU_IO_PROTOCOL instance.
+  @param[in]      Width    Signifies the width of the I/O operations.
+  @param[in]      Address  The base address of the I/O operations.  The caller is 
+                           responsible for aligning the Address if required. 
+  @param[in]      Count    The number of I/O operations to perform.
+  @param[in,out]  Buffer   For read operations, the destination buffer to store 
+                           the results.  For write operations, the source buffer 
+                           from which to write data.
+
+  @retval EFI_SUCCESS            The data was read from or written to the device.
+  @retval EFI_UNSUPPORTED        The Address is not valid for this system.
+  @retval EFI_INVALID_PARAMETER  Width or Count, or both, were invalid.
+  @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to a lack
+                                 of resources.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_CPU_IO)(
+  IN     CONST EFI_MM_CPU_IO_PROTOCOL    *This,
+  IN     EFI_MM_IO_WIDTH                 Width,
+  IN     UINT64                          Address,
+  IN     UINTN                           Count,
+  IN OUT VOID                            *Buffer
+  );
+
+typedef struct {
+  ///
+  /// This service provides the various modalities of memory and I/O read.
+  ///
+  EFI_MM_CPU_IO  Read;
+  ///
+  /// This service provides the various modalities of memory and I/O write.
+  ///
+  EFI_MM_CPU_IO  Write;
+} EFI_MM_IO_ACCESS;
+
+///
+/// MM CPU I/O Protocol provides CPU I/O and memory access within MM.
+///
+struct _EFI_MM_CPU_IO_PROTOCOL {
+  ///
+  /// Allows reads and writes to memory-mapped I/O space.
+  ///
+  EFI_MM_IO_ACCESS Mem;
+  ///
+  /// Allows reads and writes to I/O space.
+  ///
+  EFI_MM_IO_ACCESS Io;
+};
+
+extern EFI_GUID gEfiMmCpuIoProtocolGuid;
+
+#endif
diff --git a/MdePkg/Include/Protocol/MmEndOfDxe.h b/MdePkg/Include/Protocol/MmEndOfDxe.h
new file mode 100644
index 0000000..6c3f17a
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmEndOfDxe.h
@@ -0,0 +1,33 @@
+/** @file
+  MM End Of Dxe protocol introduced in the PI 1.2.1 specification.
+
+  According to PI 1.4a specification, this protocol indicates end of the
+  execution phase when all of the components are under the authority of
+  the platform manufacturer.
+  This protocol is a mandatory protocol published by MM Foundation code.
+  This protocol is an MM counterpart of the End of DXE Event.
+  This protocol prorogates End of DXE notification into MM environment.
+  This protocol is installed prior to installation of the MM Ready to Lock Protocol.
+
+  Copyright (c) 2012 - 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _MM_END_OF_DXE_H_
+#define _MM_END_OF_DXE_H_
+
+#define EFI_MM_END_OF_DXE_PROTOCOL_GUID \
+  { \
+    0x24e70042, 0xd5c5, 0x4260, { 0x8c, 0x39, 0xa, 0xd3, 0xaa, 0x32, 0xe9, 0x3d } \
+  }
+
+extern EFI_GUID gEfiMmEndOfDxeProtocolGuid;
+
+#endif
diff --git a/MdePkg/Include/Protocol/MmGpiDispatch.h b/MdePkg/Include/Protocol/MmGpiDispatch.h
new file mode 100644
index 0000000..5682e75
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmGpiDispatch.h
@@ -0,0 +1,125 @@
+/** @file
+  MM General Purpose Input (GPI) Dispatch Protocol as defined in PI 1.1 Specification
+  Volume 4 Management Mode Core Interface.
+
+  This protocol provides the parent dispatch service for the General Purpose Input 
+  (GPI) MMI source generator.
+
+  The EFI_MM_GPI_DISPATCH_PROTOCOL provides the ability to install child handlers for the 
+  given event types.  Several inputs can be enabled.  This purpose of this interface is to generate an 
+  MMI in response to any of these inputs having a true value provided.
+
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+  @par Revision Reference:
+  This protocol is from PI Version 1.1.
+
+**/
+
+#ifndef _MM_GPI_DISPATCH_H_
+#define _MM_GPI_DISPATCH_H_
+
+#include <Pi/PiMmCis.h>
+
+#define EFI_MM_GPI_DISPATCH_PROTOCOL_GUID \
+  { \
+    0x25566b03, 0xb577, 0x4cbf, {0x95, 0x8c, 0xed, 0x66, 0x3e, 0xa2, 0x43, 0x80 } \
+  }
+
+///
+/// The dispatch function's context.
+///
+typedef struct {
+  ///
+  /// A number from one of 2^64 possible GPIs that can generate an MMI. A
+  /// 0 corresponds to logical GPI[0]; 1 corresponds to logical GPI[1]; and
+  /// GpiNum of N corresponds to GPI[N], where N can span from 0 to 2^64-1.
+  ///
+  UINT64 GpiNum;
+} EFI_MM_GPI_REGISTER_CONTEXT;
+
+typedef struct _EFI_MM_GPI_DISPATCH_PROTOCOL EFI_MM_GPI_DISPATCH_PROTOCOL;
+
+/**
+  Registers a child MMI source dispatch function with a parent MM driver.
+
+  This service registers a function (DispatchFunction) which will be called when an MMI is 
+  generated because of one or more of the GPIs specified by RegisterContext. On return, 
+  DispatchHandle contains a unique handle which may be used later to unregister the function 
+  using UnRegister().
+  The DispatchFunction will be called with Context set to the same value as was passed into 
+  this function in RegisterContext and with CommBuffer pointing to another instance of 
+  EFI_MM_GPI_REGISTER_CONTEXT describing the GPIs which actually caused the MMI and 
+  CommBufferSize pointing to the size of the structure.
+
+  @param[in]  This               Pointer to the EFI_MM_GPI_DISPATCH_PROTOCOL instance.
+  @param[in]  DispatchFunction   Function to register for handler when the specified GPI causes an MMI.
+  @param[in]  RegisterContext    Pointer to the dispatch function's context.
+                                 The caller fills this context in before calling
+                                 the register function to indicate to the register
+                                 function the GPI(s) for which the dispatch function
+                                 should be invoked.
+  @param[out] DispatchHandle     Handle generated by the dispatcher to track the
+                                 function instance.
+
+  @retval EFI_SUCCESS            The dispatch function has been successfully
+                                 registered and the MMI source has been enabled.
+  @retval EFI_DEVICE_ERROR       The driver was unable to enable the MMI source.
+  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. The GPI input value
+                                 is not within valid range.
+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system or MM) to manage this child.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_GPI_REGISTER)(
+  IN CONST EFI_MM_GPI_DISPATCH_PROTOCOL    *This,
+  IN       EFI_MM_HANDLER_ENTRY_POINT      DispatchFunction,
+  IN CONST EFI_MM_GPI_REGISTER_CONTEXT     *RegisterContext,
+  OUT      EFI_HANDLE                      *DispatchHandle
+  );
+
+/**
+  Unregisters a General Purpose Input (GPI) service.
+
+  This service removes the handler associated with DispatchHandle so that it will no longer be 
+  called when the GPI triggers an MMI. 
+
+  @param[in]  This               Pointer to the EFI_MM_GPI_DISPATCH_PROTOCOL instance.
+  @param[in]  DispatchHandle     Handle of the service to remove.
+
+  @retval EFI_SUCCESS            Handle of the service to remove.
+  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_GPI_UNREGISTER)(
+  IN CONST EFI_MM_GPI_DISPATCH_PROTOCOL    *This,
+  IN       EFI_HANDLE                      DispatchHandle
+  );
+
+///
+/// Interface structure for the MM GPI MMI Dispatch Protocol
+///
+/// The MM GPI MMI Dispatch Protocol provides the parent dispatch service
+/// for the General Purpose Input (GPI) MMI source generator.
+///
+struct _EFI_MM_GPI_DISPATCH_PROTOCOL {
+  EFI_MM_GPI_REGISTER    Register;
+  EFI_MM_GPI_UNREGISTER  UnRegister;
+  ///
+  /// Denotes the maximum value of inputs that can have handlers attached.
+  ///
+  UINTN                   NumSupportedGpis;
+};
+
+extern EFI_GUID gEfiMmGpiDispatchProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmIoTrapDispatch.h b/MdePkg/Include/Protocol/MmIoTrapDispatch.h
new file mode 100644
index 0000000..ae116a0
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmIoTrapDispatch.h
@@ -0,0 +1,136 @@
+/** @file
+  MM IO Trap Dispatch Protocol as defined in PI 1.1 Specification
+  Volume 4 Management Mode Core Interface.
+
+  This protocol provides a parent dispatch service for IO trap MMI sources.
+
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+  @par Revision Reference:
+  This protocol is from PI Version 1.1.
+
+**/
+
+#ifndef _MM_IO_TRAP_DISPATCH_H_
+#define _MM_IO_TRAP_DISPATCH_H_
+
+#include <Pi/PiMmCis.h>
+
+#define EFI_MM_IO_TRAP_DISPATCH_PROTOCOL_GUID \
+  { \
+    0x58dc368d, 0x7bfa, 0x4e77, {0xab, 0xbc, 0xe, 0x29, 0x41, 0x8d, 0xf9, 0x30 } \
+  }
+
+///
+/// IO Trap valid types
+///
+typedef enum {
+  WriteTrap,
+  ReadTrap,
+  ReadWriteTrap,
+  IoTrapTypeMaximum
+} EFI_MM_IO_TRAP_DISPATCH_TYPE;
+
+///
+/// IO Trap context structure containing information about the
+/// IO trap event that should invoke the handler
+///
+typedef struct {
+  UINT16                         Address;
+  UINT16                         Length;
+  EFI_MM_IO_TRAP_DISPATCH_TYPE   Type;
+} EFI_MM_IO_TRAP_REGISTER_CONTEXT;
+
+///
+/// IO Trap context structure containing information about the IO trap that occurred
+///
+typedef struct {
+  UINT32  WriteData;
+} EFI_MM_IO_TRAP_CONTEXT;
+
+typedef struct _EFI_MM_IO_TRAP_DISPATCH_PROTOCOL EFI_MM_IO_TRAP_DISPATCH_PROTOCOL;
+
+/**
+  Register an IO trap MMI child handler for a specified MMI.
+
+  This service registers a function (DispatchFunction) which will be called when an MMI is 
+  generated because of an access to an I/O port specified by RegisterContext. On return, 
+  DispatchHandle contains a unique handle which may be used later to unregister the function 
+  using UnRegister(). If the base of the I/O range specified is zero, then an I/O range with the 
+  specified length and characteristics will be allocated and the Address field in RegisterContext 
+  updated. If no range could be allocated, then EFI_OUT_OF_RESOURCES will be returned. 
+
+  The service will not perform GCD allocation if the base address is non-zero or 
+  EFI_MM_READY_TO_LOCK has been installed.  In this case, the caller is responsible for the 
+  existence and allocation of the specific IO range.
+  An error may be returned if some or all of the requested resources conflict with an existing IO trap 
+  child handler.
+
+  It is not required that implementations will allow multiple children for a single IO trap MMI source.  
+  Some implementations may support multiple children.
+  The DispatchFunction will be called with Context updated to contain information 
+  concerning the I/O action that actually happened and is passed in RegisterContext, with 
+  CommBuffer pointing to the data actually written and CommBufferSize pointing to the size of 
+  the data in CommBuffer.
+
+  @param[in]  This               Pointer to the EFI_MM_IO_TRAP_DISPATCH_PROTOCOL instance.
+  @param[in]  DispatchFunction   Function to register for handler when I/O trap location is accessed.
+  @param[in]  RegisterContext    Pointer to the dispatch function's context.  The caller fills this
+                                 context in before calling the register function to indicate to the register
+                                 function the IO trap MMI source for which the dispatch function should be invoked.
+  @param[out] DispatchHandle     Handle of the dispatch function, for when interfacing with the parent MM driver.
+
+  @retval EFI_SUCCESS            The dispatch function has been successfully registered.
+  @retval EFI_DEVICE_ERROR       The driver was unable to complete due to hardware error.
+  @retval EFI_OUT_OF_RESOURCES   Insufficient resources are available to fulfill the IO trap range request.
+  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid.  The input value is not within a valid range.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_IO_TRAP_DISPATCH_REGISTER)(
+  IN CONST EFI_MM_IO_TRAP_DISPATCH_PROTOCOL    *This,
+  IN       EFI_MM_HANDLER_ENTRY_POINT          DispatchFunction,
+  IN OUT   EFI_MM_IO_TRAP_REGISTER_CONTEXT     *RegisterContext,
+     OUT   EFI_HANDLE                          *DispatchHandle
+  );
+
+/**
+  Unregister a child MMI source dispatch function with a parent MM driver.
+
+  This service removes a previously installed child dispatch handler. This does not guarantee that the 
+  system resources will be freed from the GCD.
+
+  @param[in] This                Pointer to the EFI_MM_IO_TRAP_DISPATCH_PROTOCOL instance. 
+  @param[in] DispatchHandle      Handle of the child service to remove.
+
+  @retval EFI_SUCCESS            The dispatch function has been successfully unregistered.
+  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_IO_TRAP_DISPATCH_UNREGISTER)(
+  IN CONST EFI_MM_IO_TRAP_DISPATCH_PROTOCOL    *This,
+  IN       EFI_HANDLE                          DispatchHandle
+  );
+
+///
+/// Interface structure for the MM IO Trap Dispatch Protocol.
+///
+/// This protocol provides a parent dispatch service for IO trap MMI sources.
+///
+struct _EFI_MM_IO_TRAP_DISPATCH_PROTOCOL {
+  EFI_MM_IO_TRAP_DISPATCH_REGISTER    Register;
+  EFI_MM_IO_TRAP_DISPATCH_UNREGISTER  UnRegister;
+};
+
+extern EFI_GUID gEfiMmIoTrapDispatchProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmPciRootBridgeIo.h b/MdePkg/Include/Protocol/MmPciRootBridgeIo.h
new file mode 100644
index 0000000..a3f3946
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmPciRootBridgeIo.h
@@ -0,0 +1,37 @@
+/** @file
+  MM PCI Root Bridge IO protocol as defined in the PI 1.2 specification.
+
+  This protocol provides PCI I/O and memory access within MM.
+
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _MM_PCI_ROOT_BRIDGE_IO_H_
+#define _MM_PCI_ROOT_BRIDGE_IO_H_
+
+#include <Protocol/PciRootBridgeIo.h>
+
+#define EFI_MM_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID \
+  { \
+    0x8bc1714d, 0xffcb, 0x41c3, { 0x89, 0xdc, 0x6c, 0x74, 0xd0, 0x6d, 0x98, 0xea } \
+  }
+
+///
+/// This protocol provides the same functionality as the PCI Root Bridge I/O Protocol defined in the 
+/// UEFI 2.1 Specifcation, section 13.2, except that the functions for Map() and Unmap() may return 
+/// EFI_UNSUPPORTED.
+///
+typedef EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL  EFI_MM_PCI_ROOT_BRIDGE_IO_PROTOCOL;
+
+extern EFI_GUID gEfiMmPciRootBridgeIoProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmPeriodicTimerDispatch.h b/MdePkg/Include/Protocol/MmPeriodicTimerDispatch.h
new file mode 100644
index 0000000..4f88dc8
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmPeriodicTimerDispatch.h
@@ -0,0 +1,170 @@
+/** @file
+  MM Periodic Timer Dispatch Protocol as defined in PI 1.1 Specification
+  Volume 4 Management Mode Core Interface.
+
+  This protocol provides the parent dispatch service for the periodical timer MMI source generator.
+
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+  @par Revision Reference:
+  This protocol is from PI Version 1.1.
+
+**/
+
+#ifndef _MM_PERIODIC_TIMER_DISPATCH_H_
+#define _MM_PERIODIC_TIMER_DISPATCH_H_
+
+#include <Pi/PiMmCis.h>
+
+#define EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL_GUID \
+  { \
+    0x4cec368e, 0x8e8e, 0x4d71, {0x8b, 0xe1, 0x95, 0x8c, 0x45, 0xfc, 0x8a, 0x53 } \
+  }
+
+///
+/// Example: A chipset supports periodic MMIs on every 64ms or 2 seconds.
+///   A child wishes schedule a period MMI to fire on a period of 3 seconds, there
+///   are several ways to approach the problem:
+///   1. The child may accept a 4 second periodic rate, in which case it registers with
+///        Period = 40000
+///        MmiTickInterval = 20000
+///      The resulting MMI will occur every 2 seconds with the child called back on
+///      every 2nd MMI.
+///      NOTE: the same result would occur if the child set MmiTickInterval = 0.
+///   2. The child may choose the finer granularity MMI (64ms):
+///        Period = 30000
+///        MmiTickInterval = 640
+///      The resulting MMI will occur every 64ms with the child called back on
+///      every 47th MMI.
+///      NOTE: the child driver should be aware that this will result in more
+///        MMIs occuring during system runtime which can negatively impact system
+///        performance.
+///
+typedef struct {
+  ///
+  /// The minimum period of time in 100 nanosecond units that the child gets called. The 
+  /// child will be called back after a time greater than the time Period.
+  ///
+  UINT64  Period;
+  ///
+  /// The period of time interval between MMIs. Children of this interface should use this 
+  /// field when registering for periodic timer intervals when a finer granularity periodic 
+  /// MMI is desired.
+  ///
+  UINT64  MmiTickInterval;
+} EFI_MM_PERIODIC_TIMER_REGISTER_CONTEXT;
+
+///
+/// The DispatchFunction will be called with Context set to the same value as was passed into 
+/// Register() in RegisterContext and with CommBuffer pointing to an instance of 
+/// EFI_MM_PERIODIC_TIMER_CONTEXT and CommBufferSize pointing to its size.
+///
+typedef struct {
+  ///
+  /// ElapsedTime is the actual time in 100 nanosecond units elapsed since last called, a
+  /// value of 0 indicates an unknown amount of time.
+  ///
+  UINT64  ElapsedTime;
+} EFI_MM_PERIODIC_TIMER_CONTEXT;
+
+typedef struct _EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL  EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL;
+
+/**
+  Register a child MMI source dispatch function for MM periodic timer.
+
+  This service registers a function (DispatchFunction) which will be called when at least the 
+  amount of time specified by RegisterContext has elapsed. On return, DispatchHandle 
+  contains a unique handle which may be used later to unregister the function using UnRegister().
+  The DispatchFunction will be called with Context set to the same value as was passed into 
+  this function in RegisterContext and with CommBuffer pointing to an instance of 
+  EFI_MM_PERIODIC_TIMER_CONTEXT and CommBufferSize pointing to its size.
+
+  @param[in]  This               Pointer to the EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL instance.
+  @param[in]  DispatchFunction   Function to register for handler when at least the specified amount
+                                 of time has elapsed. 
+  @param[in]  RegisterContext    Pointer to the dispatch function's context.
+                                 The caller fills this context in before calling
+                                 the register function to indicate to the register
+                                 function the period at which the dispatch function
+                                 should be invoked.
+  @param[out] DispatchHandle     Handle generated by the dispatcher to track the function instance. 
+
+  @retval EFI_SUCCESS            The dispatch function has been successfully
+                                 registered and the MMI source has been enabled.
+  @retval EFI_DEVICE_ERROR       The driver was unable to enable the MMI source.
+  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. The period input value
+                                 is not within valid range.
+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system or MM) to manage this child.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_PERIODIC_TIMER_REGISTER)(
+  IN CONST EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL    *This,
+  IN       EFI_MM_HANDLER_ENTRY_POINT                 DispatchFunction,
+  IN CONST EFI_MM_PERIODIC_TIMER_REGISTER_CONTEXT     *RegisterContext,
+  OUT      EFI_HANDLE                                 *DispatchHandle
+  );
+
+/**
+  Unregisters a periodic timer service.
+
+  This service removes the handler associated with DispatchHandle so that it will no longer be 
+  called when the time has elapsed.
+
+  @param[in] This                Pointer to the EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL instance.
+  @param[in] DispatchHandle      Handle of the service to remove.
+
+  @retval EFI_SUCCESS            The service has been successfully removed.
+  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_PERIODIC_TIMER_UNREGISTER)(
+  IN CONST EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL  *This,
+  IN       EFI_HANDLE                               DispatchHandle
+  );
+
+/**
+  Returns the next MMI tick period supported by the chipset.
+
+  The order returned is from longest to shortest interval period.
+
+  @param[in]     This             Pointer to the EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL instance.
+  @param[in,out] MmiTickInterval  Pointer to pointer of next shorter MMI interval
+                                  period supported by the child. This parameter works as a get-first,
+                                  get-next field.The first time this function is called, *MmiTickInterval
+                                  should be set to NULL to get the longest MMI interval.The returned
+                                  *MmiTickInterval should be passed in on subsequent calls to get the
+                                  next shorter interval period until *MmiTickInterval = NULL.
+
+  @retval EFI_SUCCESS             The service returned successfully.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_PERIODIC_TIMER_INTERVAL)(
+  IN CONST EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL  *This,
+  IN OUT UINT64                                     **MmiTickInterval
+  );
+
+///
+/// Interface structure for the MM Periodic Timer Dispatch Protocol
+///
+/// This protocol provides the parent dispatch service for the periodical timer MMI source generator.
+///
+struct _EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL {
+  EFI_MM_PERIODIC_TIMER_REGISTER    Register;
+  EFI_MM_PERIODIC_TIMER_UNREGISTER  UnRegister;
+  EFI_MM_PERIODIC_TIMER_INTERVAL    GetNextShorterInterval;
+};
+
+extern EFI_GUID gEfiMmPeriodicTimerDispatchProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmPowerButtonDispatch.h b/MdePkg/Include/Protocol/MmPowerButtonDispatch.h
new file mode 100644
index 0000000..7f1a4e2
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmPowerButtonDispatch.h
@@ -0,0 +1,117 @@
+/** @file
+  MM Power Button Dispatch Protocol as defined in PI 1.1 Specification
+  Volume 4 Management Mode Core Interface.
+
+  This protocol provides the parent dispatch service for the power button MMI source generator.
+
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+  @par Revision Reference:
+  This protocol is from PI Version 1.1.
+
+**/
+
+#ifndef _MM_POWER_BUTTON_DISPATCH_H_
+#define _MM_POWER_BUTTON_DISPATCH_H_
+
+#include <Pi/PiMmCis.h>
+
+#define EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL_GUID \
+  { \
+    0x1b1183fa, 0x1823, 0x46a7, {0x88, 0x72, 0x9c, 0x57, 0x87, 0x55, 0x40, 0x9d } \
+  }
+
+///
+/// Power Button phases.
+///
+typedef enum {
+  EfiPowerButtonEntry,
+  EfiPowerButtonExit,
+  EfiPowerButtonMax
+} EFI_POWER_BUTTON_PHASE;
+
+///
+/// The dispatch function's context.
+///
+typedef struct {
+  ///
+  /// Designates whether this handler should be invoked upon entry or exit.
+  ///
+  EFI_POWER_BUTTON_PHASE  Phase;
+} EFI_MM_POWER_BUTTON_REGISTER_CONTEXT;
+
+typedef struct _EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL;
+
+/**
+  Provides the parent dispatch service for a power button event.
+
+  This service registers a function (DispatchFunction) which will be called when an MMI is 
+  generated because the power button was pressed or released, as specified by RegisterContext. 
+  On return, DispatchHandle contains a unique handle which may be used later to unregister the 
+  function using UnRegister().
+  The DispatchFunction will be called with Context set to the same value as was passed into 
+  this function in RegisterContext and with CommBuffer and CommBufferSize set to NULL.
+
+  @param[in]  This               Pointer to the EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL instance.
+  @param[in]  DispatchFunction   Function to register for handler when power button is pressed or released.
+  @param[in]  RegisterContext    Pointer to the dispatch function's context. The caller fills in this context
+                                 before calling the Register() function to indicate to the Register() function
+                                 the power button MMI phase for which the dispatch function should be invoked.
+  @param[out] DispatchHandle     Handle generated by the dispatcher to track the function instance. 
+
+  @retval EFI_SUCCESS            The dispatch function has been successfully
+                                 registered and the MMI source has been enabled.
+  @retval EFI_DEVICE_ERROR       The driver was unable to enable the MMI source.
+  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. The power button input value
+                                 is not within valid range.
+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system or MM) to manage this child.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_POWER_BUTTON_REGISTER)(
+  IN CONST EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL  *This,
+  IN       EFI_MM_HANDLER_ENTRY_POINT             DispatchFunction,
+  IN       EFI_MM_POWER_BUTTON_REGISTER_CONTEXT   *RegisterContext,
+  OUT      EFI_HANDLE                             *DispatchHandle
+  );
+
+/**
+  Unregisters a power-button service.
+
+  This service removes the handler associated with DispatchHandle so that it will no longer be 
+  called when the standby button is pressed or released. 
+
+  @param[in] This                Pointer to the EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL instance.
+  @param[in] DispatchHandle      Handle of the service to remove.
+
+  @retval EFI_SUCCESS            The service has been successfully removed.
+  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_POWER_BUTTON_UNREGISTER)(
+  IN CONST EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL  *This,
+  IN       EFI_HANDLE                             DispatchHandle
+  );
+
+///
+/// Interface structure for the MM Power Button Dispatch Protocol.
+///
+/// This protocol provides the parent dispatch service for the power button MMI source generator.
+///
+struct _EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL {
+  EFI_MM_POWER_BUTTON_REGISTER    Register;
+  EFI_MM_POWER_BUTTON_UNREGISTER  UnRegister;
+};
+
+extern EFI_GUID gEfiMmPowerButtonDispatchProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmReadyToLock.h b/MdePkg/Include/Protocol/MmReadyToLock.h
new file mode 100644
index 0000000..7752c71
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmReadyToLock.h
@@ -0,0 +1,35 @@
+/** @file
+  MM Ready To Lock protocol introduced in the PI 1.2 specification.
+
+  According to PI 1.4a specification, this MM protocol indicates that
+  MM resources and services that should not be used by the third party
+  code are about to be locked.
+  This protocol is a mandatory protocol published by the MM Foundation
+  code when the system is preparing to lock certain resources and interfaces
+  in anticipation of the invocation of 3rd party extensible modules.
+  This protocol is an MM counterpart of the DXE MM Ready to Lock Protocol.
+  This protocol prorogates resource locking notification into MM environment.
+  This protocol is installed after installation of the MM End of DXE Protocol.
+
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _MM_READY_TO_LOCK_H_
+#define _MM_READY_TO_LOCK_H_
+
+#define EFI_MM_READY_TO_LOCK_PROTOCOL_GUID \
+  { \
+    0x47b7fa8c, 0xf4bd, 0x4af6, { 0x82, 0x00, 0x33, 0x30, 0x86, 0xf0, 0xd2, 0xc8 } \
+  }
+
+extern EFI_GUID gEfiMmReadyToLockProtocolGuid;
+
+#endif
diff --git a/MdePkg/Include/Protocol/MmReportStatusCodeHandler.h b/MdePkg/Include/Protocol/MmReportStatusCodeHandler.h
new file mode 100644
index 0000000..9f967b3
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmReportStatusCodeHandler.h
@@ -0,0 +1,81 @@
+/** @file
+  This protocol provides registering and unregistering services to status code consumers while in DXE MM.
+  
+  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __MM_REPORT_STATUS_CODE_HANDLER_PROTOCOL_H__
+#define __MM_REPORT_STATUS_CODE_HANDLER_PROTOCOL_H__
+
+#define EFI_MM_RSC_HANDLER_PROTOCOL_GUID \
+  { \
+    0x2ff29fa7, 0x5e80, 0x4ed9, {0xb3, 0x80, 0x1, 0x7d, 0x3c, 0x55, 0x4f, 0xf4} \
+  }
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_RSC_HANDLER_CALLBACK)(
+  IN EFI_STATUS_CODE_TYPE   CodeType,
+  IN EFI_STATUS_CODE_VALUE  Value,
+  IN UINT32                 Instance,
+  IN EFI_GUID               *CallerId,
+  IN EFI_STATUS_CODE_DATA   *Data
+);
+
+/**
+  Register the callback function for ReportStatusCode() notification.
+  
+  When this function is called the function pointer is added to an internal list and any future calls to
+  ReportStatusCode() will be forwarded to the Callback function.
+  
+  @param[in] Callback               A pointer to a function of type EFI_MM_RSC_HANDLER_CALLBACK that is 
+                                    called when a call to ReportStatusCode() occurs.
+
+  @retval EFI_SUCCESS               Function was successfully registered.
+  @retval EFI_INVALID_PARAMETER     The callback function was NULL.
+  @retval EFI_OUT_OF_RESOURCES      The internal buffer ran out of space. No more functions can be
+                                    registered.
+  @retval EFI_ALREADY_STARTED       The function was already registered. It can't be registered again.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_RSC_HANDLER_REGISTER)(
+  IN EFI_MM_RSC_HANDLER_CALLBACK Callback
+);
+
+/**
+  Remove a previously registered callback function from the notification list.
+  
+  A callback function must be unregistered before it is deallocated. It is important that any registered
+  callbacks that are not runtime complaint be unregistered when ExitBootServices() is called.
+
+  @param[in] Callback           A pointer to a function of type EFI_MM_RSC_HANDLER_CALLBACK that is to be
+                                unregistered.
+                        
+  @retval EFI_SUCCESS           The function was successfully unregistered.
+  @retval EFI_INVALID_PARAMETER The callback function was NULL.
+  @retval EFI_NOT_FOUND         The callback function was not found to be unregistered.
+                            
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_RSC_HANDLER_UNREGISTER)(
+  IN EFI_MM_RSC_HANDLER_CALLBACK Callback
+);
+
+typedef struct _EFI_MM_RSC_HANDLER_PROTOCOL {
+  EFI_MM_RSC_HANDLER_REGISTER      Register;
+  EFI_MM_RSC_HANDLER_UNREGISTER    Unregister;
+} EFI_MM_RSC_HANDLER_PROTOCOL;
+
+extern EFI_GUID gEfiMmRscHandlerProtocolGuid;
+
+#endif
diff --git a/MdePkg/Include/Protocol/MmStandbyButtonDispatch.h b/MdePkg/Include/Protocol/MmStandbyButtonDispatch.h
new file mode 100644
index 0000000..7dcb49c
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmStandbyButtonDispatch.h
@@ -0,0 +1,119 @@
+/** @file
+  MM Standby Button Dispatch Protocol as defined in PI 1.1 Specification
+  Volume 4 Management Mode Core Interface.
+
+  This protocol provides the parent dispatch service for the standby button MMI source generator.
+
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+  @par Revision Reference:
+  This protocol is from PI Version 1.1.
+
+**/
+
+#ifndef _MM_STANDBY_BUTTON_DISPATCH_H_
+#define _MM_STANDBY_BUTTON_DISPATCH_H_
+
+#include <Pi/PiMmCis.h>
+
+#define EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL_GUID \
+  { \
+    0x7300c4a1, 0x43f2, 0x4017, {0xa5, 0x1b, 0xc8, 0x1a, 0x7f, 0x40, 0x58, 0x5b } \
+  }
+
+///
+/// Standby Button phases
+///
+typedef enum {
+  EfiStandbyButtonEntry,
+  EfiStandbyButtonExit,
+  EfiStandbyButtonMax
+} EFI_STANDBY_BUTTON_PHASE;
+
+///
+/// The dispatch function's context.
+///
+typedef struct {
+  ///
+  /// Describes whether the child handler should be invoked upon the entry to the button 
+  /// activation or upon exit.
+  ///
+  EFI_STANDBY_BUTTON_PHASE  Phase;
+} EFI_MM_STANDBY_BUTTON_REGISTER_CONTEXT;
+
+typedef struct _EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL;
+
+/**
+  Provides the parent dispatch service for a standby button event.
+
+  This service registers a function (DispatchFunction) which will be called when an MMI is 
+  generated because the standby button was pressed or released, as specified by 
+  RegisterContext. On return, DispatchHandle contains a unique handle which may be used 
+  later to unregister the function using UnRegister().
+  The DispatchFunction will be called with Context set to the same value as was passed into 
+  this function in RegisterContext and with CommBuffer and CommBufferSize set to NULL. 
+
+  @param[in]  This               Pointer to the EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL instance.
+  @param[in]  DispatchFunction   Function to register for handler when the standby button is pressed or released.
+  @param[in]  RegisterContext    Pointer to the dispatch function's context. The caller fills in this context
+                                 before calling the register function to indicate to the register function the 
+                                 standby button MMI source for which the dispatch function should be invoked.
+  @param[out] DispatchHandle     Handle generated by the dispatcher to track the function instance. 
+
+  @retval EFI_SUCCESS            The dispatch function has been successfully
+                                 registered and the MMI source has been enabled.
+  @retval EFI_DEVICE_ERROR       The driver was unable to enable the MMI source.
+  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. The standby button input value
+                                 is not within valid range.
+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system or MM) to manage this child.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_STANDBY_BUTTON_REGISTER)(
+  IN CONST EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL  *This,
+  IN       EFI_MM_HANDLER_ENTRY_POINT               DispatchFunction,
+  IN       EFI_MM_STANDBY_BUTTON_REGISTER_CONTEXT   *RegisterContext,
+  OUT      EFI_HANDLE                               *DispatchHandle
+  );
+
+/**
+  Unregisters a child MMI source dispatch function with a parent MM driver.
+
+  This service removes the handler associated with DispatchHandle so that it will no longer be 
+  called when the standby button is pressed or released.
+
+  @param[in] This                Pointer to the EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL instance.
+  @param[in] DispatchHandle      Handle of the service to remove.
+
+  @retval EFI_SUCCESS            The service has been successfully removed.
+  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_STANDBY_BUTTON_UNREGISTER)(
+  IN CONST EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL  *This,
+  IN       EFI_HANDLE                               DispatchHandle
+  );
+
+///
+/// Interface structure for the MM Standby Button Dispatch Protocol.
+///
+/// This protocol provides the parent dispatch service for the standby
+/// button MMI source generator.
+///
+struct _EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL {
+  EFI_MM_STANDBY_BUTTON_REGISTER    Register;
+  EFI_MM_STANDBY_BUTTON_UNREGISTER  UnRegister;
+};
+
+extern EFI_GUID gEfiMmStandbyButtonDispatchProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmStatusCode.h b/MdePkg/Include/Protocol/MmStatusCode.h
new file mode 100644
index 0000000..d0bfbac
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmStatusCode.h
@@ -0,0 +1,65 @@
+/** @file
+  EFI MM Status Code Protocol as defined in the PI 1.2 specification.
+
+  This protocol provides the basic status code services while in MM. 
+
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials                          
+  are licensed and made available under the terms and conditions of the BSD License         
+  which accompanies this distribution.  The full text of the license may be found at        
+  http://opensource.org/licenses/bsd-license.php                                            
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             
+
+**/
+
+#ifndef _MM_STATUS_CODE_H__
+#define _MM_STATUS_CODE_H__
+
+
+#define EFI_MM_STATUS_CODE_PROTOCOL_GUID \
+  { \
+    0x6afd2b77, 0x98c1, 0x4acd, {0xa6, 0xf9, 0x8a, 0x94, 0x39, 0xde, 0xf, 0xb1} \
+  }
+
+typedef struct _EFI_MM_STATUS_CODE_PROTOCOL  EFI_MM_STATUS_CODE_PROTOCOL;
+
+/**
+  Service to emit the status code in MM.    
+
+  The EFI_MM_STATUS_CODE_PROTOCOL.ReportStatusCode() function enables a driver 
+  to emit a status code while in MM.  The reason that there is a separate protocol definition from the 
+  DXE variant of this service is that the publisher of this protocol will provide a service that is 
+  capability of coexisting with a foreground operational environment, such as an operating system 
+  after the termination of boot services.  
+
+  @param[in] This                Points to this instance of the EFI_MM_STATUS_CODE_PROTOCOL.
+  @param[in] CodeType            DIndicates the type of status code being reported. 
+  @param[in] Value               Describes the current status of a hardware or software entity. 
+  @param[in] Instance            The enumeration of a hardware or software entity within the system.
+  @param[in] CallerId            This optional parameter may be used to identify the caller.
+  @param[in] Data                This optional parameter may be used to pass additional data.
+
+  @retval EFI_SUCCESS            The function completed successfully.
+  @retval EFI_INVALID_PARAMETER  The function should not be completed due to a device error.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_REPORT_STATUS_CODE)(
+  IN CONST EFI_MM_STATUS_CODE_PROTOCOL   *This,
+  IN EFI_STATUS_CODE_TYPE                CodeType,
+  IN EFI_STATUS_CODE_VALUE               Value,
+  IN UINT32                              Instance,
+  IN CONST EFI_GUID                      *CallerId,
+  IN EFI_STATUS_CODE_DATA                *Data OPTIONAL
+  );
+
+struct _EFI_MM_STATUS_CODE_PROTOCOL {
+  EFI_MM_REPORT_STATUS_CODE  ReportStatusCode;
+};
+
+extern EFI_GUID gEfiMmStatusCodeProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmSwDispatch.h b/MdePkg/Include/Protocol/MmSwDispatch.h
new file mode 100644
index 0000000..004c235
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmSwDispatch.h
@@ -0,0 +1,136 @@
+/** @file
+  MM Software Dispatch Protocol introduced from PI 1.2 Specification
+  Volume 4 Management Mode Core Interface.
+
+  This protocol provides the parent dispatch service for a given MMI source generator.
+
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _MM_SW_DISPATCH2_H_
+#define _MM_SW_DISPATCH2_H_
+
+#include <Pi/PiMmCis.h>
+
+#define EFI_MM_SW_DISPATCH_PROTOCOL_GUID \
+  { \
+    0x18a3c6dc, 0x5eea, 0x48c8, {0xa1, 0xc1, 0xb5, 0x33, 0x89, 0xf9, 0x89, 0x99 } \
+  }
+
+///
+/// A particular chipset may not support all possible software MMI input values.
+/// For example, the ICH supports only values 00h to 0FFh.  The parent only allows a single
+/// child registration for each SwMmiInputValue.
+///
+typedef struct {
+  UINTN SwMmiInputValue;
+} EFI_MM_SW_REGISTER_CONTEXT;
+
+///
+/// The DispatchFunction will be called with Context set to the same value as was passed into 
+/// this function in RegisterContext and with CommBuffer (and CommBufferSize) pointing
+/// to an instance of EFI_MM_SW_CONTEXT indicating the index of the CPU which generated the 
+/// software MMI.
+///
+typedef struct {
+  ///
+  /// The 0-based index of the CPU which generated the software MMI.
+  ///
+  UINTN SwMmiCpuIndex;
+  ///
+  /// This value corresponds directly to the CommandPort parameter used in the call to Trigger().
+  ///
+  UINT8 CommandPort;
+  ///
+  /// This value corresponds directly to the DataPort parameter used in the call to Trigger().
+  ///
+  UINT8 DataPort;
+} EFI_MM_SW_CONTEXT;
+
+typedef struct _EFI_MM_SW_DISPATCH_PROTOCOL  EFI_MM_SW_DISPATCH_PROTOCOL;
+
+/**
+  Register a child MMI source dispatch function for the specified software MMI.
+
+  This service registers a function (DispatchFunction) which will be called when the software 
+  MMI source specified by RegisterContext->SwMmiCpuIndex is detected. On return, 
+  DispatchHandle contains a unique handle which may be used later to unregister the function 
+  using UnRegister().
+
+  @param[in]  This                 Pointer to the EFI_MM_SW_DISPATCH_PROTOCOL instance.
+  @param[in]  DispatchFunction     Function to register for handler when the specified software 
+                                   MMI is generated. 
+  @param[in, out] RegisterContext  Pointer to the dispatch function's context.
+                                   The caller fills this context in before calling
+                                   the register function to indicate to the register
+                                   function which Software MMI input value the
+                                   dispatch function should be invoked for.
+  @param[out] DispatchHandle       Handle generated by the dispatcher to track the
+                                   function instance.
+
+  @retval EFI_SUCCESS            The dispatch function has been successfully
+                                 registered and the MMI source has been enabled.
+  @retval EFI_DEVICE_ERROR       The SW driver was unable to enable the MMI source.
+  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. The SW MMI input value
+                                 is not within a valid range or is already in use.
+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system or MM) to manage this
+                                 child.
+  @retval EFI_OUT_OF_RESOURCES   A unique software MMI value could not be assigned
+                                 for this dispatch.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_SW_REGISTER)(
+  IN  CONST EFI_MM_SW_DISPATCH_PROTOCOL  *This,
+  IN        EFI_MM_HANDLER_ENTRY_POINT   DispatchFunction,
+  IN  OUT   EFI_MM_SW_REGISTER_CONTEXT   *RegisterContext,
+  OUT       EFI_HANDLE                   *DispatchHandle
+  );
+
+/**
+  Unregister a child MMI source dispatch function for the specified software MMI.
+
+  This service removes the handler associated with DispatchHandle so that it will no longer be 
+  called in response to a software MMI.
+
+  @param[in] This                Pointer to the EFI_MM_SW_DISPATCH_PROTOCOL instance.
+  @param[in] DispatchHandle      Handle of dispatch function to deregister.
+
+  @retval EFI_SUCCESS            The dispatch function has been successfully unregistered.
+  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_SW_UNREGISTER)(
+  IN CONST EFI_MM_SW_DISPATCH_PROTOCOL  *This,
+  IN       EFI_HANDLE                   DispatchHandle
+);
+
+///
+/// Interface structure for the MM Software MMI Dispatch Protocol.
+///
+/// The EFI_MM_SW_DISPATCH2_PROTOCOL provides the ability to install child handlers for the 
+/// given software.  These handlers will respond to software interrupts, and the maximum software 
+/// interrupt in the EFI_MM_SW_REGISTER_CONTEXT is denoted by MaximumSwiValue.
+///
+struct _EFI_MM_SW_DISPATCH_PROTOCOL {
+  EFI_MM_SW_REGISTER    Register;
+  EFI_MM_SW_UNREGISTER  UnRegister;
+  ///
+  /// A read-only field that describes the maximum value that can be used in the 
+  /// EFI_MM_SW_DISPATCH_PROTOCOL.Register() service.
+  ///
+  UINTN                 MaximumSwiValue;
+};
+
+extern EFI_GUID gEfiMmSwDispatchProtocolGuid;
+
+#endif
diff --git a/MdePkg/Include/Protocol/MmSxDispatch.h b/MdePkg/Include/Protocol/MmSxDispatch.h
new file mode 100644
index 0000000..af63389
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmSxDispatch.h
@@ -0,0 +1,135 @@
+/** @file
+  MM Sx Dispatch Protocol as defined in PI 1.2 Specification
+  Volume 4 Management Mode Core Interface.
+
+  Provides the parent dispatch service for a given Sx-state source generator.
+
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _MM_SX_DISPATCH_H_
+#define _MM_SX_DISPATCH_H_
+
+#include <Pi/PiMmCis.h>
+
+#define EFI_MM_SX_DISPATCH_PROTOCOL_GUID \
+  { \
+    0x456d2859, 0xa84b, 0x4e47, {0xa2, 0xee, 0x32, 0x76, 0xd8, 0x86, 0x99, 0x7d } \
+  }
+
+///
+/// Sleep states S0-S5
+///
+typedef enum {
+  SxS0,
+  SxS1,
+  SxS2,
+  SxS3,
+  SxS4,
+  SxS5,
+  EfiMaximumSleepType
+} EFI_SLEEP_TYPE;
+
+///
+/// Sleep state phase: entry or exit
+///
+typedef enum {
+  SxEntry,
+  SxExit,
+  EfiMaximumPhase
+} EFI_SLEEP_PHASE;
+
+///
+/// The dispatch function's context
+///
+typedef struct {
+  EFI_SLEEP_TYPE  Type;
+  EFI_SLEEP_PHASE Phase;
+} EFI_MM_SX_REGISTER_CONTEXT;
+
+typedef struct _EFI_MM_SX_DISPATCH_PROTOCOL  EFI_MM_SX_DISPATCH_PROTOCOL;
+
+/**
+  Provides the parent dispatch service for a given Sx source generator.
+
+  This service registers a function (DispatchFunction) which will be called when the sleep state 
+  event specified by RegisterContext is detected. On return, DispatchHandle contains a 
+  unique handle which may be used later to unregister the function using UnRegister().
+  The DispatchFunction will be called with Context set to the same value as was passed into 
+  this function in RegisterContext and with CommBuffer and CommBufferSize set to 
+  NULL and 0 respectively.
+
+  @param[in] This                Pointer to the EFI_MM_SX_DISPATCH_PROTOCOL instance.
+  @param[in] DispatchFunction    Function to register for handler when the specified sleep state event occurs.
+  @param[in] RegisterContext     Pointer to the dispatch function's context.
+                                 The caller fills this context in before calling
+                                 the register function to indicate to the register
+                                 function which Sx state type and phase the caller
+                                 wishes to be called back on. For this intertace,
+                                 the Sx driver will call the registered handlers for
+                                 all Sx type and phases, so the Sx state handler(s)
+                                 must check the Type and Phase field of the Dispatch
+                                 context and act accordingly.
+  @param[out]  DispatchHandle    Handle of dispatch function, for when interfacing
+                                 with the parent Sx state MM driver.
+
+  @retval EFI_SUCCESS            The dispatch function has been successfully
+                                 registered and the MMI source has been enabled.
+  @retval EFI_UNSUPPORTED        The Sx driver or hardware does not support that
+                                 Sx Type/Phase.
+  @retval EFI_DEVICE_ERROR       The Sx driver was unable to enable the MMI source.
+  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. Type & Phase are not
+                                 within valid range.
+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system or MM) to manage this
+                                 child.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_SX_REGISTER)(
+  IN  CONST EFI_MM_SX_DISPATCH_PROTOCOL  *This,
+  IN        EFI_MM_HANDLER_ENTRY_POINT   DispatchFunction,
+  IN  CONST EFI_MM_SX_REGISTER_CONTEXT   *RegisterContext,
+  OUT       EFI_HANDLE                   *DispatchHandle
+  );
+
+/**
+  Unregisters an Sx-state service.
+
+  This service removes the handler associated with DispatchHandle so that it will no longer be 
+  called in response to sleep event.
+
+  @param[in] This                Pointer to the EFI_MM_SX_DISPATCH_PROTOCOL instance.
+  @param[in] DispatchHandle      Handle of the service to remove. 
+
+  @retval EFI_SUCCESS            The service has been successfully removed.
+  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_SX_UNREGISTER)(
+  IN CONST EFI_MM_SX_DISPATCH_PROTOCOL  *This,
+  IN       EFI_HANDLE                   DispatchHandle
+  );
+
+///
+/// Interface structure for the MM Sx Dispatch Protocol
+///
+/// The EFI_MM_SX_DISPATCH_PROTOCOL provides the ability to install child handlers to 
+/// respond to sleep state related events.
+///
+struct _EFI_MM_SX_DISPATCH_PROTOCOL {
+  EFI_MM_SX_REGISTER    Register;
+  EFI_MM_SX_UNREGISTER  UnRegister;
+};
+
+extern EFI_GUID gEfiMmSxDispatchProtocolGuid;
+
+#endif
diff --git a/MdePkg/Include/Protocol/MmUsbDispatch.h b/MdePkg/Include/Protocol/MmUsbDispatch.h
new file mode 100644
index 0000000..0b4fabe
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmUsbDispatch.h
@@ -0,0 +1,130 @@
+/** @file
+  MM USB Dispatch Protocol as defined in PI 1.1 Specification
+  Volume 4 Management Mode Core Interface.
+
+  Provides the parent dispatch service for the USB MMI source generator.
+
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+  @par Revision Reference:
+  This protocol is from PI Version 1.1.
+
+**/
+
+#ifndef _MM_USB_DISPATCH_H_
+#define _MM_USB_DISPATCH_H_
+
+#include <Pi/PiMmCis.h>
+
+#define EFI_MM_USB_DISPATCH_PROTOCOL_GUID \
+  { \
+    0xee9b8d90, 0xc5a6, 0x40a2, {0xbd, 0xe2, 0x52, 0x55, 0x8d, 0x33, 0xcc, 0xa1 } \
+  }
+
+///
+/// USB MMI event types
+///
+typedef enum {
+  UsbLegacy,
+  UsbWake
+} EFI_USB_MMI_TYPE;
+
+///
+/// The dispatch function's context.
+///
+typedef struct {
+  ///
+  /// Describes whether this child handler will be invoked in response to a USB legacy 
+  /// emulation event, such as port-trap on the PS/2* keyboard control registers, or to a 
+  /// USB wake event, such as resumption from a sleep state.
+  ///
+  EFI_USB_MMI_TYPE          Type;
+  ///
+  /// The device path is part of the context structure and describes the location of the 
+  /// particular USB host controller in the system for which this register event will occur.
+  /// This location is important because of the possible integration of several USB host 
+  /// controllers in a system.
+  ///
+  EFI_DEVICE_PATH_PROTOCOL  *Device;
+} EFI_MM_USB_REGISTER_CONTEXT;
+
+typedef struct _EFI_MM_USB_DISPATCH_PROTOCOL EFI_MM_USB_DISPATCH_PROTOCOL;
+
+/**
+  Provides the parent dispatch service for the USB MMI source generator.
+
+  This service registers a function (DispatchFunction) which will be called when the USB-
+  related MMI specified by RegisterContext has occurred. On return, DispatchHandle 
+  contains a unique handle which may be used later to unregister the function using UnRegister().
+  The DispatchFunction will be called with Context set to the same value as was passed into 
+  this function in RegisterContext and with CommBuffer containing NULL and 
+  CommBufferSize containing zero.
+
+  @param[in]  This               Pointer to the EFI_MM_USB_DISPATCH_PROTOCOL instance.
+  @param[in]  DispatchFunction   Function to register for handler when a USB-related MMI occurs. 
+  @param[in]  RegisterContext    Pointer to the dispatch function's context.
+                                 The caller fills this context in before calling
+                                 the register function to indicate to the register
+                                 function the USB MMI types for which the dispatch
+                                 function should be invoked.
+  @param[out] DispatchHandle     Handle generated by the dispatcher to track the function instance.
+
+  @retval EFI_SUCCESS            The dispatch function has been successfully
+                                 registered and the MMI source has been enabled.
+  @retval EFI_DEVICE_ERROR       The driver was unable to enable the MMI source.
+  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. The USB MMI type
+                                 is not within valid range.
+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system or MM) to manage this child.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_USB_REGISTER)(
+  IN  CONST EFI_MM_USB_DISPATCH_PROTOCOL  *This,
+  IN        EFI_MM_HANDLER_ENTRY_POINT    DispatchFunction,
+  IN  CONST EFI_MM_USB_REGISTER_CONTEXT   *RegisterContext,
+  OUT       EFI_HANDLE                    *DispatchHandle
+  );
+
+/**
+  Unregisters a USB service.
+
+  This service removes the handler associated with DispatchHandle so that it will no longer be 
+  called when the USB event occurs.
+
+  @param[in]  This               Pointer to the EFI_MM_USB_DISPATCH_PROTOCOL instance.
+  @param[in]  DispatchHandle     Handle of the service to remove. 
+
+  @retval EFI_SUCCESS            The dispatch function has been successfully
+                                 unregistered and the MMI source has been disabled
+                                 if there are no other registered child dispatch
+                                 functions for this MMI source.
+  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_USB_UNREGISTER)(
+  IN CONST EFI_MM_USB_DISPATCH_PROTOCOL  *This,
+  IN       EFI_HANDLE                    DispatchHandle
+  );
+
+///
+/// Interface structure for the MM USB MMI Dispatch Protocol
+///
+/// This protocol provides the parent dispatch service for the USB MMI source generator.
+///
+struct _EFI_MM_USB_DISPATCH_PROTOCOL {
+  EFI_MM_USB_REGISTER    Register;
+  EFI_MM_USB_UNREGISTER  UnRegister;
+};
+
+extern EFI_GUID gEfiMmUsbDispatchProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index f54b056..ace4df3 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -1033,6 +1033,9 @@
   ## Include/Protocol/SmmReportStatusCodeHandler.h
   gEfiSmmRscHandlerProtocolGuid   = { 0x2ff29fa7, 0x5e80, 0x4ed9, { 0xb3, 0x80, 0x1, 0x7d, 0x3c, 0x55, 0x4f, 0xf4 }}
 
+  ## Include/Protocol/MmReportStatusCodeHandler.h
+  gEfiMmRscHandlerProtocolGuid   = { 0x2ff29fa7, 0x5e80, 0x4ed9, { 0xb3, 0x80, 0x1, 0x7d, 0x3c, 0x55, 0x4f, 0xf4 }}
+
   ## Include/Protocol/AcpiSystemDescriptionTable.h
   gEfiAcpiSdtProtocolGuid         = { 0xeb97088e, 0xcfdf, 0x49c6, { 0xbe, 0x4b, 0xd9, 0x6, 0xa5, 0xb2, 0xe, 0x86 }}
 
@@ -1042,60 +1045,117 @@
   ## Include/Protocol/SmmCpuIo2.h
   gEfiSmmCpuIo2ProtocolGuid        = { 0x3242a9d8, 0xce70, 0x4aa0, { 0x95, 0x5d, 0x5e, 0x7b, 0x14, 0x0d, 0xe4, 0xd2 }}
 
+  ## Include/Protocol/MmCpuIo.h
+  gEfiMmCpuIoProtocolGuid        = { 0x3242a9d8, 0xce70, 0x4aa0, { 0x95, 0x5d, 0x5e, 0x7b, 0x14, 0x0d, 0xe4, 0xd2 }}
+
   ## Include/Protocol/SmmBase2.h
   gEfiSmmBase2ProtocolGuid        = { 0xf4ccbfb7, 0xf6e0, 0x47fd, { 0x9d, 0xd4, 0x10, 0xa8, 0xf1, 0x50, 0xc1, 0x91 }}
 
+  ## Include/Protocol/MmBase.h
+  gEfiMmBaseProtocolGuid        = { 0xf4ccbfb7, 0xf6e0, 0x47fd, { 0x9d, 0xd4, 0x10, 0xa8, 0xf1, 0x50, 0xc1, 0x91 }}
+
   ## Include/Protocol/SmmAccess2.h
   gEfiSmmAccess2ProtocolGuid      = { 0xc2702b74, 0x800c, 0x4131, { 0x87, 0x46, 0x8f, 0xb5, 0xb8, 0x9c, 0xe4, 0xac }}
 
+  ## Include/Protocol/MmAccess.h
+  gEfiMmAccessProtocolGuid      = { 0xc2702b74, 0x800c, 0x4131, { 0x87, 0x46, 0x8f, 0xb5, 0xb8, 0x9c, 0xe4, 0xac }}
+
   ## Include/Protocol/SmmControl2.h
   gEfiSmmControl2ProtocolGuid     = { 0x843dc720, 0xab1e, 0x42cb, { 0x93, 0x57, 0x8a, 0x0, 0x78, 0xf3, 0x56, 0x1b}}
 
+  ## Include/Protocol/MmControl.h
+  gEfiMmControlProtocolGuid     = { 0x843dc720, 0xab1e, 0x42cb, { 0x93, 0x57, 0x8a, 0x0, 0x78, 0xf3, 0x56, 0x1b}}
+
   ## Include/Protocol/SmmConfiguration.h
   gEfiSmmConfigurationProtocolGuid= { 0x26eeb3de, 0xb689, 0x492e, { 0x80, 0xf0, 0xbe, 0x8b, 0xd7, 0xda, 0x4b, 0xa7 }}
 
+  ## Include/Protocol/MmConfiguration.h
+  gEfiMmConfigurationProtocolGuid= { 0x26eeb3de, 0xb689, 0x492e, { 0x80, 0xf0, 0xbe, 0x8b, 0xd7, 0xda, 0x4b, 0xa7 }}
+
   ## Include/Protocol/SmmReadyToLock.h
   gEfiSmmReadyToLockProtocolGuid  = { 0x47b7fa8c, 0xf4bd, 0x4af6, { 0x82, 0x00, 0x33, 0x30, 0x86, 0xf0, 0xd2, 0xc8 }}
 
+  ## Include/Protocol/MmReadyToLock.h
+  gEfiMmReadyToLockProtocolGuid  = { 0x47b7fa8c, 0xf4bd, 0x4af6, { 0x82, 0x00, 0x33, 0x30, 0x86, 0xf0, 0xd2, 0xc8 }}
+
   ## Include/Protocol/DxeSmmReadyToLock.h
   gEfiDxeSmmReadyToLockProtocolGuid = { 0x60ff8964, 0xe906, 0x41d0, { 0xaf, 0xed, 0xf2, 0x41, 0xe9, 0x74, 0xe0, 0x8e }}
 
+  ## Include/Protocol/DxeMmReadyToLock.h
+  gEfiDxeMmReadyToLockProtocolGuid = { 0x60ff8964, 0xe906, 0x41d0, { 0xaf, 0xed, 0xf2, 0x41, 0xe9, 0x74, 0xe0, 0x8e }}
+
   ## Include/Protocol/SmmCommunication.h
   gEfiSmmCommunicationProtocolGuid  = { 0xc68ed8e2, 0x9dc6, 0x4cbd, { 0x9d, 0x94, 0xdb, 0x65, 0xac, 0xc5, 0xc3, 0x32 }}
 
+  ## Include/Protocol/MmCommunication.h
+  gEfiMmCommunicationProtocolGuid  = { 0xc68ed8e2, 0x9dc6, 0x4cbd, { 0x9d, 0x94, 0xdb, 0x65, 0xac, 0xc5, 0xc3, 0x32 }}
+
   ## Include/Protocol/SmmStatusCode.h
   gEfiSmmStatusCodeProtocolGuid   = { 0x6afd2b77, 0x98c1, 0x4acd, { 0xa6, 0xf9, 0x8a, 0x94, 0x39, 0xde, 0xf, 0xb1}}
 
+  ## Include/Protocol/MmStatusCode.h
+  gEfiMmStatusCodeProtocolGuid   = { 0x6afd2b77, 0x98c1, 0x4acd, { 0xa6, 0xf9, 0x8a, 0x94, 0x39, 0xde, 0xf, 0xb1}}
+
   ## Include/Protocol/SmmCpu.h
   gEfiSmmCpuProtocolGuid          = { 0xeb346b97, 0x975f, 0x4a9f, { 0x8b, 0x22, 0xf8, 0xe9, 0x2b, 0xb3, 0xd5, 0x69 }}
 
+  ## Include/Protocol/MmCpu.h
+  gEfiMmCpuProtocolGuid          = { 0xeb346b97, 0x975f, 0x4a9f, { 0x8b, 0x22, 0xf8, 0xe9, 0x2b, 0xb3, 0xd5, 0x69 }}
+
   ## Include/Protocol/SmmPciRootBridgeIo.h
   gEfiSmmPciRootBridgeIoProtocolGuid = { 0x8bc1714d, 0xffcb, 0x41c3, { 0x89, 0xdc, 0x6c, 0x74, 0xd0, 0x6d, 0x98, 0xea }}
 
+  ## Include/Protocol/MmPciRootBridgeIo.h
+  gEfiMmPciRootBridgeIoProtocolGuid = { 0x8bc1714d, 0xffcb, 0x41c3, { 0x89, 0xdc, 0x6c, 0x74, 0xd0, 0x6d, 0x98, 0xea }}
+
   ## Include/Protocol/SmmSwDispatch2.h
   gEfiSmmSwDispatch2ProtocolGuid  = { 0x18a3c6dc, 0x5eea, 0x48c8, {0xa1, 0xc1, 0xb5, 0x33, 0x89, 0xf9, 0x89, 0x99 }}
 
+  ## Include/Protocol/MmSwDispatch.h
+  gEfiMmSwDispatchProtocolGuid  = { 0x18a3c6dc, 0x5eea, 0x48c8, {0xa1, 0xc1, 0xb5, 0x33, 0x89, 0xf9, 0x89, 0x99 }}
+
   ## Include/Protocol/SmmSxDispatch2.h
   gEfiSmmSxDispatch2ProtocolGuid  = { 0x456d2859, 0xa84b, 0x4e47, {0xa2, 0xee, 0x32, 0x76, 0xd8, 0x86, 0x99, 0x7d }}
 
+  ## Include/Protocol/MmSxDispatch.h
+  gEfiMmSxDispatchProtocolGuid  = { 0x456d2859, 0xa84b, 0x4e47, {0xa2, 0xee, 0x32, 0x76, 0xd8, 0x86, 0x99, 0x7d }}
+
   ## Include/Protocol/SmmPeriodicTimerDispatch2.h
   gEfiSmmPeriodicTimerDispatch2ProtocolGuid = { 0x4cec368e, 0x8e8e, 0x4d71, {0x8b, 0xe1, 0x95, 0x8c, 0x45, 0xfc, 0x8a, 0x53 }}
 
+  ## Include/Protocol/MmPeriodicTimerDispatch.h
+  gEfiMmPeriodicTimerDispatchProtocolGuid = { 0x4cec368e, 0x8e8e, 0x4d71, {0x8b, 0xe1, 0x95, 0x8c, 0x45, 0xfc, 0x8a, 0x53 }}
+
   ## Include/Protocol/SmmUsbDispatch2.h
   gEfiSmmUsbDispatch2ProtocolGuid = { 0xee9b8d90, 0xc5a6, 0x40a2, {0xbd, 0xe2, 0x52, 0x55, 0x8d, 0x33, 0xcc, 0xa1 }}
 
+  ## Include/Protocol/MmUsbDispatch.h
+  gEfiMmUsbDispatchProtocolGuid = { 0xee9b8d90, 0xc5a6, 0x40a2, {0xbd, 0xe2, 0x52, 0x55, 0x8d, 0x33, 0xcc, 0xa1 }}
+
   ## Include/Protocol/SmmGpiDispatch2.h
   gEfiSmmGpiDispatch2ProtocolGuid = { 0x25566b03, 0xb577, 0x4cbf, {0x95, 0x8c, 0xed, 0x66, 0x3e, 0xa2, 0x43, 0x80 }}
 
+  ## Include/Protocol/MmGpiDispatch.h
+  gEfiMmGpiDispatchProtocolGuid = { 0x25566b03, 0xb577, 0x4cbf, {0x95, 0x8c, 0xed, 0x66, 0x3e, 0xa2, 0x43, 0x80 }}
+
   ## Include/Protocol/SmmStandbyButtonDispatch2.h
   gEfiSmmStandbyButtonDispatch2ProtocolGuid = { 0x7300c4a1, 0x43f2, 0x4017, {0xa5, 0x1b, 0xc8, 0x1a, 0x7f, 0x40, 0x58, 0x5b }}
 
+  ## Include/Protocol/MmStandbyButtonDispatch.h
+  gEfiMmStandbyButtonDispatchProtocolGuid = { 0x7300c4a1, 0x43f2, 0x4017, {0xa5, 0x1b, 0xc8, 0x1a, 0x7f, 0x40, 0x58, 0x5b }}
+
   ## Include/Protocol/SmmPowerButtonDispatch2.h
   gEfiSmmPowerButtonDispatch2ProtocolGuid = { 0x1b1183fa, 0x1823, 0x46a7, {0x88, 0x72, 0x9c, 0x57, 0x87, 0x55, 0x40, 0x9d }}
 
+  ## Include/Protocol/MmPowerButtonDispatch.h
+  gEfiMmPowerButtonDispatchProtocolGuid = { 0x1b1183fa, 0x1823, 0x46a7, {0x88, 0x72, 0x9c, 0x57, 0x87, 0x55, 0x40, 0x9d }}
+
   ## Include/Protocol/SmmIoTrapDispatch2.h
   gEfiSmmIoTrapDispatch2ProtocolGuid = { 0x58dc368d, 0x7bfa, 0x4e77, {0xab, 0xbc, 0xe, 0x29, 0x41, 0x8d, 0xf9, 0x30 }}
 
+  ## Include/Protocol/MmIoTrapDispatch.h
+  gEfiMmIoTrapDispatchProtocolGuid = { 0x58dc368d, 0x7bfa, 0x4e77, {0xab, 0xbc, 0xe, 0x29, 0x41, 0x8d, 0xf9, 0x30 }}
+
   ## Include/Protocol/PiPcd.h
   gEfiPcdProtocolGuid = { 0x13a3f0f6, 0x264a, 0x3ef0, { 0xf2, 0xe0, 0xde, 0xc5, 0x12, 0x34, 0x2f, 0x34 } }
 
@@ -1141,6 +1201,9 @@
   ## Include/Protocol/SmmEndOfDxe.h
   gEfiSmmEndOfDxeProtocolGuid = { 0x24e70042, 0xd5c5, 0x4260, { 0x8c, 0x39, 0xa, 0xd3, 0xaa, 0x32, 0xe9, 0x3d }}
 
+  ## Include/Protocol/MmEndOfDxe.h
+  gEfiMmEndOfDxeProtocolGuid = { 0x24e70042, 0xd5c5, 0x4260, { 0x8c, 0x39, 0xa, 0xd3, 0xaa, 0x32, 0xe9, 0x3d }}
+
   ## Include/Protocol/IsaHc.h
   gEfiIsaHcProtocolGuid               = { 0xbcdaf080, 0x1bde, 0x4e22, {0xae, 0x6a, 0x43, 0x54, 0x1e, 0x12, 0x8e, 0xc4 } }
   gEfiIsaHcServiceBindingProtocolGuid = { 0xfad7933a, 0x6c21, 0x4234, {0xa4, 0x34, 0x0a, 0x8a, 0x0d, 0x2b, 0x07, 0x81 } }
-- 
2.7.0.windows.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Patch 2/2] MdePkg: Update exited SMM related definition.
  2017-08-14  8:32 [Patch 0/2] Add Management Mode infrastructure support Eric Dong
  2017-08-14  8:32 ` [Patch 1/2] MdePkg: Add new definitions for Management Mode Eric Dong
@ 2017-08-14  8:32 ` Eric Dong
  1 sibling, 0 replies; 5+ messages in thread
From: Eric Dong @ 2017-08-14  8:32 UTC (permalink / raw)
  To: edk2-devel; +Cc: Michael D Kinney, Liming Gao

After update current code to follow new spec definition(rename SMM
to MM), update code for current SMM related definitions to keep
compatibility.

Whether keep current definition or use typedef/#define to reference
new add definition (added by former patch) are based on the structure
name or function parameters type. If the name or type has
Smi/Smm/Smram keywords, the old definition will be kept, else code
use typedef/#define to reference the new add definition.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
 MdePkg/Include/Pi/PiMultiPhase.h                   |  26 +-
 MdePkg/Include/Pi/PiSmmCis.h                       | 183 ++----------
 MdePkg/Include/Protocol/DxeSmmReadyToLock.h        |   9 +-
 MdePkg/Include/Protocol/SmmAccess2.h               | 103 +------
 MdePkg/Include/Protocol/SmmBase2.h                 |   8 +-
 MdePkg/Include/Protocol/SmmCommunication.h         |  58 +---
 MdePkg/Include/Protocol/SmmConfiguration.h         |   8 +-
 MdePkg/Include/Protocol/SmmControl2.h              |  79 +-----
 MdePkg/Include/Protocol/SmmCpu.h                   | 309 +++++++--------------
 MdePkg/Include/Protocol/SmmCpuIo2.h                |  79 +-----
 MdePkg/Include/Protocol/SmmEndOfDxe.h              |   9 +-
 MdePkg/Include/Protocol/SmmGpiDispatch2.h          |  98 +------
 MdePkg/Include/Protocol/SmmIoTrapDispatch2.h       | 105 +------
 MdePkg/Include/Protocol/SmmPciRootBridgeIo.h       |  11 +-
 .../Include/Protocol/SmmPeriodicTimerDispatch2.h   |  16 +-
 MdePkg/Include/Protocol/SmmPowerButtonDispatch2.h  |  89 +-----
 MdePkg/Include/Protocol/SmmReadyToLock.h           |   7 +-
 .../Include/Protocol/SmmReportStatusCodeHandler.h  |  63 +----
 .../Include/Protocol/SmmStandbyButtonDispatch2.h   |  89 +-----
 MdePkg/Include/Protocol/SmmStatusCode.h            |  42 +--
 MdePkg/Include/Protocol/SmmSwDispatch2.h           |   8 +-
 MdePkg/Include/Protocol/SmmSxDispatch2.h           | 111 +-------
 MdePkg/Include/Protocol/SmmUsbDispatch2.h          | 101 +------
 23 files changed, 254 insertions(+), 1357 deletions(-)

diff --git a/MdePkg/Include/Pi/PiMultiPhase.h b/MdePkg/Include/Pi/PiMultiPhase.h
index 169258c..9f25051 100644
--- a/MdePkg/Include/Pi/PiMultiPhase.h
+++ b/MdePkg/Include/Pi/PiMultiPhase.h
@@ -95,43 +95,49 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 ///@}
 
 ///
-/// SMRAM states and capabilities
+/// MMRAM states and capabilities
 ///
-#define EFI_SMRAM_OPEN                  0x00000001
-#define EFI_SMRAM_CLOSED                0x00000002
-#define EFI_SMRAM_LOCKED                0x00000004
+#define EFI_MMRAM_OPEN                  0x00000001
+#define EFI_MMRAM_CLOSED                0x00000002
+#define EFI_MMRAM_LOCKED                0x00000004
 #define EFI_CACHEABLE                   0x00000008
 #define EFI_ALLOCATED                   0x00000010
 #define EFI_NEEDS_TESTING               0x00000020
 #define EFI_NEEDS_ECC_INITIALIZATION    0x00000040
 
+#define EFI_SMRAM_OPEN                  EFI_MMRAM_OPEN
+#define EFI_SMRAM_CLOSED                EFI_MMRAM_CLOSED
+#define EFI_SMRAM_LOCKED                EFI_MMRAM_LOCKED
+
 ///
-/// Structure describing a SMRAM region and its accessibility attributes.
+/// Structure describing a MMRAM region and its accessibility attributes.
 ///
 typedef struct {
   ///
-  /// Designates the physical address of the SMRAM in memory. This view of memory is 
+  /// Designates the physical address of the MMRAM in memory. This view of memory is 
   /// the same as seen by I/O-based agents, for example, but it may not be the address seen 
   /// by the processors.
   ///
   EFI_PHYSICAL_ADDRESS  PhysicalStart;
   ///
-  /// Designates the address of the SMRAM, as seen by software executing on the 
+  /// Designates the address of the MMRAM, as seen by software executing on the 
   /// processors. This address may or may not match PhysicalStart.
   ///
   EFI_PHYSICAL_ADDRESS  CpuStart;       
   ///
-  /// Describes the number of bytes in the SMRAM region.
+  /// Describes the number of bytes in the MMRAM region.
   ///
   UINT64                PhysicalSize;
   ///
-  /// Describes the accessibility attributes of the SMRAM.  These attributes include the 
+  /// Describes the accessibility attributes of the MMRAM.  These attributes include the 
   /// hardware state (e.g., Open/Closed/Locked), capability (e.g., cacheable), logical 
   /// allocation (e.g., allocated), and pre-use initialization (e.g., needs testing/ECC 
   /// initialization).
   ///
   UINT64                RegionState;
-} EFI_SMRAM_DESCRIPTOR;
+} EFI_MMRAM_DESCRIPTOR;
+
+typedef EFI_MMRAM_DESCRIPTOR  EFI_SMRAM_DESCRIPTOR;
 
 typedef enum {
   EFI_PCD_TYPE_8,
diff --git a/MdePkg/Include/Pi/PiSmmCis.h b/MdePkg/Include/Pi/PiSmmCis.h
index 6cb28b7..4f8d5d0 100644
--- a/MdePkg/Include/Pi/PiSmmCis.h
+++ b/MdePkg/Include/Pi/PiSmmCis.h
@@ -16,21 +16,17 @@
 #ifndef _PI_SMMCIS_H_
 #define _PI_SMMCIS_H_
 
-#include <Pi/PiMultiPhase.h>
+#include <Pi/PiMmCis.h>
 #include <Protocol/SmmCpuIo2.h>
 
 typedef struct _EFI_SMM_SYSTEM_TABLE2  EFI_SMM_SYSTEM_TABLE2;
-
-///
-/// The System Management System Table (SMST) signature
-///
-#define SMM_SMST_SIGNATURE            SIGNATURE_32 ('S', 'M', 'S', 'T')
-///
-/// The System Management System Table (SMST) revision is 1.4
-///
-#define SMM_SPECIFICATION_MAJOR_REVISION  1
-#define SMM_SPECIFICATION_MINOR_REVISION  40
-#define EFI_SMM_SYSTEM_TABLE2_REVISION    ((SMM_SPECIFICATION_MAJOR_REVISION<<16) | (SMM_SPECIFICATION_MINOR_REVISION))
+//
+// Define new MM related definition introduced by PI 1.5.
+//
+#define  SMM_SMST_SIGNATURE                MM_MMST_SIGNATURE
+#define  SMM_SPECIFICATION_MAJOR_REVISION  MM_SPECIFICATION_MAJOR_REVISION
+#define  SMM_SPECIFICATION_MINOR_REVISION  MM_SPECIFICATION_MINOR_REVISION
+#define  EFI_SMM_SYSTEM_TABLE2_REVISION    EFI_MM_SYSTEM_TABLE_REVISION
 
 /**
   Adds, updates, or removes a configuration table entry from the System Management System Table.
@@ -53,160 +49,19 @@ typedef struct _EFI_SMM_SYSTEM_TABLE2  EFI_SMM_SYSTEM_TABLE2;
 typedef
 EFI_STATUS
 (EFIAPI *EFI_SMM_INSTALL_CONFIGURATION_TABLE2)(
-  IN CONST EFI_SMM_SYSTEM_TABLE2  *SystemTable,
-  IN CONST EFI_GUID               *Guid,
-  IN VOID                         *Table,
-  IN UINTN                        TableSize
-  );
-
-/**
-  This service lets the caller to get one distinct application processor (AP) to execute
-  a caller-provided code stream while in SMM.
-
-  @param[in]     Procedure       A pointer to the code stream to be run on the designated
-                                 AP of the system.
-  @param[in]     CpuNumber       The zero-based index of the processor number of the AP
-                                 on which the code stream is supposed to run.
-  @param[in,out] ProcArguments   Allows the caller to pass a list of parameters to the code
-                                 that is run by the AP.
-
-  @retval EFI_SUCCESS            The call was successful and the return parameters are valid.
-  @retval EFI_INVALID_PARAMETER  The input arguments are out of range.
-  @retval EFI_INVALID_PARAMETER  The CPU requested is not available on this SMI invocation.
-  @retval EFI_INVALID_PARAMETER  The CPU cannot support an additional service invocation.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_STARTUP_THIS_AP)(
-  IN EFI_AP_PROCEDURE  Procedure,
-  IN UINTN             CpuNumber,
-  IN OUT VOID          *ProcArguments OPTIONAL
+  IN CONST EFI_SMM_SYSTEM_TABLE2    *SystemTable,
+  IN CONST EFI_GUID                 *Guid,
+  IN VOID                           *Table,
+  IN UINTN                          TableSize
   );
 
-/**
-  Function prototype for protocol install notification.
-
-  @param[in] Protocol   Points to the protocol's unique identifier.
-  @param[in] Interface  Points to the interface instance.
-  @param[in] Handle     The handle on which the interface was installed.
-
-  @return Status Code
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_NOTIFY_FN)(
-  IN CONST EFI_GUID  *Protocol,
-  IN VOID            *Interface,
-  IN EFI_HANDLE      Handle
-  );
-
-/**
-  Register a callback function be called when a particular protocol interface is installed.
-
-  The SmmRegisterProtocolNotify() function creates a registration Function that is to be 
-  called whenever a protocol interface is installed for Protocol by 
-  SmmInstallProtocolInterface().
-  If Function == NULL and Registration is an existing registration, then the callback is unhooked.
-
-  @param[in]  Protocol          The unique ID of the protocol for which the event is to be registered.
-  @param[in]  Function          Points to the notification function.
-  @param[out] Registration      A pointer to a memory location to receive the registration value.
-
-  @retval EFI_SUCCESS           Successfully returned the registration record
-                                that has been added or unhooked.
-  @retval EFI_INVALID_PARAMETER Protocol is NULL or Registration is NULL.
-  @retval EFI_OUT_OF_RESOURCES  Not enough memory resource to finish the request.
-  @retval EFI_NOT_FOUND         If the registration is not found when Function == NULL.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_REGISTER_PROTOCOL_NOTIFY)(
-  IN  CONST EFI_GUID     *Protocol,
-  IN  EFI_SMM_NOTIFY_FN  Function,
-  OUT VOID               **Registration
-  );
-
-/**
-  Manage SMI of a particular type.
-
-  @param[in]     HandlerType     Points to the handler type or NULL for root SMI handlers.
-  @param[in]     Context         Points to an optional context buffer.
-  @param[in,out] CommBuffer      Points to the optional communication buffer.
-  @param[in,out] CommBufferSize  Points to the size of the optional communication buffer.
-
-  @retval EFI_WARN_INTERRUPT_SOURCE_PENDING  Interrupt source was processed successfully but not quiesced.
-  @retval EFI_INTERRUPT_PENDING              One or more SMI sources could not be quiesced.
-  @retval EFI_NOT_FOUND                      Interrupt source was not handled or quiesced.
-  @retval EFI_SUCCESS                        Interrupt source was handled and quiesced.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_INTERRUPT_MANAGE)(
-  IN CONST EFI_GUID  *HandlerType,
-  IN CONST VOID      *Context         OPTIONAL,
-  IN OUT VOID        *CommBuffer      OPTIONAL,
-  IN OUT UINTN       *CommBufferSize  OPTIONAL
-  );
-
-/**
-  Main entry point for an SMM handler dispatch or communicate-based callback.
-
-  @param[in]     DispatchHandle  The unique handle assigned to this handler by SmiHandlerRegister().
-  @param[in]     Context         Points to an optional handler context which was specified when the
-                                 handler was registered.
-  @param[in,out] CommBuffer      A pointer to a collection of data in memory that will
-                                 be conveyed from a non-SMM environment into an SMM environment.
-  @param[in,out] CommBufferSize  The size of the CommBuffer.
-
-  @retval EFI_SUCCESS                         The interrupt was handled and quiesced. No other handlers 
-                                              should still be called.
-  @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED  The interrupt has been quiesced but other handlers should 
-                                              still be called.
-  @retval EFI_WARN_INTERRUPT_SOURCE_PENDING   The interrupt is still pending and other handlers should still 
-                                              be called.
-  @retval EFI_INTERRUPT_PENDING               The interrupt could not be quiesced.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_HANDLER_ENTRY_POINT2)(
-  IN EFI_HANDLE  DispatchHandle,
-  IN CONST VOID  *Context         OPTIONAL,
-  IN OUT VOID    *CommBuffer      OPTIONAL,
-  IN OUT UINTN   *CommBufferSize  OPTIONAL
-  );
-
-/**
-  Registers a handler to execute within SMM.
-
-  @param[in]  Handler            Handler service function pointer.
-  @param[in]  HandlerType        Points to the handler type or NULL for root SMI handlers.
-  @param[out] DispatchHandle     On return, contains a unique handle which can be used to later
-                                 unregister the handler function.
-
-  @retval EFI_SUCCESS            SMI handler added successfully.
-  @retval EFI_INVALID_PARAMETER  Handler is NULL or DispatchHandle is NULL.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_INTERRUPT_REGISTER)(
-  IN  EFI_SMM_HANDLER_ENTRY_POINT2  Handler,
-  IN  CONST EFI_GUID                *HandlerType OPTIONAL,
-  OUT EFI_HANDLE                    *DispatchHandle
-  );
-
-/**
-  Unregister a handler in SMM.
-
-  @param[in] DispatchHandle      The handle that was specified when the handler was registered.
-
-  @retval EFI_SUCCESS            Handler function was successfully unregistered.
-  @retval EFI_INVALID_PARAMETER  DispatchHandle does not refer to a valid handle.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_INTERRUPT_UNREGISTER)(
-  IN EFI_HANDLE  DispatchHandle
-  );
+typedef  EFI_MM_STARTUP_THIS_AP                EFI_SMM_STARTUP_THIS_AP;
+typedef  EFI_MM_NOTIFY_FN                      EFI_SMM_NOTIFY_FN;
+typedef  EFI_MM_REGISTER_PROTOCOL_NOTIFY       EFI_SMM_REGISTER_PROTOCOL_NOTIFY;
+typedef  EFI_MM_INTERRUPT_MANAGE               EFI_SMM_INTERRUPT_MANAGE;
+typedef  EFI_MM_HANDLER_ENTRY_POINT            EFI_SMM_HANDLER_ENTRY_POINT2;
+typedef  EFI_MM_INTERRUPT_REGISTER             EFI_SMM_INTERRUPT_REGISTER;
+typedef  EFI_MM_INTERRUPT_UNREGISTER           EFI_SMM_INTERRUPT_UNREGISTER;
 
 ///
 /// Processor information and functionality needed by SMM Foundation.
diff --git a/MdePkg/Include/Protocol/DxeSmmReadyToLock.h b/MdePkg/Include/Protocol/DxeSmmReadyToLock.h
index a52a8a2..1bb2535 100644
--- a/MdePkg/Include/Protocol/DxeSmmReadyToLock.h
+++ b/MdePkg/Include/Protocol/DxeSmmReadyToLock.h
@@ -17,7 +17,7 @@
   platform code may choose to use notification handler to lock SMM by invoking
   EFI_SMM_ACCESS2_PROTOCOL.Lock() function.
 
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -31,10 +31,9 @@
 #ifndef _DXE_SMM_READY_TO_LOCK_H_
 #define _DXE_SMM_READY_TO_LOCK_H_
 
-#define EFI_DXE_SMM_READY_TO_LOCK_PROTOCOL_GUID \
-  { \
-    0x60ff8964, 0xe906, 0x41d0, { 0xaf, 0xed, 0xf2, 0x41, 0xe9, 0x74, 0xe0, 0x8e } \
-  }
+#include <Protocol/DxeMmReadyToLock.h>
+
+#define EFI_DXE_SMM_READY_TO_LOCK_PROTOCOL_GUID EFI_DXE_MM_READY_TO_LOCK_PROTOCOL_GUID
 
 extern EFI_GUID gEfiDxeSmmReadyToLockProtocolGuid;
 
diff --git a/MdePkg/Include/Protocol/SmmAccess2.h b/MdePkg/Include/Protocol/SmmAccess2.h
index 5904266..3dc15fe 100644
--- a/MdePkg/Include/Protocol/SmmAccess2.h
+++ b/MdePkg/Include/Protocol/SmmAccess2.h
@@ -25,108 +25,19 @@
 #ifndef _SMM_ACCESS2_H_
 #define _SMM_ACCESS2_H_
 
-#define EFI_SMM_ACCESS2_PROTOCOL_GUID \
-  { \
-     0xc2702b74, 0x800c, 0x4131, {0x87, 0x46, 0x8f, 0xb5, 0xb8, 0x9c, 0xe4, 0xac } \
-  }
+#include <Protocol/MmAccess.h>
 
+#define EFI_SMM_ACCESS2_PROTOCOL_GUID       EFI_MM_ACCESS_PROTOCOL_GUID
 
-typedef struct _EFI_SMM_ACCESS2_PROTOCOL  EFI_SMM_ACCESS2_PROTOCOL;
+typedef EFI_MM_ACCESS_PROTOCOL  EFI_SMM_ACCESS2_PROTOCOL;
 
-/**
-  Opens the SMRAM area to be accessible by a boot-service driver.
+typedef EFI_MM_OPEN EFI_SMM_OPEN2;
 
-  This function "opens" SMRAM so that it is visible while not inside of SMM. The function should 
-  return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM. The function 
-  should return EFI_DEVICE_ERROR if the SMRAM configuration is locked.
+typedef EFI_MM_CLOSE EFI_SMM_CLOSE2;
 
-  @param[in] This           The EFI_SMM_ACCESS2_PROTOCOL instance.
-
-  @retval EFI_SUCCESS       The operation was successful.
-  @retval EFI_UNSUPPORTED   The system does not support opening and closing of SMRAM.
-  @retval EFI_DEVICE_ERROR  SMRAM cannot be opened, perhaps because it is locked.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_OPEN2)(
-  IN EFI_SMM_ACCESS2_PROTOCOL  *This
-  );
-
-/**
-  Inhibits access to the SMRAM.
-
-  This function "closes" SMRAM so that it is not visible while outside of SMM. The function should 
-  return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM.
-
-  @param[in] This           The EFI_SMM_ACCESS2_PROTOCOL instance.
-
-  @retval EFI_SUCCESS       The operation was successful.
-  @retval EFI_UNSUPPORTED   The system does not support opening and closing of SMRAM.
-  @retval EFI_DEVICE_ERROR  SMRAM cannot be closed.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_CLOSE2)(
-  IN EFI_SMM_ACCESS2_PROTOCOL  *This
-  );
-
-/**
-  Inhibits access to the SMRAM.
-
-  This function prohibits access to the SMRAM region.  This function is usually implemented such 
-  that it is a write-once operation. 
-
-  @param[in] This          The EFI_SMM_ACCESS2_PROTOCOL instance.
-
-  @retval EFI_SUCCESS      The device was successfully locked.
-  @retval EFI_UNSUPPORTED  The system does not support locking of SMRAM.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_LOCK2)(
-  IN EFI_SMM_ACCESS2_PROTOCOL  *This
-  );
-
-/**
-  Queries the memory controller for the possible regions that will support SMRAM.
-
-  @param[in]     This           The EFI_SMM_ACCESS2_PROTOCOL instance.
-  @param[in,out] SmramMapSize   A pointer to the size, in bytes, of the SmramMemoryMap buffer.
-  @param[in,out] SmramMap       A pointer to the buffer in which firmware places the current memory map.
-
-  @retval EFI_SUCCESS           The chipset supported the given resource.
-  @retval EFI_BUFFER_TOO_SMALL  The SmramMap parameter was too small.  The current buffer size 
-                                needed to hold the memory map is returned in SmramMapSize.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_CAPABILITIES2)(
-  IN CONST EFI_SMM_ACCESS2_PROTOCOL  *This,
-  IN OUT UINTN                       *SmramMapSize,
-  IN OUT EFI_SMRAM_DESCRIPTOR        *SmramMap
-  );
-
-///
-///  EFI SMM Access2 Protocol is used to control the visibility of the SMRAM on the platform.
-///  It abstracts the location and characteristics of SMRAM. The platform should report all 
-///  MMRAM via EFI_MM_ACCESS_PROTOCOL. The expectation is that the north bridge or memory 
-///  controller would publish this protocol.
-/// 
-struct _EFI_SMM_ACCESS2_PROTOCOL {
-  EFI_SMM_OPEN2          Open;
-  EFI_SMM_CLOSE2         Close;
-  EFI_SMM_LOCK2          Lock;
-  EFI_SMM_CAPABILITIES2  GetCapabilities;
-  ///
-  /// Indicates the current state of the SMRAM. Set to TRUE if SMRAM is locked.
-  ///
-  BOOLEAN               LockState;
-  ///
-  /// Indicates the current state of the SMRAM. Set to TRUE if SMRAM is open.
-  ///
-  BOOLEAN               OpenState;
-};
+typedef EFI_MM_LOCK EFI_SMM_LOCK2;
 
+typedef EFI_MM_CAPABILITIES EFI_SMM_CAPABILITIES2;
 extern EFI_GUID gEfiSmmAccess2ProtocolGuid;
 
 #endif
diff --git a/MdePkg/Include/Protocol/SmmBase2.h b/MdePkg/Include/Protocol/SmmBase2.h
index d60428c..0033e4e 100644
--- a/MdePkg/Include/Protocol/SmmBase2.h
+++ b/MdePkg/Include/Protocol/SmmBase2.h
@@ -4,7 +4,7 @@
   This protocol is utilized by all SMM drivers to locate the SMM infrastructure services and determine
   whether the driver is being invoked inside SMRAM or outside of SMRAM.
 
-  Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
   which accompanies this distribution.  The full text of the license may be found at        
@@ -19,11 +19,9 @@
 #define _SMM_BASE2_H_
 
 #include <Pi/PiSmmCis.h>
+#include <Protocol/MmBase.h>
 
-#define EFI_SMM_BASE2_PROTOCOL_GUID \
-  { \
-    0xf4ccbfb7, 0xf6e0, 0x47fd, {0x9d, 0xd4, 0x10, 0xa8, 0xf1, 0x50, 0xc1, 0x91 }  \
-  }
+#define EFI_SMM_BASE2_PROTOCOL_GUID  EFI_MM_BASE_PROTOCOL_GUID
 
 typedef struct _EFI_SMM_BASE2_PROTOCOL  EFI_SMM_BASE2_PROTOCOL;
 
diff --git a/MdePkg/Include/Protocol/SmmCommunication.h b/MdePkg/Include/Protocol/SmmCommunication.h
index 5587d49..95b8d0d 100644
--- a/MdePkg/Include/Protocol/SmmCommunication.h
+++ b/MdePkg/Include/Protocol/SmmCommunication.h
@@ -18,64 +18,14 @@
 #ifndef _SMM_COMMUNICATION_H_
 #define _SMM_COMMUNICATION_H_
 
-#pragma pack(1)
+#include <Protocol/MmCommunication.h>
 
-///
-/// To avoid confusion in interpreting frames, the communication buffer should always 
-/// begin with EFI_SMM_COMMUNICATE_HEADER
-///
-typedef struct {
-  ///
-  /// Allows for disambiguation of the message format.
-  ///
-  EFI_GUID  HeaderGuid;
-  ///
-  /// Describes the size of Data (in bytes) and does not include the size of the header.
-  ///
-  UINTN     MessageLength;
-  ///
-  /// Designates an array of bytes that is MessageLength in size.
-  ///
-  UINT8     Data[1];
-} EFI_SMM_COMMUNICATE_HEADER;
 
-#pragma pack()
+typedef EFI_MM_COMMUNICATE_HEADER EFI_SMM_COMMUNICATE_HEADER;
 
-#define EFI_SMM_COMMUNICATION_PROTOCOL_GUID \
-  { \
-    0xc68ed8e2, 0x9dc6, 0x4cbd, { 0x9d, 0x94, 0xdb, 0x65, 0xac, 0xc5, 0xc3, 0x32 } \
-  }
+#define EFI_SMM_COMMUNICATION_PROTOCOL_GUID EFI_MM_COMMUNICATION_PROTOCOL_GUID
 
-typedef struct _EFI_SMM_COMMUNICATION_PROTOCOL  EFI_SMM_COMMUNICATION_PROTOCOL;
-
-/**
-  Communicates with a registered handler.
-  
-  This function provides a service to send and receive messages from a registered UEFI service.
-
-  @param[in] This                The EFI_SMM_COMMUNICATION_PROTOCOL instance.
-  @param[in] CommBuffer          A pointer to the buffer to convey into SMRAM.
-  @param[in] CommSize            The size of the data buffer being passed in.On exit, the size of data
-                                 being returned. Zero if the handler does not wish to reply with any data.
-
-  @retval EFI_SUCCESS            The message was successfully posted.
-  @retval EFI_INVALID_PARAMETER  The CommBuffer was NULL.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_COMMUNICATE2)(
-  IN CONST EFI_SMM_COMMUNICATION_PROTOCOL  *This,
-  IN OUT VOID                              *CommBuffer,
-  IN OUT UINTN                             *CommSize
-  );
-
-///
-/// EFI SMM Communication Protocol provides runtime services for communicating
-/// between DXE drivers and a registered SMI handler.
-///
-struct _EFI_SMM_COMMUNICATION_PROTOCOL {
-  EFI_SMM_COMMUNICATE2  Communicate;
-};
+typedef EFI_MM_COMMUNICATION_PROTOCOL EFI_SMM_COMMUNICATION_PROTOCOL;
 
 extern EFI_GUID gEfiSmmCommunicationProtocolGuid;
 
diff --git a/MdePkg/Include/Protocol/SmmConfiguration.h b/MdePkg/Include/Protocol/SmmConfiguration.h
index 3674831..af47edb 100644
--- a/MdePkg/Include/Protocol/SmmConfiguration.h
+++ b/MdePkg/Include/Protocol/SmmConfiguration.h
@@ -6,7 +6,7 @@
   2) register the SMM Foundation entry point with the processor code. The entry
      point will be invoked by the SMM processor entry code.
   
-  Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
   which accompanies this distribution.  The full text of the license may be found at        
@@ -20,12 +20,10 @@
 #ifndef _SMM_CONFIGURATION_H_
 #define _SMM_CONFIGURATION_H_
 
+#include <Protocol/MmConfiguration.h>
 #include <Pi/PiSmmCis.h>
 
-#define EFI_SMM_CONFIGURATION_PROTOCOL_GUID \
-  { \
-    0x26eeb3de, 0xb689, 0x492e, {0x80, 0xf0, 0xbe, 0x8b, 0xd7, 0xda, 0x4b, 0xa7 }  \
-  }
+#define EFI_SMM_CONFIGURATION_PROTOCOL_GUID EFI_MM_CONFIGURATION_PROTOCOL_GUID
 
 ///
 /// Structure describing a SMRAM region which cannot be used for the SMRAM heap.
diff --git a/MdePkg/Include/Protocol/SmmControl2.h b/MdePkg/Include/Protocol/SmmControl2.h
index 58df62a..7177f8e 100644
--- a/MdePkg/Include/Protocol/SmmControl2.h
+++ b/MdePkg/Include/Protocol/SmmControl2.h
@@ -11,7 +11,7 @@
   accessed, will generate the SMI.  Also, the hardware optionally supports the periodic generation of 
   these signals.
 
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
   which accompanies this distribution.  The full text of the license may be found at        
@@ -25,81 +25,16 @@
 #ifndef _SMM_CONTROL2_H_
 #define _SMM_CONTROL2_H_
 
-#include <PiDxe.h>
+#include <Protocol/MmControl.h>
 
-#define EFI_SMM_CONTROL2_PROTOCOL_GUID \
-  { \
-    0x843dc720, 0xab1e, 0x42cb, {0x93, 0x57, 0x8a, 0x0, 0x78, 0xf3, 0x56, 0x1b}  \
-  }
+#define EFI_SMM_CONTROL2_PROTOCOL_GUID EFI_MM_CONTROL_PROTOCOL_GUID
 
-typedef struct _EFI_SMM_CONTROL2_PROTOCOL  EFI_SMM_CONTROL2_PROTOCOL;
-typedef UINTN  EFI_SMM_PERIOD;
+typedef EFI_MM_CONTROL_PROTOCOL  EFI_SMM_CONTROL2_PROTOCOL;
+typedef EFI_MM_PERIOD  EFI_SMM_PERIOD;
 
-/**
-  Invokes SMI activation from either the preboot or runtime environment.
-
-  This function generates an SMI.
-
-  @param[in]     This                The EFI_SMM_CONTROL2_PROTOCOL instance.
-  @param[in,out] CommandPort         The value written to the command port.
-  @param[in,out] DataPort            The value written to the data port.
-  @param[in]     Periodic            Optional mechanism to engender a periodic stream.
-  @param[in]     ActivationInterval  Optional parameter to repeat at this period one
-                                     time or, if the Periodic Boolean is set, periodically.
-
-  @retval EFI_SUCCESS            The SMI/PMI has been engendered.
-  @retval EFI_DEVICE_ERROR       The timing is unsupported.
-  @retval EFI_INVALID_PARAMETER  The activation period is unsupported.
-  @retval EFI_INVALID_PARAMETER  The last periodic activation has not been cleared. 
-  @retval EFI_NOT_STARTED        The SMM base service has not been initialized.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_ACTIVATE2)(
-  IN CONST EFI_SMM_CONTROL2_PROTOCOL  *This,
-  IN OUT UINT8                        *CommandPort       OPTIONAL,
-  IN OUT UINT8                        *DataPort          OPTIONAL,
-  IN BOOLEAN                          Periodic           OPTIONAL,
-  IN UINTN                            ActivationInterval OPTIONAL
-  );
-
-/**
-  Clears any system state that was created in response to the Trigger() call.
-
-  This function acknowledges and causes the deassertion of the SMI activation source.
-
-  @param[in] This                The EFI_SMM_CONTROL2_PROTOCOL instance.
-  @param[in] Periodic            Optional parameter to repeat at this period one time
-
-  @retval EFI_SUCCESS            The SMI/PMI has been engendered.
-  @retval EFI_DEVICE_ERROR       The source could not be cleared.
-  @retval EFI_INVALID_PARAMETER  The service did not support the Periodic input argument.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_DEACTIVATE2)(
-  IN CONST EFI_SMM_CONTROL2_PROTOCOL  *This,
-  IN BOOLEAN                          Periodic OPTIONAL
-  );
-
-///
-/// The EFI_SMM_CONTROL2_PROTOCOL is produced by a runtime driver. It provides  an 
-/// abstraction of the platform hardware that generates an SMI.  There are often I/O ports that, when 
-/// accessed, will generate the SMI.  Also, the hardware optionally supports the periodic generation of 
-/// these signals.
-///
-struct _EFI_SMM_CONTROL2_PROTOCOL {
-  EFI_SMM_ACTIVATE2    Trigger;
-  EFI_SMM_DEACTIVATE2  Clear;
-  ///
-  /// Minimum interval at which the platform can set the period.  A maximum is not 
-  /// specified in that the SMM infrastructure code can emulate a maximum interval that is 
-  /// greater than the hardware capabilities by using software emulation in the SMM 
-  /// infrastructure code.
-  ///
-  EFI_SMM_PERIOD      MinimumTriggerPeriod;
-};
+typedef EFI_MM_ACTIVATE EFI_SMM_ACTIVATE2;
 
+typedef EFI_MM_DEACTIVATE EFI_SMM_DEACTIVATE2;
 extern EFI_GUID gEfiSmmControl2ProtocolGuid;
 
 #endif
diff --git a/MdePkg/Include/Protocol/SmmCpu.h b/MdePkg/Include/Protocol/SmmCpu.h
index 2e7f7c3..e00eda4 100644
--- a/MdePkg/Include/Protocol/SmmCpu.h
+++ b/MdePkg/Include/Protocol/SmmCpu.h
@@ -6,7 +6,7 @@
   but not in the same format. These so-called pseudo-registers provide this information in a standard 
   format.  
 
-  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD License         
   which accompanies this distribution.  The full text of the license may be found at        
@@ -20,227 +20,116 @@
 #ifndef _SMM_CPU_H_
 #define _SMM_CPU_H_
 
-#define EFI_SMM_CPU_PROTOCOL_GUID \
-  { \
-    0xeb346b97, 0x975f, 0x4a9f, { 0x8b, 0x22, 0xf8, 0xe9, 0x2b, 0xb3, 0xd5, 0x69 } \
-  }
+#include <Protocol/MmCpu.h>
+
+#define EFI_SMM_CPU_PROTOCOL_GUID  EFI_MM_CPU_PROTOCOL_GUID
+
+#define EFI_SMM_SAVE_STATE_REGISTER_GDTBASE       EFI_MM_SAVE_STATE_REGISTER_GDTBASE
+#define EFI_SMM_SAVE_STATE_REGISTER_IDTBASE       EFI_MM_SAVE_STATE_REGISTER_IDTBASE
+#define EFI_SMM_SAVE_STATE_REGISTER_LDTBASE       EFI_MM_SAVE_STATE_REGISTER_LDTBASE
+#define EFI_SMM_SAVE_STATE_REGISTER_GDTLIMIT      EFI_MM_SAVE_STATE_REGISTER_GDTLIMIT
+#define EFI_SMM_SAVE_STATE_REGISTER_IDTLIMIT      EFI_MM_SAVE_STATE_REGISTER_IDTLIMIT
+#define EFI_SMM_SAVE_STATE_REGISTER_LDTLIMIT      EFI_MM_SAVE_STATE_REGISTER_LDTLIMIT
+#define EFI_SMM_SAVE_STATE_REGISTER_LDTINFO       EFI_MM_SAVE_STATE_REGISTER_LDTINFO
+#define EFI_SMM_SAVE_STATE_REGISTER_ES            EFI_MM_SAVE_STATE_REGISTER_ES
+#define EFI_SMM_SAVE_STATE_REGISTER_CS            EFI_MM_SAVE_STATE_REGISTER_CS
+#define EFI_SMM_SAVE_STATE_REGISTER_SS            EFI_MM_SAVE_STATE_REGISTER_SS
+#define EFI_SMM_SAVE_STATE_REGISTER_DS            EFI_MM_SAVE_STATE_REGISTER_DS
+#define EFI_SMM_SAVE_STATE_REGISTER_FS            EFI_MM_SAVE_STATE_REGISTER_FS
+#define EFI_SMM_SAVE_STATE_REGISTER_GS            EFI_MM_SAVE_STATE_REGISTER_GS
+#define EFI_SMM_SAVE_STATE_REGISTER_LDTR_SEL      EFI_MM_SAVE_STATE_REGISTER_LDTR_SEL
+#define EFI_SMM_SAVE_STATE_REGISTER_TR_SEL        EFI_MM_SAVE_STATE_REGISTER_TR_SEL
+#define EFI_SMM_SAVE_STATE_REGISTER_DR7           EFI_MM_SAVE_STATE_REGISTER_DR7
+#define EFI_SMM_SAVE_STATE_REGISTER_DR6           EFI_MM_SAVE_STATE_REGISTER_DR6
+#define EFI_SMM_SAVE_STATE_REGISTER_R8            EFI_MM_SAVE_STATE_REGISTER_R8
+#define EFI_SMM_SAVE_STATE_REGISTER_R9            EFI_MM_SAVE_STATE_REGISTER_R9
+#define EFI_SMM_SAVE_STATE_REGISTER_R10           EFI_MM_SAVE_STATE_REGISTER_R10
+#define EFI_SMM_SAVE_STATE_REGISTER_R11           EFI_MM_SAVE_STATE_REGISTER_R11
+#define EFI_SMM_SAVE_STATE_REGISTER_R12           EFI_MM_SAVE_STATE_REGISTER_R12
+#define EFI_SMM_SAVE_STATE_REGISTER_R13           EFI_MM_SAVE_STATE_REGISTER_R13
+#define EFI_SMM_SAVE_STATE_REGISTER_R14           EFI_MM_SAVE_STATE_REGISTER_R14
+#define EFI_SMM_SAVE_STATE_REGISTER_R15           EFI_MM_SAVE_STATE_REGISTER_R15
+#define EFI_SMM_SAVE_STATE_REGISTER_RAX           EFI_MM_SAVE_STATE_REGISTER_RAX
+#define EFI_SMM_SAVE_STATE_REGISTER_RBX           EFI_MM_SAVE_STATE_REGISTER_RBX
+#define EFI_SMM_SAVE_STATE_REGISTER_RCX           EFI_MM_SAVE_STATE_REGISTER_RCX
+#define EFI_SMM_SAVE_STATE_REGISTER_RDX           EFI_MM_SAVE_STATE_REGISTER_RDX
+#define EFI_SMM_SAVE_STATE_REGISTER_RSP           EFI_MM_SAVE_STATE_REGISTER_RSP
+#define EFI_SMM_SAVE_STATE_REGISTER_RBP           EFI_MM_SAVE_STATE_REGISTER_RBP
+#define EFI_SMM_SAVE_STATE_REGISTER_RSI           EFI_MM_SAVE_STATE_REGISTER_RSI
+#define EFI_SMM_SAVE_STATE_REGISTER_RDI           EFI_MM_SAVE_STATE_REGISTER_RDI
+#define EFI_SMM_SAVE_STATE_REGISTER_RIP           EFI_MM_SAVE_STATE_REGISTER_RIP
+#define EFI_SMM_SAVE_STATE_REGISTER_RFLAGS        EFI_MM_SAVE_STATE_REGISTER_RFLAGS
+#define EFI_SMM_SAVE_STATE_REGISTER_CR0           EFI_MM_SAVE_STATE_REGISTER_CR0
+#define EFI_SMM_SAVE_STATE_REGISTER_CR3           EFI_MM_SAVE_STATE_REGISTER_CR3
+#define EFI_SMM_SAVE_STATE_REGISTER_CR4           EFI_MM_SAVE_STATE_REGISTER_CR4
+#define EFI_SMM_SAVE_STATE_REGISTER_FCW           EFI_MM_SAVE_STATE_REGISTER_FCW
+#define EFI_SMM_SAVE_STATE_REGISTER_FSW           EFI_MM_SAVE_STATE_REGISTER_FSW
+#define EFI_SMM_SAVE_STATE_REGISTER_FTW           EFI_MM_SAVE_STATE_REGISTER_FTW
+#define EFI_SMM_SAVE_STATE_REGISTER_OPCODE        EFI_MM_SAVE_STATE_REGISTER_OPCODE
+#define EFI_SMM_SAVE_STATE_REGISTER_FP_EIP        EFI_MM_SAVE_STATE_REGISTER_FP_EIP
+#define EFI_SMM_SAVE_STATE_REGISTER_FP_CS         EFI_MM_SAVE_STATE_REGISTER_FP_CS
+#define EFI_SMM_SAVE_STATE_REGISTER_DATAOFFSET    EFI_MM_SAVE_STATE_REGISTER_DATAOFFSET
+#define EFI_SMM_SAVE_STATE_REGISTER_FP_DS         EFI_MM_SAVE_STATE_REGISTER_FP_DS
+#define EFI_SMM_SAVE_STATE_REGISTER_MM0           EFI_MM_SAVE_STATE_REGISTER_MM0
+#define EFI_SMM_SAVE_STATE_REGISTER_MM1           EFI_MM_SAVE_STATE_REGISTER_MM1
+#define EFI_SMM_SAVE_STATE_REGISTER_MM2           EFI_MM_SAVE_STATE_REGISTER_MM2
+#define EFI_SMM_SAVE_STATE_REGISTER_MM3           EFI_MM_SAVE_STATE_REGISTER_MM3
+#define EFI_SMM_SAVE_STATE_REGISTER_MM4           EFI_MM_SAVE_STATE_REGISTER_MM4
+#define EFI_SMM_SAVE_STATE_REGISTER_MM5           EFI_MM_SAVE_STATE_REGISTER_MM5
+#define EFI_SMM_SAVE_STATE_REGISTER_MM6           EFI_MM_SAVE_STATE_REGISTER_MM6
+#define EFI_SMM_SAVE_STATE_REGISTER_MM7           EFI_MM_SAVE_STATE_REGISTER_MM7
+#define EFI_SMM_SAVE_STATE_REGISTER_XMM0          EFI_MM_SAVE_STATE_REGISTER_XMM0
+#define EFI_SMM_SAVE_STATE_REGISTER_XMM1          EFI_MM_SAVE_STATE_REGISTER_XMM1
+#define EFI_SMM_SAVE_STATE_REGISTER_XMM2          EFI_MM_SAVE_STATE_REGISTER_XMM2
+#define EFI_SMM_SAVE_STATE_REGISTER_XMM3          EFI_MM_SAVE_STATE_REGISTER_XMM3
+#define EFI_SMM_SAVE_STATE_REGISTER_XMM4          EFI_MM_SAVE_STATE_REGISTER_XMM4
+#define EFI_SMM_SAVE_STATE_REGISTER_XMM5          EFI_MM_SAVE_STATE_REGISTER_XMM5
+#define EFI_SMM_SAVE_STATE_REGISTER_XMM6          EFI_MM_SAVE_STATE_REGISTER_XMM6
+#define EFI_SMM_SAVE_STATE_REGISTER_XMM7          EFI_MM_SAVE_STATE_REGISTER_XMM7
+#define EFI_SMM_SAVE_STATE_REGISTER_XMM8          EFI_MM_SAVE_STATE_REGISTER_XMM8
+#define EFI_SMM_SAVE_STATE_REGISTER_XMM9          EFI_MM_SAVE_STATE_REGISTER_XMM9
+#define EFI_SMM_SAVE_STATE_REGISTER_XMM10         EFI_MM_SAVE_STATE_REGISTER_XMM10
+#define EFI_SMM_SAVE_STATE_REGISTER_XMM11         EFI_MM_SAVE_STATE_REGISTER_XMM11
+#define EFI_SMM_SAVE_STATE_REGISTER_XMM12         EFI_MM_SAVE_STATE_REGISTER_XMM12
+#define EFI_SMM_SAVE_STATE_REGISTER_XMM13         EFI_MM_SAVE_STATE_REGISTER_XMM13
+#define EFI_SMM_SAVE_STATE_REGISTER_XMM14         EFI_MM_SAVE_STATE_REGISTER_XMM14
+#define EFI_SMM_SAVE_STATE_REGISTER_XMM15         EFI_MM_SAVE_STATE_REGISTER_XMM15
+#define EFI_SMM_SAVE_STATE_REGISTER_IO            EFI_MM_SAVE_STATE_REGISTER_IO
+#define EFI_SMM_SAVE_STATE_REGISTER_LMA           EFI_MM_SAVE_STATE_REGISTER_LMA
+#define EFI_SMM_SAVE_STATE_REGISTER_PROCESSOR_ID  EFI_MM_SAVE_STATE_REGISTER_PROCESSOR_ID
+
+typedef EFI_MM_SAVE_STATE_REGISTER  EFI_SMM_SAVE_STATE_REGISTER;
+
+
+#define EFI_SMM_SAVE_STATE_REGISTER_LMA_32BIT EFI_MM_SAVE_STATE_REGISTER_LMA_32BIT
+#define EFI_SMM_SAVE_STATE_REGISTER_LMA_64BIT EFI_MM_SAVE_STATE_REGISTER_LMA_64BIT
 
-///
-/// Save State register index
-///
-typedef enum {
-  ///
-  /// x86/X64 standard registers
-  ///
-  EFI_SMM_SAVE_STATE_REGISTER_GDTBASE       = 4,
-  EFI_SMM_SAVE_STATE_REGISTER_IDTBASE       = 5,
-  EFI_SMM_SAVE_STATE_REGISTER_LDTBASE       = 6,
-  EFI_SMM_SAVE_STATE_REGISTER_GDTLIMIT      = 7,
-  EFI_SMM_SAVE_STATE_REGISTER_IDTLIMIT      = 8,
-  EFI_SMM_SAVE_STATE_REGISTER_LDTLIMIT      = 9,
-  EFI_SMM_SAVE_STATE_REGISTER_LDTINFO       = 10,
-  EFI_SMM_SAVE_STATE_REGISTER_ES            = 20,
-  EFI_SMM_SAVE_STATE_REGISTER_CS            = 21,
-  EFI_SMM_SAVE_STATE_REGISTER_SS            = 22,
-  EFI_SMM_SAVE_STATE_REGISTER_DS            = 23,
-  EFI_SMM_SAVE_STATE_REGISTER_FS            = 24,
-  EFI_SMM_SAVE_STATE_REGISTER_GS            = 25,
-  EFI_SMM_SAVE_STATE_REGISTER_LDTR_SEL      = 26,
-  EFI_SMM_SAVE_STATE_REGISTER_TR_SEL        = 27,
-  EFI_SMM_SAVE_STATE_REGISTER_DR7           = 28,
-  EFI_SMM_SAVE_STATE_REGISTER_DR6           = 29,
-  EFI_SMM_SAVE_STATE_REGISTER_R8            = 30,
-  EFI_SMM_SAVE_STATE_REGISTER_R9            = 31,
-  EFI_SMM_SAVE_STATE_REGISTER_R10           = 32,
-  EFI_SMM_SAVE_STATE_REGISTER_R11           = 33,
-  EFI_SMM_SAVE_STATE_REGISTER_R12           = 34,
-  EFI_SMM_SAVE_STATE_REGISTER_R13           = 35,
-  EFI_SMM_SAVE_STATE_REGISTER_R14           = 36,
-  EFI_SMM_SAVE_STATE_REGISTER_R15           = 37,  
-  EFI_SMM_SAVE_STATE_REGISTER_RAX           = 38,
-  EFI_SMM_SAVE_STATE_REGISTER_RBX           = 39,
-  EFI_SMM_SAVE_STATE_REGISTER_RCX           = 40,
-  EFI_SMM_SAVE_STATE_REGISTER_RDX           = 41,
-  EFI_SMM_SAVE_STATE_REGISTER_RSP           = 42,
-  EFI_SMM_SAVE_STATE_REGISTER_RBP           = 43,
-  EFI_SMM_SAVE_STATE_REGISTER_RSI           = 44,
-  EFI_SMM_SAVE_STATE_REGISTER_RDI           = 45,
-  EFI_SMM_SAVE_STATE_REGISTER_RIP           = 46,
-  EFI_SMM_SAVE_STATE_REGISTER_RFLAGS        = 51,
-  EFI_SMM_SAVE_STATE_REGISTER_CR0           = 52,
-  EFI_SMM_SAVE_STATE_REGISTER_CR3           = 53,
-  EFI_SMM_SAVE_STATE_REGISTER_CR4           = 54,
-  EFI_SMM_SAVE_STATE_REGISTER_FCW           = 256,
-  EFI_SMM_SAVE_STATE_REGISTER_FSW           = 257,
-  EFI_SMM_SAVE_STATE_REGISTER_FTW           = 258,  
-  EFI_SMM_SAVE_STATE_REGISTER_OPCODE        = 259,
-  EFI_SMM_SAVE_STATE_REGISTER_FP_EIP        = 260,
-  EFI_SMM_SAVE_STATE_REGISTER_FP_CS         = 261,
-  EFI_SMM_SAVE_STATE_REGISTER_DATAOFFSET    = 262,
-  EFI_SMM_SAVE_STATE_REGISTER_FP_DS         = 263,
-  EFI_SMM_SAVE_STATE_REGISTER_MM0           = 264,
-  EFI_SMM_SAVE_STATE_REGISTER_MM1           = 265,
-  EFI_SMM_SAVE_STATE_REGISTER_MM2           = 266,
-  EFI_SMM_SAVE_STATE_REGISTER_MM3           = 267,
-  EFI_SMM_SAVE_STATE_REGISTER_MM4           = 268,
-  EFI_SMM_SAVE_STATE_REGISTER_MM5           = 269,
-  EFI_SMM_SAVE_STATE_REGISTER_MM6           = 270,
-  EFI_SMM_SAVE_STATE_REGISTER_MM7           = 271,
-  EFI_SMM_SAVE_STATE_REGISTER_XMM0          = 272,
-  EFI_SMM_SAVE_STATE_REGISTER_XMM1          = 273,
-  EFI_SMM_SAVE_STATE_REGISTER_XMM2          = 274,
-  EFI_SMM_SAVE_STATE_REGISTER_XMM3          = 275,
-  EFI_SMM_SAVE_STATE_REGISTER_XMM4          = 276,
-  EFI_SMM_SAVE_STATE_REGISTER_XMM5          = 277,
-  EFI_SMM_SAVE_STATE_REGISTER_XMM6          = 278,
-  EFI_SMM_SAVE_STATE_REGISTER_XMM7          = 279,
-  EFI_SMM_SAVE_STATE_REGISTER_XMM8          = 280,
-  EFI_SMM_SAVE_STATE_REGISTER_XMM9          = 281,
-  EFI_SMM_SAVE_STATE_REGISTER_XMM10         = 282,
-  EFI_SMM_SAVE_STATE_REGISTER_XMM11         = 283,
-  EFI_SMM_SAVE_STATE_REGISTER_XMM12         = 284,
-  EFI_SMM_SAVE_STATE_REGISTER_XMM13         = 285,
-  EFI_SMM_SAVE_STATE_REGISTER_XMM14         = 286,
-  EFI_SMM_SAVE_STATE_REGISTER_XMM15         = 287,  
-  ///
-  /// Pseudo-Registers
-  ///
-  EFI_SMM_SAVE_STATE_REGISTER_IO            = 512,
-  EFI_SMM_SAVE_STATE_REGISTER_LMA           = 513,
-  EFI_SMM_SAVE_STATE_REGISTER_PROCESSOR_ID  = 514
-} EFI_SMM_SAVE_STATE_REGISTER;  
-
-///
-/// The EFI_SMM_SAVE_STATE_REGISTER_LMA pseudo-register values
-/// If the processor acts in 32-bit mode at the time the SMI occurred, the pseudo register value 
-/// EFI_SMM_SAVE_STATE_REGISTER_LMA_32BIT is returned in Buffer. Otherwise, 
-/// EFI_SMM_SAVE_STATE_REGISTER_LMA_64BIT is returned in Buffer.
-///
-#define EFI_SMM_SAVE_STATE_REGISTER_LMA_32BIT  32
-#define EFI_SMM_SAVE_STATE_REGISTER_LMA_64BIT  64
 
 ///
 /// Size width of I/O instruction
 ///
-typedef enum {
-  EFI_SMM_SAVE_STATE_IO_WIDTH_UINT8      = 0,
-  EFI_SMM_SAVE_STATE_IO_WIDTH_UINT16     = 1,
-  EFI_SMM_SAVE_STATE_IO_WIDTH_UINT32     = 2,
-  EFI_SMM_SAVE_STATE_IO_WIDTH_UINT64     = 3
-} EFI_SMM_SAVE_STATE_IO_WIDTH;
+#define EFI_SMM_SAVE_STATE_IO_WIDTH_UINT8 EFI_MM_SAVE_STATE_IO_WIDTH_UINT8
+#define EFI_SMM_SAVE_STATE_IO_WIDTH_UINT16 EFI_MM_SAVE_STATE_IO_WIDTH_UINT16
+#define EFI_SMM_SAVE_STATE_IO_WIDTH_UINT32 EFI_MM_SAVE_STATE_IO_WIDTH_UINT32
+#define EFI_SMM_SAVE_STATE_IO_WIDTH_UINT64 EFI_MM_SAVE_STATE_IO_WIDTH_UINT64
+typedef EFI_MM_SAVE_STATE_IO_WIDTH EFI_SMM_SAVE_STATE_IO_WIDTH ;
 
 ///
 /// Types of I/O instruction
 ///
-typedef enum {
-  EFI_SMM_SAVE_STATE_IO_TYPE_INPUT       = 1,
-  EFI_SMM_SAVE_STATE_IO_TYPE_OUTPUT      = 2,
-  EFI_SMM_SAVE_STATE_IO_TYPE_STRING      = 4,
-  EFI_SMM_SAVE_STATE_IO_TYPE_REP_PREFIX  = 8
-} EFI_SMM_SAVE_STATE_IO_TYPE;
+#define EFI_SMM_SAVE_STATE_IO_TYPE_INPUT EFI_MM_SAVE_STATE_IO_TYPE_INPUT
+#define EFI_SMM_SAVE_STATE_IO_TYPE_OUTPUT EFI_MM_SAVE_STATE_IO_TYPE_OUTPUT
+#define EFI_SMM_SAVE_STATE_IO_TYPE_STRING EFI_MM_SAVE_STATE_IO_TYPE_STRING
+#define EFI_SMM_SAVE_STATE_IO_TYPE_REP_PREFIX EFI_MM_SAVE_STATE_IO_TYPE_REP_PREFIX
+typedef  EFI_MM_SAVE_STATE_IO_TYPE EFI_SMM_SAVE_STATE_IO_TYPE;
 
-///
-/// Structure of the data which is returned when ReadSaveState() is called with 
-/// EFI_SMM_SAVE_STATE_REGISTER_IO. If there was no I/O then ReadSaveState() will 
-/// return EFI_NOT_FOUND.
-///
-/// This structure describes the I/O operation which was in process when the SMI was generated.
-///
-typedef struct _EFI_SMM_SAVE_STATE_IO_INFO {
-  ///
-  /// For input instruction (IN, INS), this is data read before the SMI occurred. For output 
-  /// instructions (OUT, OUTS) this is data that was written before the SMI occurred. The 
-  /// width of the data is specified by IoWidth.
-  ///
-  UINT64                        IoData;
-  ///
-  /// The I/O port that was being accessed when the SMI was triggered.
-  ///
-  UINT16                        IoPort;
-  ///
-  /// Defines the size width (UINT8, UINT16, UINT32, UINT64) for IoData.
-  ///
-  EFI_SMM_SAVE_STATE_IO_WIDTH   IoWidth;
-  ///
-  /// Defines type of I/O instruction.
-  ///
-  EFI_SMM_SAVE_STATE_IO_TYPE    IoType;
-} EFI_SMM_SAVE_STATE_IO_INFO;
-  
-typedef struct _EFI_SMM_CPU_PROTOCOL  EFI_SMM_CPU_PROTOCOL;
-
-/**
-  Read data from the CPU save state.
-
-  This function is used to read the specified number of bytes of the specified register from the CPU 
-  save state of the specified CPU and place the value into the buffer. If the CPU does not support the
-  specified register Register, then EFI_NOT_FOUND  should be returned. If the CPU does not 
-  support the specified register width Width, then EFI_INVALID_PARAMETER is returned.
-
-  @param[in]  This               The EFI_SMM_CPU_PROTOCOL instance.
-  @param[in]  Width              The number of bytes to read from the CPU save state.
-  @param[in]  Register           Specifies the CPU register to read form the save state.
-  @param[in]  CpuIndex           Specifies the zero-based index of the CPU save state.
-  @param[out] Buffer             Upon return, this holds the CPU register value read from the save state.
-    
-  @retval EFI_SUCCESS            The register was read from Save State.
-  @retval EFI_NOT_FOUND          The register is not defined for the Save State of Processor.
-  @retval EFI_INVALID_PARAMETER  Input parameters are not valid, for example, Processor No or register width 
-                                 is not correct.This or Buffer is NULL.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_READ_SAVE_STATE)(
-  IN CONST EFI_SMM_CPU_PROTOCOL   *This,
-  IN UINTN                        Width,
-  IN EFI_SMM_SAVE_STATE_REGISTER  Register,
-  IN UINTN                        CpuIndex,
-  OUT VOID                        *Buffer
-  );
-
-
-/**
-  Write data to the CPU save state.
-
-  This function is used to write the specified number of bytes of the specified register to the CPU save 
-  state of the specified CPU and place the value into the buffer. If the CPU does not support the 
-  specified register Register, then EFI_UNSUPPORTED should be returned. If the CPU does not 
-  support the specified register width Width, then EFI_INVALID_PARAMETER is returned.
-
-  @param[in]  This               The EFI_SMM_CPU_PROTOCOL instance.
-  @param[in]  Width              The number of bytes to write to the CPU save state.
-  @param[in]  Register           Specifies the CPU register to write to the save state.
-  @param[in]  CpuIndex           Specifies the zero-based index of the CPU save state.
-  @param[in]  Buffer             Upon entry, this holds the new CPU register value.
-  
-  @retval EFI_SUCCESS            The register was written to Save State.
-  @retval EFI_NOT_FOUND          The register is not defined for the Save State of Processor.
-  @retval EFI_INVALID_PARAMETER  Input parameters are not valid. For example: 
-                                 ProcessorIndex or Width is not correct.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_WRITE_SAVE_STATE)(
-  IN CONST EFI_SMM_CPU_PROTOCOL   *This,
-  IN UINTN                        Width, 
-  IN EFI_SMM_SAVE_STATE_REGISTER  Register,
-  IN UINTN                        CpuIndex,
-  IN CONST VOID                   *Buffer
-  );
+typedef  EFI_MM_SAVE_STATE_IO_INFO EFI_SMM_SAVE_STATE_IO_INFO;
 
-///
-/// EFI SMM CPU Protocol provides access to CPU-related information while in SMM.
-///
-/// This protocol allows SMM drivers to access architecture-standard registers from any of the CPU 
-/// save state areas. In some cases, difference processors provide the same information in the save state, 
-/// but not in the same format. These so-called pseudo-registers provide this information in a standard 
-/// format.  
-///
-struct _EFI_SMM_CPU_PROTOCOL {
-  EFI_SMM_READ_SAVE_STATE   ReadSaveState;
-  EFI_SMM_WRITE_SAVE_STATE  WriteSaveState;
-};
+typedef  EFI_MM_CPU_PROTOCOL EFI_SMM_CPU_PROTOCOL;
+
+typedef EFI_MM_READ_SAVE_STATE EFI_SMM_READ_SAVE_STATE;
 
+typedef EFI_MM_WRITE_SAVE_STATE EFI_SMM_WRITE_SAVE_STATE;
 extern EFI_GUID gEfiSmmCpuProtocolGuid;
 
 #endif
diff --git a/MdePkg/Include/Protocol/SmmCpuIo2.h b/MdePkg/Include/Protocol/SmmCpuIo2.h
index 9c00c80..704568d 100644
--- a/MdePkg/Include/Protocol/SmmCpuIo2.h
+++ b/MdePkg/Include/Protocol/SmmCpuIo2.h
@@ -3,7 +3,7 @@
 
   This protocol provides CPU I/O and memory access within SMM.
 
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -17,79 +17,24 @@
 #ifndef _SMM_CPU_IO2_H_
 #define _SMM_CPU_IO2_H_
 
-#define EFI_SMM_CPU_IO2_PROTOCOL_GUID \
-  { \
-    0x3242A9D8, 0xCE70, 0x4AA0, { 0x95, 0x5D, 0x5E, 0x7B, 0x14, 0x0D, 0xE4, 0xD2 } \
-  }
+#include <Protocol/MmCpuIo.h>
 
-typedef struct _EFI_SMM_CPU_IO2_PROTOCOL  EFI_SMM_CPU_IO2_PROTOCOL;
+#define EFI_SMM_CPU_IO2_PROTOCOL_GUID EFI_MM_CPU_IO_PROTOCOL_GUID
+
+typedef EFI_MM_CPU_IO_PROTOCOL  EFI_SMM_CPU_IO2_PROTOCOL;
 
 ///
 /// Width of the SMM CPU I/O operations
 ///
-typedef enum {
-  SMM_IO_UINT8  = 0,
-  SMM_IO_UINT16 = 1,
-  SMM_IO_UINT32 = 2,
-  SMM_IO_UINT64 = 3
-} EFI_SMM_IO_WIDTH;
-
-/**
-  Provides the basic memory and I/O interfaces used toabstract accesses to devices.
-
-  The I/O operations are carried out exactly as requested.  The caller is 
-  responsible for any alignment and I/O width issues that the bus, device, 
-  platform, or type of I/O might require.
-
-  @param[in]      This     The EFI_SMM_CPU_IO2_PROTOCOL instance.
-  @param[in]      Width    Signifies the width of the I/O operations.
-  @param[in]      Address  The base address of the I/O operations.  The caller is 
-                           responsible for aligning the Address if required. 
-  @param[in]      Count    The number of I/O operations to perform.
-  @param[in,out]  Buffer   For read operations, the destination buffer to store 
-                           the results.  For write operations, the source buffer 
-                           from which to write data.
+#define SMM_IO_UINT8  MM_IO_UINT8
+#define SMM_IO_UINT16 MM_IO_UINT16
+#define SMM_IO_UINT32 MM_IO_UINT32
+#define SMM_IO_UINT64 MM_IO_UINT64
 
-  @retval EFI_SUCCESS            The data was read from or written to the device.
-  @retval EFI_UNSUPPORTED        The Address is not valid for this system.
-  @retval EFI_INVALID_PARAMETER  Width or Count, or both, were invalid.
-  @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to a lack
-                                 of resources.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_CPU_IO2)(
-  IN     CONST EFI_SMM_CPU_IO2_PROTOCOL  *This,
-  IN     EFI_SMM_IO_WIDTH                Width,
-  IN     UINT64                          Address,
-  IN     UINTN                           Count,
-  IN OUT VOID                            *Buffer
-  );
-
-typedef struct {
-  ///
-  /// This service provides the various modalities of memory and I/O read.
-  ///
-  EFI_SMM_CPU_IO2  Read;
-  ///
-  /// This service provides the various modalities of memory and I/O write.
-  ///
-  EFI_SMM_CPU_IO2  Write;
-} EFI_SMM_IO_ACCESS2;
+typedef EFI_MM_IO_WIDTH EFI_SMM_IO_WIDTH;
+typedef EFI_MM_CPU_IO EFI_SMM_CPU_IO2;
 
-///
-/// SMM CPU I/O Protocol provides CPU I/O and memory access within SMM.
-///
-struct _EFI_SMM_CPU_IO2_PROTOCOL {
-  ///
-  /// Allows reads and writes to memory-mapped I/O space.
-  ///
-  EFI_SMM_IO_ACCESS2 Mem;
-  ///
-  /// Allows reads and writes to I/O space.
-  ///
-  EFI_SMM_IO_ACCESS2 Io;
-};
+typedef EFI_MM_IO_ACCESS EFI_SMM_IO_ACCESS2;
 
 extern EFI_GUID gEfiSmmCpuIo2ProtocolGuid;
 
diff --git a/MdePkg/Include/Protocol/SmmEndOfDxe.h b/MdePkg/Include/Protocol/SmmEndOfDxe.h
index e92ce4a..ae34804 100644
--- a/MdePkg/Include/Protocol/SmmEndOfDxe.h
+++ b/MdePkg/Include/Protocol/SmmEndOfDxe.h
@@ -9,7 +9,7 @@
   This protocol prorogates End of DXE notification into SMM environment.
   This protocol is installed prior to installation of the SMM Ready to Lock Protocol.
 
-  Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2012 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -23,10 +23,9 @@
 #ifndef _SMM_END_OF_DXE_H_
 #define _SMM_END_OF_DXE_H_
 
-#define EFI_SMM_END_OF_DXE_PROTOCOL_GUID \
-  { \
-    0x24e70042, 0xd5c5, 0x4260, { 0x8c, 0x39, 0xa, 0xd3, 0xaa, 0x32, 0xe9, 0x3d } \
-  }
+#include <Protocol/MmEndOfDxe.h>
+
+#define EFI_SMM_END_OF_DXE_PROTOCOL_GUID EFI_MM_END_OF_DXE_PROTOCOL_GUID
 
 extern EFI_GUID gEfiSmmEndOfDxeProtocolGuid;
 
diff --git a/MdePkg/Include/Protocol/SmmGpiDispatch2.h b/MdePkg/Include/Protocol/SmmGpiDispatch2.h
index 65be0ce..bda3f98 100644
--- a/MdePkg/Include/Protocol/SmmGpiDispatch2.h
+++ b/MdePkg/Include/Protocol/SmmGpiDispatch2.h
@@ -9,7 +9,7 @@
   given event types.  Several inputs can be enabled.  This purpose of this interface is to generate an 
   SMI in response to any of these inputs having a true value provided.
 
-  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -26,98 +26,22 @@
 #ifndef _SMM_GPI_DISPATCH2_H_
 #define _SMM_GPI_DISPATCH2_H_
 
+#include <Protocol/MmGpiDispatch.h>
 #include <Pi/PiSmmCis.h>
 
-#define EFI_SMM_GPI_DISPATCH2_PROTOCOL_GUID \
-  { \
-    0x25566b03, 0xb577, 0x4cbf, {0x95, 0x8c, 0xed, 0x66, 0x3e, 0xa2, 0x43, 0x80 } \
-  }
-
+#define EFI_SMM_GPI_DISPATCH2_PROTOCOL_GUID    EFI_MM_GPI_DISPATCH_PROTOCOL_GUID
 ///
 /// The dispatch function's context.
 ///
-typedef struct {
-  ///
-  /// A number from one of 2^64 possible GPIs that can generate an SMI. A
-  /// 0 corresponds to logical GPI[0]; 1 corresponds to logical GPI[1]; and
-  /// GpiNum of N corresponds to GPI[N], where N can span from 0 to 2^64-1.
-  ///
-  UINT64 GpiNum;
-} EFI_SMM_GPI_REGISTER_CONTEXT;
-
-typedef struct _EFI_SMM_GPI_DISPATCH2_PROTOCOL EFI_SMM_GPI_DISPATCH2_PROTOCOL;
-
-/**
-  Registers a child SMI source dispatch function with a parent SMM driver.
-
-  This service registers a function (DispatchFunction) which will be called when an SMI is 
-  generated because of one or more of the GPIs specified by RegisterContext. On return, 
-  DispatchHandle contains a unique handle which may be used later to unregister the function 
-  using UnRegister().
-  The DispatchFunction will be called with Context set to the same value as was passed into 
-  this function in RegisterContext and with CommBuffer pointing to another instance of 
-  EFI_SMM_GPI_REGISTER_CONTEXT describing the GPIs which actually caused the SMI and 
-  CommBufferSize pointing to the size of the structure.
-
-  @param[in]  This               Pointer to the EFI_SMM_GPI_DISPATCH2_PROTOCOL instance.
-  @param[in]  DispatchFunction   Function to register for handler when the specified GPI causes an SMI.
-  @param[in]  RegisterContext    Pointer to the dispatch function's context.
-                                 The caller fills this context in before calling
-                                 the register function to indicate to the register
-                                 function the GPI(s) for which the dispatch function
-                                 should be invoked.
-  @param[out] DispatchHandle     Handle generated by the dispatcher to track the
-                                 function instance.
-
-  @retval EFI_SUCCESS            The dispatch function has been successfully
-                                 registered and the SMI source has been enabled.
-  @retval EFI_DEVICE_ERROR       The driver was unable to enable the SMI source.
-  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. The GPI input value
-                                 is not within valid range.
-  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system or SMM) to manage this child.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_GPI_REGISTER2)(
-  IN CONST EFI_SMM_GPI_DISPATCH2_PROTOCOL  *This,
-  IN       EFI_SMM_HANDLER_ENTRY_POINT2    DispatchFunction,
-  IN CONST EFI_SMM_GPI_REGISTER_CONTEXT    *RegisterContext,
-  OUT      EFI_HANDLE                      *DispatchHandle
-  );
-
-/**
-  Unregisters a General Purpose Input (GPI) service.
-
-  This service removes the handler associated with DispatchHandle so that it will no longer be 
-  called when the GPI triggers an SMI. 
-
-  @param[in]  This               Pointer to the EFI_SMM_GPI_DISPATCH2_PROTOCOL instance.
-  @param[in]  DispatchHandle     Handle of the service to remove.
-
-  @retval EFI_SUCCESS            Handle of the service to remove.
-  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_GPI_UNREGISTER2)(
-  IN CONST EFI_SMM_GPI_DISPATCH2_PROTOCOL  *This,
-  IN       EFI_HANDLE                      DispatchHandle
-  );
+typedef EFI_MM_GPI_REGISTER_CONTEXT  EFI_SMM_GPI_REGISTER_CONTEXT;
+
+typedef EFI_MM_GPI_REGISTER EFI_SMM_GPI_REGISTER2;
+
+typedef EFI_MM_GPI_UNREGISTER EFI_SMM_GPI_UNREGISTER2;
+
+typedef EFI_MM_GPI_DISPATCH_PROTOCOL EFI_SMM_GPI_DISPATCH2_PROTOCOL;
+
 
-///
-/// Interface structure for the SMM GPI SMI Dispatch Protocol
-///
-/// The SMM GPI SMI Dispatch Protocol provides the parent dispatch service
-/// for the General Purpose Input (GPI) SMI source generator.
-///
-struct _EFI_SMM_GPI_DISPATCH2_PROTOCOL {
-  EFI_SMM_GPI_REGISTER2    Register;
-  EFI_SMM_GPI_UNREGISTER2  UnRegister;
-  ///
-  /// Denotes the maximum value of inputs that can have handlers attached.
-  ///
-  UINTN                   NumSupportedGpis;
-};
 
 extern EFI_GUID gEfiSmmGpiDispatch2ProtocolGuid;
 
diff --git a/MdePkg/Include/Protocol/SmmIoTrapDispatch2.h b/MdePkg/Include/Protocol/SmmIoTrapDispatch2.h
index 187d48b..b37c9e1 100644
--- a/MdePkg/Include/Protocol/SmmIoTrapDispatch2.h
+++ b/MdePkg/Include/Protocol/SmmIoTrapDispatch2.h
@@ -4,7 +4,7 @@
 
   This protocol provides a parent dispatch service for IO trap SMI sources.
 
-  Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -21,114 +21,31 @@
 #ifndef _SMM_IO_TRAP_DISPATCH2_H_
 #define _SMM_IO_TRAP_DISPATCH2_H_
 
-#include <Pi/PiSmmCis.h>
+#include <Protocol/MmIoTrapDispatch.h>
 
-#define EFI_SMM_IO_TRAP_DISPATCH2_PROTOCOL_GUID \
-  { \
-    0x58dc368d, 0x7bfa, 0x4e77, {0xab, 0xbc, 0xe, 0x29, 0x41, 0x8d, 0xf9, 0x30 } \
-  }
+#define EFI_SMM_IO_TRAP_DISPATCH2_PROTOCOL_GUID  EFI_MM_IO_TRAP_DISPATCH_PROTOCOL_GUID
 
 ///
 /// IO Trap valid types
 ///
-typedef enum {
-  WriteTrap,
-  ReadTrap,
-  ReadWriteTrap,
-  IoTrapTypeMaximum
-} EFI_SMM_IO_TRAP_DISPATCH_TYPE;
+typedef EFI_MM_IO_TRAP_DISPATCH_TYPE EFI_SMM_IO_TRAP_DISPATCH_TYPE;
 
 ///
 /// IO Trap context structure containing information about the
 /// IO trap event that should invoke the handler
 ///
-typedef struct {
-  UINT16                         Address;
-  UINT16                         Length;
-  EFI_SMM_IO_TRAP_DISPATCH_TYPE  Type;
-} EFI_SMM_IO_TRAP_REGISTER_CONTEXT;
+typedef EFI_MM_IO_TRAP_REGISTER_CONTEXT EFI_SMM_IO_TRAP_REGISTER_CONTEXT;
 
 ///
 /// IO Trap context structure containing information about the IO trap that occurred
 ///
-typedef struct {
-  UINT32  WriteData;
-} EFI_SMM_IO_TRAP_CONTEXT;
-
-typedef struct _EFI_SMM_IO_TRAP_DISPATCH2_PROTOCOL EFI_SMM_IO_TRAP_DISPATCH2_PROTOCOL;
-
-/**
-  Register an IO trap SMI child handler for a specified SMI.
-
-  This service registers a function (DispatchFunction) which will be called when an SMI is 
-  generated because of an access to an I/O port specified by RegisterContext. On return, 
-  DispatchHandle contains a unique handle which may be used later to unregister the function 
-  using UnRegister(). If the base of the I/O range specified is zero, then an I/O range with the 
-  specified length and characteristics will be allocated and the Address field in RegisterContext 
-  updated. If no range could be allocated, then EFI_OUT_OF_RESOURCES will be returned. 
-
-  The service will not perform GCD allocation if the base address is non-zero or 
-  EFI_SMM_READY_TO_LOCK has been installed.  In this case, the caller is responsible for the 
-  existence and allocation of the specific IO range.
-  An error may be returned if some or all of the requested resources conflict with an existing IO trap 
-  child handler.
-
-  It is not required that implementations will allow multiple children for a single IO trap SMI source.  
-  Some implementations may support multiple children.
-  The DispatchFunction will be called with Context updated to contain information 
-  concerning the I/O action that actually happened and is passed in RegisterContext, with 
-  CommBuffer pointing to the data actually written and CommBufferSize pointing to the size of 
-  the data in CommBuffer.
-
-  @param[in]  This               Pointer to the EFI_SMM_IO_TRAP_DISPATCH2_PROTOCOL instance.
-  @param[in]  DispatchFunction   Function to register for handler when I/O trap location is accessed.
-  @param[in]  RegisterContext    Pointer to the dispatch function's context.  The caller fills this
-                                 context in before calling the register function to indicate to the register
-                                 function the IO trap SMI source for which the dispatch function should be invoked.
-  @param[out] DispatchHandle     Handle of the dispatch function, for when interfacing with the parent SMM driver.
-
-  @retval EFI_SUCCESS            The dispatch function has been successfully registered.
-  @retval EFI_DEVICE_ERROR       The driver was unable to complete due to hardware error.
-  @retval EFI_OUT_OF_RESOURCES   Insufficient resources are available to fulfill the IO trap range request.
-  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid.  The input value is not within a valid range.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_IO_TRAP_DISPATCH2_REGISTER)(
-  IN CONST EFI_SMM_IO_TRAP_DISPATCH2_PROTOCOL  *This,
-  IN       EFI_SMM_HANDLER_ENTRY_POINT2        DispatchFunction,
-  IN OUT   EFI_SMM_IO_TRAP_REGISTER_CONTEXT    *RegisterContext,
-     OUT   EFI_HANDLE                          *DispatchHandle
-  );
-
-/**
-  Unregister a child SMI source dispatch function with a parent SMM driver.
-
-  This service removes a previously installed child dispatch handler. This does not guarantee that the 
-  system resources will be freed from the GCD.
-
-  @param[in] This                Pointer to the EFI_SMM_IO_TRAP_DISPATCH2_PROTOCOL instance. 
-  @param[in] DispatchHandle      Handle of the child service to remove.
-
-  @retval EFI_SUCCESS            The dispatch function has been successfully unregistered.
-  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_IO_TRAP_DISPATCH2_UNREGISTER)(
-  IN CONST EFI_SMM_IO_TRAP_DISPATCH2_PROTOCOL  *This,
-  IN       EFI_HANDLE                          DispatchHandle
-  );
+typedef EFI_MM_IO_TRAP_CONTEXT EFI_SMM_IO_TRAP_CONTEXT;
 
-///
-/// Interface structure for the SMM IO Trap Dispatch2 Protocol.
-///
-/// This protocol provides a parent dispatch service for IO trap SMI sources.
-///
-struct _EFI_SMM_IO_TRAP_DISPATCH2_PROTOCOL {
-  EFI_SMM_IO_TRAP_DISPATCH2_REGISTER    Register;
-  EFI_SMM_IO_TRAP_DISPATCH2_UNREGISTER  UnRegister;
-};
+typedef EFI_MM_IO_TRAP_DISPATCH_PROTOCOL EFI_SMM_IO_TRAP_DISPATCH2_PROTOCOL;
+
+typedef EFI_MM_IO_TRAP_DISPATCH_REGISTER   EFI_SMM_IO_TRAP_DISPATCH2_REGISTER;
+
+typedef EFI_MM_IO_TRAP_DISPATCH_UNREGISTER EFI_SMM_IO_TRAP_DISPATCH2_UNREGISTER;
 
 extern EFI_GUID gEfiSmmIoTrapDispatch2ProtocolGuid;
 
diff --git a/MdePkg/Include/Protocol/SmmPciRootBridgeIo.h b/MdePkg/Include/Protocol/SmmPciRootBridgeIo.h
index 2c538f4..3894f4f 100644
--- a/MdePkg/Include/Protocol/SmmPciRootBridgeIo.h
+++ b/MdePkg/Include/Protocol/SmmPciRootBridgeIo.h
@@ -3,7 +3,7 @@
 
   This protocol provides PCI I/O and memory access within SMM.
 
-  Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -17,19 +17,16 @@
 #ifndef _SMM_PCI_ROOT_BRIDGE_IO_H_
 #define _SMM_PCI_ROOT_BRIDGE_IO_H_
 
-#include <Protocol/PciRootBridgeIo.h>
+#include <Protocol/MmPciRootBridgeIo.h>
 
-#define EFI_SMM_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID \
-  { \
-    0x8bc1714d, 0xffcb, 0x41c3, { 0x89, 0xdc, 0x6c, 0x74, 0xd0, 0x6d, 0x98, 0xea } \
-  }
+#define EFI_MM_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID EFI_SMM_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID
 
 ///
 /// This protocol provides the same functionality as the PCI Root Bridge I/O Protocol defined in the 
 /// UEFI 2.1 Specifcation, section 13.2, except that the functions for Map() and Unmap() may return 
 /// EFI_UNSUPPORTED.
 ///
-typedef EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL  EFI_SMM_PCI_ROOT_BRIDGE_IO_PROTOCOL;
+typedef EFI_MM_PCI_ROOT_BRIDGE_IO_PROTOCOL  EFI_SMM_PCI_ROOT_BRIDGE_IO_PROTOCOL;
 
 extern EFI_GUID gEfiSmmPciRootBridgeIoProtocolGuid;
 
diff --git a/MdePkg/Include/Protocol/SmmPeriodicTimerDispatch2.h b/MdePkg/Include/Protocol/SmmPeriodicTimerDispatch2.h
index 0682540..078a91b 100644
--- a/MdePkg/Include/Protocol/SmmPeriodicTimerDispatch2.h
+++ b/MdePkg/Include/Protocol/SmmPeriodicTimerDispatch2.h
@@ -4,7 +4,7 @@
 
   This protocol provides the parent dispatch service for the periodical timer SMI source generator.
 
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -22,11 +22,9 @@
 #define _SMM_PERIODIC_TIMER_DISPATCH2_H_
 
 #include <Pi/PiSmmCis.h>
+#include <Protocol/MmPeriodicTimerDispatch.h>
 
-#define EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL_GUID \
-  { \
-    0x4cec368e, 0x8e8e, 0x4d71, {0x8b, 0xe1, 0x95, 0x8c, 0x45, 0xfc, 0x8a, 0x53 } \
-  }
+#define EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL_GUID EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL_GUID
 
 ///
 /// Example: A chipset supports periodic SMIs on every 64ms or 2 seconds.
@@ -66,13 +64,7 @@ typedef struct {
 /// Register() in RegisterContext and with CommBuffer pointing to an instance of 
 /// EFI_SMM_PERIODIC_TIMER_CONTEXT and CommBufferSize pointing to its size.
 ///
-typedef struct {
-  ///
-  /// ElapsedTime is the actual time in 100 nanosecond units elapsed since last called, a
-  /// value of 0 indicates an unknown amount of time.
-  ///
-  UINT64  ElapsedTime;
-} EFI_SMM_PERIODIC_TIMER_CONTEXT;
+typedef EFI_MM_PERIODIC_TIMER_CONTEXT EFI_SMM_PERIODIC_TIMER_CONTEXT;
 
 typedef struct _EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL  EFI_SMM_PERIODIC_TIMER_DISPATCH2_PROTOCOL;
 
diff --git a/MdePkg/Include/Protocol/SmmPowerButtonDispatch2.h b/MdePkg/Include/Protocol/SmmPowerButtonDispatch2.h
index ef4626a..fa844cb 100644
--- a/MdePkg/Include/Protocol/SmmPowerButtonDispatch2.h
+++ b/MdePkg/Include/Protocol/SmmPowerButtonDispatch2.h
@@ -4,7 +4,7 @@
 
   This protocol provides the parent dispatch service for the power button SMI source generator.
 
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -21,95 +21,20 @@
 #ifndef _SMM_POWER_BUTTON_DISPATCH2_H_
 #define _SMM_POWER_BUTTON_DISPATCH2_H_
 
-#include <Pi/PiSmmCis.h>
+#include <Protocol/MmPowerButtonDispatch.h>
 
-#define EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL_GUID \
-  { \
-    0x1b1183fa, 0x1823, 0x46a7, {0x88, 0x72, 0x9c, 0x57, 0x87, 0x55, 0x40, 0x9d } \
-  }
-
-///
-/// Power Button phases.
-///
-typedef enum {
-  EfiPowerButtonEntry,
-  EfiPowerButtonExit,
-  EfiPowerButtonMax
-} EFI_POWER_BUTTON_PHASE;
+#define EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL_GUID EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL_GUID
 
 ///
 /// The dispatch function's context.
 ///
-typedef struct {
-  ///
-  /// Designates whether this handler should be invoked upon entry or exit.
-  ///
-  EFI_POWER_BUTTON_PHASE  Phase;
-} EFI_SMM_POWER_BUTTON_REGISTER_CONTEXT;
-
-typedef struct _EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL;
+typedef EFI_MM_POWER_BUTTON_REGISTER_CONTEXT EFI_SMM_POWER_BUTTON_REGISTER_CONTEXT;
 
-/**
-  Provides the parent dispatch service for a power button event.
-
-  This service registers a function (DispatchFunction) which will be called when an SMI is 
-  generated because the power button was pressed or released, as specified by RegisterContext. 
-  On return, DispatchHandle contains a unique handle which may be used later to unregister the 
-  function using UnRegister().
-  The DispatchFunction will be called with Context set to the same value as was passed into 
-  this function in RegisterContext and with CommBuffer and CommBufferSize set to NULL.
-
-  @param[in]  This               Pointer to the EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL instance.
-  @param[in]  DispatchFunction   Function to register for handler when power button is pressed or released.
-  @param[in]  RegisterContext    Pointer to the dispatch function's context. The caller fills in this context
-                                 before calling the Register() function to indicate to the Register() function
-                                 the power button SMI phase for which the dispatch function should be invoked.
-  @param[out] DispatchHandle     Handle generated by the dispatcher to track the function instance. 
-
-  @retval EFI_SUCCESS            The dispatch function has been successfully
-                                 registered and the SMI source has been enabled.
-  @retval EFI_DEVICE_ERROR       The driver was unable to enable the SMI source.
-  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. The power button input value
-                                 is not within valid range.
-  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system or SMM) to manage this child.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_POWER_BUTTON_REGISTER2)(
-  IN CONST EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL  *This,
-  IN       EFI_SMM_HANDLER_ENTRY_POINT2             DispatchFunction,
-  IN       EFI_SMM_POWER_BUTTON_REGISTER_CONTEXT    *RegisterContext,
-  OUT      EFI_HANDLE                               *DispatchHandle
-  );
+typedef EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL;
 
-/**
-  Unregisters a power-button service.
+typedef EFI_MM_POWER_BUTTON_REGISTER EFI_SMM_POWER_BUTTON_REGISTER2;
 
-  This service removes the handler associated with DispatchHandle so that it will no longer be 
-  called when the standby button is pressed or released. 
-
-  @param[in] This                Pointer to the EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL instance.
-  @param[in] DispatchHandle      Handle of the service to remove.
-
-  @retval EFI_SUCCESS            The service has been successfully removed.
-  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_POWER_BUTTON_UNREGISTER2)(
-  IN CONST EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL  *This,
-  IN       EFI_HANDLE                               DispatchHandle
-  );
-
-///
-/// Interface structure for the SMM Power Button Dispatch2 Protocol.
-///
-/// This protocol provides the parent dispatch service for the power button SMI source generator.
-///
-struct _EFI_SMM_POWER_BUTTON_DISPATCH2_PROTOCOL {
-  EFI_SMM_POWER_BUTTON_REGISTER2    Register;
-  EFI_SMM_POWER_BUTTON_UNREGISTER2  UnRegister;
-};
+typedef EFI_MM_POWER_BUTTON_UNREGISTER EFI_SMM_POWER_BUTTON_UNREGISTER2;
 
 extern EFI_GUID gEfiSmmPowerButtonDispatch2ProtocolGuid;
 
diff --git a/MdePkg/Include/Protocol/SmmReadyToLock.h b/MdePkg/Include/Protocol/SmmReadyToLock.h
index edf1719..eb8b7a4 100644
--- a/MdePkg/Include/Protocol/SmmReadyToLock.h
+++ b/MdePkg/Include/Protocol/SmmReadyToLock.h
@@ -25,10 +25,9 @@
 #ifndef _SMM_READY_TO_LOCK_H_
 #define _SMM_READY_TO_LOCK_H_
 
-#define EFI_SMM_READY_TO_LOCK_PROTOCOL_GUID \
-  { \
-    0x47b7fa8c, 0xf4bd, 0x4af6, { 0x82, 0x00, 0x33, 0x30, 0x86, 0xf0, 0xd2, 0xc8 } \
-  }
+#include <Protocol/MmReadyToLock.h>
+
+#define EFI_SMM_READY_TO_LOCK_PROTOCOL_GUID EFI_MM_READY_TO_LOCK_PROTOCOL_GUID
 
 extern EFI_GUID gEfiSmmReadyToLockProtocolGuid;
 
diff --git a/MdePkg/Include/Protocol/SmmReportStatusCodeHandler.h b/MdePkg/Include/Protocol/SmmReportStatusCodeHandler.h
index 862142d..8cddfac 100644
--- a/MdePkg/Include/Protocol/SmmReportStatusCodeHandler.h
+++ b/MdePkg/Include/Protocol/SmmReportStatusCodeHandler.h
@@ -1,7 +1,7 @@
 /** @file
   This protocol provides registering and unregistering services to status code consumers while in DXE SMM.
   
-  Copyright (c) 2007 - 2009, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -15,66 +15,17 @@
 #ifndef __SMM_REPORT_STATUS_CODE_HANDLER_PROTOCOL_H__
 #define __SMM_REPORT_STATUS_CODE_HANDLER_PROTOCOL_H__
 
-#define EFI_SMM_RSC_HANDLER_PROTOCOL_GUID \
-  { \
-    0x2ff29fa7, 0x5e80, 0x4ed9, {0xb3, 0x80, 0x1, 0x7d, 0x3c, 0x55, 0x4f, 0xf4} \
-  }
+#include <Protocol/MmReportStatusCodeHandler.h>
 
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_RSC_HANDLER_CALLBACK)(
-  IN EFI_STATUS_CODE_TYPE   CodeType,
-  IN EFI_STATUS_CODE_VALUE  Value,
-  IN UINT32                 Instance,
-  IN EFI_GUID               *CallerId,
-  IN EFI_STATUS_CODE_DATA   *Data
-);
+#define EFI_SMM_RSC_HANDLER_PROTOCOL_GUID EFI_MM_RSC_HANDLER_PROTOCOL_GUID
 
-/**
-  Register the callback function for ReportStatusCode() notification.
-  
-  When this function is called the function pointer is added to an internal list and any future calls to
-  ReportStatusCode() will be forwarded to the Callback function.
-  
-  @param[in] Callback               A pointer to a function of type EFI_RSC_HANDLER_CALLBACK that is called when
-                                    a call to ReportStatusCode() occurs.
-
-  @retval EFI_SUCCESS               Function was successfully registered.
-  @retval EFI_INVALID_PARAMETER     The callback function was NULL.
-  @retval EFI_OUT_OF_RESOURCES      The internal buffer ran out of space. No more functions can be
-                                    registered.
-  @retval EFI_ALREADY_STARTED       The function was already registered. It can't be registered again.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_RSC_HANDLER_REGISTER)(
-  IN EFI_SMM_RSC_HANDLER_CALLBACK Callback
-);
+typedef EFI_MM_RSC_HANDLER_CALLBACK EFI_SMM_RSC_HANDLER_CALLBACK;
 
-/**
-  Remove a previously registered callback function from the notification list.
-  
-  A callback function must be unregistered before it is deallocated. It is important that any registered
-  callbacks that are not runtime complaint be unregistered when ExitBootServices() is called.
+typedef EFI_MM_RSC_HANDLER_REGISTER EFI_SMM_RSC_HANDLER_REGISTER;
 
-  @param[in] Callback           A pointer to a function of type EFI_SMM_RSC_HANDLER_CALLBACK that is to be
-                                unregistered.
-                        
-  @retval EFI_SUCCESS           The function was successfully unregistered.
-  @retval EFI_INVALID_PARAMETER The callback function was NULL.
-  @retval EFI_NOT_FOUND         The callback function was not found to be unregistered.
-                            
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_RSC_HANDLER_UNREGISTER)(
-  IN EFI_SMM_RSC_HANDLER_CALLBACK Callback
-);
+typedef EFI_MM_RSC_HANDLER_UNREGISTER EFI_SMM_RSC_HANDLER_UNREGISTER;
 
-typedef struct _EFI_SMM_RSC_HANDLER_PROTOCOL {
-  EFI_SMM_RSC_HANDLER_REGISTER      Register;
-  EFI_SMM_RSC_HANDLER_UNREGISTER    Unregister;
-} EFI_SMM_RSC_HANDLER_PROTOCOL;
+typedef EFI_MM_RSC_HANDLER_PROTOCOL EFI_SMM_RSC_HANDLER_PROTOCOL;
 
 extern EFI_GUID gEfiSmmRscHandlerProtocolGuid;
 
diff --git a/MdePkg/Include/Protocol/SmmStandbyButtonDispatch2.h b/MdePkg/Include/Protocol/SmmStandbyButtonDispatch2.h
index 104e2a2..f4385ef 100644
--- a/MdePkg/Include/Protocol/SmmStandbyButtonDispatch2.h
+++ b/MdePkg/Include/Protocol/SmmStandbyButtonDispatch2.h
@@ -21,97 +21,20 @@
 #ifndef _SMM_STANDBY_BUTTON_DISPATCH2_H_
 #define _SMM_STANDBY_BUTTON_DISPATCH2_H_
 
-#include <Pi/PiSmmCis.h>
+#include <Protocol/MmStandbyButtonDispatch.h>
 
-#define EFI_SMM_STANDBY_BUTTON_DISPATCH2_PROTOCOL_GUID \
-  { \
-    0x7300c4a1, 0x43f2, 0x4017, {0xa5, 0x1b, 0xc8, 0x1a, 0x7f, 0x40, 0x58, 0x5b } \
-  }
-
-///
-/// Standby Button phases
-///
-typedef enum {
-  EfiStandbyButtonEntry,
-  EfiStandbyButtonExit,
-  EfiStandbyButtonMax
-} EFI_STANDBY_BUTTON_PHASE;
+#define EFI_SMM_STANDBY_BUTTON_DISPATCH2_PROTOCOL_GUID EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL_GUID
 
 ///
 /// The dispatch function's context.
 ///
-typedef struct {
-  ///
-  /// Describes whether the child handler should be invoked upon the entry to the button 
-  /// activation or upon exit.
-  ///
-  EFI_STANDBY_BUTTON_PHASE  Phase;
-} EFI_SMM_STANDBY_BUTTON_REGISTER_CONTEXT;
-
-typedef struct _EFI_SMM_STANDBY_BUTTON_DISPATCH2_PROTOCOL EFI_SMM_STANDBY_BUTTON_DISPATCH2_PROTOCOL;
+typedef EFI_MM_STANDBY_BUTTON_REGISTER_CONTEXT EFI_SMM_STANDBY_BUTTON_REGISTER_CONTEXT;
 
-/**
-  Provides the parent dispatch service for a standby button event.
-
-  This service registers a function (DispatchFunction) which will be called when an SMI is 
-  generated because the standby button was pressed or released, as specified by 
-  RegisterContext. On return, DispatchHandle contains a unique handle which may be used 
-  later to unregister the function using UnRegister().
-  The DispatchFunction will be called with Context set to the same value as was passed into 
-  this function in RegisterContext and with CommBuffer and CommBufferSize set to NULL. 
-
-  @param[in]  This               Pointer to the EFI_SMM_STANDBY_BUTTON_DISPATCH2_PROTOCOL instance.
-  @param[in]  DispatchFunction   Function to register for handler when the standby button is pressed or released.
-  @param[in]  RegisterContext    Pointer to the dispatch function's context. The caller fills in this context
-                                 before calling the register function to indicate to the register function the 
-                                 standby button SMI source for which the dispatch function should be invoked.
-  @param[out] DispatchHandle     Handle generated by the dispatcher to track the function instance. 
-
-  @retval EFI_SUCCESS            The dispatch function has been successfully
-                                 registered and the SMI source has been enabled.
-  @retval EFI_DEVICE_ERROR       The driver was unable to enable the SMI source.
-  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. The standby button input value
-                                 is not within valid range.
-  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system or SMM) to manage this child.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_STANDBY_BUTTON_REGISTER2)(
-  IN CONST EFI_SMM_STANDBY_BUTTON_DISPATCH2_PROTOCOL  *This,
-  IN       EFI_SMM_HANDLER_ENTRY_POINT2               DispatchFunction,
-  IN       EFI_SMM_STANDBY_BUTTON_REGISTER_CONTEXT    *RegisterContext,
-  OUT      EFI_HANDLE                                 *DispatchHandle
-  );
+typedef EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL EFI_SMM_STANDBY_BUTTON_DISPATCH2_PROTOCOL;
 
-/**
-  Unregisters a child SMI source dispatch function with a parent SMM driver.
+typedef EFI_MM_STANDBY_BUTTON_REGISTER EFI_SMM_STANDBY_BUTTON_REGISTER2;
 
-  This service removes the handler associated with DispatchHandle so that it will no longer be 
-  called when the standby button is pressed or released.
-
-  @param[in] This                Pointer to the EFI_SMM_STANDBY_BUTTON_DISPATCH2_PROTOCOL instance.
-  @param[in] DispatchHandle      Handle of the service to remove.
-
-  @retval EFI_SUCCESS            The service has been successfully removed.
-  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_STANDBY_BUTTON_UNREGISTER2)(
-  IN CONST EFI_SMM_STANDBY_BUTTON_DISPATCH2_PROTOCOL  *This,
-  IN       EFI_HANDLE                                 DispatchHandle
-  );
-
-///
-/// Interface structure for the SMM Standby Button Dispatch2 Protocol.
-///
-/// This protocol provides the parent dispatch service for the standby
-/// button SMI source generator.
-///
-struct _EFI_SMM_STANDBY_BUTTON_DISPATCH2_PROTOCOL {
-  EFI_SMM_STANDBY_BUTTON_REGISTER2    Register;
-  EFI_SMM_STANDBY_BUTTON_UNREGISTER2  UnRegister;
-};
+typedef EFI_MM_STANDBY_BUTTON_UNREGISTER EFI_SMM_STANDBY_BUTTON_UNREGISTER2;
 
 extern EFI_GUID gEfiSmmStandbyButtonDispatch2ProtocolGuid;
 
diff --git a/MdePkg/Include/Protocol/SmmStatusCode.h b/MdePkg/Include/Protocol/SmmStatusCode.h
index a0e71ef..0c03e8d 100644
--- a/MdePkg/Include/Protocol/SmmStatusCode.h
+++ b/MdePkg/Include/Protocol/SmmStatusCode.h
@@ -17,47 +17,13 @@
 #ifndef _SMM_STATUS_CODE_H__
 #define _SMM_STATUS_CODE_H__
 
+#include <Protocol/MmStatusCode.h>
 
-#define EFI_SMM_STATUS_CODE_PROTOCOL_GUID \
-  { \
-    0x6afd2b77, 0x98c1, 0x4acd, {0xa6, 0xf9, 0x8a, 0x94, 0x39, 0xde, 0xf, 0xb1} \
-  }
+#define EFI_SMM_STATUS_CODE_PROTOCOL_GUID EFI_MM_STATUS_CODE_PROTOCOL_GUID
 
-typedef struct _EFI_SMM_STATUS_CODE_PROTOCOL  EFI_SMM_STATUS_CODE_PROTOCOL;
+typedef EFI_MM_STATUS_CODE_PROTOCOL  EFI_SMM_STATUS_CODE_PROTOCOL;
 
-/**
-  Service to emit the status code in SMM.    
-
-  The EFI_SMM_STATUS_CODE_PROTOCOL.ReportStatusCode() function enables a driver 
-  to emit a status code while in SMM.  The reason that there is a separate protocol definition from the 
-  DXE variant of this service is that the publisher of this protocol will provide a service that is 
-  capability of coexisting with a foreground operational environment, such as an operating system 
-  after the termination of boot services.  
-
-  @param[in] This                Points to this instance of the EFI_SMM_STATUS_CODE_PROTOCOL.
-  @param[in] CodeType            DIndicates the type of status code being reported. 
-  @param[in] Value               Describes the current status of a hardware or software entity. 
-  @param[in] Instance            The enumeration of a hardware or software entity within the system.
-  @param[in] CallerId            This optional parameter may be used to identify the caller.
-  @param[in] Data                This optional parameter may be used to pass additional data.
-
-  @retval EFI_SUCCESS            The function completed successfully.
-  @retval EFI_INVALID_PARAMETER  The function should not be completed due to a device error.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_REPORT_STATUS_CODE)(
-  IN CONST EFI_SMM_STATUS_CODE_PROTOCOL  *This,
-  IN EFI_STATUS_CODE_TYPE                CodeType,
-  IN EFI_STATUS_CODE_VALUE               Value,
-  IN UINT32                              Instance,
-  IN CONST EFI_GUID                      *CallerId,
-  IN EFI_STATUS_CODE_DATA                *Data OPTIONAL
-  );
-
-struct _EFI_SMM_STATUS_CODE_PROTOCOL {
-  EFI_SMM_REPORT_STATUS_CODE  ReportStatusCode;
-};
+typedef EFI_MM_REPORT_STATUS_CODE EFI_SMM_REPORT_STATUS_CODE;
 
 extern EFI_GUID gEfiSmmStatusCodeProtocolGuid;
 
diff --git a/MdePkg/Include/Protocol/SmmSwDispatch2.h b/MdePkg/Include/Protocol/SmmSwDispatch2.h
index 1614937..b49ef96 100644
--- a/MdePkg/Include/Protocol/SmmSwDispatch2.h
+++ b/MdePkg/Include/Protocol/SmmSwDispatch2.h
@@ -4,7 +4,7 @@
 
   This protocol provides the parent dispatch service for a given SMI source generator.
 
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -18,12 +18,10 @@
 #ifndef _SMM_SW_DISPATCH2_H_
 #define _SMM_SW_DISPATCH2_H_
 
+#include <Protocol/MmSwDispatch.h>
 #include <Pi/PiSmmCis.h>
 
-#define EFI_SMM_SW_DISPATCH2_PROTOCOL_GUID \
-  { \
-    0x18a3c6dc, 0x5eea, 0x48c8, {0xa1, 0xc1, 0xb5, 0x33, 0x89, 0xf9, 0x89, 0x99 } \
-  }
+#define EFI_SMM_SW_DISPATCH2_PROTOCOL_GUID EFI_MM_SW_DISPATCH_PROTOCOL_GUID
 
 ///
 /// A particular chipset may not support all possible software SMI input values.
diff --git a/MdePkg/Include/Protocol/SmmSxDispatch2.h b/MdePkg/Include/Protocol/SmmSxDispatch2.h
index 37effda..1565eea 100644
--- a/MdePkg/Include/Protocol/SmmSxDispatch2.h
+++ b/MdePkg/Include/Protocol/SmmSxDispatch2.h
@@ -4,7 +4,7 @@
 
   Provides the parent dispatch service for a given Sx-state source generator.
 
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -18,117 +18,20 @@
 #ifndef _SMM_SX_DISPATCH2_H_
 #define _SMM_SX_DISPATCH2_H_
 
-#include <Pi/PiSmmCis.h>
+#include <Protocol/MmSxDispatch.h>
 
-#define EFI_SMM_SX_DISPATCH2_PROTOCOL_GUID \
-  { \
-    0x456d2859, 0xa84b, 0x4e47, {0xa2, 0xee, 0x32, 0x76, 0xd8, 0x86, 0x99, 0x7d } \
-  }
-
-///
-/// Sleep states S0-S5
-///
-typedef enum {
-  SxS0,
-  SxS1,
-  SxS2,
-  SxS3,
-  SxS4,
-  SxS5,
-  EfiMaximumSleepType
-} EFI_SLEEP_TYPE;
-
-///
-/// Sleep state phase: entry or exit
-///
-typedef enum {
-  SxEntry,
-  SxExit,
-  EfiMaximumPhase
-} EFI_SLEEP_PHASE;
+#define EFI_SMM_SX_DISPATCH2_PROTOCOL_GUID EFI_MM_SX_DISPATCH_PROTOCOL_GUID
 
 ///
 /// The dispatch function's context
 ///
-typedef struct {
-  EFI_SLEEP_TYPE  Type;
-  EFI_SLEEP_PHASE Phase;
-} EFI_SMM_SX_REGISTER_CONTEXT;
-
-typedef struct _EFI_SMM_SX_DISPATCH2_PROTOCOL  EFI_SMM_SX_DISPATCH2_PROTOCOL;
-
-/**
-  Provides the parent dispatch service for a given Sx source generator.
-
-  This service registers a function (DispatchFunction) which will be called when the sleep state 
-  event specified by RegisterContext is detected. On return, DispatchHandle contains a 
-  unique handle which may be used later to unregister the function using UnRegister().
-  The DispatchFunction will be called with Context set to the same value as was passed into 
-  this function in RegisterContext and with CommBuffer and CommBufferSize set to 
-  NULL and 0 respectively.
+typedef EFI_MM_SX_REGISTER_CONTEXT EFI_SMM_SX_REGISTER_CONTEXT;
 
-  @param[in] This                Pointer to the EFI_SMM_SX_DISPATCH2_PROTOCOL instance.
-  @param[in] DispatchFunction    Function to register for handler when the specified sleep state event occurs.
-  @param[in] RegisterContext     Pointer to the dispatch function's context.
-                                 The caller fills this context in before calling
-                                 the register function to indicate to the register
-                                 function which Sx state type and phase the caller
-                                 wishes to be called back on. For this intertace,
-                                 the Sx driver will call the registered handlers for
-                                 all Sx type and phases, so the Sx state handler(s)
-                                 must check the Type and Phase field of the Dispatch
-                                 context and act accordingly.
-  @param[out]  DispatchHandle    Handle of dispatch function, for when interfacing
-                                 with the parent Sx state SMM driver.
+typedef EFI_MM_SX_DISPATCH_PROTOCOL  EFI_SMM_SX_DISPATCH2_PROTOCOL;
 
-  @retval EFI_SUCCESS            The dispatch function has been successfully
-                                 registered and the SMI source has been enabled.
-  @retval EFI_UNSUPPORTED        The Sx driver or hardware does not support that
-                                 Sx Type/Phase.
-  @retval EFI_DEVICE_ERROR       The Sx driver was unable to enable the SMI source.
-  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. Type & Phase are not
-                                 within valid range.
-  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system or SMM) to manage this
-                                 child.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_SX_REGISTER2)(
-  IN  CONST EFI_SMM_SX_DISPATCH2_PROTOCOL  *This,
-  IN        EFI_SMM_HANDLER_ENTRY_POINT2   DispatchFunction,
-  IN  CONST EFI_SMM_SX_REGISTER_CONTEXT    *RegisterContext,
-  OUT       EFI_HANDLE                     *DispatchHandle
-  );
-
-/**
-  Unregisters an Sx-state service.
-
-  This service removes the handler associated with DispatchHandle so that it will no longer be 
-  called in response to sleep event.
+typedef EFI_MM_SX_REGISTER EFI_SMM_SX_REGISTER2;
 
-  @param[in] This                Pointer to the EFI_SMM_SX_DISPATCH2_PROTOCOL instance.
-  @param[in] DispatchHandle      Handle of the service to remove. 
-
-  @retval EFI_SUCCESS            The service has been successfully removed.
-  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_SX_UNREGISTER2)(
-  IN CONST EFI_SMM_SX_DISPATCH2_PROTOCOL  *This,
-  IN       EFI_HANDLE                     DispatchHandle
-  );
-
-///
-/// Interface structure for the SMM Sx Dispatch Protocol
-///
-/// The EFI_SMM_SX_DISPATCH2_PROTOCOL provides the ability to install child handlers to 
-/// respond to sleep state related events.
-///
-struct _EFI_SMM_SX_DISPATCH2_PROTOCOL {
-  EFI_SMM_SX_REGISTER2    Register;
-  EFI_SMM_SX_UNREGISTER2  UnRegister;
-};
+typedef EFI_MM_SX_UNREGISTER EFI_SMM_SX_UNREGISTER2;
 
 extern EFI_GUID gEfiSmmSxDispatch2ProtocolGuid;
 
diff --git a/MdePkg/Include/Protocol/SmmUsbDispatch2.h b/MdePkg/Include/Protocol/SmmUsbDispatch2.h
index fc2ef51..69289c1 100644
--- a/MdePkg/Include/Protocol/SmmUsbDispatch2.h
+++ b/MdePkg/Include/Protocol/SmmUsbDispatch2.h
@@ -4,7 +4,7 @@
 
   Provides the parent dispatch service for the USB SMI source generator.
 
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -21,108 +21,25 @@
 #ifndef _SMM_USB_DISPATCH2_H_
 #define _SMM_USB_DISPATCH2_H_
 
-#include <Pi/PiSmmCis.h>
+#include <Protocol/MmUsbDispatch.h>
 
-#define EFI_SMM_USB_DISPATCH2_PROTOCOL_GUID \
-  { \
-    0xee9b8d90, 0xc5a6, 0x40a2, {0xbd, 0xe2, 0x52, 0x55, 0x8d, 0x33, 0xcc, 0xa1 } \
-  }
+#define EFI_SMM_USB_DISPATCH2_PROTOCOL_GUID EFI_MM_USB_DISPATCH_PROTOCOL_GUID
 
 ///
 /// USB SMI event types
 ///
-typedef enum {
-  UsbLegacy,
-  UsbWake
-} EFI_USB_SMI_TYPE;
+typedef EFI_USB_MMI_TYPE EFI_USB_SMI_TYPE;
 
 ///
 /// The dispatch function's context.
 ///
-typedef struct {
-  ///
-  /// Describes whether this child handler will be invoked in response to a USB legacy 
-  /// emulation event, such as port-trap on the PS/2* keyboard control registers, or to a 
-  /// USB wake event, such as resumption from a sleep state.
-  ///
-  EFI_USB_SMI_TYPE          Type;
-  ///
-  /// The device path is part of the context structure and describes the location of the 
-  /// particular USB host controller in the system for which this register event will occur.
-  /// This location is important because of the possible integration of several USB host 
-  /// controllers in a system.
-  ///
-  EFI_DEVICE_PATH_PROTOCOL  *Device;
-} EFI_SMM_USB_REGISTER_CONTEXT;
-
-typedef struct _EFI_SMM_USB_DISPATCH2_PROTOCOL EFI_SMM_USB_DISPATCH2_PROTOCOL;
-
-/**
-  Provides the parent dispatch service for the USB SMI source generator.
+typedef EFI_MM_USB_REGISTER_CONTEXT EFI_SMM_USB_REGISTER_CONTEXT;
 
-  This service registers a function (DispatchFunction) which will be called when the USB-
-  related SMI specified by RegisterContext has occurred. On return, DispatchHandle 
-  contains a unique handle which may be used later to unregister the function using UnRegister().
-  The DispatchFunction will be called with Context set to the same value as was passed into 
-  this function in RegisterContext and with CommBuffer containing NULL and 
-  CommBufferSize containing zero.
-
-  @param[in]  This               Pointer to the EFI_SMM_USB_DISPATCH2_PROTOCOL instance.
-  @param[in]  DispatchFunction   Function to register for handler when a USB-related SMI occurs. 
-  @param[in]  RegisterContext    Pointer to the dispatch function's context.
-                                 The caller fills this context in before calling
-                                 the register function to indicate to the register
-                                 function the USB SMI types for which the dispatch
-                                 function should be invoked.
-  @param[out] DispatchHandle     Handle generated by the dispatcher to track the function instance.
-
-  @retval EFI_SUCCESS            The dispatch function has been successfully
-                                 registered and the SMI source has been enabled.
-  @retval EFI_DEVICE_ERROR       The driver was unable to enable the SMI source.
-  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. The USB SMI type
-                                 is not within valid range.
-  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system or SMM) to manage this child.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_USB_REGISTER2)(
-  IN  CONST EFI_SMM_USB_DISPATCH2_PROTOCOL  *This,
-  IN        EFI_SMM_HANDLER_ENTRY_POINT2    DispatchFunction,
-  IN  CONST EFI_SMM_USB_REGISTER_CONTEXT    *RegisterContext,
-  OUT       EFI_HANDLE                      *DispatchHandle
-  );
-
-/**
-  Unregisters a USB service.
-
-  This service removes the handler associated with DispatchHandle so that it will no longer be 
-  called when the USB event occurs.
-
-  @param[in]  This               Pointer to the EFI_SMM_USB_DISPATCH2_PROTOCOL instance.
-  @param[in]  DispatchHandle     Handle of the service to remove. 
-
-  @retval EFI_SUCCESS            The dispatch function has been successfully
-                                 unregistered and the SMI source has been disabled
-                                 if there are no other registered child dispatch
-                                 functions for this SMI source.
-  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SMM_USB_UNREGISTER2)(
-  IN CONST EFI_SMM_USB_DISPATCH2_PROTOCOL  *This,
-  IN       EFI_HANDLE                      DispatchHandle
-  );
+typedef EFI_MM_USB_DISPATCH_PROTOCOL EFI_SMM_USB_DISPATCH2_PROTOCOL;
 
-///
-/// Interface structure for the SMM USB SMI Dispatch2 Protocol
-///
-/// This protocol provides the parent dispatch service for the USB SMI source generator.
-///
-struct _EFI_SMM_USB_DISPATCH2_PROTOCOL {
-  EFI_SMM_USB_REGISTER2    Register;
-  EFI_SMM_USB_UNREGISTER2  UnRegister;
-};
+typedef EFI_MM_USB_REGISTER EFI_SMM_USB_REGISTER2;
+
+typedef EFI_MM_USB_UNREGISTER EFI_SMM_USB_UNREGISTER2;
 
 extern EFI_GUID gEfiSmmUsbDispatch2ProtocolGuid;
 
-- 
2.7.0.windows.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Patch 1/2] MdePkg: Add new definitions for Management Mode.
  2017-08-14  8:32 ` [Patch 1/2] MdePkg: Add new definitions for Management Mode Eric Dong
@ 2017-08-25  9:30   ` Gao, Liming
  0 siblings, 0 replies; 5+ messages in thread
From: Gao, Liming @ 2017-08-25  9:30 UTC (permalink / raw)
  To: Dong, Eric, edk2-devel@lists.01.org; +Cc: Kinney, Michael D

Eric:
  I have two comments. 
1) New ppi/protocol should be placed below PI1.6 comment in MdePkg.dec
2) MdePkg\Include\Pi\PiMmCis.h still has SMM word in description. It should use MM instead of SMM. 

Thanks
Liming
>-----Original Message-----
>From: Dong, Eric
>Sent: Monday, August 14, 2017 4:33 PM
>To: edk2-devel@lists.01.org
>Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming
><liming.gao@intel.com>
>Subject: [Patch 1/2] MdePkg: Add new definitions for Management Mode.
>
>In PI 1.5 version, system management mode name(SMM) has been changed
>to Management Mode(MM). It impacts the current code which still use
>SMM/Smram/SMI keywords. This patch add new definition which use
>MM/MmRam/MMI keywords to follow new spec definitions.
>
>Cc: Michael D Kinney <michael.d.kinney@intel.com>
>Cc: Liming Gao <liming.gao@intel.com>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Eric Dong <eric.dong@intel.com>
>---
> MdePkg/Include/Pi/PiMmCis.h                        | 350 +++++++++++++++++++++
> MdePkg/Include/PiMm.h                              |  25 ++
> MdePkg/Include/Protocol/DxeMmReadyToLock.h         |  41 +++
> MdePkg/Include/Protocol/MmAccess.h                 | 133 ++++++++
> MdePkg/Include/Protocol/MmBase.h                   |  87 +++++
> MdePkg/Include/Protocol/MmCommunication.h          |  83 +++++
> MdePkg/Include/Protocol/MmConfiguration.h          |  86 +++++
> MdePkg/Include/Protocol/MmControl.h                | 106 +++++++
> MdePkg/Include/Protocol/MmCpu.h                    | 247 +++++++++++++++
> MdePkg/Include/Protocol/MmCpuIo.h                  |  96 ++++++
> MdePkg/Include/Protocol/MmEndOfDxe.h               |  33 ++
> MdePkg/Include/Protocol/MmGpiDispatch.h            | 125 ++++++++
> MdePkg/Include/Protocol/MmIoTrapDispatch.h         | 136 ++++++++
> MdePkg/Include/Protocol/MmPciRootBridgeIo.h        |  37 +++
> MdePkg/Include/Protocol/MmPeriodicTimerDispatch.h  | 170 ++++++++++
> MdePkg/Include/Protocol/MmPowerButtonDispatch.h    | 117 +++++++
> MdePkg/Include/Protocol/MmReadyToLock.h            |  35 +++
> .../Include/Protocol/MmReportStatusCodeHandler.h   |  81 +++++
> MdePkg/Include/Protocol/MmStandbyButtonDispatch.h  | 119 +++++++
> MdePkg/Include/Protocol/MmStatusCode.h             |  65 ++++
> MdePkg/Include/Protocol/MmSwDispatch.h             | 136 ++++++++
> MdePkg/Include/Protocol/MmSxDispatch.h             | 135 ++++++++
> MdePkg/Include/Protocol/MmUsbDispatch.h            | 130 ++++++++
> MdePkg/MdePkg.dec                                  |  63 ++++
> 24 files changed, 2636 insertions(+)
> create mode 100644 MdePkg/Include/Pi/PiMmCis.h
> create mode 100644 MdePkg/Include/PiMm.h
> create mode 100644 MdePkg/Include/Protocol/DxeMmReadyToLock.h
> create mode 100644 MdePkg/Include/Protocol/MmAccess.h
> create mode 100644 MdePkg/Include/Protocol/MmBase.h
> create mode 100644 MdePkg/Include/Protocol/MmCommunication.h
> create mode 100644 MdePkg/Include/Protocol/MmConfiguration.h
> create mode 100644 MdePkg/Include/Protocol/MmControl.h
> create mode 100644 MdePkg/Include/Protocol/MmCpu.h
> create mode 100644 MdePkg/Include/Protocol/MmCpuIo.h
> create mode 100644 MdePkg/Include/Protocol/MmEndOfDxe.h
> create mode 100644 MdePkg/Include/Protocol/MmGpiDispatch.h
> create mode 100644 MdePkg/Include/Protocol/MmIoTrapDispatch.h
> create mode 100644 MdePkg/Include/Protocol/MmPciRootBridgeIo.h
> create mode 100644 MdePkg/Include/Protocol/MmPeriodicTimerDispatch.h
> create mode 100644 MdePkg/Include/Protocol/MmPowerButtonDispatch.h
> create mode 100644 MdePkg/Include/Protocol/MmReadyToLock.h
> create mode 100644
>MdePkg/Include/Protocol/MmReportStatusCodeHandler.h
> create mode 100644 MdePkg/Include/Protocol/MmStandbyButtonDispatch.h
> create mode 100644 MdePkg/Include/Protocol/MmStatusCode.h
> create mode 100644 MdePkg/Include/Protocol/MmSwDispatch.h
> create mode 100644 MdePkg/Include/Protocol/MmSxDispatch.h
> create mode 100644 MdePkg/Include/Protocol/MmUsbDispatch.h
>
>diff --git a/MdePkg/Include/Pi/PiMmCis.h b/MdePkg/Include/Pi/PiMmCis.h
>new file mode 100644
>index 0000000..6f41fa9
>--- /dev/null
>+++ b/MdePkg/Include/Pi/PiMmCis.h
>@@ -0,0 +1,350 @@
>+/** @file
>+  Common definitions in the Platform Initialization Specification version 1.6
>+  VOLUME 4 Management Mode Core Interface version.
>+
>+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
>+  This program and the accompanying materials
>+  are licensed and made available under the terms and conditions of the BSD
>License
>+  which accompanies this distribution.  The full text of the license may be
>found at
>+  http://opensource.org/licenses/bsd-license.php
>+
>+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>+
>+**/
>+
>+#ifndef _PI_MMCIS_H_
>+#define _PI_MMCIS_H_
>+
>+#include <Protocol/MmCpuIo.h>
>+
>+typedef struct _EFI_MM_SYSTEM_TABLE  EFI_MM_SYSTEM_TABLE;
>+
>+///
>+/// The Management Mode System Table (MMST) signature
>+///
>+#define MM_MMST_SIGNATURE            SIGNATURE_32 ('S', 'M', 'S', 'T')
>+///
>+/// The Management Mode System Table (MMST) revision is 1.6
>+///
>+#define MM_SPECIFICATION_MAJOR_REVISION  1
>+#define MM_SPECIFICATION_MINOR_REVISION  60
>+#define EFI_MM_SYSTEM_TABLE_REVISION
>((MM_SPECIFICATION_MAJOR_REVISION<<16) |
>(MM_SPECIFICATION_MINOR_REVISION))
>+
>+/**
>+  Adds, updates, or removes a configuration table entry from the
>Management Mode System Table.
>+
>+  The MmInstallConfigurationTable() function is used to maintain the list
>+  of configuration tables that are stored in the Management Mode System
>+  Table.  The list is stored as an array of (GUID, Pointer) pairs.  The list
>+  must be allocated from pool memory with PoolType set to
>EfiRuntimeServicesData.
>+
>+  @param[in] SystemTable         A pointer to the MM System Table (MMST).
>+  @param[in] Guid                A pointer to the GUID for the entry to add, update,
>or remove.
>+  @param[in] Table               A pointer to the buffer of the table to add.
>+  @param[in] TableSize           The size of the table to install.
>+
>+  @retval EFI_SUCCESS            The (Guid, Table) pair was added, updated, or
>removed.
>+  @retval EFI_INVALID_PARAMETER  Guid is not valid.
>+  @retval EFI_NOT_FOUND          An attempt was made to delete a non-
>existent entry.
>+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory available
>to complete the operation.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_INSTALL_CONFIGURATION_TABLE)(
>+  IN CONST EFI_MM_SYSTEM_TABLE    *SystemTable,
>+  IN CONST EFI_GUID               *Guid,
>+  IN VOID                         *Table,
>+  IN UINTN                        TableSize
>+  );
>+
>+/**
>+  This service lets the caller to get one distinct application processor (AP) to
>execute
>+  a caller-provided code stream while in MM.
>+
>+  @param[in]     Procedure       A pointer to the code stream to be run on the
>designated
>+                                 AP of the system.
>+  @param[in]     CpuNumber       The zero-based index of the processor
>number of the AP
>+                                 on which the code stream is supposed to run.
>+  @param[in,out] ProcArguments   Allows the caller to pass a list of
>parameters to the code
>+                                 that is run by the AP.
>+
>+  @retval EFI_SUCCESS            The call was successful and the return
>parameters are valid.
>+  @retval EFI_INVALID_PARAMETER  The input arguments are out of range.
>+  @retval EFI_INVALID_PARAMETER  The CPU requested is not available on
>this SMI invocation.
>+  @retval EFI_INVALID_PARAMETER  The CPU cannot support an additional
>service invocation.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_STARTUP_THIS_AP)(
>+  IN EFI_AP_PROCEDURE  Procedure,
>+  IN UINTN             CpuNumber,
>+  IN OUT VOID          *ProcArguments OPTIONAL
>+  );
>+
>+/**
>+  Function prototype for protocol install notification.
>+
>+  @param[in] Protocol   Points to the protocol's unique identifier.
>+  @param[in] Interface  Points to the interface instance.
>+  @param[in] Handle     The handle on which the interface was installed.
>+
>+  @return Status Code
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_NOTIFY_FN)(
>+  IN CONST EFI_GUID  *Protocol,
>+  IN VOID            *Interface,
>+  IN EFI_HANDLE      Handle
>+  );
>+
>+/**
>+  Register a callback function be called when a particular protocol interface is
>installed.
>+
>+  The MmRegisterProtocolNotify() function creates a registration Function
>that is to be
>+  called whenever a protocol interface is installed for Protocol by
>+  MmInstallProtocolInterface().
>+  If Function == NULL and Registration is an existing registration, then the
>callback is unhooked.
>+
>+  @param[in]  Protocol          The unique ID of the protocol for which the event
>is to be registered.
>+  @param[in]  Function          Points to the notification function.
>+  @param[out] Registration      A pointer to a memory location to receive the
>registration value.
>+
>+  @retval EFI_SUCCESS           Successfully returned the registration record
>+                                that has been added or unhooked.
>+  @retval EFI_INVALID_PARAMETER Protocol is NULL or Registration is NULL.
>+  @retval EFI_OUT_OF_RESOURCES  Not enough memory resource to finish
>the request.
>+  @retval EFI_NOT_FOUND         If the registration is not found when Function
>== NULL.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_REGISTER_PROTOCOL_NOTIFY)(
>+  IN  CONST EFI_GUID     *Protocol,
>+  IN  EFI_MM_NOTIFY_FN   Function,
>+  OUT VOID               **Registration
>+  );
>+
>+/**
>+  Manage MMI of a particular type.
>+
>+  @param[in]     HandlerType     Points to the handler type or NULL for root
>MMI handlers.
>+  @param[in]     Context         Points to an optional context buffer.
>+  @param[in,out] CommBuffer      Points to the optional communication
>buffer.
>+  @param[in,out] CommBufferSize  Points to the size of the optional
>communication buffer.
>+
>+  @retval EFI_WARN_INTERRUPT_SOURCE_PENDING  Interrupt source was
>processed successfully but not quiesced.
>+  @retval EFI_INTERRUPT_PENDING              One or more SMI sources could
>not be quiesced.
>+  @retval EFI_NOT_FOUND                      Interrupt source was not handled or
>quiesced.
>+  @retval EFI_SUCCESS                        Interrupt source was handled and
>quiesced.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_INTERRUPT_MANAGE)(
>+  IN CONST EFI_GUID  *HandlerType,
>+  IN CONST VOID      *Context         OPTIONAL,
>+  IN OUT VOID        *CommBuffer      OPTIONAL,
>+  IN OUT UINTN       *CommBufferSize  OPTIONAL
>+  );
>+
>+/**
>+  Main entry point for an MM handler dispatch or communicate-based
>callback.
>+
>+  @param[in]     DispatchHandle  The unique handle assigned to this handler
>by MmiHandlerRegister().
>+  @param[in]     Context         Points to an optional handler context which was
>specified when the
>+                                 handler was registered.
>+  @param[in,out] CommBuffer      A pointer to a collection of data in memory
>that will
>+                                 be conveyed from a non-MM environment into an MM
>environment.
>+  @param[in,out] CommBufferSize  The size of the CommBuffer.
>+
>+  @retval EFI_SUCCESS                         The interrupt was handled and quiesced.
>No other handlers
>+                                              should still be called.
>+  @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED  The interrupt has
>been quiesced but other handlers should
>+                                              still be called.
>+  @retval EFI_WARN_INTERRUPT_SOURCE_PENDING   The interrupt is still
>pending and other handlers should still
>+                                              be called.
>+  @retval EFI_INTERRUPT_PENDING               The interrupt could not be
>quiesced.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_HANDLER_ENTRY_POINT)(
>+  IN EFI_HANDLE  DispatchHandle,
>+  IN CONST VOID  *Context         OPTIONAL,
>+  IN OUT VOID    *CommBuffer      OPTIONAL,
>+  IN OUT UINTN   *CommBufferSize  OPTIONAL
>+  );
>+
>+/**
>+  Registers a handler to execute within MM.
>+
>+  @param[in]  Handler            Handler service function pointer.
>+  @param[in]  HandlerType        Points to the handler type or NULL for root
>MMI handlers.
>+  @param[out] DispatchHandle     On return, contains a unique handle which
>can be used to later
>+                                 unregister the handler function.
>+
>+  @retval EFI_SUCCESS            MMI handler added successfully.
>+  @retval EFI_INVALID_PARAMETER  Handler is NULL or DispatchHandle is
>NULL.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_INTERRUPT_REGISTER)(
>+  IN  EFI_MM_HANDLER_ENTRY_POINT    Handler,
>+  IN  CONST EFI_GUID                *HandlerType OPTIONAL,
>+  OUT EFI_HANDLE                    *DispatchHandle
>+  );
>+
>+/**
>+  Unregister a handler in MM.
>+
>+  @param[in] DispatchHandle      The handle that was specified when the
>handler was registered.
>+
>+  @retval EFI_SUCCESS            Handler function was successfully unregistered.
>+  @retval EFI_INVALID_PARAMETER  DispatchHandle does not refer to a valid
>handle.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_INTERRUPT_UNREGISTER)(
>+  IN EFI_HANDLE  DispatchHandle
>+  );
>+
>+///
>+/// Processor information and functionality needed by MM Foundation.
>+///
>+typedef struct _EFI_MM_ENTRY_CONTEXT {
>+  EFI_MM_STARTUP_THIS_AP   MmStartupThisAp;
>+  ///
>+  /// A number between zero and the NumberOfCpus field. This field
>designates which
>+  /// processor is executing the SMM Foundation.
>+  ///
>+  UINTN                    CurrentlyExecutingCpu;
>+  ///
>+  /// The number of possible processors in the platform.  This is a 1 based
>+  /// counter.  This does not indicate the number of processors that entered
>SMM.
>+  ///
>+  UINTN                    NumberOfCpus;
>+  ///
>+  /// Points to an array, where each element describes the number of bytes
>in the
>+  /// corresponding save state specified by CpuSaveState. There are always
>+  /// NumberOfCpus entries in the array.
>+  ///
>+  UINTN                    *CpuSaveStateSize;
>+  ///
>+  /// Points to an array, where each element is a pointer to a CPU save state.
>The
>+  /// corresponding element in CpuSaveStateSize specifies the number of
>bytes in the
>+  /// save state area. There are always NumberOfCpus entries in the array.
>+  ///
>+  VOID                     **CpuSaveState;
>+} EFI_MM_ENTRY_CONTEXT;
>+
>+/**
>+  This function is the main entry point to the MM Foundation.
>+
>+  @param[in] MmEntryContext  Processor information and functionality
>needed by MM Foundation.
>+**/
>+typedef
>+VOID
>+(EFIAPI *EFI_MM_ENTRY_POINT)(
>+  IN CONST EFI_MM_ENTRY_CONTEXT  *MmEntryContext
>+  );
>+
>+///
>+/// Management Mode System Table (MMST)
>+///
>+/// The Management Mode System Table (MMST) is a table that contains a
>collection of common
>+/// services for managing MMRAM allocation and providing basic I/O services.
>These services are
>+/// intended for both preboot and runtime usage.
>+///
>+struct _EFI_MM_SYSTEM_TABLE {
>+  ///
>+  /// The table header for the SMST.
>+  ///
>+  EFI_TABLE_HEADER                     Hdr;
>+  ///
>+  /// A pointer to a NULL-terminated Unicode string containing the vendor
>name.
>+  /// It is permissible for this pointer to be NULL.
>+  ///
>+  CHAR16                               *MmFirmwareVendor;
>+  ///
>+  /// The particular revision of the firmware.
>+  ///
>+  UINT32                               MmFirmwareRevision;
>+
>+  EFI_MM_INSTALL_CONFIGURATION_TABLE   MmInstallConfigurationTable;
>+
>+  ///
>+  /// I/O Service
>+  ///
>+  EFI_MM_CPU_IO_PROTOCOL               MmIo;
>+
>+  ///
>+  /// Runtime memory services
>+  ///
>+  EFI_ALLOCATE_POOL                    MmAllocatePool;
>+  EFI_FREE_POOL                        MmFreePool;
>+  EFI_ALLOCATE_PAGES                   MmAllocatePages;
>+  EFI_FREE_PAGES                       MmFreePages;
>+
>+  ///
>+  /// MP service
>+  ///
>+  EFI_MM_STARTUP_THIS_AP               MmStartupThisAp;
>+
>+  ///
>+  /// CPU information records
>+  ///
>+
>+  ///
>+  /// A number between zero and and the NumberOfCpus field. This field
>designates
>+  /// which processor is executing the SMM infrastructure.
>+  ///
>+  UINTN                                CurrentlyExecutingCpu;
>+  ///
>+  /// The number of possible processors in the platform.  This is a 1 based
>counter.
>+  ///
>+  UINTN                                NumberOfCpus;
>+  ///
>+  /// Points to an array, where each element describes the number of bytes
>in the
>+  /// corresponding save state specified by CpuSaveState. There are always
>+  /// NumberOfCpus entries in the array.
>+  ///
>+  UINTN                                *CpuSaveStateSize;
>+  ///
>+  /// Points to an array, where each element is a pointer to a CPU save state.
>The
>+  /// corresponding element in CpuSaveStateSize specifies the number of
>bytes in the
>+  /// save state area. There are always NumberOfCpus entries in the array.
>+  ///
>+  VOID                                 **CpuSaveState;
>+
>+  ///
>+  /// Extensibility table
>+  ///
>+
>+  ///
>+  /// The number of UEFI Configuration Tables in the buffer
>SmmConfigurationTable.
>+  ///
>+  UINTN                                NumberOfTableEntries;
>+  ///
>+  /// A pointer to the UEFI Configuration Tables. The number of entries in the
>table is
>+  /// NumberOfTableEntries.
>+  ///
>+  EFI_CONFIGURATION_TABLE              *MmConfigurationTable;
>+
>+  ///
>+  /// Protocol services
>+  ///
>+  EFI_INSTALL_PROTOCOL_INTERFACE       MmInstallProtocolInterface;
>+  EFI_UNINSTALL_PROTOCOL_INTERFACE     MmUninstallProtocolInterface;
>+  EFI_HANDLE_PROTOCOL                  MmHandleProtocol;
>+  EFI_MM_REGISTER_PROTOCOL_NOTIFY      MmRegisterProtocolNotify;
>+  EFI_LOCATE_HANDLE                    MmLocateHandle;
>+  EFI_LOCATE_PROTOCOL                  MmLocateProtocol;
>+
>+  ///
>+  /// MMI Management functions
>+  ///
>+  EFI_MM_INTERRUPT_MANAGE              MmiManage;
>+  EFI_MM_INTERRUPT_REGISTER            MmiHandlerRegister;
>+  EFI_MM_INTERRUPT_UNREGISTER          MmiHandlerUnRegister;
>+};
>+
>+#endif
>diff --git a/MdePkg/Include/PiMm.h b/MdePkg/Include/PiMm.h
>new file mode 100644
>index 0000000..fdb7d27
>--- /dev/null
>+++ b/MdePkg/Include/PiMm.h
>@@ -0,0 +1,25 @@
>+/** @file
>+
>+  Root include file for Mde Package MM modules.
>+
>+Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
>+This program and the accompanying materials are licensed and made
>available under
>+the terms and conditions of the BSD License that accompanies this
>distribution.
>+The full text of the license may be found at
>+http://opensource.org/licenses/bsd-license.php.
>+
>+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>+
>+**/
>+
>+#ifndef __PI_MM_H__
>+#define __PI_MM_H__
>+
>+#include <Uefi/UefiBaseType.h>
>+#include <Uefi/UefiSpec.h>
>+
>+#include <Pi/PiMmCis.h>
>+
>+#endif
>+
>diff --git a/MdePkg/Include/Protocol/DxeMmReadyToLock.h
>b/MdePkg/Include/Protocol/DxeMmReadyToLock.h
>new file mode 100644
>index 0000000..9101101
>--- /dev/null
>+++ b/MdePkg/Include/Protocol/DxeMmReadyToLock.h
>@@ -0,0 +1,41 @@
>+/** @file
>+  DXE MM Ready To Lock protocol introduced in the PI 1.2 specification.
>+
>+  According to PI 1.4a specification, this UEFI protocol indicates that
>+  resources and services that should not be used by the third party code
>+  are about to be locked.
>+  This protocol is a mandatory protocol published by PI platform code.
>+  This protocol in tandem with the End of DXE Event facilitates transition
>+  of the platform from the environment where all of the components are
>+  under the authority of the platform manufacturer to the environment
>where
>+  third party extensible modules such as UEFI drivers and UEFI applications
>+  are executed. The protocol is published immediately after signaling of the
>+  End of DXE Event. PI modules that need to lock or protect their resources
>+  in anticipation of the invocation of 3rd party extensible modules should
>+  register for notification on installation of this protocol and effect the
>+  appropriate protections in their notification handlers. For example, PI
>+  platform code may choose to use notification handler to lock MM by
>invoking
>+  EFI_MM_ACCESS_PROTOCOL.Lock() function.
>+
>+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>+  This program and the accompanying materials
>+  are licensed and made available under the terms and conditions of the BSD
>License
>+  which accompanies this distribution.  The full text of the license may be
>found at
>+  http://opensource.org/licenses/bsd-license.php
>+
>+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>+
>+**/
>+
>+#ifndef _DXE_MM_READY_TO_LOCK_H_
>+#define _DXE_MM_READY_TO_LOCK_H_
>+
>+#define EFI_DXE_MM_READY_TO_LOCK_PROTOCOL_GUID \
>+  { \
>+    0x60ff8964, 0xe906, 0x41d0, { 0xaf, 0xed, 0xf2, 0x41, 0xe9, 0x74, 0xe0,
>0x8e } \
>+  }
>+
>+extern EFI_GUID gEfiDxeMmReadyToLockProtocolGuid;
>+
>+#endif
>diff --git a/MdePkg/Include/Protocol/MmAccess.h
>b/MdePkg/Include/Protocol/MmAccess.h
>new file mode 100644
>index 0000000..b59c798
>--- /dev/null
>+++ b/MdePkg/Include/Protocol/MmAccess.h
>@@ -0,0 +1,133 @@
>+/** @file
>+  EFI MM Access Protocol as defined in the PI 1.2 specification.
>+
>+  This protocol is used to control the visibility of the MMRAM on the platform.
>+  It abstracts the location and characteristics of MMRAM.  The expectation is
>+  that the north bridge or memory controller would publish this protocol.
>+
>+  The principal functionality found in the memory controller includes the
>following:
>+  - Exposing the MMRAM to all non-MM agents, or the "open" state
>+  - Shrouding the MMRAM to all but the MM agents, or the "closed" state
>+  - Preserving the system integrity, or "locking" the MMRAM, such that the
>settings cannot be
>+    perturbed by either boot service or runtime agents
>+
>+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>+  This program and the accompanying materials
>+  are licensed and made available under the terms and conditions of the BSD
>License
>+  which accompanies this distribution.  The full text of the license may be
>found at
>+  http://opensource.org/licenses/bsd-license.php
>+
>+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>+
>+**/
>+
>+#ifndef _MM_ACCESS_H_
>+#define _MM_ACCESS_H_
>+
>+#define EFI_MM_ACCESS_PROTOCOL_GUID \
>+  { \
>+     0xc2702b74, 0x800c, 0x4131, {0x87, 0x46, 0x8f, 0xb5, 0xb8, 0x9c, 0xe4,
>0xac } \
>+  }
>+
>+
>+typedef struct _EFI_MM_ACCESS_PROTOCOL  EFI_MM_ACCESS_PROTOCOL;
>+
>+/**
>+  Opens the MMRAM area to be accessible by a boot-service driver.
>+
>+  This function "opens" MMRAM so that it is visible while not inside of MM.
>The function should
>+  return EFI_UNSUPPORTED if the hardware does not support hiding of
>MMRAM. The function
>+  should return EFI_DEVICE_ERROR if the MMRAM configuration is locked.
>+
>+  @param[in] This           The EFI_MM_ACCESS_PROTOCOL instance.
>+
>+  @retval EFI_SUCCESS       The operation was successful.
>+  @retval EFI_UNSUPPORTED   The system does not support opening and
>closing of MMRAM.
>+  @retval EFI_DEVICE_ERROR  MMRAM cannot be opened, perhaps because
>it is locked.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_OPEN)(
>+  IN EFI_MM_ACCESS_PROTOCOL  *This
>+  );
>+
>+/**
>+  Inhibits access to the MMRAM.
>+
>+  This function "closes" MMRAM so that it is not visible while outside of MM.
>The function should
>+  return EFI_UNSUPPORTED if the hardware does not support hiding of
>MMRAM.
>+
>+  @param[in] This           The EFI_MM_ACCESS_PROTOCOL instance.
>+
>+  @retval EFI_SUCCESS       The operation was successful.
>+  @retval EFI_UNSUPPORTED   The system does not support opening and
>closing of MMRAM.
>+  @retval EFI_DEVICE_ERROR  MMRAM cannot be closed.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_CLOSE)(
>+  IN EFI_MM_ACCESS_PROTOCOL  *This
>+  );
>+
>+/**
>+  Inhibits access to the MMRAM.
>+
>+  This function prohibits access to the MMRAM region.  This function is
>usually implemented such
>+  that it is a write-once operation.
>+
>+  @param[in] This          The EFI_MM_ACCESS_PROTOCOL instance.
>+
>+  @retval EFI_SUCCESS      The device was successfully locked.
>+  @retval EFI_UNSUPPORTED  The system does not support locking of
>MMRAM.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_LOCK)(
>+  IN EFI_MM_ACCESS_PROTOCOL  *This
>+  );
>+
>+/**
>+  Queries the memory controller for the possible regions that will support
>MMRAM.
>+
>+  @param[in]     This           The EFI_MM_ACCESS_PROTOCOL instance.
>+  @param[in,out] MmramMapSize   A pointer to the size, in bytes, of the
>MmramMemoryMap buffer.
>+  @param[in,out] MmramMap       A pointer to the buffer in which firmware
>places the current memory map.
>+
>+  @retval EFI_SUCCESS           The chipset supported the given resource.
>+  @retval EFI_BUFFER_TOO_SMALL  The MmramMap parameter was too
>small.  The current buffer size
>+                                needed to hold the memory map is returned in
>MmramMapSize.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_CAPABILITIES)(
>+  IN CONST EFI_MM_ACCESS_PROTOCOL    *This,
>+  IN OUT UINTN                       *MmramMapSize,
>+  IN OUT EFI_MMRAM_DESCRIPTOR        *MmramMap
>+  );
>+
>+///
>+///  EFI MM Access Protocol is used to control the visibility of the MMRAM
>on the platform.
>+///  It abstracts the location and characteristics of MMRAM. The platform
>should report all
>+///  MMRAM via EFI_MM_ACCESS_PROTOCOL. The expectation is that the
>north bridge or memory
>+///  controller would publish this protocol.
>+///
>+struct _EFI_MM_ACCESS_PROTOCOL {
>+  EFI_MM_OPEN          Open;
>+  EFI_MM_CLOSE         Close;
>+  EFI_MM_LOCK          Lock;
>+  EFI_MM_CAPABILITIES  GetCapabilities;
>+  ///
>+  /// Indicates the current state of the MMRAM. Set to TRUE if MMRAM is
>locked.
>+  ///
>+  BOOLEAN               LockState;
>+  ///
>+  /// Indicates the current state of the MMRAM. Set to TRUE if MMRAM is
>open.
>+  ///
>+  BOOLEAN               OpenState;
>+};
>+
>+extern EFI_GUID gEfiMmAccessProtocolGuid;
>+
>+#endif
>+
>diff --git a/MdePkg/Include/Protocol/MmBase.h
>b/MdePkg/Include/Protocol/MmBase.h
>new file mode 100644
>index 0000000..23c3bf4
>--- /dev/null
>+++ b/MdePkg/Include/Protocol/MmBase.h
>@@ -0,0 +1,87 @@
>+/** @file
>+  EFI MM Base Protocol as defined in the PI 1.2 specification.
>+
>+  This protocol is utilized by all MM drivers to locate the MM infrastructure
>services and determine
>+  whether the driver is being invoked inside MMRAM or outside of MMRAM.
>+
>+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>+  This program and the accompanying materials
>+  are licensed and made available under the terms and conditions of the BSD
>License
>+  which accompanies this distribution.  The full text of the license may be
>found at
>+  http://opensource.org/licenses/bsd-license.php
>+
>+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>+
>+**/
>+
>+#ifndef _MM_BASE_H_
>+#define _MM_BASE_H_
>+
>+#include <Pi/PiMmCis.h>
>+
>+#define EFI_MM_BASE_PROTOCOL_GUID \
>+  { \
>+    0xf4ccbfb7, 0xf6e0, 0x47fd, {0x9d, 0xd4, 0x10, 0xa8, 0xf1, 0x50, 0xc1, 0x91 }
>\
>+  }
>+
>+typedef struct _EFI_MM_BASE_PROTOCOL  EFI_MM_BASE_PROTOCOL;
>+
>+/**
>+  Service to indicate whether the driver is currently executing in the MM
>Initialization phase.
>+
>+  This service is used to indicate whether the driver is currently executing in
>the MM Initialization
>+  phase. For MM drivers, this will return TRUE in InMmram while inside the
>driver's entry point and
>+  otherwise FALSE. For combination MM/DXE drivers, this will return FALSE in
>the DXE launch. For the
>+  MM launch, it behaves as an MM driver.
>+
>+  @param[in]  This               The EFI_MM_BASE_PROTOCOL instance.
>+  @param[out] InMmram            Pointer to a Boolean which, on return,
>indicates that the driver is
>+                                 currently executing inside of MMRAM (TRUE) or outside of
>MMRAM (FALSE).
>+
>+  @retval EFI_SUCCESS            The call returned successfully.
>+  @retval EFI_INVALID_PARAMETER  InMmram was NULL.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_INSIDE_OUT)(
>+  IN CONST EFI_MM_BASE_PROTOCOL    *This,
>+  OUT BOOLEAN                      *InMmram
>+  )
>+;
>+
>+/**
>+  Returns the location of the Management Mode Service Table (MMST).
>+
>+  This function returns the location of the Management Mode Service Table
>(MMST).  The use of the
>+  API is such that a driver can discover the location of the MMST in its entry
>point and then cache it in
>+  some driver global variable so that the MMST can be invoked in subsequent
>handlers.
>+
>+  @param[in]     This            The EFI_MM_BASE_PROTOCOL instance.
>+  @param[in,out] Mmst            On return, points to a pointer to the
>Management Mode Service Table (MMST).
>+
>+  @retval EFI_SUCCESS            The operation was successful.
>+  @retval EFI_INVALID_PARAMETER  Mmst was invalid.
>+  @retval EFI_UNSUPPORTED        Not in MM.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_GET_MMST_LOCATION)(
>+  IN CONST EFI_MM_BASE_PROTOCOL  *This,
>+  IN OUT EFI_MM_SYSTEM_TABLE     **Mmst
>+  )
>+;
>+
>+///
>+/// EFI MM Base Protocol is utilized by all MM drivers to locate the MM
>infrastructure
>+/// services and determine whether the driver is being invoked inside
>MMRAM or outside of MMRAM.
>+///
>+struct _EFI_MM_BASE_PROTOCOL {
>+  EFI_MM_INSIDE_OUT         InMm;
>+  EFI_MM_GET_MMST_LOCATION  GetMmstLocation;
>+};
>+
>+extern EFI_GUID gEfiMmBaseProtocolGuid;
>+
>+#endif
>+
>diff --git a/MdePkg/Include/Protocol/MmCommunication.h
>b/MdePkg/Include/Protocol/MmCommunication.h
>new file mode 100644
>index 0000000..5dbb38e
>--- /dev/null
>+++ b/MdePkg/Include/Protocol/MmCommunication.h
>@@ -0,0 +1,83 @@
>+/** @file
>+  EFI MM Communication Protocol as defined in the PI 1.2 specification.
>+
>+  This protocol provides a means of communicating between drivers outside
>of MM and MMI
>+  handlers inside of MM.
>+
>+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>+  This program and the accompanying materials
>+  are licensed and made available under the terms and conditions of the BSD
>License
>+  which accompanies this distribution.  The full text of the license may be
>found at
>+  http://opensource.org/licenses/bsd-license.php
>+
>+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>+
>+**/
>+
>+#ifndef _MM_COMMUNICATION_H_
>+#define _MM_COMMUNICATION_H_
>+
>+#pragma pack(1)
>+
>+///
>+/// To avoid confusion in interpreting frames, the communication buffer
>should always
>+/// begin with EFI_MM_COMMUNICATE_HEADER
>+///
>+typedef struct {
>+  ///
>+  /// Allows for disambiguation of the message format.
>+  ///
>+  EFI_GUID  HeaderGuid;
>+  ///
>+  /// Describes the size of Data (in bytes) and does not include the size of the
>header.
>+  ///
>+  UINTN     MessageLength;
>+  ///
>+  /// Designates an array of bytes that is MessageLength in size.
>+  ///
>+  UINT8     Data[1];
>+} EFI_MM_COMMUNICATE_HEADER;
>+
>+#pragma pack()
>+
>+#define EFI_MM_COMMUNICATION_PROTOCOL_GUID \
>+  { \
>+    0xc68ed8e2, 0x9dc6, 0x4cbd, { 0x9d, 0x94, 0xdb, 0x65, 0xac, 0xc5, 0xc3,
>0x32 } \
>+  }
>+
>+typedef struct _EFI_MM_COMMUNICATION_PROTOCOL
>EFI_MM_COMMUNICATION_PROTOCOL;
>+
>+/**
>+  Communicates with a registered handler.
>+
>+  This function provides a service to send and receive messages from a
>registered UEFI service.
>+
>+  @param[in] This                The EFI_MM_COMMUNICATION_PROTOCOL
>instance.
>+  @param[in] CommBuffer          A pointer to the buffer to convey into
>MMRAM.
>+  @param[in] CommSize            The size of the data buffer being passed in.On
>exit, the size of data
>+                                 being returned. Zero if the handler does not wish to reply
>with any data.
>+
>+  @retval EFI_SUCCESS            The message was successfully posted.
>+  @retval EFI_INVALID_PARAMETER  The CommBuffer was NULL.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_COMMUNICATE)(
>+  IN CONST EFI_MM_COMMUNICATION_PROTOCOL   *This,
>+  IN OUT VOID                              *CommBuffer,
>+  IN OUT UINTN                             *CommSize
>+  );
>+
>+///
>+/// EFI MM Communication Protocol provides runtime services for
>communicating
>+/// between DXE drivers and a registered MMI handler.
>+///
>+struct _EFI_MM_COMMUNICATION_PROTOCOL {
>+  EFI_MM_COMMUNICATE  Communicate;
>+};
>+
>+extern EFI_GUID gEfiMmCommunicationProtocolGuid;
>+
>+#endif
>+
>diff --git a/MdePkg/Include/Protocol/MmConfiguration.h
>b/MdePkg/Include/Protocol/MmConfiguration.h
>new file mode 100644
>index 0000000..aacd96c
>--- /dev/null
>+++ b/MdePkg/Include/Protocol/MmConfiguration.h
>@@ -0,0 +1,86 @@
>+/** @file
>+  EFI MM Configuration Protocol as defined in the PI 1.2 specification.
>+
>+  This protocol is used to:
>+  1) report the portions of MMRAM regions which cannot be used for the
>MMRAM heap.
>+  2) register the MM Foundation entry point with the processor code. The
>entry
>+     point will be invoked by the MM processor entry code.
>+
>+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>+  This program and the accompanying materials
>+  are licensed and made available under the terms and conditions of the BSD
>License
>+  which accompanies this distribution.  The full text of the license may be
>found at
>+  http://opensource.org/licenses/bsd-license.php
>+
>+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>+
>+**/
>+
>+#ifndef _MM_CONFIGURATION_H_
>+#define _MM_CONFIGURATION_H_
>+
>+#include <Pi/PiMmCis.h>
>+
>+#define EFI_MM_CONFIGURATION_PROTOCOL_GUID \
>+  { \
>+    0x26eeb3de, 0xb689, 0x492e, {0x80, 0xf0, 0xbe, 0x8b, 0xd7, 0xda, 0x4b,
>0xa7 }  \
>+  }
>+
>+///
>+/// Structure describing a MMRAM region which cannot be used for the
>MMRAM heap.
>+///
>+typedef struct _EFI_MM_RESERVED_MMRAM_REGION {
>+  ///
>+  /// Starting address of the reserved MMRAM area, as it appears while
>MMRAM is open.
>+  /// Ignored if MmramReservedSize is 0.
>+  ///
>+  EFI_PHYSICAL_ADDRESS    MmramReservedStart;
>+  ///
>+  /// Number of bytes occupied by the reserved MMRAM area. A size of zero
>indicates the
>+  /// last MMRAM area.
>+  ///
>+  UINT64                  MmramReservedSize;
>+} EFI_MM_RESERVED_MMRAM_REGION;
>+
>+typedef struct _EFI_MM_CONFIGURATION_PROTOCOL
>EFI_MM_CONFIGURATION_PROTOCOL;
>+
>+/**
>+  Register the MM Foundation entry point.
>+
>+  This function registers the MM Foundation entry point with the processor
>code. This entry point
>+  will be invoked by the MM Processor entry code.
>+
>+  @param[in] This                The EFI_MM_CONFIGURATION_PROTOCOL
>instance.
>+  @param[in] MmEntryPoint        MM Foundation entry point.
>+
>+  @retval EFI_SUCCESS            Success to register MM Entry Point.
>+  @retval EFI_INVALID_PARAMETER  MmEntryPoint is NULL.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_REGISTER_MM_ENTRY)(
>+  IN CONST EFI_MM_CONFIGURATION_PROTOCOL  *This,
>+  IN EFI_MM_ENTRY_POINT                   MmEntryPoint
>+  );
>+
>+///
>+/// The EFI MM Configuration Protocol is a mandatory protocol published by
>a DXE CPU driver to
>+/// indicate which areas within MMRAM are reserved for use by the CPU for
>any purpose,
>+/// such as stack, save state or MM entry point.
>+///
>+/// The RegistermmEntry() function allows the MM IPL DXE driver to register
>the MM
>+/// Foundation entry point with the MM entry vector code.
>+///
>+struct _EFI_MM_CONFIGURATION_PROTOCOL {
>+  ///
>+  /// A pointer to an array MMRAM ranges used by the initial MM entry code.
>+  ///
>+  EFI_MM_RESERVED_MMRAM_REGION  *MmramReservedRegions;
>+  EFI_MM_REGISTER_MM_ENTRY      RegisterMmEntry;
>+};
>+
>+extern EFI_GUID gEfiMmConfigurationProtocolGuid;
>+
>+#endif
>+
>diff --git a/MdePkg/Include/Protocol/MmControl.h
>b/MdePkg/Include/Protocol/MmControl.h
>new file mode 100644
>index 0000000..c8672c5
>--- /dev/null
>+++ b/MdePkg/Include/Protocol/MmControl.h
>@@ -0,0 +1,106 @@
>+/** @file
>+  EFI MM Control Protocol as defined in the PI 1.2 specification.
>+
>+  This protocol is used initiate synchronous MMI activations. This protocol
>could be published by a
>+  processor driver to abstract the MMI IPI or a driver which abstracts the ASIC
>that is supporting the
>+  APM port. Because of the possibility of performing MMI IPI transactions,
>the ability to generate this
>+  event from a platform chipset agent is an optional capability for both IA-32
>and x64-based systems.
>+
>+  The EFI_MM_CONTROL_PROTOCOL is produced by a runtime driver. It
>provides  an
>+  abstraction of the platform hardware that generates an MMI.  There are
>often I/O ports that, when
>+  accessed, will generate the MMI.  Also, the hardware optionally supports
>the periodic generation of
>+  these signals.
>+
>+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>+  This program and the accompanying materials
>+  are licensed and made available under the terms and conditions of the BSD
>License
>+  which accompanies this distribution.  The full text of the license may be
>found at
>+  http://opensource.org/licenses/bsd-license.php
>+
>+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>+
>+**/
>+
>+#ifndef _MM_CONTROL_H_
>+#define _MM_CONTROL_H_
>+
>+#include <PiDxe.h>
>+
>+#define EFI_MM_CONTROL_PROTOCOL_GUID \
>+  { \
>+    0x843dc720, 0xab1e, 0x42cb, {0x93, 0x57, 0x8a, 0x0, 0x78, 0xf3, 0x56, 0x1b}
>\
>+  }
>+
>+typedef struct _EFI_MM_CONTROL_PROTOCOL
>EFI_MM_CONTROL_PROTOCOL;
>+typedef UINTN  EFI_MM_PERIOD;
>+
>+/**
>+  Invokes MMI activation from either the preboot or runtime environment.
>+
>+  This function generates an MMI.
>+
>+  @param[in]     This                The EFI_MM_CONTROL_PROTOCOL instance.
>+  @param[in,out] CommandPort         The value written to the command port.
>+  @param[in,out] DataPort            The value written to the data port.
>+  @param[in]     Periodic            Optional mechanism to engender a periodic
>stream.
>+  @param[in]     ActivationInterval  Optional parameter to repeat at this
>period one
>+                                     time or, if the Periodic Boolean is set, periodically.
>+
>+  @retval EFI_SUCCESS            The MMI/PMI has been engendered.
>+  @retval EFI_DEVICE_ERROR       The timing is unsupported.
>+  @retval EFI_INVALID_PARAMETER  The activation period is unsupported.
>+  @retval EFI_INVALID_PARAMETER  The last periodic activation has not been
>cleared.
>+  @retval EFI_NOT_STARTED        The MM base service has not been
>initialized.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_ACTIVATE)(
>+  IN CONST EFI_MM_CONTROL_PROTOCOL    *This,
>+  IN OUT UINT8                        *CommandPort       OPTIONAL,
>+  IN OUT UINT8                        *DataPort          OPTIONAL,
>+  IN BOOLEAN                          Periodic           OPTIONAL,
>+  IN UINTN                            ActivationInterval OPTIONAL
>+  );
>+
>+/**
>+  Clears any system state that was created in response to the Trigger() call.
>+
>+  This function acknowledges and causes the deassertion of the MMI
>activation source.
>+
>+  @param[in] This                The EFI_MM_CONTROL_PROTOCOL instance.
>+  @param[in] Periodic            Optional parameter to repeat at this period one
>time
>+
>+  @retval EFI_SUCCESS            The MMI/PMI has been engendered.
>+  @retval EFI_DEVICE_ERROR       The source could not be cleared.
>+  @retval EFI_INVALID_PARAMETER  The service did not support the Periodic
>input argument.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_DEACTIVATE)(
>+  IN CONST EFI_MM_CONTROL_PROTOCOL    *This,
>+  IN BOOLEAN                          Periodic OPTIONAL
>+  );
>+
>+///
>+/// The EFI_MM_CONTROL_PROTOCOL is produced by a runtime driver. It
>provides  an
>+/// abstraction of the platform hardware that generates an MMI.  There are
>often I/O ports that, when
>+/// accessed, will generate the MMI.  Also, the hardware optionally supports
>the periodic generation of
>+/// these signals.
>+///
>+struct _EFI_MM_CONTROL_PROTOCOL {
>+  EFI_MM_ACTIVATE    Trigger;
>+  EFI_MM_DEACTIVATE  Clear;
>+  ///
>+  /// Minimum interval at which the platform can set the period.  A maximum
>is not
>+  /// specified in that the MM infrastructure code can emulate a maximum
>interval that is
>+  /// greater than the hardware capabilities by using software emulation in
>the MM
>+  /// infrastructure code.
>+  ///
>+  EFI_MM_PERIOD      MinimumTriggerPeriod;
>+};
>+
>+extern EFI_GUID gEfiMmControlProtocolGuid;
>+
>+#endif
>+
>diff --git a/MdePkg/Include/Protocol/MmCpu.h
>b/MdePkg/Include/Protocol/MmCpu.h
>new file mode 100644
>index 0000000..d6ddbcd
>--- /dev/null
>+++ b/MdePkg/Include/Protocol/MmCpu.h
>@@ -0,0 +1,247 @@
>+/** @file
>+  EFI MM CPU Protocol as defined in the PI 1.2 specification.
>+
>+  This protocol allows MM drivers to access architecture-standard registers
>from any of the CPU
>+  save state areas. In some cases, difference processors provide the same
>information in the save state,
>+  but not in the same format. These so-called pseudo-registers provide this
>information in a standard
>+  format.
>+
>+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>+  This program and the accompanying materials
>+  are licensed and made available under the terms and conditions of the BSD
>License
>+  which accompanies this distribution.  The full text of the license may be
>found at
>+  http://opensource.org/licenses/bsd-license.php
>+
>+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>+
>+**/
>+
>+#ifndef _MM_CPU_H_
>+#define _MM_CPU_H_
>+
>+#define EFI_MM_CPU_PROTOCOL_GUID \
>+  { \
>+    0xeb346b97, 0x975f, 0x4a9f, { 0x8b, 0x22, 0xf8, 0xe9, 0x2b, 0xb3, 0xd5,
>0x69 } \
>+  }
>+
>+///
>+/// Save State register index
>+///
>+typedef enum {
>+  ///
>+  /// x86/X64 standard registers
>+  ///
>+  EFI_MM_SAVE_STATE_REGISTER_GDTBASE       = 4,
>+  EFI_MM_SAVE_STATE_REGISTER_IDTBASE       = 5,
>+  EFI_MM_SAVE_STATE_REGISTER_LDTBASE       = 6,
>+  EFI_MM_SAVE_STATE_REGISTER_GDTLIMIT      = 7,
>+  EFI_MM_SAVE_STATE_REGISTER_IDTLIMIT      = 8,
>+  EFI_MM_SAVE_STATE_REGISTER_LDTLIMIT      = 9,
>+  EFI_MM_SAVE_STATE_REGISTER_LDTINFO       = 10,
>+  EFI_MM_SAVE_STATE_REGISTER_ES            = 20,
>+  EFI_MM_SAVE_STATE_REGISTER_CS            = 21,
>+  EFI_MM_SAVE_STATE_REGISTER_SS            = 22,
>+  EFI_MM_SAVE_STATE_REGISTER_DS            = 23,
>+  EFI_MM_SAVE_STATE_REGISTER_FS            = 24,
>+  EFI_MM_SAVE_STATE_REGISTER_GS            = 25,
>+  EFI_MM_SAVE_STATE_REGISTER_LDTR_SEL      = 26,
>+  EFI_MM_SAVE_STATE_REGISTER_TR_SEL        = 27,
>+  EFI_MM_SAVE_STATE_REGISTER_DR7           = 28,
>+  EFI_MM_SAVE_STATE_REGISTER_DR6           = 29,
>+  EFI_MM_SAVE_STATE_REGISTER_R8            = 30,
>+  EFI_MM_SAVE_STATE_REGISTER_R9            = 31,
>+  EFI_MM_SAVE_STATE_REGISTER_R10           = 32,
>+  EFI_MM_SAVE_STATE_REGISTER_R11           = 33,
>+  EFI_MM_SAVE_STATE_REGISTER_R12           = 34,
>+  EFI_MM_SAVE_STATE_REGISTER_R13           = 35,
>+  EFI_MM_SAVE_STATE_REGISTER_R14           = 36,
>+  EFI_MM_SAVE_STATE_REGISTER_R15           = 37,
>+  EFI_MM_SAVE_STATE_REGISTER_RAX           = 38,
>+  EFI_MM_SAVE_STATE_REGISTER_RBX           = 39,
>+  EFI_MM_SAVE_STATE_REGISTER_RCX           = 40,
>+  EFI_MM_SAVE_STATE_REGISTER_RDX           = 41,
>+  EFI_MM_SAVE_STATE_REGISTER_RSP           = 42,
>+  EFI_MM_SAVE_STATE_REGISTER_RBP           = 43,
>+  EFI_MM_SAVE_STATE_REGISTER_RSI           = 44,
>+  EFI_MM_SAVE_STATE_REGISTER_RDI           = 45,
>+  EFI_MM_SAVE_STATE_REGISTER_RIP           = 46,
>+  EFI_MM_SAVE_STATE_REGISTER_RFLAGS        = 51,
>+  EFI_MM_SAVE_STATE_REGISTER_CR0           = 52,
>+  EFI_MM_SAVE_STATE_REGISTER_CR3           = 53,
>+  EFI_MM_SAVE_STATE_REGISTER_CR4           = 54,
>+  EFI_MM_SAVE_STATE_REGISTER_FCW           = 256,
>+  EFI_MM_SAVE_STATE_REGISTER_FSW           = 257,
>+  EFI_MM_SAVE_STATE_REGISTER_FTW           = 258,
>+  EFI_MM_SAVE_STATE_REGISTER_OPCODE        = 259,
>+  EFI_MM_SAVE_STATE_REGISTER_FP_EIP        = 260,
>+  EFI_MM_SAVE_STATE_REGISTER_FP_CS         = 261,
>+  EFI_MM_SAVE_STATE_REGISTER_DATAOFFSET    = 262,
>+  EFI_MM_SAVE_STATE_REGISTER_FP_DS         = 263,
>+  EFI_MM_SAVE_STATE_REGISTER_MM0           = 264,
>+  EFI_MM_SAVE_STATE_REGISTER_MM1           = 265,
>+  EFI_MM_SAVE_STATE_REGISTER_MM2           = 266,
>+  EFI_MM_SAVE_STATE_REGISTER_MM3           = 267,
>+  EFI_MM_SAVE_STATE_REGISTER_MM4           = 268,
>+  EFI_MM_SAVE_STATE_REGISTER_MM5           = 269,
>+  EFI_MM_SAVE_STATE_REGISTER_MM6           = 270,
>+  EFI_MM_SAVE_STATE_REGISTER_MM7           = 271,
>+  EFI_MM_SAVE_STATE_REGISTER_XMM0          = 272,
>+  EFI_MM_SAVE_STATE_REGISTER_XMM1          = 273,
>+  EFI_MM_SAVE_STATE_REGISTER_XMM2          = 274,
>+  EFI_MM_SAVE_STATE_REGISTER_XMM3          = 275,
>+  EFI_MM_SAVE_STATE_REGISTER_XMM4          = 276,
>+  EFI_MM_SAVE_STATE_REGISTER_XMM5          = 277,
>+  EFI_MM_SAVE_STATE_REGISTER_XMM6          = 278,
>+  EFI_MM_SAVE_STATE_REGISTER_XMM7          = 279,
>+  EFI_MM_SAVE_STATE_REGISTER_XMM8          = 280,
>+  EFI_MM_SAVE_STATE_REGISTER_XMM9          = 281,
>+  EFI_MM_SAVE_STATE_REGISTER_XMM10         = 282,
>+  EFI_MM_SAVE_STATE_REGISTER_XMM11         = 283,
>+  EFI_MM_SAVE_STATE_REGISTER_XMM12         = 284,
>+  EFI_MM_SAVE_STATE_REGISTER_XMM13         = 285,
>+  EFI_MM_SAVE_STATE_REGISTER_XMM14         = 286,
>+  EFI_MM_SAVE_STATE_REGISTER_XMM15         = 287,
>+  ///
>+  /// Pseudo-Registers
>+  ///
>+  EFI_MM_SAVE_STATE_REGISTER_IO            = 512,
>+  EFI_MM_SAVE_STATE_REGISTER_LMA           = 513,
>+  EFI_MM_SAVE_STATE_REGISTER_PROCESSOR_ID  = 514
>+} EFI_MM_SAVE_STATE_REGISTER;
>+
>+///
>+/// The EFI_MM_SAVE_STATE_REGISTER_LMA pseudo-register values
>+/// If the processor acts in 32-bit mode at the time the MMI occurred, the
>pseudo register value
>+/// EFI_MM_SAVE_STATE_REGISTER_LMA_32BIT is returned in Buffer.
>Otherwise,
>+/// EFI_MM_SAVE_STATE_REGISTER_LMA_64BIT is returned in Buffer.
>+///
>+#define EFI_MM_SAVE_STATE_REGISTER_LMA_32BIT  32
>+#define EFI_MM_SAVE_STATE_REGISTER_LMA_64BIT  64
>+
>+///
>+/// Size width of I/O instruction
>+///
>+typedef enum {
>+  EFI_MM_SAVE_STATE_IO_WIDTH_UINT8      = 0,
>+  EFI_MM_SAVE_STATE_IO_WIDTH_UINT16     = 1,
>+  EFI_MM_SAVE_STATE_IO_WIDTH_UINT32     = 2,
>+  EFI_MM_SAVE_STATE_IO_WIDTH_UINT64     = 3
>+} EFI_MM_SAVE_STATE_IO_WIDTH;
>+
>+///
>+/// Types of I/O instruction
>+///
>+typedef enum {
>+  EFI_MM_SAVE_STATE_IO_TYPE_INPUT       = 1,
>+  EFI_MM_SAVE_STATE_IO_TYPE_OUTPUT      = 2,
>+  EFI_MM_SAVE_STATE_IO_TYPE_STRING      = 4,
>+  EFI_MM_SAVE_STATE_IO_TYPE_REP_PREFIX  = 8
>+} EFI_MM_SAVE_STATE_IO_TYPE;
>+
>+///
>+/// Structure of the data which is returned when ReadSaveState() is called
>with
>+/// EFI_MM_SAVE_STATE_REGISTER_IO. If there was no I/O then
>ReadSaveState() will
>+/// return EFI_NOT_FOUND.
>+///
>+/// This structure describes the I/O operation which was in process when the
>MMI was generated.
>+///
>+typedef struct _EFI_MM_SAVE_STATE_IO_INFO {
>+  ///
>+  /// For input instruction (IN, INS), this is data read before the MMI occurred.
>For output
>+  /// instructions (OUT, OUTS) this is data that was written before the MMI
>occurred. The
>+  /// width of the data is specified by IoWidth.
>+  ///
>+  UINT64                        IoData;
>+  ///
>+  /// The I/O port that was being accessed when the MMI was triggered.
>+  ///
>+  UINT16                        IoPort;
>+  ///
>+  /// Defines the size width (UINT8, UINT16, UINT32, UINT64) for IoData.
>+  ///
>+  EFI_MM_SAVE_STATE_IO_WIDTH    IoWidth;
>+  ///
>+  /// Defines type of I/O instruction.
>+  ///
>+  EFI_MM_SAVE_STATE_IO_TYPE     IoType;
>+} EFI_MM_SAVE_STATE_IO_INFO;
>+
>+typedef struct _EFI_MM_CPU_PROTOCOL  EFI_MM_CPU_PROTOCOL;
>+
>+/**
>+  Read data from the CPU save state.
>+
>+  This function is used to read the specified number of bytes of the specified
>register from the CPU
>+  save state of the specified CPU and place the value into the buffer. If the
>CPU does not support the
>+  specified register Register, then EFI_NOT_FOUND  should be returned. If
>the CPU does not
>+  support the specified register width Width, then EFI_INVALID_PARAMETER
>is returned.
>+
>+  @param[in]  This               The EFI_MM_CPU_PROTOCOL instance.
>+  @param[in]  Width              The number of bytes to read from the CPU save
>state.
>+  @param[in]  Register           Specifies the CPU register to read form the save
>state.
>+  @param[in]  CpuIndex           Specifies the zero-based index of the CPU save
>state.
>+  @param[out] Buffer             Upon return, this holds the CPU register value
>read from the save state.
>+
>+  @retval EFI_SUCCESS            The register was read from Save State.
>+  @retval EFI_NOT_FOUND          The register is not defined for the Save State
>of Processor.
>+  @retval EFI_INVALID_PARAMETER  Input parameters are not valid, for
>example, Processor No or register width
>+                                 is not correct.This or Buffer is NULL.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_READ_SAVE_STATE)(
>+  IN CONST EFI_MM_CPU_PROTOCOL    *This,
>+  IN UINTN                        Width,
>+  IN EFI_MM_SAVE_STATE_REGISTER   Register,
>+  IN UINTN                        CpuIndex,
>+  OUT VOID                        *Buffer
>+  );
>+
>+
>+/**
>+  Write data to the CPU save state.
>+
>+  This function is used to write the specified number of bytes of the specified
>register to the CPU save
>+  state of the specified CPU and place the value into the buffer. If the CPU
>does not support the
>+  specified register Register, then EFI_UNSUPPORTED should be returned. If
>the CPU does not
>+  support the specified register width Width, then EFI_INVALID_PARAMETER
>is returned.
>+
>+  @param[in]  This               The EFI_MM_CPU_PROTOCOL instance.
>+  @param[in]  Width              The number of bytes to write to the CPU save
>state.
>+  @param[in]  Register           Specifies the CPU register to write to the save
>state.
>+  @param[in]  CpuIndex           Specifies the zero-based index of the CPU save
>state.
>+  @param[in]  Buffer             Upon entry, this holds the new CPU register value.
>+
>+  @retval EFI_SUCCESS            The register was written to Save State.
>+  @retval EFI_NOT_FOUND          The register is not defined for the Save State
>of Processor.
>+  @retval EFI_INVALID_PARAMETER  Input parameters are not valid. For
>example:
>+                                 ProcessorIndex or Width is not correct.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_WRITE_SAVE_STATE)(
>+  IN CONST EFI_MM_CPU_PROTOCOL    *This,
>+  IN UINTN                        Width,
>+  IN EFI_MM_SAVE_STATE_REGISTER   Register,
>+  IN UINTN                        CpuIndex,
>+  IN CONST VOID                   *Buffer
>+  );
>+
>+///
>+/// EFI MM CPU Protocol provides access to CPU-related information while in
>MM.
>+///
>+/// This protocol allows MM drivers to access architecture-standard registers
>from any of the CPU
>+/// save state areas. In some cases, difference processors provide the same
>information in the save state,
>+/// but not in the same format. These so-called pseudo-registers provide this
>information in a standard
>+/// format.
>+///
>+struct _EFI_MM_CPU_PROTOCOL {
>+  EFI_MM_READ_SAVE_STATE   ReadSaveState;
>+  EFI_MM_WRITE_SAVE_STATE  WriteSaveState;
>+};
>+
>+extern EFI_GUID gEfiMmCpuProtocolGuid;
>+
>+#endif
>+
>diff --git a/MdePkg/Include/Protocol/MmCpuIo.h
>b/MdePkg/Include/Protocol/MmCpuIo.h
>new file mode 100644
>index 0000000..9fda26c
>--- /dev/null
>+++ b/MdePkg/Include/Protocol/MmCpuIo.h
>@@ -0,0 +1,96 @@
>+/** @file
>+  MM CPU I/O 2 protocol as defined in the PI 1.2 specification.
>+
>+  This protocol provides CPU I/O and memory access within MM.
>+
>+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>+  This program and the accompanying materials
>+  are licensed and made available under the terms and conditions of the BSD
>License
>+  which accompanies this distribution.  The full text of the license may be
>found at
>+  http://opensource.org/licenses/bsd-license.php
>+
>+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>+
>+**/
>+
>+#ifndef _MM_CPU_IO_H_
>+#define _MM_CPU_IO_H_
>+
>+#define EFI_MM_CPU_IO_PROTOCOL_GUID \
>+  { \
>+    0x3242A9D8, 0xCE70, 0x4AA0, { 0x95, 0x5D, 0x5E, 0x7B, 0x14, 0x0D, 0xE4,
>0xD2 } \
>+  }
>+
>+typedef struct _EFI_MM_CPU_IO_PROTOCOL
>EFI_MM_CPU_IO_PROTOCOL;
>+
>+///
>+/// Width of the MM CPU I/O operations
>+///
>+typedef enum {
>+  MM_IO_UINT8  = 0,
>+  MM_IO_UINT16 = 1,
>+  MM_IO_UINT32 = 2,
>+  MM_IO_UINT64 = 3
>+} EFI_MM_IO_WIDTH;
>+
>+/**
>+  Provides the basic memory and I/O interfaces used toabstract accesses to
>devices.
>+
>+  The I/O operations are carried out exactly as requested.  The caller is
>+  responsible for any alignment and I/O width issues that the bus, device,
>+  platform, or type of I/O might require.
>+
>+  @param[in]      This     The EFI_MM_CPU_IO_PROTOCOL instance.
>+  @param[in]      Width    Signifies the width of the I/O operations.
>+  @param[in]      Address  The base address of the I/O operations.  The caller
>is
>+                           responsible for aligning the Address if required.
>+  @param[in]      Count    The number of I/O operations to perform.
>+  @param[in,out]  Buffer   For read operations, the destination buffer to
>store
>+                           the results.  For write operations, the source buffer
>+                           from which to write data.
>+
>+  @retval EFI_SUCCESS            The data was read from or written to the device.
>+  @retval EFI_UNSUPPORTED        The Address is not valid for this system.
>+  @retval EFI_INVALID_PARAMETER  Width or Count, or both, were invalid.
>+  @retval EFI_OUT_OF_RESOURCES   The request could not be completed
>due to a lack
>+                                 of resources.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_CPU_IO)(
>+  IN     CONST EFI_MM_CPU_IO_PROTOCOL    *This,
>+  IN     EFI_MM_IO_WIDTH                 Width,
>+  IN     UINT64                          Address,
>+  IN     UINTN                           Count,
>+  IN OUT VOID                            *Buffer
>+  );
>+
>+typedef struct {
>+  ///
>+  /// This service provides the various modalities of memory and I/O read.
>+  ///
>+  EFI_MM_CPU_IO  Read;
>+  ///
>+  /// This service provides the various modalities of memory and I/O write.
>+  ///
>+  EFI_MM_CPU_IO  Write;
>+} EFI_MM_IO_ACCESS;
>+
>+///
>+/// MM CPU I/O Protocol provides CPU I/O and memory access within MM.
>+///
>+struct _EFI_MM_CPU_IO_PROTOCOL {
>+  ///
>+  /// Allows reads and writes to memory-mapped I/O space.
>+  ///
>+  EFI_MM_IO_ACCESS Mem;
>+  ///
>+  /// Allows reads and writes to I/O space.
>+  ///
>+  EFI_MM_IO_ACCESS Io;
>+};
>+
>+extern EFI_GUID gEfiMmCpuIoProtocolGuid;
>+
>+#endif
>diff --git a/MdePkg/Include/Protocol/MmEndOfDxe.h
>b/MdePkg/Include/Protocol/MmEndOfDxe.h
>new file mode 100644
>index 0000000..6c3f17a
>--- /dev/null
>+++ b/MdePkg/Include/Protocol/MmEndOfDxe.h
>@@ -0,0 +1,33 @@
>+/** @file
>+  MM End Of Dxe protocol introduced in the PI 1.2.1 specification.
>+
>+  According to PI 1.4a specification, this protocol indicates end of the
>+  execution phase when all of the components are under the authority of
>+  the platform manufacturer.
>+  This protocol is a mandatory protocol published by MM Foundation code.
>+  This protocol is an MM counterpart of the End of DXE Event.
>+  This protocol prorogates End of DXE notification into MM environment.
>+  This protocol is installed prior to installation of the MM Ready to Lock
>Protocol.
>+
>+  Copyright (c) 2012 - 2017, Intel Corporation. All rights reserved.<BR>
>+  This program and the accompanying materials
>+  are licensed and made available under the terms and conditions of the BSD
>License
>+  which accompanies this distribution.  The full text of the license may be
>found at
>+  http://opensource.org/licenses/bsd-license.php
>+
>+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>+
>+**/
>+
>+#ifndef _MM_END_OF_DXE_H_
>+#define _MM_END_OF_DXE_H_
>+
>+#define EFI_MM_END_OF_DXE_PROTOCOL_GUID \
>+  { \
>+    0x24e70042, 0xd5c5, 0x4260, { 0x8c, 0x39, 0xa, 0xd3, 0xaa, 0x32, 0xe9, 0x3d }
>\
>+  }
>+
>+extern EFI_GUID gEfiMmEndOfDxeProtocolGuid;
>+
>+#endif
>diff --git a/MdePkg/Include/Protocol/MmGpiDispatch.h
>b/MdePkg/Include/Protocol/MmGpiDispatch.h
>new file mode 100644
>index 0000000..5682e75
>--- /dev/null
>+++ b/MdePkg/Include/Protocol/MmGpiDispatch.h
>@@ -0,0 +1,125 @@
>+/** @file
>+  MM General Purpose Input (GPI) Dispatch Protocol as defined in PI 1.1
>Specification
>+  Volume 4 Management Mode Core Interface.
>+
>+  This protocol provides the parent dispatch service for the General Purpose
>Input
>+  (GPI) MMI source generator.
>+
>+  The EFI_MM_GPI_DISPATCH_PROTOCOL provides the ability to install child
>handlers for the
>+  given event types.  Several inputs can be enabled.  This purpose of this
>interface is to generate an
>+  MMI in response to any of these inputs having a true value provided.
>+
>+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>+  This program and the accompanying materials
>+  are licensed and made available under the terms and conditions of the BSD
>License
>+  which accompanies this distribution.  The full text of the license may be
>found at
>+  http://opensource.org/licenses/bsd-license.php
>+
>+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>+
>+  @par Revision Reference:
>+  This protocol is from PI Version 1.1.
>+
>+**/
>+
>+#ifndef _MM_GPI_DISPATCH_H_
>+#define _MM_GPI_DISPATCH_H_
>+
>+#include <Pi/PiMmCis.h>
>+
>+#define EFI_MM_GPI_DISPATCH_PROTOCOL_GUID \
>+  { \
>+    0x25566b03, 0xb577, 0x4cbf, {0x95, 0x8c, 0xed, 0x66, 0x3e, 0xa2, 0x43,
>0x80 } \
>+  }
>+
>+///
>+/// The dispatch function's context.
>+///
>+typedef struct {
>+  ///
>+  /// A number from one of 2^64 possible GPIs that can generate an MMI. A
>+  /// 0 corresponds to logical GPI[0]; 1 corresponds to logical GPI[1]; and
>+  /// GpiNum of N corresponds to GPI[N], where N can span from 0 to 2^64-1.
>+  ///
>+  UINT64 GpiNum;
>+} EFI_MM_GPI_REGISTER_CONTEXT;
>+
>+typedef struct _EFI_MM_GPI_DISPATCH_PROTOCOL
>EFI_MM_GPI_DISPATCH_PROTOCOL;
>+
>+/**
>+  Registers a child MMI source dispatch function with a parent MM driver.
>+
>+  This service registers a function (DispatchFunction) which will be called
>when an MMI is
>+  generated because of one or more of the GPIs specified by RegisterContext.
>On return,
>+  DispatchHandle contains a unique handle which may be used later to
>unregister the function
>+  using UnRegister().
>+  The DispatchFunction will be called with Context set to the same value as
>was passed into
>+  this function in RegisterContext and with CommBuffer pointing to another
>instance of
>+  EFI_MM_GPI_REGISTER_CONTEXT describing the GPIs which actually
>caused the MMI and
>+  CommBufferSize pointing to the size of the structure.
>+
>+  @param[in]  This               Pointer to the EFI_MM_GPI_DISPATCH_PROTOCOL
>instance.
>+  @param[in]  DispatchFunction   Function to register for handler when the
>specified GPI causes an MMI.
>+  @param[in]  RegisterContext    Pointer to the dispatch function's context.
>+                                 The caller fills this context in before calling
>+                                 the register function to indicate to the register
>+                                 function the GPI(s) for which the dispatch function
>+                                 should be invoked.
>+  @param[out] DispatchHandle     Handle generated by the dispatcher to
>track the
>+                                 function instance.
>+
>+  @retval EFI_SUCCESS            The dispatch function has been successfully
>+                                 registered and the MMI source has been enabled.
>+  @retval EFI_DEVICE_ERROR       The driver was unable to enable the MMI
>source.
>+  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. The GPI input
>value
>+                                 is not within valid range.
>+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system
>or MM) to manage this child.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_GPI_REGISTER)(
>+  IN CONST EFI_MM_GPI_DISPATCH_PROTOCOL    *This,
>+  IN       EFI_MM_HANDLER_ENTRY_POINT      DispatchFunction,
>+  IN CONST EFI_MM_GPI_REGISTER_CONTEXT     *RegisterContext,
>+  OUT      EFI_HANDLE                      *DispatchHandle
>+  );
>+
>+/**
>+  Unregisters a General Purpose Input (GPI) service.
>+
>+  This service removes the handler associated with DispatchHandle so that it
>will no longer be
>+  called when the GPI triggers an MMI.
>+
>+  @param[in]  This               Pointer to the EFI_MM_GPI_DISPATCH_PROTOCOL
>instance.
>+  @param[in]  DispatchHandle     Handle of the service to remove.
>+
>+  @retval EFI_SUCCESS            Handle of the service to remove.
>+  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_GPI_UNREGISTER)(
>+  IN CONST EFI_MM_GPI_DISPATCH_PROTOCOL    *This,
>+  IN       EFI_HANDLE                      DispatchHandle
>+  );
>+
>+///
>+/// Interface structure for the MM GPI MMI Dispatch Protocol
>+///
>+/// The MM GPI MMI Dispatch Protocol provides the parent dispatch service
>+/// for the General Purpose Input (GPI) MMI source generator.
>+///
>+struct _EFI_MM_GPI_DISPATCH_PROTOCOL {
>+  EFI_MM_GPI_REGISTER    Register;
>+  EFI_MM_GPI_UNREGISTER  UnRegister;
>+  ///
>+  /// Denotes the maximum value of inputs that can have handlers attached.
>+  ///
>+  UINTN                   NumSupportedGpis;
>+};
>+
>+extern EFI_GUID gEfiMmGpiDispatchProtocolGuid;
>+
>+#endif
>+
>diff --git a/MdePkg/Include/Protocol/MmIoTrapDispatch.h
>b/MdePkg/Include/Protocol/MmIoTrapDispatch.h
>new file mode 100644
>index 0000000..ae116a0
>--- /dev/null
>+++ b/MdePkg/Include/Protocol/MmIoTrapDispatch.h
>@@ -0,0 +1,136 @@
>+/** @file
>+  MM IO Trap Dispatch Protocol as defined in PI 1.1 Specification
>+  Volume 4 Management Mode Core Interface.
>+
>+  This protocol provides a parent dispatch service for IO trap MMI sources.
>+
>+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>+  This program and the accompanying materials
>+  are licensed and made available under the terms and conditions of the BSD
>License
>+  which accompanies this distribution.  The full text of the license may be
>found at
>+  http://opensource.org/licenses/bsd-license.php
>+
>+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>+
>+  @par Revision Reference:
>+  This protocol is from PI Version 1.1.
>+
>+**/
>+
>+#ifndef _MM_IO_TRAP_DISPATCH_H_
>+#define _MM_IO_TRAP_DISPATCH_H_
>+
>+#include <Pi/PiMmCis.h>
>+
>+#define EFI_MM_IO_TRAP_DISPATCH_PROTOCOL_GUID \
>+  { \
>+    0x58dc368d, 0x7bfa, 0x4e77, {0xab, 0xbc, 0xe, 0x29, 0x41, 0x8d, 0xf9, 0x30 }
>\
>+  }
>+
>+///
>+/// IO Trap valid types
>+///
>+typedef enum {
>+  WriteTrap,
>+  ReadTrap,
>+  ReadWriteTrap,
>+  IoTrapTypeMaximum
>+} EFI_MM_IO_TRAP_DISPATCH_TYPE;
>+
>+///
>+/// IO Trap context structure containing information about the
>+/// IO trap event that should invoke the handler
>+///
>+typedef struct {
>+  UINT16                         Address;
>+  UINT16                         Length;
>+  EFI_MM_IO_TRAP_DISPATCH_TYPE   Type;
>+} EFI_MM_IO_TRAP_REGISTER_CONTEXT;
>+
>+///
>+/// IO Trap context structure containing information about the IO trap that
>occurred
>+///
>+typedef struct {
>+  UINT32  WriteData;
>+} EFI_MM_IO_TRAP_CONTEXT;
>+
>+typedef struct _EFI_MM_IO_TRAP_DISPATCH_PROTOCOL
>EFI_MM_IO_TRAP_DISPATCH_PROTOCOL;
>+
>+/**
>+  Register an IO trap MMI child handler for a specified MMI.
>+
>+  This service registers a function (DispatchFunction) which will be called
>when an MMI is
>+  generated because of an access to an I/O port specified by RegisterContext.
>On return,
>+  DispatchHandle contains a unique handle which may be used later to
>unregister the function
>+  using UnRegister(). If the base of the I/O range specified is zero, then an
>I/O range with the
>+  specified length and characteristics will be allocated and the Address field in
>RegisterContext
>+  updated. If no range could be allocated, then EFI_OUT_OF_RESOURCES will
>be returned.
>+
>+  The service will not perform GCD allocation if the base address is non-zero
>or
>+  EFI_MM_READY_TO_LOCK has been installed.  In this case, the caller is
>responsible for the
>+  existence and allocation of the specific IO range.
>+  An error may be returned if some or all of the requested resources conflict
>with an existing IO trap
>+  child handler.
>+
>+  It is not required that implementations will allow multiple children for a
>single IO trap MMI source.
>+  Some implementations may support multiple children.
>+  The DispatchFunction will be called with Context updated to contain
>information
>+  concerning the I/O action that actually happened and is passed in
>RegisterContext, with
>+  CommBuffer pointing to the data actually written and CommBufferSize
>pointing to the size of
>+  the data in CommBuffer.
>+
>+  @param[in]  This               Pointer to the
>EFI_MM_IO_TRAP_DISPATCH_PROTOCOL instance.
>+  @param[in]  DispatchFunction   Function to register for handler when I/O
>trap location is accessed.
>+  @param[in]  RegisterContext    Pointer to the dispatch function's context.
>The caller fills this
>+                                 context in before calling the register function to indicate to
>the register
>+                                 function the IO trap MMI source for which the dispatch
>function should be invoked.
>+  @param[out] DispatchHandle     Handle of the dispatch function, for when
>interfacing with the parent MM driver.
>+
>+  @retval EFI_SUCCESS            The dispatch function has been successfully
>registered.
>+  @retval EFI_DEVICE_ERROR       The driver was unable to complete due to
>hardware error.
>+  @retval EFI_OUT_OF_RESOURCES   Insufficient resources are available to
>fulfill the IO trap range request.
>+  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid.  The input
>value is not within a valid range.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_IO_TRAP_DISPATCH_REGISTER)(
>+  IN CONST EFI_MM_IO_TRAP_DISPATCH_PROTOCOL    *This,
>+  IN       EFI_MM_HANDLER_ENTRY_POINT          DispatchFunction,
>+  IN OUT   EFI_MM_IO_TRAP_REGISTER_CONTEXT     *RegisterContext,
>+     OUT   EFI_HANDLE                          *DispatchHandle
>+  );
>+
>+/**
>+  Unregister a child MMI source dispatch function with a parent MM driver.
>+
>+  This service removes a previously installed child dispatch handler. This does
>not guarantee that the
>+  system resources will be freed from the GCD.
>+
>+  @param[in] This                Pointer to the
>EFI_MM_IO_TRAP_DISPATCH_PROTOCOL instance.
>+  @param[in] DispatchHandle      Handle of the child service to remove.
>+
>+  @retval EFI_SUCCESS            The dispatch function has been successfully
>unregistered.
>+  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_IO_TRAP_DISPATCH_UNREGISTER)(
>+  IN CONST EFI_MM_IO_TRAP_DISPATCH_PROTOCOL    *This,
>+  IN       EFI_HANDLE                          DispatchHandle
>+  );
>+
>+///
>+/// Interface structure for the MM IO Trap Dispatch Protocol.
>+///
>+/// This protocol provides a parent dispatch service for IO trap MMI sources.
>+///
>+struct _EFI_MM_IO_TRAP_DISPATCH_PROTOCOL {
>+  EFI_MM_IO_TRAP_DISPATCH_REGISTER    Register;
>+  EFI_MM_IO_TRAP_DISPATCH_UNREGISTER  UnRegister;
>+};
>+
>+extern EFI_GUID gEfiMmIoTrapDispatchProtocolGuid;
>+
>+#endif
>+
>diff --git a/MdePkg/Include/Protocol/MmPciRootBridgeIo.h
>b/MdePkg/Include/Protocol/MmPciRootBridgeIo.h
>new file mode 100644
>index 0000000..a3f3946
>--- /dev/null
>+++ b/MdePkg/Include/Protocol/MmPciRootBridgeIo.h
>@@ -0,0 +1,37 @@
>+/** @file
>+  MM PCI Root Bridge IO protocol as defined in the PI 1.2 specification.
>+
>+  This protocol provides PCI I/O and memory access within MM.
>+
>+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>+  This program and the accompanying materials
>+  are licensed and made available under the terms and conditions of the BSD
>License
>+  which accompanies this distribution.  The full text of the license may be
>found at
>+  http://opensource.org/licenses/bsd-license.php
>+
>+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>+
>+**/
>+
>+#ifndef _MM_PCI_ROOT_BRIDGE_IO_H_
>+#define _MM_PCI_ROOT_BRIDGE_IO_H_
>+
>+#include <Protocol/PciRootBridgeIo.h>
>+
>+#define EFI_MM_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID \
>+  { \
>+    0x8bc1714d, 0xffcb, 0x41c3, { 0x89, 0xdc, 0x6c, 0x74, 0xd0, 0x6d, 0x98,
>0xea } \
>+  }
>+
>+///
>+/// This protocol provides the same functionality as the PCI Root Bridge I/O
>Protocol defined in the
>+/// UEFI 2.1 Specifcation, section 13.2, except that the functions for Map()
>and Unmap() may return
>+/// EFI_UNSUPPORTED.
>+///
>+typedef EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
>EFI_MM_PCI_ROOT_BRIDGE_IO_PROTOCOL;
>+
>+extern EFI_GUID gEfiMmPciRootBridgeIoProtocolGuid;
>+
>+#endif
>+
>diff --git a/MdePkg/Include/Protocol/MmPeriodicTimerDispatch.h
>b/MdePkg/Include/Protocol/MmPeriodicTimerDispatch.h
>new file mode 100644
>index 0000000..4f88dc8
>--- /dev/null
>+++ b/MdePkg/Include/Protocol/MmPeriodicTimerDispatch.h
>@@ -0,0 +1,170 @@
>+/** @file
>+  MM Periodic Timer Dispatch Protocol as defined in PI 1.1 Specification
>+  Volume 4 Management Mode Core Interface.
>+
>+  This protocol provides the parent dispatch service for the periodical timer
>MMI source generator.
>+
>+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>+  This program and the accompanying materials
>+  are licensed and made available under the terms and conditions of the BSD
>License
>+  which accompanies this distribution.  The full text of the license may be
>found at
>+  http://opensource.org/licenses/bsd-license.php
>+
>+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>+
>+  @par Revision Reference:
>+  This protocol is from PI Version 1.1.
>+
>+**/
>+
>+#ifndef _MM_PERIODIC_TIMER_DISPATCH_H_
>+#define _MM_PERIODIC_TIMER_DISPATCH_H_
>+
>+#include <Pi/PiMmCis.h>
>+
>+#define EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL_GUID \
>+  { \
>+    0x4cec368e, 0x8e8e, 0x4d71, {0x8b, 0xe1, 0x95, 0x8c, 0x45, 0xfc, 0x8a,
>0x53 } \
>+  }
>+
>+///
>+/// Example: A chipset supports periodic MMIs on every 64ms or 2 seconds.
>+///   A child wishes schedule a period MMI to fire on a period of 3 seconds,
>there
>+///   are several ways to approach the problem:
>+///   1. The child may accept a 4 second periodic rate, in which case it registers
>with
>+///        Period = 40000
>+///        MmiTickInterval = 20000
>+///      The resulting MMI will occur every 2 seconds with the child called back
>on
>+///      every 2nd MMI.
>+///      NOTE: the same result would occur if the child set MmiTickInterval = 0.
>+///   2. The child may choose the finer granularity MMI (64ms):
>+///        Period = 30000
>+///        MmiTickInterval = 640
>+///      The resulting MMI will occur every 64ms with the child called back on
>+///      every 47th MMI.
>+///      NOTE: the child driver should be aware that this will result in more
>+///        MMIs occuring during system runtime which can negatively impact
>system
>+///        performance.
>+///
>+typedef struct {
>+  ///
>+  /// The minimum period of time in 100 nanosecond units that the child gets
>called. The
>+  /// child will be called back after a time greater than the time Period.
>+  ///
>+  UINT64  Period;
>+  ///
>+  /// The period of time interval between MMIs. Children of this interface
>should use this
>+  /// field when registering for periodic timer intervals when a finer
>granularity periodic
>+  /// MMI is desired.
>+  ///
>+  UINT64  MmiTickInterval;
>+} EFI_MM_PERIODIC_TIMER_REGISTER_CONTEXT;
>+
>+///
>+/// The DispatchFunction will be called with Context set to the same value as
>was passed into
>+/// Register() in RegisterContext and with CommBuffer pointing to an
>instance of
>+/// EFI_MM_PERIODIC_TIMER_CONTEXT and CommBufferSize pointing to
>its size.
>+///
>+typedef struct {
>+  ///
>+  /// ElapsedTime is the actual time in 100 nanosecond units elapsed since last
>called, a
>+  /// value of 0 indicates an unknown amount of time.
>+  ///
>+  UINT64  ElapsedTime;
>+} EFI_MM_PERIODIC_TIMER_CONTEXT;
>+
>+typedef struct _EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL
>EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL;
>+
>+/**
>+  Register a child MMI source dispatch function for MM periodic timer.
>+
>+  This service registers a function (DispatchFunction) which will be called
>when at least the
>+  amount of time specified by RegisterContext has elapsed. On return,
>DispatchHandle
>+  contains a unique handle which may be used later to unregister the
>function using UnRegister().
>+  The DispatchFunction will be called with Context set to the same value as
>was passed into
>+  this function in RegisterContext and with CommBuffer pointing to an
>instance of
>+  EFI_MM_PERIODIC_TIMER_CONTEXT and CommBufferSize pointing to its
>size.
>+
>+  @param[in]  This               Pointer to the
>EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL instance.
>+  @param[in]  DispatchFunction   Function to register for handler when at
>least the specified amount
>+                                 of time has elapsed.
>+  @param[in]  RegisterContext    Pointer to the dispatch function's context.
>+                                 The caller fills this context in before calling
>+                                 the register function to indicate to the register
>+                                 function the period at which the dispatch function
>+                                 should be invoked.
>+  @param[out] DispatchHandle     Handle generated by the dispatcher to
>track the function instance.
>+
>+  @retval EFI_SUCCESS            The dispatch function has been successfully
>+                                 registered and the MMI source has been enabled.
>+  @retval EFI_DEVICE_ERROR       The driver was unable to enable the MMI
>source.
>+  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. The period
>input value
>+                                 is not within valid range.
>+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system
>or MM) to manage this child.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_PERIODIC_TIMER_REGISTER)(
>+  IN CONST EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL    *This,
>+  IN       EFI_MM_HANDLER_ENTRY_POINT                 DispatchFunction,
>+  IN CONST EFI_MM_PERIODIC_TIMER_REGISTER_CONTEXT
>*RegisterContext,
>+  OUT      EFI_HANDLE                                 *DispatchHandle
>+  );
>+
>+/**
>+  Unregisters a periodic timer service.
>+
>+  This service removes the handler associated with DispatchHandle so that it
>will no longer be
>+  called when the time has elapsed.
>+
>+  @param[in] This                Pointer to the
>EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL instance.
>+  @param[in] DispatchHandle      Handle of the service to remove.
>+
>+  @retval EFI_SUCCESS            The service has been successfully removed.
>+  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_PERIODIC_TIMER_UNREGISTER)(
>+  IN CONST EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL  *This,
>+  IN       EFI_HANDLE                               DispatchHandle
>+  );
>+
>+/**
>+  Returns the next MMI tick period supported by the chipset.
>+
>+  The order returned is from longest to shortest interval period.
>+
>+  @param[in]     This             Pointer to the
>EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL instance.
>+  @param[in,out] MmiTickInterval  Pointer to pointer of next shorter MMI
>interval
>+                                  period supported by the child. This parameter works as a
>get-first,
>+                                  get-next field.The first time this function is called,
>*MmiTickInterval
>+                                  should be set to NULL to get the longest MMI interval.The
>returned
>+                                  *MmiTickInterval should be passed in on subsequent calls
>to get the
>+                                  next shorter interval period until *MmiTickInterval = NULL.
>+
>+  @retval EFI_SUCCESS             The service returned successfully.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_PERIODIC_TIMER_INTERVAL)(
>+  IN CONST EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL  *This,
>+  IN OUT UINT64                                     **MmiTickInterval
>+  );
>+
>+///
>+/// Interface structure for the MM Periodic Timer Dispatch Protocol
>+///
>+/// This protocol provides the parent dispatch service for the periodical timer
>MMI source generator.
>+///
>+struct _EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL {
>+  EFI_MM_PERIODIC_TIMER_REGISTER    Register;
>+  EFI_MM_PERIODIC_TIMER_UNREGISTER  UnRegister;
>+  EFI_MM_PERIODIC_TIMER_INTERVAL    GetNextShorterInterval;
>+};
>+
>+extern EFI_GUID gEfiMmPeriodicTimerDispatchProtocolGuid;
>+
>+#endif
>+
>diff --git a/MdePkg/Include/Protocol/MmPowerButtonDispatch.h
>b/MdePkg/Include/Protocol/MmPowerButtonDispatch.h
>new file mode 100644
>index 0000000..7f1a4e2
>--- /dev/null
>+++ b/MdePkg/Include/Protocol/MmPowerButtonDispatch.h
>@@ -0,0 +1,117 @@
>+/** @file
>+  MM Power Button Dispatch Protocol as defined in PI 1.1 Specification
>+  Volume 4 Management Mode Core Interface.
>+
>+  This protocol provides the parent dispatch service for the power button
>MMI source generator.
>+
>+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>+  This program and the accompanying materials
>+  are licensed and made available under the terms and conditions of the BSD
>License
>+  which accompanies this distribution.  The full text of the license may be
>found at
>+  http://opensource.org/licenses/bsd-license.php
>+
>+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>+
>+  @par Revision Reference:
>+  This protocol is from PI Version 1.1.
>+
>+**/
>+
>+#ifndef _MM_POWER_BUTTON_DISPATCH_H_
>+#define _MM_POWER_BUTTON_DISPATCH_H_
>+
>+#include <Pi/PiMmCis.h>
>+
>+#define EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL_GUID \
>+  { \
>+    0x1b1183fa, 0x1823, 0x46a7, {0x88, 0x72, 0x9c, 0x57, 0x87, 0x55, 0x40, 0x9d }
>\
>+  }
>+
>+///
>+/// Power Button phases.
>+///
>+typedef enum {
>+  EfiPowerButtonEntry,
>+  EfiPowerButtonExit,
>+  EfiPowerButtonMax
>+} EFI_POWER_BUTTON_PHASE;
>+
>+///
>+/// The dispatch function's context.
>+///
>+typedef struct {
>+  ///
>+  /// Designates whether this handler should be invoked upon entry or exit.
>+  ///
>+  EFI_POWER_BUTTON_PHASE  Phase;
>+} EFI_MM_POWER_BUTTON_REGISTER_CONTEXT;
>+
>+typedef struct _EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL
>EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL;
>+
>+/**
>+  Provides the parent dispatch service for a power button event.
>+
>+  This service registers a function (DispatchFunction) which will be called
>when an MMI is
>+  generated because the power button was pressed or released, as specified
>by RegisterContext.
>+  On return, DispatchHandle contains a unique handle which may be used
>later to unregister the
>+  function using UnRegister().
>+  The DispatchFunction will be called with Context set to the same value as
>was passed into
>+  this function in RegisterContext and with CommBuffer and CommBufferSize
>set to NULL.
>+
>+  @param[in]  This               Pointer to the
>EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL instance.
>+  @param[in]  DispatchFunction   Function to register for handler when
>power button is pressed or released.
>+  @param[in]  RegisterContext    Pointer to the dispatch function's context.
>The caller fills in this context
>+                                 before calling the Register() function to indicate to the
>Register() function
>+                                 the power button MMI phase for which the dispatch
>function should be invoked.
>+  @param[out] DispatchHandle     Handle generated by the dispatcher to
>track the function instance.
>+
>+  @retval EFI_SUCCESS            The dispatch function has been successfully
>+                                 registered and the MMI source has been enabled.
>+  @retval EFI_DEVICE_ERROR       The driver was unable to enable the MMI
>source.
>+  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. The power
>button input value
>+                                 is not within valid range.
>+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system
>or MM) to manage this child.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_POWER_BUTTON_REGISTER)(
>+  IN CONST EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL  *This,
>+  IN       EFI_MM_HANDLER_ENTRY_POINT             DispatchFunction,
>+  IN       EFI_MM_POWER_BUTTON_REGISTER_CONTEXT   *RegisterContext,
>+  OUT      EFI_HANDLE                             *DispatchHandle
>+  );
>+
>+/**
>+  Unregisters a power-button service.
>+
>+  This service removes the handler associated with DispatchHandle so that it
>will no longer be
>+  called when the standby button is pressed or released.
>+
>+  @param[in] This                Pointer to the
>EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL instance.
>+  @param[in] DispatchHandle      Handle of the service to remove.
>+
>+  @retval EFI_SUCCESS            The service has been successfully removed.
>+  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_POWER_BUTTON_UNREGISTER)(
>+  IN CONST EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL  *This,
>+  IN       EFI_HANDLE                             DispatchHandle
>+  );
>+
>+///
>+/// Interface structure for the MM Power Button Dispatch Protocol.
>+///
>+/// This protocol provides the parent dispatch service for the power button
>MMI source generator.
>+///
>+struct _EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL {
>+  EFI_MM_POWER_BUTTON_REGISTER    Register;
>+  EFI_MM_POWER_BUTTON_UNREGISTER  UnRegister;
>+};
>+
>+extern EFI_GUID gEfiMmPowerButtonDispatchProtocolGuid;
>+
>+#endif
>+
>diff --git a/MdePkg/Include/Protocol/MmReadyToLock.h
>b/MdePkg/Include/Protocol/MmReadyToLock.h
>new file mode 100644
>index 0000000..7752c71
>--- /dev/null
>+++ b/MdePkg/Include/Protocol/MmReadyToLock.h
>@@ -0,0 +1,35 @@
>+/** @file
>+  MM Ready To Lock protocol introduced in the PI 1.2 specification.
>+
>+  According to PI 1.4a specification, this MM protocol indicates that
>+  MM resources and services that should not be used by the third party
>+  code are about to be locked.
>+  This protocol is a mandatory protocol published by the MM Foundation
>+  code when the system is preparing to lock certain resources and interfaces
>+  in anticipation of the invocation of 3rd party extensible modules.
>+  This protocol is an MM counterpart of the DXE MM Ready to Lock Protocol.
>+  This protocol prorogates resource locking notification into MM environment.
>+  This protocol is installed after installation of the MM End of DXE Protocol.
>+
>+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>+  This program and the accompanying materials
>+  are licensed and made available under the terms and conditions of the BSD
>License
>+  which accompanies this distribution.  The full text of the license may be
>found at
>+  http://opensource.org/licenses/bsd-license.php
>+
>+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>+
>+**/
>+
>+#ifndef _MM_READY_TO_LOCK_H_
>+#define _MM_READY_TO_LOCK_H_
>+
>+#define EFI_MM_READY_TO_LOCK_PROTOCOL_GUID \
>+  { \
>+    0x47b7fa8c, 0xf4bd, 0x4af6, { 0x82, 0x00, 0x33, 0x30, 0x86, 0xf0, 0xd2, 0xc8 }
>\
>+  }
>+
>+extern EFI_GUID gEfiMmReadyToLockProtocolGuid;
>+
>+#endif
>diff --git a/MdePkg/Include/Protocol/MmReportStatusCodeHandler.h
>b/MdePkg/Include/Protocol/MmReportStatusCodeHandler.h
>new file mode 100644
>index 0000000..9f967b3
>--- /dev/null
>+++ b/MdePkg/Include/Protocol/MmReportStatusCodeHandler.h
>@@ -0,0 +1,81 @@
>+/** @file
>+  This protocol provides registering and unregistering services to status code
>consumers while in DXE MM.
>+
>+  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
>+  This program and the accompanying materials
>+  are licensed and made available under the terms and conditions of the BSD
>License
>+  which accompanies this distribution.  The full text of the license may be
>found at
>+  http://opensource.org/licenses/bsd-license.php
>+
>+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>+
>+**/
>+
>+#ifndef __MM_REPORT_STATUS_CODE_HANDLER_PROTOCOL_H__
>+#define __MM_REPORT_STATUS_CODE_HANDLER_PROTOCOL_H__
>+
>+#define EFI_MM_RSC_HANDLER_PROTOCOL_GUID \
>+  { \
>+    0x2ff29fa7, 0x5e80, 0x4ed9, {0xb3, 0x80, 0x1, 0x7d, 0x3c, 0x55, 0x4f, 0xf4} \
>+  }
>+
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_RSC_HANDLER_CALLBACK)(
>+  IN EFI_STATUS_CODE_TYPE   CodeType,
>+  IN EFI_STATUS_CODE_VALUE  Value,
>+  IN UINT32                 Instance,
>+  IN EFI_GUID               *CallerId,
>+  IN EFI_STATUS_CODE_DATA   *Data
>+);
>+
>+/**
>+  Register the callback function for ReportStatusCode() notification.
>+
>+  When this function is called the function pointer is added to an internal list
>and any future calls to
>+  ReportStatusCode() will be forwarded to the Callback function.
>+
>+  @param[in] Callback               A pointer to a function of type
>EFI_MM_RSC_HANDLER_CALLBACK that is
>+                                    called when a call to ReportStatusCode() occurs.
>+
>+  @retval EFI_SUCCESS               Function was successfully registered.
>+  @retval EFI_INVALID_PARAMETER     The callback function was NULL.
>+  @retval EFI_OUT_OF_RESOURCES      The internal buffer ran out of space.
>No more functions can be
>+                                    registered.
>+  @retval EFI_ALREADY_STARTED       The function was already registered. It
>can't be registered again.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_RSC_HANDLER_REGISTER)(
>+  IN EFI_MM_RSC_HANDLER_CALLBACK Callback
>+);
>+
>+/**
>+  Remove a previously registered callback function from the notification list.
>+
>+  A callback function must be unregistered before it is deallocated. It is
>important that any registered
>+  callbacks that are not runtime complaint be unregistered when
>ExitBootServices() is called.
>+
>+  @param[in] Callback           A pointer to a function of type
>EFI_MM_RSC_HANDLER_CALLBACK that is to be
>+                                unregistered.
>+
>+  @retval EFI_SUCCESS           The function was successfully unregistered.
>+  @retval EFI_INVALID_PARAMETER The callback function was NULL.
>+  @retval EFI_NOT_FOUND         The callback function was not found to be
>unregistered.
>+
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_RSC_HANDLER_UNREGISTER)(
>+  IN EFI_MM_RSC_HANDLER_CALLBACK Callback
>+);
>+
>+typedef struct _EFI_MM_RSC_HANDLER_PROTOCOL {
>+  EFI_MM_RSC_HANDLER_REGISTER      Register;
>+  EFI_MM_RSC_HANDLER_UNREGISTER    Unregister;
>+} EFI_MM_RSC_HANDLER_PROTOCOL;
>+
>+extern EFI_GUID gEfiMmRscHandlerProtocolGuid;
>+
>+#endif
>diff --git a/MdePkg/Include/Protocol/MmStandbyButtonDispatch.h
>b/MdePkg/Include/Protocol/MmStandbyButtonDispatch.h
>new file mode 100644
>index 0000000..7dcb49c
>--- /dev/null
>+++ b/MdePkg/Include/Protocol/MmStandbyButtonDispatch.h
>@@ -0,0 +1,119 @@
>+/** @file
>+  MM Standby Button Dispatch Protocol as defined in PI 1.1 Specification
>+  Volume 4 Management Mode Core Interface.
>+
>+  This protocol provides the parent dispatch service for the standby button
>MMI source generator.
>+
>+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>+  This program and the accompanying materials
>+  are licensed and made available under the terms and conditions of the BSD
>License
>+  which accompanies this distribution.  The full text of the license may be
>found at
>+  http://opensource.org/licenses/bsd-license.php
>+
>+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>+
>+  @par Revision Reference:
>+  This protocol is from PI Version 1.1.
>+
>+**/
>+
>+#ifndef _MM_STANDBY_BUTTON_DISPATCH_H_
>+#define _MM_STANDBY_BUTTON_DISPATCH_H_
>+
>+#include <Pi/PiMmCis.h>
>+
>+#define EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL_GUID \
>+  { \
>+    0x7300c4a1, 0x43f2, 0x4017, {0xa5, 0x1b, 0xc8, 0x1a, 0x7f, 0x40, 0x58, 0x5b }
>\
>+  }
>+
>+///
>+/// Standby Button phases
>+///
>+typedef enum {
>+  EfiStandbyButtonEntry,
>+  EfiStandbyButtonExit,
>+  EfiStandbyButtonMax
>+} EFI_STANDBY_BUTTON_PHASE;
>+
>+///
>+/// The dispatch function's context.
>+///
>+typedef struct {
>+  ///
>+  /// Describes whether the child handler should be invoked upon the entry
>to the button
>+  /// activation or upon exit.
>+  ///
>+  EFI_STANDBY_BUTTON_PHASE  Phase;
>+} EFI_MM_STANDBY_BUTTON_REGISTER_CONTEXT;
>+
>+typedef struct _EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL
>EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL;
>+
>+/**
>+  Provides the parent dispatch service for a standby button event.
>+
>+  This service registers a function (DispatchFunction) which will be called
>when an MMI is
>+  generated because the standby button was pressed or released, as
>specified by
>+  RegisterContext. On return, DispatchHandle contains a unique handle which
>may be used
>+  later to unregister the function using UnRegister().
>+  The DispatchFunction will be called with Context set to the same value as
>was passed into
>+  this function in RegisterContext and with CommBuffer and CommBufferSize
>set to NULL.
>+
>+  @param[in]  This               Pointer to the
>EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL instance.
>+  @param[in]  DispatchFunction   Function to register for handler when the
>standby button is pressed or released.
>+  @param[in]  RegisterContext    Pointer to the dispatch function's context.
>The caller fills in this context
>+                                 before calling the register function to indicate to the register
>function the
>+                                 standby button MMI source for which the dispatch function
>should be invoked.
>+  @param[out] DispatchHandle     Handle generated by the dispatcher to
>track the function instance.
>+
>+  @retval EFI_SUCCESS            The dispatch function has been successfully
>+                                 registered and the MMI source has been enabled.
>+  @retval EFI_DEVICE_ERROR       The driver was unable to enable the MMI
>source.
>+  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. The standby
>button input value
>+                                 is not within valid range.
>+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system
>or MM) to manage this child.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_STANDBY_BUTTON_REGISTER)(
>+  IN CONST EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL  *This,
>+  IN       EFI_MM_HANDLER_ENTRY_POINT               DispatchFunction,
>+  IN       EFI_MM_STANDBY_BUTTON_REGISTER_CONTEXT   *RegisterContext,
>+  OUT      EFI_HANDLE                               *DispatchHandle
>+  );
>+
>+/**
>+  Unregisters a child MMI source dispatch function with a parent MM driver.
>+
>+  This service removes the handler associated with DispatchHandle so that it
>will no longer be
>+  called when the standby button is pressed or released.
>+
>+  @param[in] This                Pointer to the
>EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL instance.
>+  @param[in] DispatchHandle      Handle of the service to remove.
>+
>+  @retval EFI_SUCCESS            The service has been successfully removed.
>+  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_STANDBY_BUTTON_UNREGISTER)(
>+  IN CONST EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL  *This,
>+  IN       EFI_HANDLE                               DispatchHandle
>+  );
>+
>+///
>+/// Interface structure for the MM Standby Button Dispatch Protocol.
>+///
>+/// This protocol provides the parent dispatch service for the standby
>+/// button MMI source generator.
>+///
>+struct _EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL {
>+  EFI_MM_STANDBY_BUTTON_REGISTER    Register;
>+  EFI_MM_STANDBY_BUTTON_UNREGISTER  UnRegister;
>+};
>+
>+extern EFI_GUID gEfiMmStandbyButtonDispatchProtocolGuid;
>+
>+#endif
>+
>diff --git a/MdePkg/Include/Protocol/MmStatusCode.h
>b/MdePkg/Include/Protocol/MmStatusCode.h
>new file mode 100644
>index 0000000..d0bfbac
>--- /dev/null
>+++ b/MdePkg/Include/Protocol/MmStatusCode.h
>@@ -0,0 +1,65 @@
>+/** @file
>+  EFI MM Status Code Protocol as defined in the PI 1.2 specification.
>+
>+  This protocol provides the basic status code services while in MM.
>+
>+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>+  This program and the accompanying materials
>+  are licensed and made available under the terms and conditions of the BSD
>License
>+  which accompanies this distribution.  The full text of the license may be
>found at
>+  http://opensource.org/licenses/bsd-license.php
>+
>+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>+
>+**/
>+
>+#ifndef _MM_STATUS_CODE_H__
>+#define _MM_STATUS_CODE_H__
>+
>+
>+#define EFI_MM_STATUS_CODE_PROTOCOL_GUID \
>+  { \
>+    0x6afd2b77, 0x98c1, 0x4acd, {0xa6, 0xf9, 0x8a, 0x94, 0x39, 0xde, 0xf, 0xb1}
>\
>+  }
>+
>+typedef struct _EFI_MM_STATUS_CODE_PROTOCOL
>EFI_MM_STATUS_CODE_PROTOCOL;
>+
>+/**
>+  Service to emit the status code in MM.
>+
>+  The EFI_MM_STATUS_CODE_PROTOCOL.ReportStatusCode() function
>enables a driver
>+  to emit a status code while in MM.  The reason that there is a separate
>protocol definition from the
>+  DXE variant of this service is that the publisher of this protocol will provide a
>service that is
>+  capability of coexisting with a foreground operational environment, such as
>an operating system
>+  after the termination of boot services.
>+
>+  @param[in] This                Points to this instance of the
>EFI_MM_STATUS_CODE_PROTOCOL.
>+  @param[in] CodeType            DIndicates the type of status code being
>reported.
>+  @param[in] Value               Describes the current status of a hardware or
>software entity.
>+  @param[in] Instance            The enumeration of a hardware or software
>entity within the system.
>+  @param[in] CallerId            This optional parameter may be used to identify
>the caller.
>+  @param[in] Data                This optional parameter may be used to pass
>additional data.
>+
>+  @retval EFI_SUCCESS            The function completed successfully.
>+  @retval EFI_INVALID_PARAMETER  The function should not be completed
>due to a device error.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_REPORT_STATUS_CODE)(
>+  IN CONST EFI_MM_STATUS_CODE_PROTOCOL   *This,
>+  IN EFI_STATUS_CODE_TYPE                CodeType,
>+  IN EFI_STATUS_CODE_VALUE               Value,
>+  IN UINT32                              Instance,
>+  IN CONST EFI_GUID                      *CallerId,
>+  IN EFI_STATUS_CODE_DATA                *Data OPTIONAL
>+  );
>+
>+struct _EFI_MM_STATUS_CODE_PROTOCOL {
>+  EFI_MM_REPORT_STATUS_CODE  ReportStatusCode;
>+};
>+
>+extern EFI_GUID gEfiMmStatusCodeProtocolGuid;
>+
>+#endif
>+
>diff --git a/MdePkg/Include/Protocol/MmSwDispatch.h
>b/MdePkg/Include/Protocol/MmSwDispatch.h
>new file mode 100644
>index 0000000..004c235
>--- /dev/null
>+++ b/MdePkg/Include/Protocol/MmSwDispatch.h
>@@ -0,0 +1,136 @@
>+/** @file
>+  MM Software Dispatch Protocol introduced from PI 1.2 Specification
>+  Volume 4 Management Mode Core Interface.
>+
>+  This protocol provides the parent dispatch service for a given MMI source
>generator.
>+
>+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>+  This program and the accompanying materials
>+  are licensed and made available under the terms and conditions of the BSD
>License
>+  which accompanies this distribution.  The full text of the license may be
>found at
>+  http://opensource.org/licenses/bsd-license.php
>+
>+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>+
>+**/
>+
>+#ifndef _MM_SW_DISPATCH2_H_
>+#define _MM_SW_DISPATCH2_H_
>+
>+#include <Pi/PiMmCis.h>
>+
>+#define EFI_MM_SW_DISPATCH_PROTOCOL_GUID \
>+  { \
>+    0x18a3c6dc, 0x5eea, 0x48c8, {0xa1, 0xc1, 0xb5, 0x33, 0x89, 0xf9, 0x89, 0x99 }
>\
>+  }
>+
>+///
>+/// A particular chipset may not support all possible software MMI input
>values.
>+/// For example, the ICH supports only values 00h to 0FFh.  The parent only
>allows a single
>+/// child registration for each SwMmiInputValue.
>+///
>+typedef struct {
>+  UINTN SwMmiInputValue;
>+} EFI_MM_SW_REGISTER_CONTEXT;
>+
>+///
>+/// The DispatchFunction will be called with Context set to the same value as
>was passed into
>+/// this function in RegisterContext and with CommBuffer (and
>CommBufferSize) pointing
>+/// to an instance of EFI_MM_SW_CONTEXT indicating the index of the CPU
>which generated the
>+/// software MMI.
>+///
>+typedef struct {
>+  ///
>+  /// The 0-based index of the CPU which generated the software MMI.
>+  ///
>+  UINTN SwMmiCpuIndex;
>+  ///
>+  /// This value corresponds directly to the CommandPort parameter used in
>the call to Trigger().
>+  ///
>+  UINT8 CommandPort;
>+  ///
>+  /// This value corresponds directly to the DataPort parameter used in the
>call to Trigger().
>+  ///
>+  UINT8 DataPort;
>+} EFI_MM_SW_CONTEXT;
>+
>+typedef struct _EFI_MM_SW_DISPATCH_PROTOCOL
>EFI_MM_SW_DISPATCH_PROTOCOL;
>+
>+/**
>+  Register a child MMI source dispatch function for the specified software
>MMI.
>+
>+  This service registers a function (DispatchFunction) which will be called
>when the software
>+  MMI source specified by RegisterContext->SwMmiCpuIndex is detected.
>On return,
>+  DispatchHandle contains a unique handle which may be used later to
>unregister the function
>+  using UnRegister().
>+
>+  @param[in]  This                 Pointer to the
>EFI_MM_SW_DISPATCH_PROTOCOL instance.
>+  @param[in]  DispatchFunction     Function to register for handler when the
>specified software
>+                                   MMI is generated.
>+  @param[in, out] RegisterContext  Pointer to the dispatch function's context.
>+                                   The caller fills this context in before calling
>+                                   the register function to indicate to the register
>+                                   function which Software MMI input value the
>+                                   dispatch function should be invoked for.
>+  @param[out] DispatchHandle       Handle generated by the dispatcher to
>track the
>+                                   function instance.
>+
>+  @retval EFI_SUCCESS            The dispatch function has been successfully
>+                                 registered and the MMI source has been enabled.
>+  @retval EFI_DEVICE_ERROR       The SW driver was unable to enable the
>MMI source.
>+  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. The SW MMI
>input value
>+                                 is not within a valid range or is already in use.
>+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system
>or MM) to manage this
>+                                 child.
>+  @retval EFI_OUT_OF_RESOURCES   A unique software MMI value could not
>be assigned
>+                                 for this dispatch.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_SW_REGISTER)(
>+  IN  CONST EFI_MM_SW_DISPATCH_PROTOCOL  *This,
>+  IN        EFI_MM_HANDLER_ENTRY_POINT   DispatchFunction,
>+  IN  OUT   EFI_MM_SW_REGISTER_CONTEXT   *RegisterContext,
>+  OUT       EFI_HANDLE                   *DispatchHandle
>+  );
>+
>+/**
>+  Unregister a child MMI source dispatch function for the specified software
>MMI.
>+
>+  This service removes the handler associated with DispatchHandle so that it
>will no longer be
>+  called in response to a software MMI.
>+
>+  @param[in] This                Pointer to the EFI_MM_SW_DISPATCH_PROTOCOL
>instance.
>+  @param[in] DispatchHandle      Handle of dispatch function to deregister.
>+
>+  @retval EFI_SUCCESS            The dispatch function has been successfully
>unregistered.
>+  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_SW_UNREGISTER)(
>+  IN CONST EFI_MM_SW_DISPATCH_PROTOCOL  *This,
>+  IN       EFI_HANDLE                   DispatchHandle
>+);
>+
>+///
>+/// Interface structure for the MM Software MMI Dispatch Protocol.
>+///
>+/// The EFI_MM_SW_DISPATCH2_PROTOCOL provides the ability to install
>child handlers for the
>+/// given software.  These handlers will respond to software interrupts, and
>the maximum software
>+/// interrupt in the EFI_MM_SW_REGISTER_CONTEXT is denoted by
>MaximumSwiValue.
>+///
>+struct _EFI_MM_SW_DISPATCH_PROTOCOL {
>+  EFI_MM_SW_REGISTER    Register;
>+  EFI_MM_SW_UNREGISTER  UnRegister;
>+  ///
>+  /// A read-only field that describes the maximum value that can be used in
>the
>+  /// EFI_MM_SW_DISPATCH_PROTOCOL.Register() service.
>+  ///
>+  UINTN                 MaximumSwiValue;
>+};
>+
>+extern EFI_GUID gEfiMmSwDispatchProtocolGuid;
>+
>+#endif
>diff --git a/MdePkg/Include/Protocol/MmSxDispatch.h
>b/MdePkg/Include/Protocol/MmSxDispatch.h
>new file mode 100644
>index 0000000..af63389
>--- /dev/null
>+++ b/MdePkg/Include/Protocol/MmSxDispatch.h
>@@ -0,0 +1,135 @@
>+/** @file
>+  MM Sx Dispatch Protocol as defined in PI 1.2 Specification
>+  Volume 4 Management Mode Core Interface.
>+
>+  Provides the parent dispatch service for a given Sx-state source generator.
>+
>+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>+  This program and the accompanying materials
>+  are licensed and made available under the terms and conditions of the BSD
>License
>+  which accompanies this distribution.  The full text of the license may be
>found at
>+  http://opensource.org/licenses/bsd-license.php
>+
>+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>+
>+**/
>+
>+#ifndef _MM_SX_DISPATCH_H_
>+#define _MM_SX_DISPATCH_H_
>+
>+#include <Pi/PiMmCis.h>
>+
>+#define EFI_MM_SX_DISPATCH_PROTOCOL_GUID \
>+  { \
>+    0x456d2859, 0xa84b, 0x4e47, {0xa2, 0xee, 0x32, 0x76, 0xd8, 0x86, 0x99,
>0x7d } \
>+  }
>+
>+///
>+/// Sleep states S0-S5
>+///
>+typedef enum {
>+  SxS0,
>+  SxS1,
>+  SxS2,
>+  SxS3,
>+  SxS4,
>+  SxS5,
>+  EfiMaximumSleepType
>+} EFI_SLEEP_TYPE;
>+
>+///
>+/// Sleep state phase: entry or exit
>+///
>+typedef enum {
>+  SxEntry,
>+  SxExit,
>+  EfiMaximumPhase
>+} EFI_SLEEP_PHASE;
>+
>+///
>+/// The dispatch function's context
>+///
>+typedef struct {
>+  EFI_SLEEP_TYPE  Type;
>+  EFI_SLEEP_PHASE Phase;
>+} EFI_MM_SX_REGISTER_CONTEXT;
>+
>+typedef struct _EFI_MM_SX_DISPATCH_PROTOCOL
>EFI_MM_SX_DISPATCH_PROTOCOL;
>+
>+/**
>+  Provides the parent dispatch service for a given Sx source generator.
>+
>+  This service registers a function (DispatchFunction) which will be called
>when the sleep state
>+  event specified by RegisterContext is detected. On return, DispatchHandle
>contains a
>+  unique handle which may be used later to unregister the function using
>UnRegister().
>+  The DispatchFunction will be called with Context set to the same value as
>was passed into
>+  this function in RegisterContext and with CommBuffer and CommBufferSize
>set to
>+  NULL and 0 respectively.
>+
>+  @param[in] This                Pointer to the EFI_MM_SX_DISPATCH_PROTOCOL
>instance.
>+  @param[in] DispatchFunction    Function to register for handler when the
>specified sleep state event occurs.
>+  @param[in] RegisterContext     Pointer to the dispatch function's context.
>+                                 The caller fills this context in before calling
>+                                 the register function to indicate to the register
>+                                 function which Sx state type and phase the caller
>+                                 wishes to be called back on. For this intertace,
>+                                 the Sx driver will call the registered handlers for
>+                                 all Sx type and phases, so the Sx state handler(s)
>+                                 must check the Type and Phase field of the Dispatch
>+                                 context and act accordingly.
>+  @param[out]  DispatchHandle    Handle of dispatch function, for when
>interfacing
>+                                 with the parent Sx state MM driver.
>+
>+  @retval EFI_SUCCESS            The dispatch function has been successfully
>+                                 registered and the MMI source has been enabled.
>+  @retval EFI_UNSUPPORTED        The Sx driver or hardware does not support
>that
>+                                 Sx Type/Phase.
>+  @retval EFI_DEVICE_ERROR       The Sx driver was unable to enable the MMI
>source.
>+  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. Type & Phase
>are not
>+                                 within valid range.
>+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system
>or MM) to manage this
>+                                 child.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_SX_REGISTER)(
>+  IN  CONST EFI_MM_SX_DISPATCH_PROTOCOL  *This,
>+  IN        EFI_MM_HANDLER_ENTRY_POINT   DispatchFunction,
>+  IN  CONST EFI_MM_SX_REGISTER_CONTEXT   *RegisterContext,
>+  OUT       EFI_HANDLE                   *DispatchHandle
>+  );
>+
>+/**
>+  Unregisters an Sx-state service.
>+
>+  This service removes the handler associated with DispatchHandle so that it
>will no longer be
>+  called in response to sleep event.
>+
>+  @param[in] This                Pointer to the EFI_MM_SX_DISPATCH_PROTOCOL
>instance.
>+  @param[in] DispatchHandle      Handle of the service to remove.
>+
>+  @retval EFI_SUCCESS            The service has been successfully removed.
>+  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_SX_UNREGISTER)(
>+  IN CONST EFI_MM_SX_DISPATCH_PROTOCOL  *This,
>+  IN       EFI_HANDLE                   DispatchHandle
>+  );
>+
>+///
>+/// Interface structure for the MM Sx Dispatch Protocol
>+///
>+/// The EFI_MM_SX_DISPATCH_PROTOCOL provides the ability to install
>child handlers to
>+/// respond to sleep state related events.
>+///
>+struct _EFI_MM_SX_DISPATCH_PROTOCOL {
>+  EFI_MM_SX_REGISTER    Register;
>+  EFI_MM_SX_UNREGISTER  UnRegister;
>+};
>+
>+extern EFI_GUID gEfiMmSxDispatchProtocolGuid;
>+
>+#endif
>diff --git a/MdePkg/Include/Protocol/MmUsbDispatch.h
>b/MdePkg/Include/Protocol/MmUsbDispatch.h
>new file mode 100644
>index 0000000..0b4fabe
>--- /dev/null
>+++ b/MdePkg/Include/Protocol/MmUsbDispatch.h
>@@ -0,0 +1,130 @@
>+/** @file
>+  MM USB Dispatch Protocol as defined in PI 1.1 Specification
>+  Volume 4 Management Mode Core Interface.
>+
>+  Provides the parent dispatch service for the USB MMI source generator.
>+
>+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>+  This program and the accompanying materials
>+  are licensed and made available under the terms and conditions of the BSD
>License
>+  which accompanies this distribution.  The full text of the license may be
>found at
>+  http://opensource.org/licenses/bsd-license.php
>+
>+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
>BASIS,
>+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
>EXPRESS OR IMPLIED.
>+
>+  @par Revision Reference:
>+  This protocol is from PI Version 1.1.
>+
>+**/
>+
>+#ifndef _MM_USB_DISPATCH_H_
>+#define _MM_USB_DISPATCH_H_
>+
>+#include <Pi/PiMmCis.h>
>+
>+#define EFI_MM_USB_DISPATCH_PROTOCOL_GUID \
>+  { \
>+    0xee9b8d90, 0xc5a6, 0x40a2, {0xbd, 0xe2, 0x52, 0x55, 0x8d, 0x33, 0xcc,
>0xa1 } \
>+  }
>+
>+///
>+/// USB MMI event types
>+///
>+typedef enum {
>+  UsbLegacy,
>+  UsbWake
>+} EFI_USB_MMI_TYPE;
>+
>+///
>+/// The dispatch function's context.
>+///
>+typedef struct {
>+  ///
>+  /// Describes whether this child handler will be invoked in response to a
>USB legacy
>+  /// emulation event, such as port-trap on the PS/2* keyboard control
>registers, or to a
>+  /// USB wake event, such as resumption from a sleep state.
>+  ///
>+  EFI_USB_MMI_TYPE          Type;
>+  ///
>+  /// The device path is part of the context structure and describes the
>location of the
>+  /// particular USB host controller in the system for which this register event
>will occur.
>+  /// This location is important because of the possible integration of several
>USB host
>+  /// controllers in a system.
>+  ///
>+  EFI_DEVICE_PATH_PROTOCOL  *Device;
>+} EFI_MM_USB_REGISTER_CONTEXT;
>+
>+typedef struct _EFI_MM_USB_DISPATCH_PROTOCOL
>EFI_MM_USB_DISPATCH_PROTOCOL;
>+
>+/**
>+  Provides the parent dispatch service for the USB MMI source generator.
>+
>+  This service registers a function (DispatchFunction) which will be called
>when the USB-
>+  related MMI specified by RegisterContext has occurred. On return,
>DispatchHandle
>+  contains a unique handle which may be used later to unregister the
>function using UnRegister().
>+  The DispatchFunction will be called with Context set to the same value as
>was passed into
>+  this function in RegisterContext and with CommBuffer containing NULL and
>+  CommBufferSize containing zero.
>+
>+  @param[in]  This               Pointer to the
>EFI_MM_USB_DISPATCH_PROTOCOL instance.
>+  @param[in]  DispatchFunction   Function to register for handler when a
>USB-related MMI occurs.
>+  @param[in]  RegisterContext    Pointer to the dispatch function's context.
>+                                 The caller fills this context in before calling
>+                                 the register function to indicate to the register
>+                                 function the USB MMI types for which the dispatch
>+                                 function should be invoked.
>+  @param[out] DispatchHandle     Handle generated by the dispatcher to
>track the function instance.
>+
>+  @retval EFI_SUCCESS            The dispatch function has been successfully
>+                                 registered and the MMI source has been enabled.
>+  @retval EFI_DEVICE_ERROR       The driver was unable to enable the MMI
>source.
>+  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. The USB MMI
>type
>+                                 is not within valid range.
>+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system
>or MM) to manage this child.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_USB_REGISTER)(
>+  IN  CONST EFI_MM_USB_DISPATCH_PROTOCOL  *This,
>+  IN        EFI_MM_HANDLER_ENTRY_POINT    DispatchFunction,
>+  IN  CONST EFI_MM_USB_REGISTER_CONTEXT   *RegisterContext,
>+  OUT       EFI_HANDLE                    *DispatchHandle
>+  );
>+
>+/**
>+  Unregisters a USB service.
>+
>+  This service removes the handler associated with DispatchHandle so that it
>will no longer be
>+  called when the USB event occurs.
>+
>+  @param[in]  This               Pointer to the
>EFI_MM_USB_DISPATCH_PROTOCOL instance.
>+  @param[in]  DispatchHandle     Handle of the service to remove.
>+
>+  @retval EFI_SUCCESS            The dispatch function has been successfully
>+                                 unregistered and the MMI source has been disabled
>+                                 if there are no other registered child dispatch
>+                                 functions for this MMI source.
>+  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
>+**/
>+typedef
>+EFI_STATUS
>+(EFIAPI *EFI_MM_USB_UNREGISTER)(
>+  IN CONST EFI_MM_USB_DISPATCH_PROTOCOL  *This,
>+  IN       EFI_HANDLE                    DispatchHandle
>+  );
>+
>+///
>+/// Interface structure for the MM USB MMI Dispatch Protocol
>+///
>+/// This protocol provides the parent dispatch service for the USB MMI
>source generator.
>+///
>+struct _EFI_MM_USB_DISPATCH_PROTOCOL {
>+  EFI_MM_USB_REGISTER    Register;
>+  EFI_MM_USB_UNREGISTER  UnRegister;
>+};
>+
>+extern EFI_GUID gEfiMmUsbDispatchProtocolGuid;
>+
>+#endif
>+
>diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
>index f54b056..ace4df3 100644
>--- a/MdePkg/MdePkg.dec
>+++ b/MdePkg/MdePkg.dec
>@@ -1033,6 +1033,9 @@
>   ## Include/Protocol/SmmReportStatusCodeHandler.h
>   gEfiSmmRscHandlerProtocolGuid   = { 0x2ff29fa7, 0x5e80, 0x4ed9, { 0xb3,
>0x80, 0x1, 0x7d, 0x3c, 0x55, 0x4f, 0xf4 }}
>
>+  ## Include/Protocol/MmReportStatusCodeHandler.h
>+  gEfiMmRscHandlerProtocolGuid   = { 0x2ff29fa7, 0x5e80, 0x4ed9, { 0xb3,
>0x80, 0x1, 0x7d, 0x3c, 0x55, 0x4f, 0xf4 }}
>+
>   ## Include/Protocol/AcpiSystemDescriptionTable.h
>   gEfiAcpiSdtProtocolGuid         = { 0xeb97088e, 0xcfdf, 0x49c6, { 0xbe, 0x4b,
>0xd9, 0x6, 0xa5, 0xb2, 0xe, 0x86 }}
>
>@@ -1042,60 +1045,117 @@
>   ## Include/Protocol/SmmCpuIo2.h
>   gEfiSmmCpuIo2ProtocolGuid        = { 0x3242a9d8, 0xce70, 0x4aa0, { 0x95, 0x5d,
>0x5e, 0x7b, 0x14, 0x0d, 0xe4, 0xd2 }}
>
>+  ## Include/Protocol/MmCpuIo.h
>+  gEfiMmCpuIoProtocolGuid        = { 0x3242a9d8, 0xce70, 0x4aa0, { 0x95, 0x5d,
>0x5e, 0x7b, 0x14, 0x0d, 0xe4, 0xd2 }}
>+
>   ## Include/Protocol/SmmBase2.h
>   gEfiSmmBase2ProtocolGuid        = { 0xf4ccbfb7, 0xf6e0, 0x47fd, { 0x9d, 0xd4,
>0x10, 0xa8, 0xf1, 0x50, 0xc1, 0x91 }}
>
>+  ## Include/Protocol/MmBase.h
>+  gEfiMmBaseProtocolGuid        = { 0xf4ccbfb7, 0xf6e0, 0x47fd, { 0x9d, 0xd4,
>0x10, 0xa8, 0xf1, 0x50, 0xc1, 0x91 }}
>+
>   ## Include/Protocol/SmmAccess2.h
>   gEfiSmmAccess2ProtocolGuid      = { 0xc2702b74, 0x800c, 0x4131, { 0x87, 0x46,
>0x8f, 0xb5, 0xb8, 0x9c, 0xe4, 0xac }}
>
>+  ## Include/Protocol/MmAccess.h
>+  gEfiMmAccessProtocolGuid      = { 0xc2702b74, 0x800c, 0x4131, { 0x87, 0x46,
>0x8f, 0xb5, 0xb8, 0x9c, 0xe4, 0xac }}
>+
>   ## Include/Protocol/SmmControl2.h
>   gEfiSmmControl2ProtocolGuid     = { 0x843dc720, 0xab1e, 0x42cb, { 0x93, 0x57,
>0x8a, 0x0, 0x78, 0xf3, 0x56, 0x1b}}
>
>+  ## Include/Protocol/MmControl.h
>+  gEfiMmControlProtocolGuid     = { 0x843dc720, 0xab1e, 0x42cb, { 0x93, 0x57,
>0x8a, 0x0, 0x78, 0xf3, 0x56, 0x1b}}
>+
>   ## Include/Protocol/SmmConfiguration.h
>   gEfiSmmConfigurationProtocolGuid= { 0x26eeb3de, 0xb689, 0x492e, { 0x80,
>0xf0, 0xbe, 0x8b, 0xd7, 0xda, 0x4b, 0xa7 }}
>
>+  ## Include/Protocol/MmConfiguration.h
>+  gEfiMmConfigurationProtocolGuid= { 0x26eeb3de, 0xb689, 0x492e, { 0x80,
>0xf0, 0xbe, 0x8b, 0xd7, 0xda, 0x4b, 0xa7 }}
>+
>   ## Include/Protocol/SmmReadyToLock.h
>   gEfiSmmReadyToLockProtocolGuid  = { 0x47b7fa8c, 0xf4bd, 0x4af6, { 0x82,
>0x00, 0x33, 0x30, 0x86, 0xf0, 0xd2, 0xc8 }}
>
>+  ## Include/Protocol/MmReadyToLock.h
>+  gEfiMmReadyToLockProtocolGuid  = { 0x47b7fa8c, 0xf4bd, 0x4af6, { 0x82,
>0x00, 0x33, 0x30, 0x86, 0xf0, 0xd2, 0xc8 }}
>+
>   ## Include/Protocol/DxeSmmReadyToLock.h
>   gEfiDxeSmmReadyToLockProtocolGuid = { 0x60ff8964, 0xe906, 0x41d0, { 0xaf,
>0xed, 0xf2, 0x41, 0xe9, 0x74, 0xe0, 0x8e }}
>
>+  ## Include/Protocol/DxeMmReadyToLock.h
>+  gEfiDxeMmReadyToLockProtocolGuid = { 0x60ff8964, 0xe906, 0x41d0, { 0xaf,
>0xed, 0xf2, 0x41, 0xe9, 0x74, 0xe0, 0x8e }}
>+
>   ## Include/Protocol/SmmCommunication.h
>   gEfiSmmCommunicationProtocolGuid  = { 0xc68ed8e2, 0x9dc6, 0x4cbd,
>{ 0x9d, 0x94, 0xdb, 0x65, 0xac, 0xc5, 0xc3, 0x32 }}
>
>+  ## Include/Protocol/MmCommunication.h
>+  gEfiMmCommunicationProtocolGuid  = { 0xc68ed8e2, 0x9dc6, 0x4cbd,
>{ 0x9d, 0x94, 0xdb, 0x65, 0xac, 0xc5, 0xc3, 0x32 }}
>+
>   ## Include/Protocol/SmmStatusCode.h
>   gEfiSmmStatusCodeProtocolGuid   = { 0x6afd2b77, 0x98c1, 0x4acd, { 0xa6,
>0xf9, 0x8a, 0x94, 0x39, 0xde, 0xf, 0xb1}}
>
>+  ## Include/Protocol/MmStatusCode.h
>+  gEfiMmStatusCodeProtocolGuid   = { 0x6afd2b77, 0x98c1, 0x4acd, { 0xa6,
>0xf9, 0x8a, 0x94, 0x39, 0xde, 0xf, 0xb1}}
>+
>   ## Include/Protocol/SmmCpu.h
>   gEfiSmmCpuProtocolGuid          = { 0xeb346b97, 0x975f, 0x4a9f, { 0x8b, 0x22,
>0xf8, 0xe9, 0x2b, 0xb3, 0xd5, 0x69 }}
>
>+  ## Include/Protocol/MmCpu.h
>+  gEfiMmCpuProtocolGuid          = { 0xeb346b97, 0x975f, 0x4a9f, { 0x8b, 0x22,
>0xf8, 0xe9, 0x2b, 0xb3, 0xd5, 0x69 }}
>+
>   ## Include/Protocol/SmmPciRootBridgeIo.h
>   gEfiSmmPciRootBridgeIoProtocolGuid = { 0x8bc1714d, 0xffcb, 0x41c3, { 0x89,
>0xdc, 0x6c, 0x74, 0xd0, 0x6d, 0x98, 0xea }}
>
>+  ## Include/Protocol/MmPciRootBridgeIo.h
>+  gEfiMmPciRootBridgeIoProtocolGuid = { 0x8bc1714d, 0xffcb, 0x41c3, { 0x89,
>0xdc, 0x6c, 0x74, 0xd0, 0x6d, 0x98, 0xea }}
>+
>   ## Include/Protocol/SmmSwDispatch2.h
>   gEfiSmmSwDispatch2ProtocolGuid  = { 0x18a3c6dc, 0x5eea, 0x48c8, {0xa1,
>0xc1, 0xb5, 0x33, 0x89, 0xf9, 0x89, 0x99 }}
>
>+  ## Include/Protocol/MmSwDispatch.h
>+  gEfiMmSwDispatchProtocolGuid  = { 0x18a3c6dc, 0x5eea, 0x48c8, {0xa1,
>0xc1, 0xb5, 0x33, 0x89, 0xf9, 0x89, 0x99 }}
>+
>   ## Include/Protocol/SmmSxDispatch2.h
>   gEfiSmmSxDispatch2ProtocolGuid  = { 0x456d2859, 0xa84b, 0x4e47, {0xa2,
>0xee, 0x32, 0x76, 0xd8, 0x86, 0x99, 0x7d }}
>
>+  ## Include/Protocol/MmSxDispatch.h
>+  gEfiMmSxDispatchProtocolGuid  = { 0x456d2859, 0xa84b, 0x4e47, {0xa2,
>0xee, 0x32, 0x76, 0xd8, 0x86, 0x99, 0x7d }}
>+
>   ## Include/Protocol/SmmPeriodicTimerDispatch2.h
>   gEfiSmmPeriodicTimerDispatch2ProtocolGuid = { 0x4cec368e, 0x8e8e,
>0x4d71, {0x8b, 0xe1, 0x95, 0x8c, 0x45, 0xfc, 0x8a, 0x53 }}
>
>+  ## Include/Protocol/MmPeriodicTimerDispatch.h
>+  gEfiMmPeriodicTimerDispatchProtocolGuid = { 0x4cec368e, 0x8e8e, 0x4d71,
>{0x8b, 0xe1, 0x95, 0x8c, 0x45, 0xfc, 0x8a, 0x53 }}
>+
>   ## Include/Protocol/SmmUsbDispatch2.h
>   gEfiSmmUsbDispatch2ProtocolGuid = { 0xee9b8d90, 0xc5a6, 0x40a2, {0xbd,
>0xe2, 0x52, 0x55, 0x8d, 0x33, 0xcc, 0xa1 }}
>
>+  ## Include/Protocol/MmUsbDispatch.h
>+  gEfiMmUsbDispatchProtocolGuid = { 0xee9b8d90, 0xc5a6, 0x40a2, {0xbd,
>0xe2, 0x52, 0x55, 0x8d, 0x33, 0xcc, 0xa1 }}
>+
>   ## Include/Protocol/SmmGpiDispatch2.h
>   gEfiSmmGpiDispatch2ProtocolGuid = { 0x25566b03, 0xb577, 0x4cbf, {0x95,
>0x8c, 0xed, 0x66, 0x3e, 0xa2, 0x43, 0x80 }}
>
>+  ## Include/Protocol/MmGpiDispatch.h
>+  gEfiMmGpiDispatchProtocolGuid = { 0x25566b03, 0xb577, 0x4cbf, {0x95,
>0x8c, 0xed, 0x66, 0x3e, 0xa2, 0x43, 0x80 }}
>+
>   ## Include/Protocol/SmmStandbyButtonDispatch2.h
>   gEfiSmmStandbyButtonDispatch2ProtocolGuid = { 0x7300c4a1, 0x43f2,
>0x4017, {0xa5, 0x1b, 0xc8, 0x1a, 0x7f, 0x40, 0x58, 0x5b }}
>
>+  ## Include/Protocol/MmStandbyButtonDispatch.h
>+  gEfiMmStandbyButtonDispatchProtocolGuid = { 0x7300c4a1, 0x43f2, 0x4017,
>{0xa5, 0x1b, 0xc8, 0x1a, 0x7f, 0x40, 0x58, 0x5b }}
>+
>   ## Include/Protocol/SmmPowerButtonDispatch2.h
>   gEfiSmmPowerButtonDispatch2ProtocolGuid = { 0x1b1183fa, 0x1823, 0x46a7,
>{0x88, 0x72, 0x9c, 0x57, 0x87, 0x55, 0x40, 0x9d }}
>
>+  ## Include/Protocol/MmPowerButtonDispatch.h
>+  gEfiMmPowerButtonDispatchProtocolGuid = { 0x1b1183fa, 0x1823, 0x46a7,
>{0x88, 0x72, 0x9c, 0x57, 0x87, 0x55, 0x40, 0x9d }}
>+
>   ## Include/Protocol/SmmIoTrapDispatch2.h
>   gEfiSmmIoTrapDispatch2ProtocolGuid = { 0x58dc368d, 0x7bfa, 0x4e77, {0xab,
>0xbc, 0xe, 0x29, 0x41, 0x8d, 0xf9, 0x30 }}
>
>+  ## Include/Protocol/MmIoTrapDispatch.h
>+  gEfiMmIoTrapDispatchProtocolGuid = { 0x58dc368d, 0x7bfa, 0x4e77, {0xab,
>0xbc, 0xe, 0x29, 0x41, 0x8d, 0xf9, 0x30 }}
>+
>   ## Include/Protocol/PiPcd.h
>   gEfiPcdProtocolGuid = { 0x13a3f0f6, 0x264a, 0x3ef0, { 0xf2, 0xe0, 0xde, 0xc5,
>0x12, 0x34, 0x2f, 0x34 } }
>
>@@ -1141,6 +1201,9 @@
>   ## Include/Protocol/SmmEndOfDxe.h
>   gEfiSmmEndOfDxeProtocolGuid = { 0x24e70042, 0xd5c5, 0x4260, { 0x8c, 0x39,
>0xa, 0xd3, 0xaa, 0x32, 0xe9, 0x3d }}
>
>+  ## Include/Protocol/MmEndOfDxe.h
>+  gEfiMmEndOfDxeProtocolGuid = { 0x24e70042, 0xd5c5, 0x4260, { 0x8c, 0x39,
>0xa, 0xd3, 0xaa, 0x32, 0xe9, 0x3d }}
>+
>   ## Include/Protocol/IsaHc.h
>   gEfiIsaHcProtocolGuid               = { 0xbcdaf080, 0x1bde, 0x4e22, {0xae, 0x6a,
>0x43, 0x54, 0x1e, 0x12, 0x8e, 0xc4 } }
>   gEfiIsaHcServiceBindingProtocolGuid = { 0xfad7933a, 0x6c21, 0x4234, {0xa4,
>0x34, 0x0a, 0x8a, 0x0d, 0x2b, 0x07, 0x81 } }
>--
>2.7.0.windows.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Patch 1/2] MdePkg: Add new definitions for Management Mode.
  2017-08-28  6:40 [Patch v2 0/2] Add Management Mode infrastructure support Eric Dong
@ 2017-08-28  6:40 ` Eric Dong
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Dong @ 2017-08-28  6:40 UTC (permalink / raw)
  To: edk2-devel; +Cc: Michael D Kinney, Liming Gao

In PI 1.5 version, system management mode name(SMM) has been changed
to Management Mode(MM). It impacts the current code which still use
SMM/Smram/SMI keywords. This patch add new definition which use
MM/MmRam/MMI keywords to follow new spec definitions.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
 MdePkg/Include/Pi/PiMmCis.h                        | 350 +++++++++++++++++++++
 MdePkg/Include/PiMm.h                              |  25 ++
 MdePkg/Include/Protocol/DxeMmReadyToLock.h         |  25 ++
 MdePkg/Include/Protocol/MmAccess.h                 | 133 ++++++++
 MdePkg/Include/Protocol/MmBase.h                   |  87 +++++
 MdePkg/Include/Protocol/MmCommunication.h          |  83 +++++
 MdePkg/Include/Protocol/MmConfiguration.h          |  86 +++++
 MdePkg/Include/Protocol/MmControl.h                | 106 +++++++
 MdePkg/Include/Protocol/MmCpu.h                    | 247 +++++++++++++++
 MdePkg/Include/Protocol/MmCpuIo.h                  |  96 ++++++
 MdePkg/Include/Protocol/MmEndOfDxe.h               |  30 ++
 MdePkg/Include/Protocol/MmGpiDispatch.h            | 125 ++++++++
 MdePkg/Include/Protocol/MmIoTrapDispatch.h         | 136 ++++++++
 MdePkg/Include/Protocol/MmPciRootBridgeIo.h        |  37 +++
 MdePkg/Include/Protocol/MmPeriodicTimerDispatch.h  | 170 ++++++++++
 MdePkg/Include/Protocol/MmPowerButtonDispatch.h    | 117 +++++++
 MdePkg/Include/Protocol/MmReadyToLock.h            |  32 ++
 .../Include/Protocol/MmReportStatusCodeHandler.h   |  81 +++++
 MdePkg/Include/Protocol/MmStandbyButtonDispatch.h  | 119 +++++++
 MdePkg/Include/Protocol/MmStatusCode.h             |  65 ++++
 MdePkg/Include/Protocol/MmSwDispatch.h             | 136 ++++++++
 MdePkg/Include/Protocol/MmSxDispatch.h             | 135 ++++++++
 MdePkg/Include/Protocol/MmUsbDispatch.h            | 130 ++++++++
 MdePkg/MdePkg.dec                                  |  67 ++++
 24 files changed, 2618 insertions(+)
 create mode 100644 MdePkg/Include/Pi/PiMmCis.h
 create mode 100644 MdePkg/Include/PiMm.h
 create mode 100644 MdePkg/Include/Protocol/DxeMmReadyToLock.h
 create mode 100644 MdePkg/Include/Protocol/MmAccess.h
 create mode 100644 MdePkg/Include/Protocol/MmBase.h
 create mode 100644 MdePkg/Include/Protocol/MmCommunication.h
 create mode 100644 MdePkg/Include/Protocol/MmConfiguration.h
 create mode 100644 MdePkg/Include/Protocol/MmControl.h
 create mode 100644 MdePkg/Include/Protocol/MmCpu.h
 create mode 100644 MdePkg/Include/Protocol/MmCpuIo.h
 create mode 100644 MdePkg/Include/Protocol/MmEndOfDxe.h
 create mode 100644 MdePkg/Include/Protocol/MmGpiDispatch.h
 create mode 100644 MdePkg/Include/Protocol/MmIoTrapDispatch.h
 create mode 100644 MdePkg/Include/Protocol/MmPciRootBridgeIo.h
 create mode 100644 MdePkg/Include/Protocol/MmPeriodicTimerDispatch.h
 create mode 100644 MdePkg/Include/Protocol/MmPowerButtonDispatch.h
 create mode 100644 MdePkg/Include/Protocol/MmReadyToLock.h
 create mode 100644 MdePkg/Include/Protocol/MmReportStatusCodeHandler.h
 create mode 100644 MdePkg/Include/Protocol/MmStandbyButtonDispatch.h
 create mode 100644 MdePkg/Include/Protocol/MmStatusCode.h
 create mode 100644 MdePkg/Include/Protocol/MmSwDispatch.h
 create mode 100644 MdePkg/Include/Protocol/MmSxDispatch.h
 create mode 100644 MdePkg/Include/Protocol/MmUsbDispatch.h

diff --git a/MdePkg/Include/Pi/PiMmCis.h b/MdePkg/Include/Pi/PiMmCis.h
new file mode 100644
index 0000000..b066d49
--- /dev/null
+++ b/MdePkg/Include/Pi/PiMmCis.h
@@ -0,0 +1,350 @@
+/** @file
+  Common definitions in the Platform Initialization Specification version 1.5
+  VOLUME 4 Management Mode Core Interface version.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _PI_MMCIS_H_
+#define _PI_MMCIS_H_
+
+#include <Protocol/MmCpuIo.h>
+
+typedef struct _EFI_MM_SYSTEM_TABLE  EFI_MM_SYSTEM_TABLE;
+
+///
+/// The Management Mode System Table (MMST) signature
+///
+#define MM_MMST_SIGNATURE            SIGNATURE_32 ('S', 'M', 'S', 'T')
+///
+/// The Management Mode System Table (MMST) revision is 1.6
+///
+#define MM_SPECIFICATION_MAJOR_REVISION  1
+#define MM_SPECIFICATION_MINOR_REVISION  60
+#define EFI_MM_SYSTEM_TABLE_REVISION    ((MM_SPECIFICATION_MAJOR_REVISION<<16) | (MM_SPECIFICATION_MINOR_REVISION))
+
+/**
+  Adds, updates, or removes a configuration table entry from the Management Mode System Table.
+
+  The MmInstallConfigurationTable() function is used to maintain the list
+  of configuration tables that are stored in the Management Mode System
+  Table.  The list is stored as an array of (GUID, Pointer) pairs.  The list
+  must be allocated from pool memory with PoolType set to EfiRuntimeServicesData.
+
+  @param[in] SystemTable         A pointer to the MM System Table (MMST).
+  @param[in] Guid                A pointer to the GUID for the entry to add, update, or remove.
+  @param[in] Table               A pointer to the buffer of the table to add.
+  @param[in] TableSize           The size of the table to install.
+
+  @retval EFI_SUCCESS            The (Guid, Table) pair was added, updated, or removed.
+  @retval EFI_INVALID_PARAMETER  Guid is not valid.
+  @retval EFI_NOT_FOUND          An attempt was made to delete a non-existent entry.
+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory available to complete the operation.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_INSTALL_CONFIGURATION_TABLE)(
+  IN CONST EFI_MM_SYSTEM_TABLE    *SystemTable,
+  IN CONST EFI_GUID               *Guid,
+  IN VOID                         *Table,
+  IN UINTN                        TableSize
+  );
+
+/**
+  This service lets the caller to get one distinct application processor (AP) to execute
+  a caller-provided code stream while in MM.
+
+  @param[in]     Procedure       A pointer to the code stream to be run on the designated
+                                 AP of the system.
+  @param[in]     CpuNumber       The zero-based index of the processor number of the AP
+                                 on which the code stream is supposed to run.
+  @param[in,out] ProcArguments   Allows the caller to pass a list of parameters to the code
+                                 that is run by the AP.
+
+  @retval EFI_SUCCESS            The call was successful and the return parameters are valid.
+  @retval EFI_INVALID_PARAMETER  The input arguments are out of range.
+  @retval EFI_INVALID_PARAMETER  The CPU requested is not available on this SMI invocation.
+  @retval EFI_INVALID_PARAMETER  The CPU cannot support an additional service invocation.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_STARTUP_THIS_AP)(
+  IN EFI_AP_PROCEDURE  Procedure,
+  IN UINTN             CpuNumber,
+  IN OUT VOID          *ProcArguments OPTIONAL
+  );
+
+/**
+  Function prototype for protocol install notification.
+
+  @param[in] Protocol   Points to the protocol's unique identifier.
+  @param[in] Interface  Points to the interface instance.
+  @param[in] Handle     The handle on which the interface was installed.
+
+  @return Status Code
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_NOTIFY_FN)(
+  IN CONST EFI_GUID  *Protocol,
+  IN VOID            *Interface,
+  IN EFI_HANDLE      Handle
+  );
+
+/**
+  Register a callback function be called when a particular protocol interface is installed.
+
+  The MmRegisterProtocolNotify() function creates a registration Function that is to be
+  called whenever a protocol interface is installed for Protocol by
+  MmInstallProtocolInterface().
+  If Function == NULL and Registration is an existing registration, then the callback is unhooked.
+
+  @param[in]  Protocol          The unique ID of the protocol for which the event is to be registered.
+  @param[in]  Function          Points to the notification function.
+  @param[out] Registration      A pointer to a memory location to receive the registration value.
+
+  @retval EFI_SUCCESS           Successfully returned the registration record
+                                that has been added or unhooked.
+  @retval EFI_INVALID_PARAMETER Protocol is NULL or Registration is NULL.
+  @retval EFI_OUT_OF_RESOURCES  Not enough memory resource to finish the request.
+  @retval EFI_NOT_FOUND         If the registration is not found when Function == NULL.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_REGISTER_PROTOCOL_NOTIFY)(
+  IN  CONST EFI_GUID     *Protocol,
+  IN  EFI_MM_NOTIFY_FN   Function,
+  OUT VOID               **Registration
+  );
+
+/**
+  Manage MMI of a particular type.
+
+  @param[in]     HandlerType     Points to the handler type or NULL for root MMI handlers.
+  @param[in]     Context         Points to an optional context buffer.
+  @param[in,out] CommBuffer      Points to the optional communication buffer.
+  @param[in,out] CommBufferSize  Points to the size of the optional communication buffer.
+
+  @retval EFI_WARN_INTERRUPT_SOURCE_PENDING  Interrupt source was processed successfully but not quiesced.
+  @retval EFI_INTERRUPT_PENDING              One or more SMI sources could not be quiesced.
+  @retval EFI_NOT_FOUND                      Interrupt source was not handled or quiesced.
+  @retval EFI_SUCCESS                        Interrupt source was handled and quiesced.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_INTERRUPT_MANAGE)(
+  IN CONST EFI_GUID  *HandlerType,
+  IN CONST VOID      *Context         OPTIONAL,
+  IN OUT VOID        *CommBuffer      OPTIONAL,
+  IN OUT UINTN       *CommBufferSize  OPTIONAL
+  );
+
+/**
+  Main entry point for an MM handler dispatch or communicate-based callback.
+
+  @param[in]     DispatchHandle  The unique handle assigned to this handler by MmiHandlerRegister().
+  @param[in]     Context         Points to an optional handler context which was specified when the
+                                 handler was registered.
+  @param[in,out] CommBuffer      A pointer to a collection of data in memory that will
+                                 be conveyed from a non-MM environment into an MM environment.
+  @param[in,out] CommBufferSize  The size of the CommBuffer.
+
+  @retval EFI_SUCCESS                         The interrupt was handled and quiesced. No other handlers
+                                              should still be called.
+  @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED  The interrupt has been quiesced but other handlers should
+                                              still be called.
+  @retval EFI_WARN_INTERRUPT_SOURCE_PENDING   The interrupt is still pending and other handlers should still
+                                              be called.
+  @retval EFI_INTERRUPT_PENDING               The interrupt could not be quiesced.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_HANDLER_ENTRY_POINT)(
+  IN EFI_HANDLE  DispatchHandle,
+  IN CONST VOID  *Context         OPTIONAL,
+  IN OUT VOID    *CommBuffer      OPTIONAL,
+  IN OUT UINTN   *CommBufferSize  OPTIONAL
+  );
+
+/**
+  Registers a handler to execute within MM.
+
+  @param[in]  Handler            Handler service function pointer.
+  @param[in]  HandlerType        Points to the handler type or NULL for root MMI handlers.
+  @param[out] DispatchHandle     On return, contains a unique handle which can be used to later
+                                 unregister the handler function.
+
+  @retval EFI_SUCCESS            MMI handler added successfully.
+  @retval EFI_INVALID_PARAMETER  Handler is NULL or DispatchHandle is NULL.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_INTERRUPT_REGISTER)(
+  IN  EFI_MM_HANDLER_ENTRY_POINT    Handler,
+  IN  CONST EFI_GUID                *HandlerType OPTIONAL,
+  OUT EFI_HANDLE                    *DispatchHandle
+  );
+
+/**
+  Unregister a handler in MM.
+
+  @param[in] DispatchHandle      The handle that was specified when the handler was registered.
+
+  @retval EFI_SUCCESS            Handler function was successfully unregistered.
+  @retval EFI_INVALID_PARAMETER  DispatchHandle does not refer to a valid handle.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_INTERRUPT_UNREGISTER)(
+  IN EFI_HANDLE  DispatchHandle
+  );
+
+///
+/// Processor information and functionality needed by MM Foundation.
+///
+typedef struct _EFI_MM_ENTRY_CONTEXT {
+  EFI_MM_STARTUP_THIS_AP   MmStartupThisAp;
+  ///
+  /// A number between zero and the NumberOfCpus field. This field designates which
+  /// processor is executing the MM Foundation.
+  ///
+  UINTN                    CurrentlyExecutingCpu;
+  ///
+  /// The number of possible processors in the platform.  This is a 1 based
+  /// counter.  This does not indicate the number of processors that entered MM.
+  ///
+  UINTN                    NumberOfCpus;
+  ///
+  /// Points to an array, where each element describes the number of bytes in the
+  /// corresponding save state specified by CpuSaveState. There are always
+  /// NumberOfCpus entries in the array.
+  ///
+  UINTN                    *CpuSaveStateSize;
+  ///
+  /// Points to an array, where each element is a pointer to a CPU save state. The
+  /// corresponding element in CpuSaveStateSize specifies the number of bytes in the
+  /// save state area. There are always NumberOfCpus entries in the array.
+  ///
+  VOID                     **CpuSaveState;
+} EFI_MM_ENTRY_CONTEXT;
+
+/**
+  This function is the main entry point to the MM Foundation.
+
+  @param[in] MmEntryContext  Processor information and functionality needed by MM Foundation.
+**/
+typedef
+VOID
+(EFIAPI *EFI_MM_ENTRY_POINT)(
+  IN CONST EFI_MM_ENTRY_CONTEXT  *MmEntryContext
+  );
+
+///
+/// Management Mode System Table (MMST)
+///
+/// The Management Mode System Table (MMST) is a table that contains a collection of common
+/// services for managing MMRAM allocation and providing basic I/O services. These services are
+/// intended for both preboot and runtime usage.
+///
+struct _EFI_MM_SYSTEM_TABLE {
+  ///
+  /// The table header for the SMST.
+  ///
+  EFI_TABLE_HEADER                     Hdr;
+  ///
+  /// A pointer to a NULL-terminated Unicode string containing the vendor name.
+  /// It is permissible for this pointer to be NULL.
+  ///
+  CHAR16                               *MmFirmwareVendor;
+  ///
+  /// The particular revision of the firmware.
+  ///
+  UINT32                               MmFirmwareRevision;
+
+  EFI_MM_INSTALL_CONFIGURATION_TABLE   MmInstallConfigurationTable;
+
+  ///
+  /// I/O Service
+  ///
+  EFI_MM_CPU_IO_PROTOCOL               MmIo;
+
+  ///
+  /// Runtime memory services
+  ///
+  EFI_ALLOCATE_POOL                    MmAllocatePool;
+  EFI_FREE_POOL                        MmFreePool;
+  EFI_ALLOCATE_PAGES                   MmAllocatePages;
+  EFI_FREE_PAGES                       MmFreePages;
+
+  ///
+  /// MP service
+  ///
+  EFI_MM_STARTUP_THIS_AP               MmStartupThisAp;
+
+  ///
+  /// CPU information records
+  ///
+
+  ///
+  /// A number between zero and and the NumberOfCpus field. This field designates
+  /// which processor is executing the MM infrastructure.
+  ///
+  UINTN                                CurrentlyExecutingCpu;
+  ///
+  /// The number of possible processors in the platform.  This is a 1 based counter.
+  ///
+  UINTN                                NumberOfCpus;
+  ///
+  /// Points to an array, where each element describes the number of bytes in the
+  /// corresponding save state specified by CpuSaveState. There are always
+  /// NumberOfCpus entries in the array.
+  ///
+  UINTN                                *CpuSaveStateSize;
+  ///
+  /// Points to an array, where each element is a pointer to a CPU save state. The
+  /// corresponding element in CpuSaveStateSize specifies the number of bytes in the
+  /// save state area. There are always NumberOfCpus entries in the array.
+  ///
+  VOID                                 **CpuSaveState;
+
+  ///
+  /// Extensibility table
+  ///
+
+  ///
+  /// The number of UEFI Configuration Tables in the buffer MmConfigurationTable.
+  ///
+  UINTN                                NumberOfTableEntries;
+  ///
+  /// A pointer to the UEFI Configuration Tables. The number of entries in the table is
+  /// NumberOfTableEntries.
+  ///
+  EFI_CONFIGURATION_TABLE              *MmConfigurationTable;
+
+  ///
+  /// Protocol services
+  ///
+  EFI_INSTALL_PROTOCOL_INTERFACE       MmInstallProtocolInterface;
+  EFI_UNINSTALL_PROTOCOL_INTERFACE     MmUninstallProtocolInterface;
+  EFI_HANDLE_PROTOCOL                  MmHandleProtocol;
+  EFI_MM_REGISTER_PROTOCOL_NOTIFY      MmRegisterProtocolNotify;
+  EFI_LOCATE_HANDLE                    MmLocateHandle;
+  EFI_LOCATE_PROTOCOL                  MmLocateProtocol;
+
+  ///
+  /// MMI Management functions
+  ///
+  EFI_MM_INTERRUPT_MANAGE              MmiManage;
+  EFI_MM_INTERRUPT_REGISTER            MmiHandlerRegister;
+  EFI_MM_INTERRUPT_UNREGISTER          MmiHandlerUnRegister;
+};
+
+#endif
diff --git a/MdePkg/Include/PiMm.h b/MdePkg/Include/PiMm.h
new file mode 100644
index 0000000..6ee59cc
--- /dev/null
+++ b/MdePkg/Include/PiMm.h
@@ -0,0 +1,25 @@
+/** @file
+
+  Root include file for Mde Package MM modules.
+
+Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+This program and the accompanying materials are licensed and made available under
+the terms and conditions of the BSD License that accompanies this distribution.
+The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php.
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __PI_MM_H__
+#define __PI_MM_H__
+
+#include <Uefi/UefiBaseType.h>
+#include <Uefi/UefiSpec.h>
+
+#include <Pi/PiMmCis.h>
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/DxeMmReadyToLock.h b/MdePkg/Include/Protocol/DxeMmReadyToLock.h
new file mode 100644
index 0000000..8b61f4d
--- /dev/null
+++ b/MdePkg/Include/Protocol/DxeMmReadyToLock.h
@@ -0,0 +1,25 @@
+/** @file
+  DXE MM Ready To Lock protocol introduced in the PI 1.5 specification.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _DXE_MM_READY_TO_LOCK_H_
+#define _DXE_MM_READY_TO_LOCK_H_
+
+#define EFI_DXE_MM_READY_TO_LOCK_PROTOCOL_GUID \
+  { \
+    0x60ff8964, 0xe906, 0x41d0, { 0xaf, 0xed, 0xf2, 0x41, 0xe9, 0x74, 0xe0, 0x8e } \
+  }
+
+extern EFI_GUID gEfiDxeMmReadyToLockProtocolGuid;
+
+#endif
diff --git a/MdePkg/Include/Protocol/MmAccess.h b/MdePkg/Include/Protocol/MmAccess.h
new file mode 100644
index 0000000..ad3ed7b
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmAccess.h
@@ -0,0 +1,133 @@
+/** @file
+  EFI MM Access Protocol as defined in the PI 1.5 specification.
+
+  This protocol is used to control the visibility of the MMRAM on the platform.
+  It abstracts the location and characteristics of MMRAM.  The expectation is
+  that the north bridge or memory controller would publish this protocol.
+
+  The principal functionality found in the memory controller includes the following:
+  - Exposing the MMRAM to all non-MM agents, or the "open" state
+  - Shrouding the MMRAM to all but the MM agents, or the "closed" state
+  - Preserving the system integrity, or "locking" the MMRAM, such that the settings cannot be
+    perturbed by either boot service or runtime agents
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _MM_ACCESS_H_
+#define _MM_ACCESS_H_
+
+#define EFI_MM_ACCESS_PROTOCOL_GUID \
+  { \
+     0xc2702b74, 0x800c, 0x4131, {0x87, 0x46, 0x8f, 0xb5, 0xb8, 0x9c, 0xe4, 0xac } \
+  }
+
+
+typedef struct _EFI_MM_ACCESS_PROTOCOL  EFI_MM_ACCESS_PROTOCOL;
+
+/**
+  Opens the MMRAM area to be accessible by a boot-service driver.
+
+  This function "opens" MMRAM so that it is visible while not inside of MM. The function should
+  return EFI_UNSUPPORTED if the hardware does not support hiding of MMRAM. The function
+  should return EFI_DEVICE_ERROR if the MMRAM configuration is locked.
+
+  @param[in] This           The EFI_MM_ACCESS_PROTOCOL instance.
+
+  @retval EFI_SUCCESS       The operation was successful.
+  @retval EFI_UNSUPPORTED   The system does not support opening and closing of MMRAM.
+  @retval EFI_DEVICE_ERROR  MMRAM cannot be opened, perhaps because it is locked.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_OPEN)(
+  IN EFI_MM_ACCESS_PROTOCOL  *This
+  );
+
+/**
+  Inhibits access to the MMRAM.
+
+  This function "closes" MMRAM so that it is not visible while outside of MM. The function should
+  return EFI_UNSUPPORTED if the hardware does not support hiding of MMRAM.
+
+  @param[in] This           The EFI_MM_ACCESS_PROTOCOL instance.
+
+  @retval EFI_SUCCESS       The operation was successful.
+  @retval EFI_UNSUPPORTED   The system does not support opening and closing of MMRAM.
+  @retval EFI_DEVICE_ERROR  MMRAM cannot be closed.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_CLOSE)(
+  IN EFI_MM_ACCESS_PROTOCOL  *This
+  );
+
+/**
+  Inhibits access to the MMRAM.
+
+  This function prohibits access to the MMRAM region.  This function is usually implemented such
+  that it is a write-once operation.
+
+  @param[in] This          The EFI_MM_ACCESS_PROTOCOL instance.
+
+  @retval EFI_SUCCESS      The device was successfully locked.
+  @retval EFI_UNSUPPORTED  The system does not support locking of MMRAM.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_LOCK)(
+  IN EFI_MM_ACCESS_PROTOCOL  *This
+  );
+
+/**
+  Queries the memory controller for the possible regions that will support MMRAM.
+
+  @param[in]     This           The EFI_MM_ACCESS_PROTOCOL instance.
+  @param[in,out] MmramMapSize   A pointer to the size, in bytes, of the MmramMemoryMap buffer.
+  @param[in,out] MmramMap       A pointer to the buffer in which firmware places the current memory map.
+
+  @retval EFI_SUCCESS           The chipset supported the given resource.
+  @retval EFI_BUFFER_TOO_SMALL  The MmramMap parameter was too small.  The current buffer size
+                                needed to hold the memory map is returned in MmramMapSize.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_CAPABILITIES)(
+  IN CONST EFI_MM_ACCESS_PROTOCOL    *This,
+  IN OUT UINTN                       *MmramMapSize,
+  IN OUT EFI_MMRAM_DESCRIPTOR        *MmramMap
+  );
+
+///
+///  EFI MM Access Protocol is used to control the visibility of the MMRAM on the platform.
+///  It abstracts the location and characteristics of MMRAM. The platform should report all
+///  MMRAM via EFI_MM_ACCESS_PROTOCOL. The expectation is that the north bridge or memory
+///  controller would publish this protocol.
+///
+struct _EFI_MM_ACCESS_PROTOCOL {
+  EFI_MM_OPEN          Open;
+  EFI_MM_CLOSE         Close;
+  EFI_MM_LOCK          Lock;
+  EFI_MM_CAPABILITIES  GetCapabilities;
+  ///
+  /// Indicates the current state of the MMRAM. Set to TRUE if MMRAM is locked.
+  ///
+  BOOLEAN               LockState;
+  ///
+  /// Indicates the current state of the MMRAM. Set to TRUE if MMRAM is open.
+  ///
+  BOOLEAN               OpenState;
+};
+
+extern EFI_GUID gEfiMmAccessProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmBase.h b/MdePkg/Include/Protocol/MmBase.h
new file mode 100644
index 0000000..a84c587
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmBase.h
@@ -0,0 +1,87 @@
+/** @file
+  EFI MM Base Protocol as defined in the PI 1.5 specification.
+
+  This protocol is utilized by all MM drivers to locate the MM infrastructure services and determine
+  whether the driver is being invoked inside MMRAM or outside of MMRAM.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _MM_BASE_H_
+#define _MM_BASE_H_
+
+#include <Pi/PiMmCis.h>
+
+#define EFI_MM_BASE_PROTOCOL_GUID \
+  { \
+    0xf4ccbfb7, 0xf6e0, 0x47fd, {0x9d, 0xd4, 0x10, 0xa8, 0xf1, 0x50, 0xc1, 0x91 }  \
+  }
+
+typedef struct _EFI_MM_BASE_PROTOCOL  EFI_MM_BASE_PROTOCOL;
+
+/**
+  Service to indicate whether the driver is currently executing in the MM Initialization phase.
+
+  This service is used to indicate whether the driver is currently executing in the MM Initialization
+  phase. For MM drivers, this will return TRUE in InMmram while inside the driver's entry point and
+  otherwise FALSE. For combination MM/DXE drivers, this will return FALSE in the DXE launch. For the
+  MM launch, it behaves as an MM driver.
+
+  @param[in]  This               The EFI_MM_BASE_PROTOCOL instance.
+  @param[out] InMmram            Pointer to a Boolean which, on return, indicates that the driver is
+                                 currently executing inside of MMRAM (TRUE) or outside of MMRAM (FALSE).
+
+  @retval EFI_SUCCESS            The call returned successfully.
+  @retval EFI_INVALID_PARAMETER  InMmram was NULL.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_INSIDE_OUT)(
+  IN CONST EFI_MM_BASE_PROTOCOL    *This,
+  OUT BOOLEAN                      *InMmram
+  )
+;
+
+/**
+  Returns the location of the Management Mode Service Table (MMST).
+
+  This function returns the location of the Management Mode Service Table (MMST).  The use of the
+  API is such that a driver can discover the location of the MMST in its entry point and then cache it in
+  some driver global variable so that the MMST can be invoked in subsequent handlers.
+
+  @param[in]     This            The EFI_MM_BASE_PROTOCOL instance.
+  @param[in,out] Mmst            On return, points to a pointer to the Management Mode Service Table (MMST).
+
+  @retval EFI_SUCCESS            The operation was successful.
+  @retval EFI_INVALID_PARAMETER  Mmst was invalid.
+  @retval EFI_UNSUPPORTED        Not in MM.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_GET_MMST_LOCATION)(
+  IN CONST EFI_MM_BASE_PROTOCOL  *This,
+  IN OUT EFI_MM_SYSTEM_TABLE     **Mmst
+  )
+;
+
+///
+/// EFI MM Base Protocol is utilized by all MM drivers to locate the MM infrastructure
+/// services and determine whether the driver is being invoked inside MMRAM or outside of MMRAM.
+///
+struct _EFI_MM_BASE_PROTOCOL {
+  EFI_MM_INSIDE_OUT         InMm;
+  EFI_MM_GET_MMST_LOCATION  GetMmstLocation;
+};
+
+extern EFI_GUID gEfiMmBaseProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmCommunication.h b/MdePkg/Include/Protocol/MmCommunication.h
new file mode 100644
index 0000000..16450e3
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmCommunication.h
@@ -0,0 +1,83 @@
+/** @file
+  EFI MM Communication Protocol as defined in the PI 1.5 specification.
+
+  This protocol provides a means of communicating between drivers outside of MM and MMI
+  handlers inside of MM.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _MM_COMMUNICATION_H_
+#define _MM_COMMUNICATION_H_
+
+#pragma pack(1)
+
+///
+/// To avoid confusion in interpreting frames, the communication buffer should always
+/// begin with EFI_MM_COMMUNICATE_HEADER
+///
+typedef struct {
+  ///
+  /// Allows for disambiguation of the message format.
+  ///
+  EFI_GUID  HeaderGuid;
+  ///
+  /// Describes the size of Data (in bytes) and does not include the size of the header.
+  ///
+  UINTN     MessageLength;
+  ///
+  /// Designates an array of bytes that is MessageLength in size.
+  ///
+  UINT8     Data[1];
+} EFI_MM_COMMUNICATE_HEADER;
+
+#pragma pack()
+
+#define EFI_MM_COMMUNICATION_PROTOCOL_GUID \
+  { \
+    0xc68ed8e2, 0x9dc6, 0x4cbd, { 0x9d, 0x94, 0xdb, 0x65, 0xac, 0xc5, 0xc3, 0x32 } \
+  }
+
+typedef struct _EFI_MM_COMMUNICATION_PROTOCOL  EFI_MM_COMMUNICATION_PROTOCOL;
+
+/**
+  Communicates with a registered handler.
+
+  This function provides a service to send and receive messages from a registered UEFI service.
+
+  @param[in] This                The EFI_MM_COMMUNICATION_PROTOCOL instance.
+  @param[in] CommBuffer          A pointer to the buffer to convey into MMRAM.
+  @param[in] CommSize            The size of the data buffer being passed in.On exit, the size of data
+                                 being returned. Zero if the handler does not wish to reply with any data.
+
+  @retval EFI_SUCCESS            The message was successfully posted.
+  @retval EFI_INVALID_PARAMETER  The CommBuffer was NULL.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_COMMUNICATE)(
+  IN CONST EFI_MM_COMMUNICATION_PROTOCOL   *This,
+  IN OUT VOID                              *CommBuffer,
+  IN OUT UINTN                             *CommSize
+  );
+
+///
+/// EFI MM Communication Protocol provides runtime services for communicating
+/// between DXE drivers and a registered MMI handler.
+///
+struct _EFI_MM_COMMUNICATION_PROTOCOL {
+  EFI_MM_COMMUNICATE  Communicate;
+};
+
+extern EFI_GUID gEfiMmCommunicationProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmConfiguration.h b/MdePkg/Include/Protocol/MmConfiguration.h
new file mode 100644
index 0000000..4719186
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmConfiguration.h
@@ -0,0 +1,86 @@
+/** @file
+  EFI MM Configuration Protocol as defined in the PI 1.5 specification.
+
+  This protocol is used to:
+  1) report the portions of MMRAM regions which cannot be used for the MMRAM heap.
+  2) register the MM Foundation entry point with the processor code. The entry
+     point will be invoked by the MM processor entry code.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _MM_CONFIGURATION_H_
+#define _MM_CONFIGURATION_H_
+
+#include <Pi/PiMmCis.h>
+
+#define EFI_MM_CONFIGURATION_PROTOCOL_GUID \
+  { \
+    0x26eeb3de, 0xb689, 0x492e, {0x80, 0xf0, 0xbe, 0x8b, 0xd7, 0xda, 0x4b, 0xa7 }  \
+  }
+
+///
+/// Structure describing a MMRAM region which cannot be used for the MMRAM heap.
+///
+typedef struct _EFI_MM_RESERVED_MMRAM_REGION {
+  ///
+  /// Starting address of the reserved MMRAM area, as it appears while MMRAM is open.
+  /// Ignored if MmramReservedSize is 0.
+  ///
+  EFI_PHYSICAL_ADDRESS    MmramReservedStart;
+  ///
+  /// Number of bytes occupied by the reserved MMRAM area. A size of zero indicates the
+  /// last MMRAM area.
+  ///
+  UINT64                  MmramReservedSize;
+} EFI_MM_RESERVED_MMRAM_REGION;
+
+typedef struct _EFI_MM_CONFIGURATION_PROTOCOL  EFI_MM_CONFIGURATION_PROTOCOL;
+
+/**
+  Register the MM Foundation entry point.
+
+  This function registers the MM Foundation entry point with the processor code. This entry point
+  will be invoked by the MM Processor entry code.
+
+  @param[in] This                The EFI_MM_CONFIGURATION_PROTOCOL instance.
+  @param[in] MmEntryPoint        MM Foundation entry point.
+
+  @retval EFI_SUCCESS            Success to register MM Entry Point.
+  @retval EFI_INVALID_PARAMETER  MmEntryPoint is NULL.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_REGISTER_MM_ENTRY)(
+  IN CONST EFI_MM_CONFIGURATION_PROTOCOL  *This,
+  IN EFI_MM_ENTRY_POINT                   MmEntryPoint
+  );
+
+///
+/// The EFI MM Configuration Protocol is a mandatory protocol published by a DXE CPU driver to
+/// indicate which areas within MMRAM are reserved for use by the CPU for any purpose,
+/// such as stack, save state or MM entry point.
+///
+/// The RegistermmEntry() function allows the MM IPL DXE driver to register the MM
+/// Foundation entry point with the MM entry vector code.
+///
+struct _EFI_MM_CONFIGURATION_PROTOCOL {
+  ///
+  /// A pointer to an array MMRAM ranges used by the initial MM entry code.
+  ///
+  EFI_MM_RESERVED_MMRAM_REGION  *MmramReservedRegions;
+  EFI_MM_REGISTER_MM_ENTRY      RegisterMmEntry;
+};
+
+extern EFI_GUID gEfiMmConfigurationProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmControl.h b/MdePkg/Include/Protocol/MmControl.h
new file mode 100644
index 0000000..1461137
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmControl.h
@@ -0,0 +1,106 @@
+/** @file
+  EFI MM Control Protocol as defined in the PI 1.5 specification.
+
+  This protocol is used initiate synchronous MMI activations. This protocol could be published by a
+  processor driver to abstract the MMI IPI or a driver which abstracts the ASIC that is supporting the
+  APM port. Because of the possibility of performing MMI IPI transactions, the ability to generate this
+  event from a platform chipset agent is an optional capability for both IA-32 and x64-based systems.
+
+  The EFI_MM_CONTROL_PROTOCOL is produced by a runtime driver. It provides  an
+  abstraction of the platform hardware that generates an MMI.  There are often I/O ports that, when
+  accessed, will generate the MMI.  Also, the hardware optionally supports the periodic generation of
+  these signals.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _MM_CONTROL_H_
+#define _MM_CONTROL_H_
+
+#include <PiDxe.h>
+
+#define EFI_MM_CONTROL_PROTOCOL_GUID \
+  { \
+    0x843dc720, 0xab1e, 0x42cb, {0x93, 0x57, 0x8a, 0x0, 0x78, 0xf3, 0x56, 0x1b}  \
+  }
+
+typedef struct _EFI_MM_CONTROL_PROTOCOL  EFI_MM_CONTROL_PROTOCOL;
+typedef UINTN  EFI_MM_PERIOD;
+
+/**
+  Invokes MMI activation from either the preboot or runtime environment.
+
+  This function generates an MMI.
+
+  @param[in]     This                The EFI_MM_CONTROL_PROTOCOL instance.
+  @param[in,out] CommandPort         The value written to the command port.
+  @param[in,out] DataPort            The value written to the data port.
+  @param[in]     Periodic            Optional mechanism to engender a periodic stream.
+  @param[in]     ActivationInterval  Optional parameter to repeat at this period one
+                                     time or, if the Periodic Boolean is set, periodically.
+
+  @retval EFI_SUCCESS            The MMI/PMI has been engendered.
+  @retval EFI_DEVICE_ERROR       The timing is unsupported.
+  @retval EFI_INVALID_PARAMETER  The activation period is unsupported.
+  @retval EFI_INVALID_PARAMETER  The last periodic activation has not been cleared.
+  @retval EFI_NOT_STARTED        The MM base service has not been initialized.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_ACTIVATE)(
+  IN CONST EFI_MM_CONTROL_PROTOCOL    *This,
+  IN OUT UINT8                        *CommandPort       OPTIONAL,
+  IN OUT UINT8                        *DataPort          OPTIONAL,
+  IN BOOLEAN                          Periodic           OPTIONAL,
+  IN UINTN                            ActivationInterval OPTIONAL
+  );
+
+/**
+  Clears any system state that was created in response to the Trigger() call.
+
+  This function acknowledges and causes the deassertion of the MMI activation source.
+
+  @param[in] This                The EFI_MM_CONTROL_PROTOCOL instance.
+  @param[in] Periodic            Optional parameter to repeat at this period one time
+
+  @retval EFI_SUCCESS            The MMI/PMI has been engendered.
+  @retval EFI_DEVICE_ERROR       The source could not be cleared.
+  @retval EFI_INVALID_PARAMETER  The service did not support the Periodic input argument.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_DEACTIVATE)(
+  IN CONST EFI_MM_CONTROL_PROTOCOL    *This,
+  IN BOOLEAN                          Periodic OPTIONAL
+  );
+
+///
+/// The EFI_MM_CONTROL_PROTOCOL is produced by a runtime driver. It provides  an
+/// abstraction of the platform hardware that generates an MMI.  There are often I/O ports that, when
+/// accessed, will generate the MMI.  Also, the hardware optionally supports the periodic generation of
+/// these signals.
+///
+struct _EFI_MM_CONTROL_PROTOCOL {
+  EFI_MM_ACTIVATE    Trigger;
+  EFI_MM_DEACTIVATE  Clear;
+  ///
+  /// Minimum interval at which the platform can set the period.  A maximum is not
+  /// specified in that the MM infrastructure code can emulate a maximum interval that is
+  /// greater than the hardware capabilities by using software emulation in the MM
+  /// infrastructure code.
+  ///
+  EFI_MM_PERIOD      MinimumTriggerPeriod;
+};
+
+extern EFI_GUID gEfiMmControlProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmCpu.h b/MdePkg/Include/Protocol/MmCpu.h
new file mode 100644
index 0000000..c62037f
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmCpu.h
@@ -0,0 +1,247 @@
+/** @file
+  EFI MM CPU Protocol as defined in the PI 1.5 specification.
+
+  This protocol allows MM drivers to access architecture-standard registers from any of the CPU
+  save state areas. In some cases, difference processors provide the same information in the save state,
+  but not in the same format. These so-called pseudo-registers provide this information in a standard
+  format.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _MM_CPU_H_
+#define _MM_CPU_H_
+
+#define EFI_MM_CPU_PROTOCOL_GUID \
+  { \
+    0xeb346b97, 0x975f, 0x4a9f, { 0x8b, 0x22, 0xf8, 0xe9, 0x2b, 0xb3, 0xd5, 0x69 } \
+  }
+
+///
+/// Save State register index
+///
+typedef enum {
+  ///
+  /// x86/X64 standard registers
+  ///
+  EFI_MM_SAVE_STATE_REGISTER_GDTBASE       = 4,
+  EFI_MM_SAVE_STATE_REGISTER_IDTBASE       = 5,
+  EFI_MM_SAVE_STATE_REGISTER_LDTBASE       = 6,
+  EFI_MM_SAVE_STATE_REGISTER_GDTLIMIT      = 7,
+  EFI_MM_SAVE_STATE_REGISTER_IDTLIMIT      = 8,
+  EFI_MM_SAVE_STATE_REGISTER_LDTLIMIT      = 9,
+  EFI_MM_SAVE_STATE_REGISTER_LDTINFO       = 10,
+  EFI_MM_SAVE_STATE_REGISTER_ES            = 20,
+  EFI_MM_SAVE_STATE_REGISTER_CS            = 21,
+  EFI_MM_SAVE_STATE_REGISTER_SS            = 22,
+  EFI_MM_SAVE_STATE_REGISTER_DS            = 23,
+  EFI_MM_SAVE_STATE_REGISTER_FS            = 24,
+  EFI_MM_SAVE_STATE_REGISTER_GS            = 25,
+  EFI_MM_SAVE_STATE_REGISTER_LDTR_SEL      = 26,
+  EFI_MM_SAVE_STATE_REGISTER_TR_SEL        = 27,
+  EFI_MM_SAVE_STATE_REGISTER_DR7           = 28,
+  EFI_MM_SAVE_STATE_REGISTER_DR6           = 29,
+  EFI_MM_SAVE_STATE_REGISTER_R8            = 30,
+  EFI_MM_SAVE_STATE_REGISTER_R9            = 31,
+  EFI_MM_SAVE_STATE_REGISTER_R10           = 32,
+  EFI_MM_SAVE_STATE_REGISTER_R11           = 33,
+  EFI_MM_SAVE_STATE_REGISTER_R12           = 34,
+  EFI_MM_SAVE_STATE_REGISTER_R13           = 35,
+  EFI_MM_SAVE_STATE_REGISTER_R14           = 36,
+  EFI_MM_SAVE_STATE_REGISTER_R15           = 37,
+  EFI_MM_SAVE_STATE_REGISTER_RAX           = 38,
+  EFI_MM_SAVE_STATE_REGISTER_RBX           = 39,
+  EFI_MM_SAVE_STATE_REGISTER_RCX           = 40,
+  EFI_MM_SAVE_STATE_REGISTER_RDX           = 41,
+  EFI_MM_SAVE_STATE_REGISTER_RSP           = 42,
+  EFI_MM_SAVE_STATE_REGISTER_RBP           = 43,
+  EFI_MM_SAVE_STATE_REGISTER_RSI           = 44,
+  EFI_MM_SAVE_STATE_REGISTER_RDI           = 45,
+  EFI_MM_SAVE_STATE_REGISTER_RIP           = 46,
+  EFI_MM_SAVE_STATE_REGISTER_RFLAGS        = 51,
+  EFI_MM_SAVE_STATE_REGISTER_CR0           = 52,
+  EFI_MM_SAVE_STATE_REGISTER_CR3           = 53,
+  EFI_MM_SAVE_STATE_REGISTER_CR4           = 54,
+  EFI_MM_SAVE_STATE_REGISTER_FCW           = 256,
+  EFI_MM_SAVE_STATE_REGISTER_FSW           = 257,
+  EFI_MM_SAVE_STATE_REGISTER_FTW           = 258,
+  EFI_MM_SAVE_STATE_REGISTER_OPCODE        = 259,
+  EFI_MM_SAVE_STATE_REGISTER_FP_EIP        = 260,
+  EFI_MM_SAVE_STATE_REGISTER_FP_CS         = 261,
+  EFI_MM_SAVE_STATE_REGISTER_DATAOFFSET    = 262,
+  EFI_MM_SAVE_STATE_REGISTER_FP_DS         = 263,
+  EFI_MM_SAVE_STATE_REGISTER_MM0           = 264,
+  EFI_MM_SAVE_STATE_REGISTER_MM1           = 265,
+  EFI_MM_SAVE_STATE_REGISTER_MM2           = 266,
+  EFI_MM_SAVE_STATE_REGISTER_MM3           = 267,
+  EFI_MM_SAVE_STATE_REGISTER_MM4           = 268,
+  EFI_MM_SAVE_STATE_REGISTER_MM5           = 269,
+  EFI_MM_SAVE_STATE_REGISTER_MM6           = 270,
+  EFI_MM_SAVE_STATE_REGISTER_MM7           = 271,
+  EFI_MM_SAVE_STATE_REGISTER_XMM0          = 272,
+  EFI_MM_SAVE_STATE_REGISTER_XMM1          = 273,
+  EFI_MM_SAVE_STATE_REGISTER_XMM2          = 274,
+  EFI_MM_SAVE_STATE_REGISTER_XMM3          = 275,
+  EFI_MM_SAVE_STATE_REGISTER_XMM4          = 276,
+  EFI_MM_SAVE_STATE_REGISTER_XMM5          = 277,
+  EFI_MM_SAVE_STATE_REGISTER_XMM6          = 278,
+  EFI_MM_SAVE_STATE_REGISTER_XMM7          = 279,
+  EFI_MM_SAVE_STATE_REGISTER_XMM8          = 280,
+  EFI_MM_SAVE_STATE_REGISTER_XMM9          = 281,
+  EFI_MM_SAVE_STATE_REGISTER_XMM10         = 282,
+  EFI_MM_SAVE_STATE_REGISTER_XMM11         = 283,
+  EFI_MM_SAVE_STATE_REGISTER_XMM12         = 284,
+  EFI_MM_SAVE_STATE_REGISTER_XMM13         = 285,
+  EFI_MM_SAVE_STATE_REGISTER_XMM14         = 286,
+  EFI_MM_SAVE_STATE_REGISTER_XMM15         = 287,
+  ///
+  /// Pseudo-Registers
+  ///
+  EFI_MM_SAVE_STATE_REGISTER_IO            = 512,
+  EFI_MM_SAVE_STATE_REGISTER_LMA           = 513,
+  EFI_MM_SAVE_STATE_REGISTER_PROCESSOR_ID  = 514
+} EFI_MM_SAVE_STATE_REGISTER;
+
+///
+/// The EFI_MM_SAVE_STATE_REGISTER_LMA pseudo-register values
+/// If the processor acts in 32-bit mode at the time the MMI occurred, the pseudo register value
+/// EFI_MM_SAVE_STATE_REGISTER_LMA_32BIT is returned in Buffer. Otherwise,
+/// EFI_MM_SAVE_STATE_REGISTER_LMA_64BIT is returned in Buffer.
+///
+#define EFI_MM_SAVE_STATE_REGISTER_LMA_32BIT  32
+#define EFI_MM_SAVE_STATE_REGISTER_LMA_64BIT  64
+
+///
+/// Size width of I/O instruction
+///
+typedef enum {
+  EFI_MM_SAVE_STATE_IO_WIDTH_UINT8      = 0,
+  EFI_MM_SAVE_STATE_IO_WIDTH_UINT16     = 1,
+  EFI_MM_SAVE_STATE_IO_WIDTH_UINT32     = 2,
+  EFI_MM_SAVE_STATE_IO_WIDTH_UINT64     = 3
+} EFI_MM_SAVE_STATE_IO_WIDTH;
+
+///
+/// Types of I/O instruction
+///
+typedef enum {
+  EFI_MM_SAVE_STATE_IO_TYPE_INPUT       = 1,
+  EFI_MM_SAVE_STATE_IO_TYPE_OUTPUT      = 2,
+  EFI_MM_SAVE_STATE_IO_TYPE_STRING      = 4,
+  EFI_MM_SAVE_STATE_IO_TYPE_REP_PREFIX  = 8
+} EFI_MM_SAVE_STATE_IO_TYPE;
+
+///
+/// Structure of the data which is returned when ReadSaveState() is called with
+/// EFI_MM_SAVE_STATE_REGISTER_IO. If there was no I/O then ReadSaveState() will
+/// return EFI_NOT_FOUND.
+///
+/// This structure describes the I/O operation which was in process when the MMI was generated.
+///
+typedef struct _EFI_MM_SAVE_STATE_IO_INFO {
+  ///
+  /// For input instruction (IN, INS), this is data read before the MMI occurred. For output
+  /// instructions (OUT, OUTS) this is data that was written before the MMI occurred. The
+  /// width of the data is specified by IoWidth.
+  ///
+  UINT64                        IoData;
+  ///
+  /// The I/O port that was being accessed when the MMI was triggered.
+  ///
+  UINT16                        IoPort;
+  ///
+  /// Defines the size width (UINT8, UINT16, UINT32, UINT64) for IoData.
+  ///
+  EFI_MM_SAVE_STATE_IO_WIDTH    IoWidth;
+  ///
+  /// Defines type of I/O instruction.
+  ///
+  EFI_MM_SAVE_STATE_IO_TYPE     IoType;
+} EFI_MM_SAVE_STATE_IO_INFO;
+
+typedef struct _EFI_MM_CPU_PROTOCOL  EFI_MM_CPU_PROTOCOL;
+
+/**
+  Read data from the CPU save state.
+
+  This function is used to read the specified number of bytes of the specified register from the CPU
+  save state of the specified CPU and place the value into the buffer. If the CPU does not support the
+  specified register Register, then EFI_NOT_FOUND  should be returned. If the CPU does not
+  support the specified register width Width, then EFI_INVALID_PARAMETER is returned.
+
+  @param[in]  This               The EFI_MM_CPU_PROTOCOL instance.
+  @param[in]  Width              The number of bytes to read from the CPU save state.
+  @param[in]  Register           Specifies the CPU register to read form the save state.
+  @param[in]  CpuIndex           Specifies the zero-based index of the CPU save state.
+  @param[out] Buffer             Upon return, this holds the CPU register value read from the save state.
+
+  @retval EFI_SUCCESS            The register was read from Save State.
+  @retval EFI_NOT_FOUND          The register is not defined for the Save State of Processor.
+  @retval EFI_INVALID_PARAMETER  Input parameters are not valid, for example, Processor No or register width
+                                 is not correct.This or Buffer is NULL.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_READ_SAVE_STATE)(
+  IN CONST EFI_MM_CPU_PROTOCOL    *This,
+  IN UINTN                        Width,
+  IN EFI_MM_SAVE_STATE_REGISTER   Register,
+  IN UINTN                        CpuIndex,
+  OUT VOID                        *Buffer
+  );
+
+
+/**
+  Write data to the CPU save state.
+
+  This function is used to write the specified number of bytes of the specified register to the CPU save
+  state of the specified CPU and place the value into the buffer. If the CPU does not support the
+  specified register Register, then EFI_UNSUPPORTED should be returned. If the CPU does not
+  support the specified register width Width, then EFI_INVALID_PARAMETER is returned.
+
+  @param[in]  This               The EFI_MM_CPU_PROTOCOL instance.
+  @param[in]  Width              The number of bytes to write to the CPU save state.
+  @param[in]  Register           Specifies the CPU register to write to the save state.
+  @param[in]  CpuIndex           Specifies the zero-based index of the CPU save state.
+  @param[in]  Buffer             Upon entry, this holds the new CPU register value.
+
+  @retval EFI_SUCCESS            The register was written to Save State.
+  @retval EFI_NOT_FOUND          The register is not defined for the Save State of Processor.
+  @retval EFI_INVALID_PARAMETER  Input parameters are not valid. For example:
+                                 ProcessorIndex or Width is not correct.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_WRITE_SAVE_STATE)(
+  IN CONST EFI_MM_CPU_PROTOCOL    *This,
+  IN UINTN                        Width,
+  IN EFI_MM_SAVE_STATE_REGISTER   Register,
+  IN UINTN                        CpuIndex,
+  IN CONST VOID                   *Buffer
+  );
+
+///
+/// EFI MM CPU Protocol provides access to CPU-related information while in MM.
+///
+/// This protocol allows MM drivers to access architecture-standard registers from any of the CPU
+/// save state areas. In some cases, difference processors provide the same information in the save state,
+/// but not in the same format. These so-called pseudo-registers provide this information in a standard
+/// format.
+///
+struct _EFI_MM_CPU_PROTOCOL {
+  EFI_MM_READ_SAVE_STATE   ReadSaveState;
+  EFI_MM_WRITE_SAVE_STATE  WriteSaveState;
+};
+
+extern EFI_GUID gEfiMmCpuProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmCpuIo.h b/MdePkg/Include/Protocol/MmCpuIo.h
new file mode 100644
index 0000000..646480e
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmCpuIo.h
@@ -0,0 +1,96 @@
+/** @file
+  MM CPU I/O 2 protocol as defined in the PI 1.5 specification.
+
+  This protocol provides CPU I/O and memory access within MM.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _MM_CPU_IO_H_
+#define _MM_CPU_IO_H_
+
+#define EFI_MM_CPU_IO_PROTOCOL_GUID \
+  { \
+    0x3242A9D8, 0xCE70, 0x4AA0, { 0x95, 0x5D, 0x5E, 0x7B, 0x14, 0x0D, 0xE4, 0xD2 } \
+  }
+
+typedef struct _EFI_MM_CPU_IO_PROTOCOL  EFI_MM_CPU_IO_PROTOCOL;
+
+///
+/// Width of the MM CPU I/O operations
+///
+typedef enum {
+  MM_IO_UINT8  = 0,
+  MM_IO_UINT16 = 1,
+  MM_IO_UINT32 = 2,
+  MM_IO_UINT64 = 3
+} EFI_MM_IO_WIDTH;
+
+/**
+  Provides the basic memory and I/O interfaces used toabstract accesses to devices.
+
+  The I/O operations are carried out exactly as requested.  The caller is
+  responsible for any alignment and I/O width issues that the bus, device,
+  platform, or type of I/O might require.
+
+  @param[in]      This     The EFI_MM_CPU_IO_PROTOCOL instance.
+  @param[in]      Width    Signifies the width of the I/O operations.
+  @param[in]      Address  The base address of the I/O operations.  The caller is
+                           responsible for aligning the Address if required.
+  @param[in]      Count    The number of I/O operations to perform.
+  @param[in,out]  Buffer   For read operations, the destination buffer to store
+                           the results.  For write operations, the source buffer
+                           from which to write data.
+
+  @retval EFI_SUCCESS            The data was read from or written to the device.
+  @retval EFI_UNSUPPORTED        The Address is not valid for this system.
+  @retval EFI_INVALID_PARAMETER  Width or Count, or both, were invalid.
+  @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to a lack
+                                 of resources.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_CPU_IO)(
+  IN     CONST EFI_MM_CPU_IO_PROTOCOL    *This,
+  IN     EFI_MM_IO_WIDTH                 Width,
+  IN     UINT64                          Address,
+  IN     UINTN                           Count,
+  IN OUT VOID                            *Buffer
+  );
+
+typedef struct {
+  ///
+  /// This service provides the various modalities of memory and I/O read.
+  ///
+  EFI_MM_CPU_IO  Read;
+  ///
+  /// This service provides the various modalities of memory and I/O write.
+  ///
+  EFI_MM_CPU_IO  Write;
+} EFI_MM_IO_ACCESS;
+
+///
+/// MM CPU I/O Protocol provides CPU I/O and memory access within MM.
+///
+struct _EFI_MM_CPU_IO_PROTOCOL {
+  ///
+  /// Allows reads and writes to memory-mapped I/O space.
+  ///
+  EFI_MM_IO_ACCESS Mem;
+  ///
+  /// Allows reads and writes to I/O space.
+  ///
+  EFI_MM_IO_ACCESS Io;
+};
+
+extern EFI_GUID gEfiMmCpuIoProtocolGuid;
+
+#endif
diff --git a/MdePkg/Include/Protocol/MmEndOfDxe.h b/MdePkg/Include/Protocol/MmEndOfDxe.h
new file mode 100644
index 0000000..f110d0f
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmEndOfDxe.h
@@ -0,0 +1,30 @@
+/** @file
+  MM End Of Dxe protocol introduced in the PI 1.5 specification.
+
+  This protocol is a mandatory protocol published by MM Foundation code.
+  This protocol is an MM counterpart of the End of DXE Event.
+  This protocol prorogates End of DXE notification into MM environment.
+  This protocol is installed prior to installation of the MM Ready to Lock Protocol.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _MM_END_OF_DXE_H_
+#define _MM_END_OF_DXE_H_
+
+#define EFI_MM_END_OF_DXE_PROTOCOL_GUID \
+  { \
+    0x24e70042, 0xd5c5, 0x4260, { 0x8c, 0x39, 0xa, 0xd3, 0xaa, 0x32, 0xe9, 0x3d } \
+  }
+
+extern EFI_GUID gEfiMmEndOfDxeProtocolGuid;
+
+#endif
diff --git a/MdePkg/Include/Protocol/MmGpiDispatch.h b/MdePkg/Include/Protocol/MmGpiDispatch.h
new file mode 100644
index 0000000..87db7a0
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmGpiDispatch.h
@@ -0,0 +1,125 @@
+/** @file
+  MM General Purpose Input (GPI) Dispatch Protocol as defined in PI 1.5 Specification
+  Volume 4 Management Mode Core Interface.
+
+  This protocol provides the parent dispatch service for the General Purpose Input
+  (GPI) MMI source generator.
+
+  The EFI_MM_GPI_DISPATCH_PROTOCOL provides the ability to install child handlers for the
+  given event types.  Several inputs can be enabled.  This purpose of this interface is to generate an
+  MMI in response to any of these inputs having a true value provided.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+  @par Revision Reference:
+  This protocol is from PI Version 1.5.
+
+**/
+
+#ifndef _MM_GPI_DISPATCH_H_
+#define _MM_GPI_DISPATCH_H_
+
+#include <Pi/PiMmCis.h>
+
+#define EFI_MM_GPI_DISPATCH_PROTOCOL_GUID \
+  { \
+    0x25566b03, 0xb577, 0x4cbf, {0x95, 0x8c, 0xed, 0x66, 0x3e, 0xa2, 0x43, 0x80 } \
+  }
+
+///
+/// The dispatch function's context.
+///
+typedef struct {
+  ///
+  /// A number from one of 2^64 possible GPIs that can generate an MMI. A
+  /// 0 corresponds to logical GPI[0]; 1 corresponds to logical GPI[1]; and
+  /// GpiNum of N corresponds to GPI[N], where N can span from 0 to 2^64-1.
+  ///
+  UINT64 GpiNum;
+} EFI_MM_GPI_REGISTER_CONTEXT;
+
+typedef struct _EFI_MM_GPI_DISPATCH_PROTOCOL EFI_MM_GPI_DISPATCH_PROTOCOL;
+
+/**
+  Registers a child MMI source dispatch function with a parent MM driver.
+
+  This service registers a function (DispatchFunction) which will be called when an MMI is
+  generated because of one or more of the GPIs specified by RegisterContext. On return,
+  DispatchHandle contains a unique handle which may be used later to unregister the function
+  using UnRegister().
+  The DispatchFunction will be called with Context set to the same value as was passed into
+  this function in RegisterContext and with CommBuffer pointing to another instance of
+  EFI_MM_GPI_REGISTER_CONTEXT describing the GPIs which actually caused the MMI and
+  CommBufferSize pointing to the size of the structure.
+
+  @param[in]  This               Pointer to the EFI_MM_GPI_DISPATCH_PROTOCOL instance.
+  @param[in]  DispatchFunction   Function to register for handler when the specified GPI causes an MMI.
+  @param[in]  RegisterContext    Pointer to the dispatch function's context.
+                                 The caller fills this context in before calling
+                                 the register function to indicate to the register
+                                 function the GPI(s) for which the dispatch function
+                                 should be invoked.
+  @param[out] DispatchHandle     Handle generated by the dispatcher to track the
+                                 function instance.
+
+  @retval EFI_SUCCESS            The dispatch function has been successfully
+                                 registered and the MMI source has been enabled.
+  @retval EFI_DEVICE_ERROR       The driver was unable to enable the MMI source.
+  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. The GPI input value
+                                 is not within valid range.
+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system or MM) to manage this child.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_GPI_REGISTER)(
+  IN CONST EFI_MM_GPI_DISPATCH_PROTOCOL    *This,
+  IN       EFI_MM_HANDLER_ENTRY_POINT      DispatchFunction,
+  IN CONST EFI_MM_GPI_REGISTER_CONTEXT     *RegisterContext,
+  OUT      EFI_HANDLE                      *DispatchHandle
+  );
+
+/**
+  Unregisters a General Purpose Input (GPI) service.
+
+  This service removes the handler associated with DispatchHandle so that it will no longer be
+  called when the GPI triggers an MMI.
+
+  @param[in]  This               Pointer to the EFI_MM_GPI_DISPATCH_PROTOCOL instance.
+  @param[in]  DispatchHandle     Handle of the service to remove.
+
+  @retval EFI_SUCCESS            Handle of the service to remove.
+  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_GPI_UNREGISTER)(
+  IN CONST EFI_MM_GPI_DISPATCH_PROTOCOL    *This,
+  IN       EFI_HANDLE                      DispatchHandle
+  );
+
+///
+/// Interface structure for the MM GPI MMI Dispatch Protocol
+///
+/// The MM GPI MMI Dispatch Protocol provides the parent dispatch service
+/// for the General Purpose Input (GPI) MMI source generator.
+///
+struct _EFI_MM_GPI_DISPATCH_PROTOCOL {
+  EFI_MM_GPI_REGISTER    Register;
+  EFI_MM_GPI_UNREGISTER  UnRegister;
+  ///
+  /// Denotes the maximum value of inputs that can have handlers attached.
+  ///
+  UINTN                   NumSupportedGpis;
+};
+
+extern EFI_GUID gEfiMmGpiDispatchProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmIoTrapDispatch.h b/MdePkg/Include/Protocol/MmIoTrapDispatch.h
new file mode 100644
index 0000000..be0098b
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmIoTrapDispatch.h
@@ -0,0 +1,136 @@
+/** @file
+  MM IO Trap Dispatch Protocol as defined in PI 1.5 Specification
+  Volume 4 Management Mode Core Interface.
+
+  This protocol provides a parent dispatch service for IO trap MMI sources.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+  @par Revision Reference:
+  This protocol is from PI Version 1.5.
+
+**/
+
+#ifndef _MM_IO_TRAP_DISPATCH_H_
+#define _MM_IO_TRAP_DISPATCH_H_
+
+#include <Pi/PiMmCis.h>
+
+#define EFI_MM_IO_TRAP_DISPATCH_PROTOCOL_GUID \
+  { \
+    0x58dc368d, 0x7bfa, 0x4e77, {0xab, 0xbc, 0xe, 0x29, 0x41, 0x8d, 0xf9, 0x30 } \
+  }
+
+///
+/// IO Trap valid types
+///
+typedef enum {
+  WriteTrap,
+  ReadTrap,
+  ReadWriteTrap,
+  IoTrapTypeMaximum
+} EFI_MM_IO_TRAP_DISPATCH_TYPE;
+
+///
+/// IO Trap context structure containing information about the
+/// IO trap event that should invoke the handler
+///
+typedef struct {
+  UINT16                         Address;
+  UINT16                         Length;
+  EFI_MM_IO_TRAP_DISPATCH_TYPE   Type;
+} EFI_MM_IO_TRAP_REGISTER_CONTEXT;
+
+///
+/// IO Trap context structure containing information about the IO trap that occurred
+///
+typedef struct {
+  UINT32  WriteData;
+} EFI_MM_IO_TRAP_CONTEXT;
+
+typedef struct _EFI_MM_IO_TRAP_DISPATCH_PROTOCOL EFI_MM_IO_TRAP_DISPATCH_PROTOCOL;
+
+/**
+  Register an IO trap MMI child handler for a specified MMI.
+
+  This service registers a function (DispatchFunction) which will be called when an MMI is
+  generated because of an access to an I/O port specified by RegisterContext. On return,
+  DispatchHandle contains a unique handle which may be used later to unregister the function
+  using UnRegister(). If the base of the I/O range specified is zero, then an I/O range with the
+  specified length and characteristics will be allocated and the Address field in RegisterContext
+  updated. If no range could be allocated, then EFI_OUT_OF_RESOURCES will be returned.
+
+  The service will not perform GCD allocation if the base address is non-zero or
+  EFI_MM_READY_TO_LOCK has been installed.  In this case, the caller is responsible for the
+  existence and allocation of the specific IO range.
+  An error may be returned if some or all of the requested resources conflict with an existing IO trap
+  child handler.
+
+  It is not required that implementations will allow multiple children for a single IO trap MMI source.
+  Some implementations may support multiple children.
+  The DispatchFunction will be called with Context updated to contain information
+  concerning the I/O action that actually happened and is passed in RegisterContext, with
+  CommBuffer pointing to the data actually written and CommBufferSize pointing to the size of
+  the data in CommBuffer.
+
+  @param[in]  This               Pointer to the EFI_MM_IO_TRAP_DISPATCH_PROTOCOL instance.
+  @param[in]  DispatchFunction   Function to register for handler when I/O trap location is accessed.
+  @param[in]  RegisterContext    Pointer to the dispatch function's context.  The caller fills this
+                                 context in before calling the register function to indicate to the register
+                                 function the IO trap MMI source for which the dispatch function should be invoked.
+  @param[out] DispatchHandle     Handle of the dispatch function, for when interfacing with the parent MM driver.
+
+  @retval EFI_SUCCESS            The dispatch function has been successfully registered.
+  @retval EFI_DEVICE_ERROR       The driver was unable to complete due to hardware error.
+  @retval EFI_OUT_OF_RESOURCES   Insufficient resources are available to fulfill the IO trap range request.
+  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid.  The input value is not within a valid range.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_IO_TRAP_DISPATCH_REGISTER)(
+  IN CONST EFI_MM_IO_TRAP_DISPATCH_PROTOCOL    *This,
+  IN       EFI_MM_HANDLER_ENTRY_POINT          DispatchFunction,
+  IN OUT   EFI_MM_IO_TRAP_REGISTER_CONTEXT     *RegisterContext,
+     OUT   EFI_HANDLE                          *DispatchHandle
+  );
+
+/**
+  Unregister a child MMI source dispatch function with a parent MM driver.
+
+  This service removes a previously installed child dispatch handler. This does not guarantee that the
+  system resources will be freed from the GCD.
+
+  @param[in] This                Pointer to the EFI_MM_IO_TRAP_DISPATCH_PROTOCOL instance.
+  @param[in] DispatchHandle      Handle of the child service to remove.
+
+  @retval EFI_SUCCESS            The dispatch function has been successfully unregistered.
+  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_IO_TRAP_DISPATCH_UNREGISTER)(
+  IN CONST EFI_MM_IO_TRAP_DISPATCH_PROTOCOL    *This,
+  IN       EFI_HANDLE                          DispatchHandle
+  );
+
+///
+/// Interface structure for the MM IO Trap Dispatch Protocol.
+///
+/// This protocol provides a parent dispatch service for IO trap MMI sources.
+///
+struct _EFI_MM_IO_TRAP_DISPATCH_PROTOCOL {
+  EFI_MM_IO_TRAP_DISPATCH_REGISTER    Register;
+  EFI_MM_IO_TRAP_DISPATCH_UNREGISTER  UnRegister;
+};
+
+extern EFI_GUID gEfiMmIoTrapDispatchProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmPciRootBridgeIo.h b/MdePkg/Include/Protocol/MmPciRootBridgeIo.h
new file mode 100644
index 0000000..1de9931
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmPciRootBridgeIo.h
@@ -0,0 +1,37 @@
+/** @file
+  MM PCI Root Bridge IO protocol as defined in the PI 1.5 specification.
+
+  This protocol provides PCI I/O and memory access within MM.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _MM_PCI_ROOT_BRIDGE_IO_H_
+#define _MM_PCI_ROOT_BRIDGE_IO_H_
+
+#include <Protocol/PciRootBridgeIo.h>
+
+#define EFI_MM_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID \
+  { \
+    0x8bc1714d, 0xffcb, 0x41c3, { 0x89, 0xdc, 0x6c, 0x74, 0xd0, 0x6d, 0x98, 0xea } \
+  }
+
+///
+/// This protocol provides the same functionality as the PCI Root Bridge I/O Protocol defined in the
+/// UEFI 2.1 Specifcation, section 13.2, except that the functions for Map() and Unmap() may return
+/// EFI_UNSUPPORTED.
+///
+typedef EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL  EFI_MM_PCI_ROOT_BRIDGE_IO_PROTOCOL;
+
+extern EFI_GUID gEfiMmPciRootBridgeIoProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmPeriodicTimerDispatch.h b/MdePkg/Include/Protocol/MmPeriodicTimerDispatch.h
new file mode 100644
index 0000000..2a8cc38
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmPeriodicTimerDispatch.h
@@ -0,0 +1,170 @@
+/** @file
+  MM Periodic Timer Dispatch Protocol as defined in PI 1.5 Specification
+  Volume 4 Management Mode Core Interface.
+
+  This protocol provides the parent dispatch service for the periodical timer MMI source generator.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+  @par Revision Reference:
+  This protocol is from PI Version 1.5.
+
+**/
+
+#ifndef _MM_PERIODIC_TIMER_DISPATCH_H_
+#define _MM_PERIODIC_TIMER_DISPATCH_H_
+
+#include <Pi/PiMmCis.h>
+
+#define EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL_GUID \
+  { \
+    0x4cec368e, 0x8e8e, 0x4d71, {0x8b, 0xe1, 0x95, 0x8c, 0x45, 0xfc, 0x8a, 0x53 } \
+  }
+
+///
+/// Example: A chipset supports periodic MMIs on every 64ms or 2 seconds.
+///   A child wishes schedule a period MMI to fire on a period of 3 seconds, there
+///   are several ways to approach the problem:
+///   1. The child may accept a 4 second periodic rate, in which case it registers with
+///        Period = 40000
+///        MmiTickInterval = 20000
+///      The resulting MMI will occur every 2 seconds with the child called back on
+///      every 2nd MMI.
+///      NOTE: the same result would occur if the child set MmiTickInterval = 0.
+///   2. The child may choose the finer granularity MMI (64ms):
+///        Period = 30000
+///        MmiTickInterval = 640
+///      The resulting MMI will occur every 64ms with the child called back on
+///      every 47th MMI.
+///      NOTE: the child driver should be aware that this will result in more
+///        MMIs occuring during system runtime which can negatively impact system
+///        performance.
+///
+typedef struct {
+  ///
+  /// The minimum period of time in 100 nanosecond units that the child gets called. The
+  /// child will be called back after a time greater than the time Period.
+  ///
+  UINT64  Period;
+  ///
+  /// The period of time interval between MMIs. Children of this interface should use this
+  /// field when registering for periodic timer intervals when a finer granularity periodic
+  /// MMI is desired.
+  ///
+  UINT64  MmiTickInterval;
+} EFI_MM_PERIODIC_TIMER_REGISTER_CONTEXT;
+
+///
+/// The DispatchFunction will be called with Context set to the same value as was passed into
+/// Register() in RegisterContext and with CommBuffer pointing to an instance of
+/// EFI_MM_PERIODIC_TIMER_CONTEXT and CommBufferSize pointing to its size.
+///
+typedef struct {
+  ///
+  /// ElapsedTime is the actual time in 100 nanosecond units elapsed since last called, a
+  /// value of 0 indicates an unknown amount of time.
+  ///
+  UINT64  ElapsedTime;
+} EFI_MM_PERIODIC_TIMER_CONTEXT;
+
+typedef struct _EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL  EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL;
+
+/**
+  Register a child MMI source dispatch function for MM periodic timer.
+
+  This service registers a function (DispatchFunction) which will be called when at least the
+  amount of time specified by RegisterContext has elapsed. On return, DispatchHandle
+  contains a unique handle which may be used later to unregister the function using UnRegister().
+  The DispatchFunction will be called with Context set to the same value as was passed into
+  this function in RegisterContext and with CommBuffer pointing to an instance of
+  EFI_MM_PERIODIC_TIMER_CONTEXT and CommBufferSize pointing to its size.
+
+  @param[in]  This               Pointer to the EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL instance.
+  @param[in]  DispatchFunction   Function to register for handler when at least the specified amount
+                                 of time has elapsed.
+  @param[in]  RegisterContext    Pointer to the dispatch function's context.
+                                 The caller fills this context in before calling
+                                 the register function to indicate to the register
+                                 function the period at which the dispatch function
+                                 should be invoked.
+  @param[out] DispatchHandle     Handle generated by the dispatcher to track the function instance.
+
+  @retval EFI_SUCCESS            The dispatch function has been successfully
+                                 registered and the MMI source has been enabled.
+  @retval EFI_DEVICE_ERROR       The driver was unable to enable the MMI source.
+  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. The period input value
+                                 is not within valid range.
+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system or MM) to manage this child.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_PERIODIC_TIMER_REGISTER)(
+  IN CONST EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL    *This,
+  IN       EFI_MM_HANDLER_ENTRY_POINT                 DispatchFunction,
+  IN CONST EFI_MM_PERIODIC_TIMER_REGISTER_CONTEXT     *RegisterContext,
+  OUT      EFI_HANDLE                                 *DispatchHandle
+  );
+
+/**
+  Unregisters a periodic timer service.
+
+  This service removes the handler associated with DispatchHandle so that it will no longer be
+  called when the time has elapsed.
+
+  @param[in] This                Pointer to the EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL instance.
+  @param[in] DispatchHandle      Handle of the service to remove.
+
+  @retval EFI_SUCCESS            The service has been successfully removed.
+  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_PERIODIC_TIMER_UNREGISTER)(
+  IN CONST EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL  *This,
+  IN       EFI_HANDLE                               DispatchHandle
+  );
+
+/**
+  Returns the next MMI tick period supported by the chipset.
+
+  The order returned is from longest to shortest interval period.
+
+  @param[in]     This             Pointer to the EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL instance.
+  @param[in,out] MmiTickInterval  Pointer to pointer of next shorter MMI interval
+                                  period supported by the child. This parameter works as a get-first,
+                                  get-next field.The first time this function is called, *MmiTickInterval
+                                  should be set to NULL to get the longest MMI interval.The returned
+                                  *MmiTickInterval should be passed in on subsequent calls to get the
+                                  next shorter interval period until *MmiTickInterval = NULL.
+
+  @retval EFI_SUCCESS             The service returned successfully.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_PERIODIC_TIMER_INTERVAL)(
+  IN CONST EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL  *This,
+  IN OUT UINT64                                     **MmiTickInterval
+  );
+
+///
+/// Interface structure for the MM Periodic Timer Dispatch Protocol
+///
+/// This protocol provides the parent dispatch service for the periodical timer MMI source generator.
+///
+struct _EFI_MM_PERIODIC_TIMER_DISPATCH_PROTOCOL {
+  EFI_MM_PERIODIC_TIMER_REGISTER    Register;
+  EFI_MM_PERIODIC_TIMER_UNREGISTER  UnRegister;
+  EFI_MM_PERIODIC_TIMER_INTERVAL    GetNextShorterInterval;
+};
+
+extern EFI_GUID gEfiMmPeriodicTimerDispatchProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmPowerButtonDispatch.h b/MdePkg/Include/Protocol/MmPowerButtonDispatch.h
new file mode 100644
index 0000000..b8a12f5
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmPowerButtonDispatch.h
@@ -0,0 +1,117 @@
+/** @file
+  MM Power Button Dispatch Protocol as defined in PI 1.5 Specification
+  Volume 4 Management Mode Core Interface.
+
+  This protocol provides the parent dispatch service for the power button MMI source generator.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+  @par Revision Reference:
+  This protocol is from PI Version 1.5.
+
+**/
+
+#ifndef _MM_POWER_BUTTON_DISPATCH_H_
+#define _MM_POWER_BUTTON_DISPATCH_H_
+
+#include <Pi/PiMmCis.h>
+
+#define EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL_GUID \
+  { \
+    0x1b1183fa, 0x1823, 0x46a7, {0x88, 0x72, 0x9c, 0x57, 0x87, 0x55, 0x40, 0x9d } \
+  }
+
+///
+/// Power Button phases.
+///
+typedef enum {
+  EfiPowerButtonEntry,
+  EfiPowerButtonExit,
+  EfiPowerButtonMax
+} EFI_POWER_BUTTON_PHASE;
+
+///
+/// The dispatch function's context.
+///
+typedef struct {
+  ///
+  /// Designates whether this handler should be invoked upon entry or exit.
+  ///
+  EFI_POWER_BUTTON_PHASE  Phase;
+} EFI_MM_POWER_BUTTON_REGISTER_CONTEXT;
+
+typedef struct _EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL;
+
+/**
+  Provides the parent dispatch service for a power button event.
+
+  This service registers a function (DispatchFunction) which will be called when an MMI is
+  generated because the power button was pressed or released, as specified by RegisterContext.
+  On return, DispatchHandle contains a unique handle which may be used later to unregister the
+  function using UnRegister().
+  The DispatchFunction will be called with Context set to the same value as was passed into
+  this function in RegisterContext and with CommBuffer and CommBufferSize set to NULL.
+
+  @param[in]  This               Pointer to the EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL instance.
+  @param[in]  DispatchFunction   Function to register for handler when power button is pressed or released.
+  @param[in]  RegisterContext    Pointer to the dispatch function's context. The caller fills in this context
+                                 before calling the Register() function to indicate to the Register() function
+                                 the power button MMI phase for which the dispatch function should be invoked.
+  @param[out] DispatchHandle     Handle generated by the dispatcher to track the function instance.
+
+  @retval EFI_SUCCESS            The dispatch function has been successfully
+                                 registered and the MMI source has been enabled.
+  @retval EFI_DEVICE_ERROR       The driver was unable to enable the MMI source.
+  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. The power button input value
+                                 is not within valid range.
+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system or MM) to manage this child.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_POWER_BUTTON_REGISTER)(
+  IN CONST EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL  *This,
+  IN       EFI_MM_HANDLER_ENTRY_POINT             DispatchFunction,
+  IN       EFI_MM_POWER_BUTTON_REGISTER_CONTEXT   *RegisterContext,
+  OUT      EFI_HANDLE                             *DispatchHandle
+  );
+
+/**
+  Unregisters a power-button service.
+
+  This service removes the handler associated with DispatchHandle so that it will no longer be
+  called when the standby button is pressed or released.
+
+  @param[in] This                Pointer to the EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL instance.
+  @param[in] DispatchHandle      Handle of the service to remove.
+
+  @retval EFI_SUCCESS            The service has been successfully removed.
+  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_POWER_BUTTON_UNREGISTER)(
+  IN CONST EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL  *This,
+  IN       EFI_HANDLE                             DispatchHandle
+  );
+
+///
+/// Interface structure for the MM Power Button Dispatch Protocol.
+///
+/// This protocol provides the parent dispatch service for the power button MMI source generator.
+///
+struct _EFI_MM_POWER_BUTTON_DISPATCH_PROTOCOL {
+  EFI_MM_POWER_BUTTON_REGISTER    Register;
+  EFI_MM_POWER_BUTTON_UNREGISTER  UnRegister;
+};
+
+extern EFI_GUID gEfiMmPowerButtonDispatchProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmReadyToLock.h b/MdePkg/Include/Protocol/MmReadyToLock.h
new file mode 100644
index 0000000..a9a1af4
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmReadyToLock.h
@@ -0,0 +1,32 @@
+/** @file
+  MM Ready To Lock protocol introduced in the PI 1.5 specification.
+
+  This protocol is a mandatory protocol published by the MM Foundation
+  code when the system is preparing to lock certain resources and interfaces
+  in anticipation of the invocation of 3rd party extensible modules.
+  This protocol is an MM counterpart of the DXE MM Ready to Lock Protocol.
+  This protocol prorogates resource locking notification into MM environment.
+  This protocol is installed after installation of the MM End of DXE Protocol.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _MM_READY_TO_LOCK_H_
+#define _MM_READY_TO_LOCK_H_
+
+#define EFI_MM_READY_TO_LOCK_PROTOCOL_GUID \
+  { \
+    0x47b7fa8c, 0xf4bd, 0x4af6, { 0x82, 0x00, 0x33, 0x30, 0x86, 0xf0, 0xd2, 0xc8 } \
+  }
+
+extern EFI_GUID gEfiMmReadyToLockProtocolGuid;
+
+#endif
diff --git a/MdePkg/Include/Protocol/MmReportStatusCodeHandler.h b/MdePkg/Include/Protocol/MmReportStatusCodeHandler.h
new file mode 100644
index 0000000..4037d72
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmReportStatusCodeHandler.h
@@ -0,0 +1,81 @@
+/** @file
+  This protocol provides registering and unregistering services to status code consumers while in DXE MM.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __MM_REPORT_STATUS_CODE_HANDLER_PROTOCOL_H__
+#define __MM_REPORT_STATUS_CODE_HANDLER_PROTOCOL_H__
+
+#define EFI_MM_RSC_HANDLER_PROTOCOL_GUID \
+  { \
+    0x2ff29fa7, 0x5e80, 0x4ed9, {0xb3, 0x80, 0x1, 0x7d, 0x3c, 0x55, 0x4f, 0xf4} \
+  }
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_RSC_HANDLER_CALLBACK)(
+  IN EFI_STATUS_CODE_TYPE   CodeType,
+  IN EFI_STATUS_CODE_VALUE  Value,
+  IN UINT32                 Instance,
+  IN EFI_GUID               *CallerId,
+  IN EFI_STATUS_CODE_DATA   *Data
+);
+
+/**
+  Register the callback function for ReportStatusCode() notification.
+
+  When this function is called the function pointer is added to an internal list and any future calls to
+  ReportStatusCode() will be forwarded to the Callback function.
+
+  @param[in] Callback               A pointer to a function of type EFI_MM_RSC_HANDLER_CALLBACK that is
+                                    called when a call to ReportStatusCode() occurs.
+
+  @retval EFI_SUCCESS               Function was successfully registered.
+  @retval EFI_INVALID_PARAMETER     The callback function was NULL.
+  @retval EFI_OUT_OF_RESOURCES      The internal buffer ran out of space. No more functions can be
+                                    registered.
+  @retval EFI_ALREADY_STARTED       The function was already registered. It can't be registered again.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_RSC_HANDLER_REGISTER)(
+  IN EFI_MM_RSC_HANDLER_CALLBACK Callback
+);
+
+/**
+  Remove a previously registered callback function from the notification list.
+
+  A callback function must be unregistered before it is deallocated. It is important that any registered
+  callbacks that are not runtime complaint be unregistered when ExitBootServices() is called.
+
+  @param[in] Callback           A pointer to a function of type EFI_MM_RSC_HANDLER_CALLBACK that is to be
+                                unregistered.
+
+  @retval EFI_SUCCESS           The function was successfully unregistered.
+  @retval EFI_INVALID_PARAMETER The callback function was NULL.
+  @retval EFI_NOT_FOUND         The callback function was not found to be unregistered.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_RSC_HANDLER_UNREGISTER)(
+  IN EFI_MM_RSC_HANDLER_CALLBACK Callback
+);
+
+typedef struct _EFI_MM_RSC_HANDLER_PROTOCOL {
+  EFI_MM_RSC_HANDLER_REGISTER      Register;
+  EFI_MM_RSC_HANDLER_UNREGISTER    Unregister;
+} EFI_MM_RSC_HANDLER_PROTOCOL;
+
+extern EFI_GUID gEfiMmRscHandlerProtocolGuid;
+
+#endif
diff --git a/MdePkg/Include/Protocol/MmStandbyButtonDispatch.h b/MdePkg/Include/Protocol/MmStandbyButtonDispatch.h
new file mode 100644
index 0000000..dc95e8f
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmStandbyButtonDispatch.h
@@ -0,0 +1,119 @@
+/** @file
+  MM Standby Button Dispatch Protocol as defined in PI 1.5 Specification
+  Volume 4 Management Mode Core Interface.
+
+  This protocol provides the parent dispatch service for the standby button MMI source generator.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+  @par Revision Reference:
+  This protocol is from PI Version 1.5.
+
+**/
+
+#ifndef _MM_STANDBY_BUTTON_DISPATCH_H_
+#define _MM_STANDBY_BUTTON_DISPATCH_H_
+
+#include <Pi/PiMmCis.h>
+
+#define EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL_GUID \
+  { \
+    0x7300c4a1, 0x43f2, 0x4017, {0xa5, 0x1b, 0xc8, 0x1a, 0x7f, 0x40, 0x58, 0x5b } \
+  }
+
+///
+/// Standby Button phases
+///
+typedef enum {
+  EfiStandbyButtonEntry,
+  EfiStandbyButtonExit,
+  EfiStandbyButtonMax
+} EFI_STANDBY_BUTTON_PHASE;
+
+///
+/// The dispatch function's context.
+///
+typedef struct {
+  ///
+  /// Describes whether the child handler should be invoked upon the entry to the button
+  /// activation or upon exit.
+  ///
+  EFI_STANDBY_BUTTON_PHASE  Phase;
+} EFI_MM_STANDBY_BUTTON_REGISTER_CONTEXT;
+
+typedef struct _EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL;
+
+/**
+  Provides the parent dispatch service for a standby button event.
+
+  This service registers a function (DispatchFunction) which will be called when an MMI is
+  generated because the standby button was pressed or released, as specified by
+  RegisterContext. On return, DispatchHandle contains a unique handle which may be used
+  later to unregister the function using UnRegister().
+  The DispatchFunction will be called with Context set to the same value as was passed into
+  this function in RegisterContext and with CommBuffer and CommBufferSize set to NULL.
+
+  @param[in]  This               Pointer to the EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL instance.
+  @param[in]  DispatchFunction   Function to register for handler when the standby button is pressed or released.
+  @param[in]  RegisterContext    Pointer to the dispatch function's context. The caller fills in this context
+                                 before calling the register function to indicate to the register function the
+                                 standby button MMI source for which the dispatch function should be invoked.
+  @param[out] DispatchHandle     Handle generated by the dispatcher to track the function instance.
+
+  @retval EFI_SUCCESS            The dispatch function has been successfully
+                                 registered and the MMI source has been enabled.
+  @retval EFI_DEVICE_ERROR       The driver was unable to enable the MMI source.
+  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. The standby button input value
+                                 is not within valid range.
+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system or MM) to manage this child.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_STANDBY_BUTTON_REGISTER)(
+  IN CONST EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL  *This,
+  IN       EFI_MM_HANDLER_ENTRY_POINT               DispatchFunction,
+  IN       EFI_MM_STANDBY_BUTTON_REGISTER_CONTEXT   *RegisterContext,
+  OUT      EFI_HANDLE                               *DispatchHandle
+  );
+
+/**
+  Unregisters a child MMI source dispatch function with a parent MM driver.
+
+  This service removes the handler associated with DispatchHandle so that it will no longer be
+  called when the standby button is pressed or released.
+
+  @param[in] This                Pointer to the EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL instance.
+  @param[in] DispatchHandle      Handle of the service to remove.
+
+  @retval EFI_SUCCESS            The service has been successfully removed.
+  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_STANDBY_BUTTON_UNREGISTER)(
+  IN CONST EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL  *This,
+  IN       EFI_HANDLE                               DispatchHandle
+  );
+
+///
+/// Interface structure for the MM Standby Button Dispatch Protocol.
+///
+/// This protocol provides the parent dispatch service for the standby
+/// button MMI source generator.
+///
+struct _EFI_MM_STANDBY_BUTTON_DISPATCH_PROTOCOL {
+  EFI_MM_STANDBY_BUTTON_REGISTER    Register;
+  EFI_MM_STANDBY_BUTTON_UNREGISTER  UnRegister;
+};
+
+extern EFI_GUID gEfiMmStandbyButtonDispatchProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmStatusCode.h b/MdePkg/Include/Protocol/MmStatusCode.h
new file mode 100644
index 0000000..adebaee
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmStatusCode.h
@@ -0,0 +1,65 @@
+/** @file
+  EFI MM Status Code Protocol as defined in the PI 1.5 specification.
+
+  This protocol provides the basic status code services while in MM.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _MM_STATUS_CODE_H__
+#define _MM_STATUS_CODE_H__
+
+
+#define EFI_MM_STATUS_CODE_PROTOCOL_GUID \
+  { \
+    0x6afd2b77, 0x98c1, 0x4acd, {0xa6, 0xf9, 0x8a, 0x94, 0x39, 0xde, 0xf, 0xb1} \
+  }
+
+typedef struct _EFI_MM_STATUS_CODE_PROTOCOL  EFI_MM_STATUS_CODE_PROTOCOL;
+
+/**
+  Service to emit the status code in MM.
+
+  The EFI_MM_STATUS_CODE_PROTOCOL.ReportStatusCode() function enables a driver
+  to emit a status code while in MM.  The reason that there is a separate protocol definition from the
+  DXE variant of this service is that the publisher of this protocol will provide a service that is
+  capability of coexisting with a foreground operational environment, such as an operating system
+  after the termination of boot services.
+
+  @param[in] This                Points to this instance of the EFI_MM_STATUS_CODE_PROTOCOL.
+  @param[in] CodeType            DIndicates the type of status code being reported.
+  @param[in] Value               Describes the current status of a hardware or software entity.
+  @param[in] Instance            The enumeration of a hardware or software entity within the system.
+  @param[in] CallerId            This optional parameter may be used to identify the caller.
+  @param[in] Data                This optional parameter may be used to pass additional data.
+
+  @retval EFI_SUCCESS            The function completed successfully.
+  @retval EFI_INVALID_PARAMETER  The function should not be completed due to a device error.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_REPORT_STATUS_CODE)(
+  IN CONST EFI_MM_STATUS_CODE_PROTOCOL   *This,
+  IN EFI_STATUS_CODE_TYPE                CodeType,
+  IN EFI_STATUS_CODE_VALUE               Value,
+  IN UINT32                              Instance,
+  IN CONST EFI_GUID                      *CallerId,
+  IN EFI_STATUS_CODE_DATA                *Data OPTIONAL
+  );
+
+struct _EFI_MM_STATUS_CODE_PROTOCOL {
+  EFI_MM_REPORT_STATUS_CODE  ReportStatusCode;
+};
+
+extern EFI_GUID gEfiMmStatusCodeProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/Include/Protocol/MmSwDispatch.h b/MdePkg/Include/Protocol/MmSwDispatch.h
new file mode 100644
index 0000000..d3acb64
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmSwDispatch.h
@@ -0,0 +1,136 @@
+/** @file
+  MM Software Dispatch Protocol introduced from PI 1.5 Specification
+  Volume 4 Management Mode Core Interface.
+
+  This protocol provides the parent dispatch service for a given MMI source generator.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _MM_SW_DISPATCH2_H_
+#define _MM_SW_DISPATCH2_H_
+
+#include <Pi/PiMmCis.h>
+
+#define EFI_MM_SW_DISPATCH_PROTOCOL_GUID \
+  { \
+    0x18a3c6dc, 0x5eea, 0x48c8, {0xa1, 0xc1, 0xb5, 0x33, 0x89, 0xf9, 0x89, 0x99 } \
+  }
+
+///
+/// A particular chipset may not support all possible software MMI input values.
+/// For example, the ICH supports only values 00h to 0FFh.  The parent only allows a single
+/// child registration for each SwMmiInputValue.
+///
+typedef struct {
+  UINTN SwMmiInputValue;
+} EFI_MM_SW_REGISTER_CONTEXT;
+
+///
+/// The DispatchFunction will be called with Context set to the same value as was passed into
+/// this function in RegisterContext and with CommBuffer (and CommBufferSize) pointing
+/// to an instance of EFI_MM_SW_CONTEXT indicating the index of the CPU which generated the
+/// software MMI.
+///
+typedef struct {
+  ///
+  /// The 0-based index of the CPU which generated the software MMI.
+  ///
+  UINTN SwMmiCpuIndex;
+  ///
+  /// This value corresponds directly to the CommandPort parameter used in the call to Trigger().
+  ///
+  UINT8 CommandPort;
+  ///
+  /// This value corresponds directly to the DataPort parameter used in the call to Trigger().
+  ///
+  UINT8 DataPort;
+} EFI_MM_SW_CONTEXT;
+
+typedef struct _EFI_MM_SW_DISPATCH_PROTOCOL  EFI_MM_SW_DISPATCH_PROTOCOL;
+
+/**
+  Register a child MMI source dispatch function for the specified software MMI.
+
+  This service registers a function (DispatchFunction) which will be called when the software
+  MMI source specified by RegisterContext->SwMmiCpuIndex is detected. On return,
+  DispatchHandle contains a unique handle which may be used later to unregister the function
+  using UnRegister().
+
+  @param[in]  This                 Pointer to the EFI_MM_SW_DISPATCH_PROTOCOL instance.
+  @param[in]  DispatchFunction     Function to register for handler when the specified software
+                                   MMI is generated.
+  @param[in, out] RegisterContext  Pointer to the dispatch function's context.
+                                   The caller fills this context in before calling
+                                   the register function to indicate to the register
+                                   function which Software MMI input value the
+                                   dispatch function should be invoked for.
+  @param[out] DispatchHandle       Handle generated by the dispatcher to track the
+                                   function instance.
+
+  @retval EFI_SUCCESS            The dispatch function has been successfully
+                                 registered and the MMI source has been enabled.
+  @retval EFI_DEVICE_ERROR       The SW driver was unable to enable the MMI source.
+  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. The SW MMI input value
+                                 is not within a valid range or is already in use.
+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system or MM) to manage this
+                                 child.
+  @retval EFI_OUT_OF_RESOURCES   A unique software MMI value could not be assigned
+                                 for this dispatch.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_SW_REGISTER)(
+  IN  CONST EFI_MM_SW_DISPATCH_PROTOCOL  *This,
+  IN        EFI_MM_HANDLER_ENTRY_POINT   DispatchFunction,
+  IN  OUT   EFI_MM_SW_REGISTER_CONTEXT   *RegisterContext,
+  OUT       EFI_HANDLE                   *DispatchHandle
+  );
+
+/**
+  Unregister a child MMI source dispatch function for the specified software MMI.
+
+  This service removes the handler associated with DispatchHandle so that it will no longer be
+  called in response to a software MMI.
+
+  @param[in] This                Pointer to the EFI_MM_SW_DISPATCH_PROTOCOL instance.
+  @param[in] DispatchHandle      Handle of dispatch function to deregister.
+
+  @retval EFI_SUCCESS            The dispatch function has been successfully unregistered.
+  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_SW_UNREGISTER)(
+  IN CONST EFI_MM_SW_DISPATCH_PROTOCOL  *This,
+  IN       EFI_HANDLE                   DispatchHandle
+);
+
+///
+/// Interface structure for the MM Software MMI Dispatch Protocol.
+///
+/// The EFI_MM_SW_DISPATCH2_PROTOCOL provides the ability to install child handlers for the
+/// given software.  These handlers will respond to software interrupts, and the maximum software
+/// interrupt in the EFI_MM_SW_REGISTER_CONTEXT is denoted by MaximumSwiValue.
+///
+struct _EFI_MM_SW_DISPATCH_PROTOCOL {
+  EFI_MM_SW_REGISTER    Register;
+  EFI_MM_SW_UNREGISTER  UnRegister;
+  ///
+  /// A read-only field that describes the maximum value that can be used in the
+  /// EFI_MM_SW_DISPATCH_PROTOCOL.Register() service.
+  ///
+  UINTN                 MaximumSwiValue;
+};
+
+extern EFI_GUID gEfiMmSwDispatchProtocolGuid;
+
+#endif
diff --git a/MdePkg/Include/Protocol/MmSxDispatch.h b/MdePkg/Include/Protocol/MmSxDispatch.h
new file mode 100644
index 0000000..acceb89
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmSxDispatch.h
@@ -0,0 +1,135 @@
+/** @file
+  MM Sx Dispatch Protocol as defined in PI 1.5 Specification
+  Volume 4 Management Mode Core Interface.
+
+  Provides the parent dispatch service for a given Sx-state source generator.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _MM_SX_DISPATCH_H_
+#define _MM_SX_DISPATCH_H_
+
+#include <Pi/PiMmCis.h>
+
+#define EFI_MM_SX_DISPATCH_PROTOCOL_GUID \
+  { \
+    0x456d2859, 0xa84b, 0x4e47, {0xa2, 0xee, 0x32, 0x76, 0xd8, 0x86, 0x99, 0x7d } \
+  }
+
+///
+/// Sleep states S0-S5
+///
+typedef enum {
+  SxS0,
+  SxS1,
+  SxS2,
+  SxS3,
+  SxS4,
+  SxS5,
+  EfiMaximumSleepType
+} EFI_SLEEP_TYPE;
+
+///
+/// Sleep state phase: entry or exit
+///
+typedef enum {
+  SxEntry,
+  SxExit,
+  EfiMaximumPhase
+} EFI_SLEEP_PHASE;
+
+///
+/// The dispatch function's context
+///
+typedef struct {
+  EFI_SLEEP_TYPE  Type;
+  EFI_SLEEP_PHASE Phase;
+} EFI_MM_SX_REGISTER_CONTEXT;
+
+typedef struct _EFI_MM_SX_DISPATCH_PROTOCOL  EFI_MM_SX_DISPATCH_PROTOCOL;
+
+/**
+  Provides the parent dispatch service for a given Sx source generator.
+
+  This service registers a function (DispatchFunction) which will be called when the sleep state
+  event specified by RegisterContext is detected. On return, DispatchHandle contains a
+  unique handle which may be used later to unregister the function using UnRegister().
+  The DispatchFunction will be called with Context set to the same value as was passed into
+  this function in RegisterContext and with CommBuffer and CommBufferSize set to
+  NULL and 0 respectively.
+
+  @param[in] This                Pointer to the EFI_MM_SX_DISPATCH_PROTOCOL instance.
+  @param[in] DispatchFunction    Function to register for handler when the specified sleep state event occurs.
+  @param[in] RegisterContext     Pointer to the dispatch function's context.
+                                 The caller fills this context in before calling
+                                 the register function to indicate to the register
+                                 function which Sx state type and phase the caller
+                                 wishes to be called back on. For this intertace,
+                                 the Sx driver will call the registered handlers for
+                                 all Sx type and phases, so the Sx state handler(s)
+                                 must check the Type and Phase field of the Dispatch
+                                 context and act accordingly.
+  @param[out]  DispatchHandle    Handle of dispatch function, for when interfacing
+                                 with the parent Sx state MM driver.
+
+  @retval EFI_SUCCESS            The dispatch function has been successfully
+                                 registered and the MMI source has been enabled.
+  @retval EFI_UNSUPPORTED        The Sx driver or hardware does not support that
+                                 Sx Type/Phase.
+  @retval EFI_DEVICE_ERROR       The Sx driver was unable to enable the MMI source.
+  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. Type & Phase are not
+                                 within valid range.
+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system or MM) to manage this
+                                 child.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_SX_REGISTER)(
+  IN  CONST EFI_MM_SX_DISPATCH_PROTOCOL  *This,
+  IN        EFI_MM_HANDLER_ENTRY_POINT   DispatchFunction,
+  IN  CONST EFI_MM_SX_REGISTER_CONTEXT   *RegisterContext,
+  OUT       EFI_HANDLE                   *DispatchHandle
+  );
+
+/**
+  Unregisters an Sx-state service.
+
+  This service removes the handler associated with DispatchHandle so that it will no longer be
+  called in response to sleep event.
+
+  @param[in] This                Pointer to the EFI_MM_SX_DISPATCH_PROTOCOL instance.
+  @param[in] DispatchHandle      Handle of the service to remove.
+
+  @retval EFI_SUCCESS            The service has been successfully removed.
+  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_SX_UNREGISTER)(
+  IN CONST EFI_MM_SX_DISPATCH_PROTOCOL  *This,
+  IN       EFI_HANDLE                   DispatchHandle
+  );
+
+///
+/// Interface structure for the MM Sx Dispatch Protocol
+///
+/// The EFI_MM_SX_DISPATCH_PROTOCOL provides the ability to install child handlers to
+/// respond to sleep state related events.
+///
+struct _EFI_MM_SX_DISPATCH_PROTOCOL {
+  EFI_MM_SX_REGISTER    Register;
+  EFI_MM_SX_UNREGISTER  UnRegister;
+};
+
+extern EFI_GUID gEfiMmSxDispatchProtocolGuid;
+
+#endif
diff --git a/MdePkg/Include/Protocol/MmUsbDispatch.h b/MdePkg/Include/Protocol/MmUsbDispatch.h
new file mode 100644
index 0000000..6684287
--- /dev/null
+++ b/MdePkg/Include/Protocol/MmUsbDispatch.h
@@ -0,0 +1,130 @@
+/** @file
+  MM USB Dispatch Protocol as defined in PI 1.5 Specification
+  Volume 4 Management Mode Core Interface.
+
+  Provides the parent dispatch service for the USB MMI source generator.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+  @par Revision Reference:
+  This protocol is from PI Version 1.5.
+
+**/
+
+#ifndef _MM_USB_DISPATCH_H_
+#define _MM_USB_DISPATCH_H_
+
+#include <Pi/PiMmCis.h>
+
+#define EFI_MM_USB_DISPATCH_PROTOCOL_GUID \
+  { \
+    0xee9b8d90, 0xc5a6, 0x40a2, {0xbd, 0xe2, 0x52, 0x55, 0x8d, 0x33, 0xcc, 0xa1 } \
+  }
+
+///
+/// USB MMI event types
+///
+typedef enum {
+  UsbLegacy,
+  UsbWake
+} EFI_USB_MMI_TYPE;
+
+///
+/// The dispatch function's context.
+///
+typedef struct {
+  ///
+  /// Describes whether this child handler will be invoked in response to a USB legacy
+  /// emulation event, such as port-trap on the PS/2* keyboard control registers, or to a
+  /// USB wake event, such as resumption from a sleep state.
+  ///
+  EFI_USB_MMI_TYPE          Type;
+  ///
+  /// The device path is part of the context structure and describes the location of the
+  /// particular USB host controller in the system for which this register event will occur.
+  /// This location is important because of the possible integration of several USB host
+  /// controllers in a system.
+  ///
+  EFI_DEVICE_PATH_PROTOCOL  *Device;
+} EFI_MM_USB_REGISTER_CONTEXT;
+
+typedef struct _EFI_MM_USB_DISPATCH_PROTOCOL EFI_MM_USB_DISPATCH_PROTOCOL;
+
+/**
+  Provides the parent dispatch service for the USB MMI source generator.
+
+  This service registers a function (DispatchFunction) which will be called when the USB-
+  related MMI specified by RegisterContext has occurred. On return, DispatchHandle
+  contains a unique handle which may be used later to unregister the function using UnRegister().
+  The DispatchFunction will be called with Context set to the same value as was passed into
+  this function in RegisterContext and with CommBuffer containing NULL and
+  CommBufferSize containing zero.
+
+  @param[in]  This               Pointer to the EFI_MM_USB_DISPATCH_PROTOCOL instance.
+  @param[in]  DispatchFunction   Function to register for handler when a USB-related MMI occurs.
+  @param[in]  RegisterContext    Pointer to the dispatch function's context.
+                                 The caller fills this context in before calling
+                                 the register function to indicate to the register
+                                 function the USB MMI types for which the dispatch
+                                 function should be invoked.
+  @param[out] DispatchHandle     Handle generated by the dispatcher to track the function instance.
+
+  @retval EFI_SUCCESS            The dispatch function has been successfully
+                                 registered and the MMI source has been enabled.
+  @retval EFI_DEVICE_ERROR       The driver was unable to enable the MMI source.
+  @retval EFI_INVALID_PARAMETER  RegisterContext is invalid. The USB MMI type
+                                 is not within valid range.
+  @retval EFI_OUT_OF_RESOURCES   There is not enough memory (system or MM) to manage this child.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_USB_REGISTER)(
+  IN  CONST EFI_MM_USB_DISPATCH_PROTOCOL  *This,
+  IN        EFI_MM_HANDLER_ENTRY_POINT    DispatchFunction,
+  IN  CONST EFI_MM_USB_REGISTER_CONTEXT   *RegisterContext,
+  OUT       EFI_HANDLE                    *DispatchHandle
+  );
+
+/**
+  Unregisters a USB service.
+
+  This service removes the handler associated with DispatchHandle so that it will no longer be
+  called when the USB event occurs.
+
+  @param[in]  This               Pointer to the EFI_MM_USB_DISPATCH_PROTOCOL instance.
+  @param[in]  DispatchHandle     Handle of the service to remove.
+
+  @retval EFI_SUCCESS            The dispatch function has been successfully
+                                 unregistered and the MMI source has been disabled
+                                 if there are no other registered child dispatch
+                                 functions for this MMI source.
+  @retval EFI_INVALID_PARAMETER  The DispatchHandle was not valid.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MM_USB_UNREGISTER)(
+  IN CONST EFI_MM_USB_DISPATCH_PROTOCOL  *This,
+  IN       EFI_HANDLE                    DispatchHandle
+  );
+
+///
+/// Interface structure for the MM USB MMI Dispatch Protocol
+///
+/// This protocol provides the parent dispatch service for the USB MMI source generator.
+///
+struct _EFI_MM_USB_DISPATCH_PROTOCOL {
+  EFI_MM_USB_REGISTER    Register;
+  EFI_MM_USB_UNREGISTER  UnRegister;
+};
+
+extern EFI_GUID gEfiMmUsbDispatchProtocolGuid;
+
+#endif
+
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index 425004f..4d2de8a 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -1171,6 +1171,73 @@
   gEfiI2cBusConfigurationManagementProtocolGuid = { 0x55b71fb5, 0x17c6, 0x410e, { 0xb5, 0xbd, 0x5f, 0xa2, 0xe3, 0xd4, 0x46, 0x6b }}
 
   #
+  # Protocols defined in PI 1.5.
+  #
+
+  ## Include/Protocol/MmEndOfDxe.h
+  gEfiMmEndOfDxeProtocolGuid = { 0x24e70042, 0xd5c5, 0x4260, { 0x8c, 0x39, 0xa, 0xd3, 0xaa, 0x32, 0xe9, 0x3d }}
+
+  ## Include/Protocol/MmIoTrapDispatch.h
+  gEfiMmIoTrapDispatchProtocolGuid = { 0x58dc368d, 0x7bfa, 0x4e77, {0xab, 0xbc, 0xe, 0x29, 0x41, 0x8d, 0xf9, 0x30 }}
+
+  ## Include/Protocol/MmPowerButtonDispatch.h
+  gEfiMmPowerButtonDispatchProtocolGuid = { 0x1b1183fa, 0x1823, 0x46a7, {0x88, 0x72, 0x9c, 0x57, 0x87, 0x55, 0x40, 0x9d }}
+
+  ## Include/Protocol/MmStandbyButtonDispatch.h
+  gEfiMmStandbyButtonDispatchProtocolGuid = { 0x7300c4a1, 0x43f2, 0x4017, {0xa5, 0x1b, 0xc8, 0x1a, 0x7f, 0x40, 0x58, 0x5b }}
+
+  ## Include/Protocol/MmGpiDispatch.h
+  gEfiMmGpiDispatchProtocolGuid = { 0x25566b03, 0xb577, 0x4cbf, {0x95, 0x8c, 0xed, 0x66, 0x3e, 0xa2, 0x43, 0x80 }}
+
+  ## Include/Protocol/MmUsbDispatch.h
+  gEfiMmUsbDispatchProtocolGuid = { 0xee9b8d90, 0xc5a6, 0x40a2, {0xbd, 0xe2, 0x52, 0x55, 0x8d, 0x33, 0xcc, 0xa1 }}
+
+  ## Include/Protocol/MmPeriodicTimerDispatch.h
+  gEfiMmPeriodicTimerDispatchProtocolGuid = { 0x4cec368e, 0x8e8e, 0x4d71, {0x8b, 0xe1, 0x95, 0x8c, 0x45, 0xfc, 0x8a, 0x53 }}
+
+  ## Include/Protocol/MmSxDispatch.h
+  gEfiMmSxDispatchProtocolGuid  = { 0x456d2859, 0xa84b, 0x4e47, {0xa2, 0xee, 0x32, 0x76, 0xd8, 0x86, 0x99, 0x7d }}
+
+  ## Include/Protocol/MmSwDispatch.h
+  gEfiMmSwDispatchProtocolGuid  = { 0x18a3c6dc, 0x5eea, 0x48c8, {0xa1, 0xc1, 0xb5, 0x33, 0x89, 0xf9, 0x89, 0x99 }}
+
+  ## Include/Protocol/MmPciRootBridgeIo.h
+  gEfiMmPciRootBridgeIoProtocolGuid = { 0x8bc1714d, 0xffcb, 0x41c3, { 0x89, 0xdc, 0x6c, 0x74, 0xd0, 0x6d, 0x98, 0xea }}
+
+  ## Include/Protocol/MmCpu.h
+  gEfiMmCpuProtocolGuid          = { 0xeb346b97, 0x975f, 0x4a9f, { 0x8b, 0x22, 0xf8, 0xe9, 0x2b, 0xb3, 0xd5, 0x69 }}
+
+  ## Include/Protocol/MmStatusCode.h
+  gEfiMmStatusCodeProtocolGuid   = { 0x6afd2b77, 0x98c1, 0x4acd, { 0xa6, 0xf9, 0x8a, 0x94, 0x39, 0xde, 0xf, 0xb1}}
+
+  ## Include/Protocol/DxeMmReadyToLock.h
+  gEfiDxeMmReadyToLockProtocolGuid = { 0x60ff8964, 0xe906, 0x41d0, { 0xaf, 0xed, 0xf2, 0x41, 0xe9, 0x74, 0xe0, 0x8e }}
+
+  ## Include/Protocol/MmConfiguration.h
+  gEfiMmConfigurationProtocolGuid= { 0x26eeb3de, 0xb689, 0x492e, { 0x80, 0xf0, 0xbe, 0x8b, 0xd7, 0xda, 0x4b, 0xa7 }}
+
+  ## Include/Protocol/MmReadyToLock.h
+  gEfiMmReadyToLockProtocolGuid  = { 0x47b7fa8c, 0xf4bd, 0x4af6, { 0x82, 0x00, 0x33, 0x30, 0x86, 0xf0, 0xd2, 0xc8 }}
+
+  ## Include/Protocol/MmControl.h
+  gEfiMmControlProtocolGuid     = { 0x843dc720, 0xab1e, 0x42cb, { 0x93, 0x57, 0x8a, 0x0, 0x78, 0xf3, 0x56, 0x1b}}
+
+  ## Include/Protocol/MmAccess.h
+  gEfiMmAccessProtocolGuid      = { 0xc2702b74, 0x800c, 0x4131, { 0x87, 0x46, 0x8f, 0xb5, 0xb8, 0x9c, 0xe4, 0xac }}
+
+  ## Include/Protocol/MmBase.h
+  gEfiMmBaseProtocolGuid        = { 0xf4ccbfb7, 0xf6e0, 0x47fd, { 0x9d, 0xd4, 0x10, 0xa8, 0xf1, 0x50, 0xc1, 0x91 }}
+
+  ## Include/Protocol/MmCpuIo.h
+  gEfiMmCpuIoProtocolGuid        = { 0x3242a9d8, 0xce70, 0x4aa0, { 0x95, 0x5d, 0x5e, 0x7b, 0x14, 0x0d, 0xe4, 0xd2 }}
+
+  ## Include/Protocol/MmReportStatusCodeHandler.h
+  gEfiMmRscHandlerProtocolGuid   = { 0x2ff29fa7, 0x5e80, 0x4ed9, { 0xb3, 0x80, 0x1, 0x7d, 0x3c, 0x55, 0x4f, 0xf4 }}
+
+  ## Include/Protocol/MmCommunication.h
+  gEfiMmCommunicationProtocolGuid  = { 0xc68ed8e2, 0x9dc6, 0x4cbd, { 0x9d, 0x94, 0xdb, 0x65, 0xac, 0xc5, 0xc3, 0x32 }}
+
+  #
   # Protocols defined in UEFI2.1/UEFI2.0/EFI1.1
   #
 
-- 
2.7.0.windows.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-08-28  6:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-14  8:32 [Patch 0/2] Add Management Mode infrastructure support Eric Dong
2017-08-14  8:32 ` [Patch 1/2] MdePkg: Add new definitions for Management Mode Eric Dong
2017-08-25  9:30   ` Gao, Liming
2017-08-14  8:32 ` [Patch 2/2] MdePkg: Update exited SMM related definition Eric Dong
  -- strict thread matches above, loose matches on Subject: below --
2017-08-28  6:40 [Patch v2 0/2] Add Management Mode infrastructure support Eric Dong
2017-08-28  6:40 ` [Patch 1/2] MdePkg: Add new definitions for Management Mode Eric Dong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox