3. Management Mode System Table (MMST)

3.1. MMST Introduction

This section describes the Management Mode System Table (MMST). The MMST is a set of capabilities exported for use by all drivers that are loaded into Management Mode RAM (MMRAM).

The MMST is similar to the UEFI System Table. It is a fixed set of services and data that are designed to provide basic services for MM Drivers. The MMST is provided by the MM IPL driver, which also manages the following:

  • Dispatch of drivers in MM

  • Allocations of MMRAM

  • Installation/discovery of MM protocols

3.2. EFI_MM_SYSTEM_TABLE

Summary

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.

Related Definitions

///
/// Management Mode System Table (MMST)
///
#define MM_MMST_SIGNATURE SIGNATURE_32 ('S', 'M', 'S', 'T')
#define EFI_MM_SYSTEM_TABLE_REVISION PI_SPECIFICATION_VERSION

typedef struct _EFI_MM_SYSTEM_TABLE {
   EFI_TABLE_HEADER                         Hdr;

   CHAR16                                   *MmFirmwareVendor;
   UINT32                                   MmFirmwareRevision;

   EFI_MM_INSTALL_CONFIGURATION_TABLE       MmInstallConfigurationTable;

   EFI_MM_CPU_IO_PROTOCOL                   MmIo;

        //
        // Runtime memory service
        //
        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
        //
        UINTN                               CurrentlyExecutingCpu;
        UINTN *NumberOfCpus* ;
    UINTN                                   *CpuSaveStateSize;
    VOID                                    **CpuSaveState;

        //
        // Extensibility table
        //
        UINTN                               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;*
    } EFI_MM_SYSTEM_TABLE;

Parameters

Hdr

The table header for the Management Mode System Table (MMST). This header contains the MM_SMST_SIGNATURE, MM_MMST_SIGNATURE and EFI_MM_SYSTEM_TABLE_REVISION values along with the size of the EFI_MM_SYSTEM_TABLE structure.

Note: In the MM Foundation use of the EFI_TABLE_HEADER for the Management Mode Services Table (MMST), there is special treatment of the CRC32 field. This value is reserved for MM and should be set to zero

MmFirmwareVendor

A pointer to a NULL -terminated Unicode string containing the vendor name. It is permissible for this pointer to be NULL .

MmFirmwareRevision

The particular revision of the firmware.

MmInstallConfigurationTable

Adds, updates, or removes a configuration table entry from the MMST. See the MmInstallConfigurationTable() function description.

MmIo

Provides the basic memory and I/O interfaces that are used to abstract accesses to devices. The I/O services are provided by the driver which produces the MM CPU I/O Protocol. If that driver has not been loaded yet, this function pointer will return EFI_UNSUPPORTED.

MmAllocatePool

Allocates MMRAM.

MmFreePool

Returns pool memory to the system.

MmAllocatePages

Allocates pages from MMRAM.

MmFreePages

Returns pages of memory to the system.

MmStartupThisAp

Initiate a procedure on an application processor while in MM. See the MmStartupThisAp() function description. MmStartupThisAp may not be used during MM Driver Initialization, and MM and MM Driver must be considered “undefined”. This service only defined while an MMI is being processed.

CurrentlyExecutingCpu

A number between zero and the value in the field NumberOfCpus . This field designates which processor is executing the MM infrastructure. CurrentlyExecutingCpu may not be used during MM Driver Initialization, and MM and MM Driver and must be considered “undefined”. This field is only defined while an MMI is being processed.

NumberOfCpus

The number of possible processors in the platform. This is a 1-based counter. NumberOfCpus may not be used in the entry point of an MM MM Driver and must be considered “undefined”. This field is only defined while an MMI is being processed.

CpuSaveStateSize

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. CpuSaveStateSize may not be used during MM Driver Initialization Driver and must be considered “undefined”. This field is only defined while an MMI is being processed.

CpuSaveState

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. CpuSaveState may not be used during MM Driver Initialization MM Driver and must be considered “undefined”. This field is only defined while an MMI is being processed.

NumberOfTableEntries

The number of UEFI Configuration Tables in the buffer MmConfigurationTable .

MmConfigurationTable

A pointer to the UEFI Configuration Tables . The number of entries in the table is NumberOfTableEntries . Type EFI_CONFIGURATION_TABLE is defined in the UEFI Specification.

MmInstallProtocolInterface

Installs an MM protocol interface on a device handle. Type EFI_INSTALL_PROTOCOL_INTERFACE is defined in the UEFI Specification.

MmUninstallProtocolInterface

Removes an MM protocol interface from a device handle. Type EFI_UNINSTALL_PROTOCOL_INTERFACE is defined in the UEFI Specification.

MmHandleProtocol

Queries a handle to determine if it supports a specified MM protocol. Type EFI_HANDLE_PROTOCOL is defined in the UEFI Specification.

MmRegisterProtocolNotify

Registers a callback routine that will be called whenever an interface is installed for a specified MM protocol.

MmLocateHandle

Returns an array of handles that support a specified MM protocol. Type EFI_LOCATE_HANDLE is defined in the UEFI Specification.

MmLocateProtocol

Returns the first installed interface for a specific MM protocol. Type EFI_LOCATE_PROTOCOL is defined in the UEFI Specification.

MmiManage

Manage MMI sources of a particular type.

MmiHandlerRegister

Registers an MMI handler for an MMI source.

MmiHandlerUnRegister

Unregisters an MMI handler for an MMI source.

Description

The CurrentlyExecutingCpu parameter is a value that is less than the NumberOfCpus field. The CpuSaveState is a pointer to an array of CPU save states in MMRAM. The CurrentlyExecutingCpu can be used as an index to locate the respective save-state for which the given processor is executing, if so desired.

The EFI_MM_SYSTEM_TABLE provides support for MMRAM allocation. The functions have the same function prototypes as those found in the UEFI Boot Services, but are only effective in allocating and freeing MMRAM. Drivers cannot allocate or free UEFI memory using these services. Drivers cannot allocate or free MMRAM using the UEFI Boot Services. The functions are:

  • MmAllocatePages()

  • MmFreePages()

  • MmAllocatePool()

  • MmFreePool()

The EFI_MM_SYSTEM_TABLE provides support for MM protocols, which are runtime protocols designed to execute exclusively inside of MM. Drivers cannot access protocols installed using the UEFI Boot Services through this interface. Drivers cannot access protocols installed using these interfaces through the UEFI Boot Services interfaces.

Five of the standard protocol-related functions from the UEFI boot services table are provided in the MMST and perform in a similar fashion. These functions are required to be available until the EFI_MM_READY_TO_LOCK_PROTOCOL notification has been installed. The functions are:

  • MmInstallProtocolInterface()

  • MmUninstallProtocolInterface()

  • MmLocateHandle()

  • MmHandleProtocol()

  • MmLocateProtocol()

Noticeably absent are services which support the UEFI driver model. The function MmRegisterProtocolNotify() , works in a similar fashion to the UEFI function except that it does not use an event.

3.2.1. MmInstallConfigurationTable()

Summary

Adds, updates, or removes a configuration table entry from the Management Mode System Table (MMST) .

Prototype

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*
   )

Parameters

SystemTable

A pointer to the Management Mode System Table (MMST) .

Guid

A pointer to the GUID for the entry to add, update, or remove.

Table

A pointer to the buffer of the table to add.

TableSize

The size of the table to install.

Description

The MmInstallConfigurationTable() function is used to maintain the list of configuration tables that are stored in the MMST. The list is stored as an array of (GUID, Pointer) pairs. The list must be allocated from pool memory with PoolType set to EfiRuntimeServicesData .

If Guid is not a valid GUID, EFI_INVALID_PARAMETER is returned. If Guid is valid, there are four possibilities:

  • If Guid is not present in the MMST and Table is not NULL , then the ( Guid , Table ) pair is added to the MMST. See Note below.

  • If Guid is not present in the MMST and Table is NULL , then EFI_NOT_FOUND is returned.

  • If Guid is present in the MMST and Table is not NULL , then the ( Guid , Table ) pair is updated with the new Table value.

  • If Guid is present in the MMST and Table is NULL , then the entry associated with Guid is removed from the MMST.

If an add, modify, or remove operation is completed, then EFI_SUCCESS is returned.

Note

If there is not enough memory to perform an add operation, then EFI_OUT_OF_RESOURCES is returned.

Status Codes Returned

Table 3.35 Status Codes Returned

EFI_SUCCESS

The Guid Table pair was added updated or removed

EFI_INVALID_PARAMETER

Guid is not valid

EFI_NOT_FOUND

An attempt was made to delete a nonexistent entry

EFI_OUT_OF_RESOURCES

There is not enough memory available to complete the operation

3.2.2. MmAllocatePool()

Summary

Allocates pool memory from MMRAM.

Prototype

Type EFI_ALLOCATE_POOL is defined in the UEFI Specification. The function is also described in that specification.

Description

The MmAllocatePool() function allocates a memory region of Size bytes from memory of type PoolType and returns the address of the allocated memory in the location referenced by Buffer . This function allocates pages from EfiConventionalMemory as needed to grow the requested pool type. All allocations are eight-byte aligned.

The allocated pool memory is returned to the available pool with the MmFreePool() function.

All allocations of MMRAM should use EfiRuntimeServicesCode or EfiRuntimeServicesData .

Status Codes Returned

Table 3.36 Status Codes Returned

EFI_SUCCESS

The requested number of bytes was allocated.

EFI_OUT_OF_RESOURCES

The pool requested could not be allocated.

EFI_INVALID_PARAMETER

PoolType was invalid.

3.2.3. MmFreePool()

Summary

Returns pool memory to the system.

Prototype

Type EFI_FREE_POOL is defined in the UEFI Specification. The function description is also found in that specification.

Description

The MmFreePool() function returns the memory specified by Buffer to the MMRAM heap. The Buffer that is freed must have been allocated by MmAllocatePool().

Status Codes Returned

Table 3.37 Status Codes Returned

EFI_SUCCESS

The memory was returned to the system.

EFI_INVALID_PARAMETER

Buffer was invalid.

3.2.4. MmAllocatePages()

Summary

Allocates page memory from MMRAM.

Prototype

Type EFI_ALLOCATE_PAGES is defined in the UEFI Specification. The function description is also found in that specification.

Description

The MmAllocatePages() function allocates the requested number of pages from the MMRAM heap and returns a pointer to the base address of the page range in the location referenced by Memory. The function scans the MM memory map to locate free pages. When it finds a physically contiguous block of pages that is large enough and also satisfies the allocation requirements of Type, it changes the memory map to indicate that the pages are now of type MemoryType.

All allocations of MMRAM should use EfiRuntimeServicesCode or EfiRuntimeServicesData .

Allocation requests of Type:

  • AllocateAnyPages allocate any available range of pages that satisfies the request. On input, the address pointed to by Memory is ignored.

  • AllocateMaxAddress allocate any available range of pages whose uppermost address is less than or equal to the address pointed to by Memory on input.

  • AllocateAddress allocate pages at the address pointed to by Memory on input.

Status Codes Returned

Table 3.38 Status Codes Returned

EFI_SUCCESS

The requested pages were allocated

EFI_OUT_OF_RESOURCES

The pages could not be allocated

EFI_INVALID_PARAMETER

Type is not AllocateAnyPages or AllocateMaxAddress or AllocateAddress

EFI_INVALID_PARAMETER

MemoryType is in the range EfiMaxMemoryType 0x7FFFFFFF

EFI_NOT_FOUND

The requested pages could not be found

3.2.5. MmFreePages()

Summary

Returns pages of memory to the system.

Protocol

Type EFI_FREE_PAGES is defined in the UEFI Specification. The function description is also found in this specification.

Description

The MmFreePages() function returns memory allocated by MmAllocatePages () to the MMRAM heap.

Status Codes Returned

Table 3.39 Status Codes Returned

EFI_SUCCESS

The requested memory pages were freed

EFI_NOT_FOUND

The requested memory pages were not allocated with MmAllocatePages

EFI_NOT_FOUND

EFI_INVALID_PARAMETER Memory is not a page aligned address or Pages is invalid

3.2.6. MmStartupThisAp()

Summary

This service lets the caller get one distinct application processor (AP) to execute a caller-provided code stream while in MM.

Prototype

typedef
EFI_STATUS
  (EFIAPI \*EFI_MM_STARTUP_THIS_AP) (
  IN *EFI_AP_PROCEDURE* *Procedure*
  IN UINTN *CpuNumber,*
  IN OUT VOID *\*ProcArguments* OPTIONAL
  );

Parameters

Procedure

A pointer to the code stream to be run on the designated AP of the system. Type EFI_AP_PROCEDURE is defined below.

CpuNumber

The zero-based index of the processor number of the AP on which the code stream is supposed to run. If the processor number points to the current processor, then it will not run the supplied code.

ProcArguments

Allows the caller to pass a list of parameters to the code that is run by the AP. It is an optional common mailbox between APs and the caller to share information.

Related Definitions

See PI Spec Volume 2, EFI_MP_SERVICES_PROTOCOL.StartupAllAPs, Related Definitions.

Descriptions

This function is used to dispatch one specific, healthy, enabled, and non-busy AP out of the processor pool to the code stream that is provided by the caller while in MM. The recovery of a failed AP is optional and the recovery mechanism is implementation dependent.

Status Codes Returned

Table 3.40 Status Codes Returned

EFI_SUCCESS

The call was successful and the return parameters are valid

EFI_INVALID_PARAMETER

The input arguments are out of range

EFI_INVALID_PARAMETER

The CPU requested is not available on this MMI invocation

EFI_INVALID_PARAMETER

The CPU cannot support an additional service invocation

3.2.7. MmInstallProtocolInterface()

Summary

Installs a MM protocol interface on a device handle. If the handle does not exist, it is created and added to the list of handles in the system.

Prototype

Type EFI_INSTALL_PROTOCOL_INTERFACE is defined in the UEFI Specification. The function description is also found in this specification.

Description

The MmInstallProtocolInterface() function installs a protocol interface (a GUID/Protocol Interface structure pair) on an MM device handle. The same GUID cannot be installed more than once onto the same handle. If installation of a duplicate GUID on a handle is attempted, an EFI_INVALID_PARAMETER will result. Installing a protocol interface allows other MM MM Drivers to locate the Handle , and the interfaces installed on it.

When a protocol interface is installed, the firmware calls all notification functions that have registered to wait for the installation of Protocol. For more information, see the MmRegisterProtocolNotify() function description.

Status Codes Returned

Table 3.41 Status Codes Returned

EFI_SUCCESS

The protocol interface was installed

EFI_OUT_OF_RESOURCES

Space for a new handle could not be allocated

EFI_INVALID_PARAMETER

Handle is NULL

EFI_INVALID_PARAMETER

Protocol is NULL

EFI_INVALID_PARAMETER

InterfaceType is not EFI_NATIVE_INTERFACE

EFI_INVALID_PARAMETER

Protocol is already installed on the handle specified by Handle

3.2.8. MmUninstallProtocolInterface()

Summary

Removes a MM protocol interface from a device handle.

Prototype

Type EFI_UNINSTALL_PROTOCOL_INTERFACE is defined in the UEFI Specification. The function description is also found in that specification.

Description

The MmUninstallProtocolInterface() function removes a protocol interface from the handle on which it was previously installed. The Protocol and Interface values define the protocol interface to remove from the handle. The caller is responsible for ensuring that there are no references to a protocol interface that has been removed. If the last protocol interface is removed from a handle, the handle is freed and is no longer valid.

Status Codes Returned

Table 3.42 Status Codes Returned

EFI_SUCCESS

The interface was removed

EFI_NOT_FOUND

The interface was not found

EFI_ACCESS_DENIED

The interface was not removed because the interface is still being used by a driver

EFI_INVALID_PARAMETER

Handle i s not a valid EFI_HANDLE

EFI_INVALID_PARAMETER

Protocol is NULL

3.2.9. MmHandleProtocol()

Summary

Queries a handle to determine if it supports a specified MM protocol.

Prototype

Type EFI_HANDLE_PROTOCOL is defined in the UEFI Specification. The function description is also found in that specification.

Description

The MmHandleProtocol() function queries Handle to determine if it supports Protocol . If it does, then, on return, Interface points to a pointer to the corresponding Protocol Interface.

Interface can then be passed to any protocol service to identify the context of the request.

Status Codes Returned

Table 3.43 Status Codes Returned

EFI_SUCCESS

The interface information for the specified protocol was returned

EFI_UNSUPPORTED

The device does not support the specified protocol

EFI_INVALID_PARAMETER

Handle is not a valid EFI_HANDLE

EFI_INVALID_PARAMETER

Protocol is NULL

EFI_INVALID_PARAMETER

Interface is NULL

3.2.10. MmRegisterProtocolNotify()

Summary

Register a callback function be called when a particular protocol interface is installed.

Prototype

typedef
EFI_STATUS
(EFIAPI \*EFI_MM_REGISTER_PROTOCOL_NOTIFY)(
  IN CONST EFI_GUID \*Protocol,
  IN EFI_MM_NOTIFY_FN Function,
  IN OUT VOID \**Registration
);

Parameters

Protocol

The unique ID of the protocol for which the event is to be registered. Type EFI_GUID is defined in the InstallProtocolInterface() function description.

Function

Points to the notification function, which is described below.

Registration

A pointer to a memory location to receive the registration value. This value must be saved and used by the notification function to retrieve the list of handles that have added a protocol interface of type Protocol .

Description

The MmRegisterProtocolNotify() function creates a registration Function that is to be called whenever a protocol interface is installed for Protocol by MmInstallProtocolInterface() . When Function has been called, the MmLocateHandle() function can be called to identify the newly installed handles that support Protocol . The Registration parameter in MmRegisterProtocolNotify() corresponds to the SearchKey parameter in MmLocateHandle() . Note that the same handle may be returned multiple times if the handle reinstalls the target protocol ID multiple times. If Function == NULL and Registration is an existing registration, then the callback is unhooked. *Protocol must be validated it with *Registration . If Registration is not found then EFI_NOT_FOUND is returned.

Related Definitions

typedef
EFI_STATUS
(EFIAPI \*EFI_MM_NOTIFY_FN)(
  IN CONST EFI_GUID *\*Protocol* ,
  IN VOID *\*Interface,*
  IN EFI_HANDLE *Handle*
  );

Parameters

Protocol

Points to the protocol’s unique identifier.

Interface

Points to the interface instance.

Handle

The handle on which the interface was installed.

Status Codes Returned

Table 3.44 Status Codes Returned

EFI_SUCCESS

Successfully returned the registration record that has been added or unhooked

EFI_INVALID_PARAMETER

Protocol is NULL or Registration is NULL

EFI_OUT_OF_RESOURCES

Not enough memory resource to finish the request

EFI_NOT_FOUND

If the registration is not found when Function NULL

3.2.11. MmLocateHandle()

Summary

Returns an array of handles that support a specified protocol.

Prototype

Type EFI_LOCATE_HANDLE is defined in the UEFI Specification. The function description is also found in this specification.

Description

The MmLocateHandle() function returns an array of handles that match the SearchType request. If the input value of BufferSize is too small, the function returns EFI_BUFFER_TOO_SMALL and updates BufferSize to the size of the buffer needed to obtain the array.

Status Codes Returned

Table 3.45 Status Codes Returned

EFI_SUCCESS

The array of handles was returned

EFI_NOT_FOUND

No handles match the search

EFI_BUFFER_TOO_SMALL

The BufferSize is too small for the result BufferSize has been updated with the size needed to complete the request

EFI_INVALID_PARAMETER

SearchType is not a member of EFI_LOCATE_SEARCH_TYPE

EFI_INVALID_PARAMETER

SearchType is ByRegisterNotify and SearchKey is NULL

EFI_INVALID_PARAMETER

SearchType is ByProtocol and Protoco l is NULL

EFI_INVALID_PARAMETER

One or more matches are found and BufferSiz e is NULL

EFI_INVALID_PARAMETER

BufferSize is large enough for the result and Buffer is NULL

3.2.12. MmLocateProtocol()

Summary

Returns the first MM protocol instance that matches the given protocol.

Prototype

Type EFI_LOCATE_PROTOCOL is defined in the UEFI Specification. The function description is found in that specification.

Description

The MmLocateProtocol() function finds the first device handle that support Protocol, and returns a pointer to the protocol interface from that handle in Interface. If no protocol instances are found, then Interface is set to NULL .

If Interface is NULL , then EFI_INVALID_PARAMETER is returned.

If Registration is NULL , and there are no handles in the handle database that support Protocol , then EFI_NOT_FOUND is returned.

If Registration is not NULL , and there are no new handles for Registration, then EFI_NOT_FOUND is returned.

Status Codes Returned

Table 3.46 Status Codes Returned

EFI_SUCCESS

A protocol instance matching Protocol was found and returned in Interface

EFI_INVALID_PARAMETER

Interface is NULL

EFI_NOT_FOUND

No protocol instances were found that match Protocol and Registration

3.2.13. MmiManage()

Summary

Manage MMI of a particular type.

Prototype

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
  );

Parameters

HandlerType

Points to the handler type or NULL for root MMI handlers.

Context

Points to an optional context buffer. The format of the contents of the context buffer depends on HandlerType .

CommBuffer

Points to the optional communication buffer. The format of the contents of the communication buffer depends on HandlerType . The contents of the buffer (and its size) may be altered if EFI_SUCCESS is returned.

CommBufferSize

Points to the size of the optional communication buffer. The size of the buffer may be altered if EFI_SUCCESS is returned.

Description

This function will call the registered handler functions which match the specified invocation type.

If NULL is passed in HandlerType , then only those registered handler functions which passed NULL as their HandlerType will be called. If NULL is passed in HandlerType , then Context should be NULL, CommBuffer should point to an instance of EFI_MM_ENTRY_CONTEXT and CommBufferSize should point to the size of that structure. Type EFI_MM_ENTRY_CONTEXT is defined in “Related Definitions” below.

If at least one of the handlers returns EFI_WARN_INTERRUPT_SOURCE_QUIESCED or EFI_SUCCESS then the function will return EFI_SUCCESS . If a handler returns EFI_SUCCESS and HandlerType is not NULL then no additional handlers will be processed.

If a handler returns EFI_INTERRUPT_PENDING and HandlerType is not NULL then no additional handlers will be processed and EFI_INTERRUPT_PENDING will be returned. If all the handlers returned EFI_WARN_INTERRUPT_SOURCE_PENDING then EFI_WARN_INTERRUPT_SOURCE_PENDING will be returned.

If no handlers of HandlerType are found then EFI_NOT_FOUND will be returned.

Status Codes Returned

Table 3.47 Status Codes Returned

EFI_WARN_INTERRUPT_SOURCE_PENDING

The MMI was processed successfully but the MMI source not quiesced

EFI_INTERRUPT_PENDING

One or more MMI sources could not be quiesced

EFI_NOT_FOUND

The MMI was not handled and the MMI source was not quiesced

EFI_SUCCESS

The MMI was handled and the MMI source was quiesced

3.2.14. MmiHandlerRegister()

Summary

Registers a handler to execute within MM.

Prototype

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*
  );

Parameters

Handler

Handler service function pointer. Type EFI_MM_HANDLER_ENTRY_POINT is defined in “Related Definitions” below.

HandlerType

Points to an EFI_GUID which describes the type of invocation that this handler is for or NULL to indicate a root MMI handler.

DispatchHandle

On return, contains a unique handle which can be used to later unregister the handler function. It is also passed to the handler function itself.

Description

This service allows the registration of a MMI handling function from within MM. The handler should have the EFI_MM_HANDLER_ENTRY_POINT interface defined in “Related Definitions” below.

Related Definitions

//**********************************************\*
// EFI_MM_HANDLER_ENTRY_POINT
//**********************************************\*
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
);

Parameters

DispatchHandle

The unique handle assigned to this handler by MmiHandlerRegister() .Type EFI_HANDLE is defined in InstallProtocolInterface() in the UEFI Specification.

Context

Points to the optional handler context which was specified when the handler was registered.

CommBuffer

A pointer to a collection of data in memory that will be conveyed from a non-MM environment into an MM environment. The buffer must be contiguous, physically mapped, and be a physical address.

CommBufferSize

The size of the CommBuffer. MmiHandlerRegister() returns one of two status codes:

Status Codes Returned (MmiHandlerRegister)

EFI_SUCCESS

MMI handler added successfully.

EFI_INVALID_PARAMETER

Handler is NULL or DispatchHandle is NULL

EFI_MM_HANDLER_ENTRY_POINT returns one of four status codes:

Status Codes Returned (EFI_MM_HANDLER_ENTRY_POINT)

EFI_SUCCESS

The MMI was handled and the MMI source the MMI source was quiesced. No other handlers should still be called.

EFI_WARN_INTERRUPT_SOURCE_QUIESCED

The MMI source has been quiesced but other handlers should still be called.

EFI_WARN_INTERRUPT_SOURCE_PENDING

The MMI source is still pending and other handlers should still be called.

EFI_INTERRUPT_PENDING

The MMI source could not be quiesced.

3.2.15. MmiHandlerUnRegister()

Summary

Unregister a handler in MM.

Prototype

typedef
EFI_STATUS
(EFIAPI \*EFI_MM_INTERRUPT_UNREGISTER)(
  IN EFI_HANDLE *DispatchHandle* ,
  );

Parameters

DispatchHandle

The handle that was specified when the handler was registered.

Description

This function unregisters the specified handler function.

Status Codes Returned

Table 3.48 Status Codes Returned

EFI_SUCCESS

Handler function was successfully unregistered

EFI_INVALID_PARAMETER

DispatchHandle does not refer to a valid handle