TianoCore EDK2 master
Loading...
Searching...
No Matches
PchSmiDispatchSmm.c File Reference

Go to the source code of this file.

Data Structures

struct  SMM_PCH_REGISTER
 

Functions

EFI_SMM_SW_DISPATCH2_CONTEXTFindContextBySwSmiInputValue (IN UINTN SwSmiInputValue)
 
EFI_SMM_SW_DISPATCH2_CONTEXTFindContextByDispatchHandle (IN EFI_HANDLE DispatchHandle)
 
EFI_STATUS SmmSwDispatcher (IN EFI_HANDLE DispatchHandle, IN CONST VOID *RegisterContext, IN OUT VOID *CommBuffer, IN OUT UINTN *CommBufferSize)
 
EFI_STATUS SmiInputValueCheck (IN UINTN SwSmiInputValue)
 
EFI_STATUS EFIAPI SmmSwDispatch2Register (IN CONST EFI_SMM_SW_DISPATCH2_PROTOCOL *This, IN EFI_SMM_HANDLER_ENTRY_POINT2 DispatchFunction, IN OUT EFI_SMM_SW_REGISTER_CONTEXT *RegContext, OUT EFI_HANDLE *DispatchHandle)
 
EFI_STATUS EFIAPI SmmSwDispatch2UnRegister (IN CONST EFI_SMM_SW_DISPATCH2_PROTOCOL *This, IN EFI_HANDLE DispatchHandle)
 
PLD_GENERIC_REGISTERGetSmmCtrlRegById (IN PLD_SMM_REGISTERS *SmmRegister, IN UINT32 Id)
 
EFI_STATUS EFIAPI PchSmiDispatchEntryPoint (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

SMM_PCH_REGISTER mSmiPchReg
 
EFI_SMM_CPU_PROTOCOLmSmmCpuProtocol
 
LIST_ENTRY mSmmSwDispatch2Queue = INITIALIZE_LIST_HEAD_VARIABLE (mSmmSwDispatch2Queue)
 
EFI_SMM_SW_DISPATCH2_PROTOCOL gSmmSwDispatch2
 

Detailed Description

SMM SwDispatch2 Protocol.

Copyright (c) 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file PchSmiDispatchSmm.c.

Function Documentation

◆ FindContextByDispatchHandle()

EFI_SMM_SW_DISPATCH2_CONTEXT * FindContextByDispatchHandle ( IN EFI_HANDLE  DispatchHandle)

Find SmmSwDispatch2Context by DispatchHandle.

Parameters
DispatchHandleThe handle to identify the SmmSwDispatch2 context
Returns
Pointer to EFI_SMM_SW_DISPATCH2_CONTEXT context

Definition at line 59 of file PchSmiDispatchSmm.c.

◆ FindContextBySwSmiInputValue()

EFI_SMM_SW_DISPATCH2_CONTEXT * FindContextBySwSmiInputValue ( IN UINTN  SwSmiInputValue)

Find SmmSwDispatch2Context by SwSmiInputValue.

Parameters
[in]SwSmiInputValueThe value to identify the SmmSwDispatch2 context
Returns
Pointer to EFI_SMM_SW_DISPATCH2_CONTEXT context

Definition at line 33 of file PchSmiDispatchSmm.c.

◆ GetSmmCtrlRegById()

PLD_GENERIC_REGISTER * GetSmmCtrlRegById ( IN PLD_SMM_REGISTERS SmmRegister,
IN UINT32  Id 
)

Get specified SMI register based on given register ID

Parameters
[in]SmmRegisterSMI related register array from bootloader
[in]IdThe register ID to get.
Return values
NULLThe register is not found or the format is not expected.
Returns
smi register

Definition at line 341 of file PchSmiDispatchSmm.c.

◆ PchSmiDispatchEntryPoint()

EFI_STATUS EFIAPI PchSmiDispatchEntryPoint ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Entry Point for this driver.

Parameters
[in]ImageHandleImage handle of this driver.
[in]SystemTableA Pointer to the EFI System Table.
Return values
EFI_SUCCESSThe entry point is executed successfully.
otherSome error occurred when executing this entry point.

Definition at line 394 of file PchSmiDispatchSmm.c.

◆ SmiInputValueCheck()

EFI_STATUS SmiInputValueCheck ( IN UINTN  SwSmiInputValue)

Check the SwSmiInputValue is already used

Parameters
[in]SwSmiInputValueTo identify the SmmSwDispatch2 context
Return values
EFI_SUCCESSSwSmiInputValue could be used.
EFI_INVALID_PARAMETERSwSmiInputValue is already be used.

Definition at line 188 of file PchSmiDispatchSmm.c.

◆ SmmSwDispatch2Register()

EFI_STATUS EFIAPI SmmSwDispatch2Register ( IN CONST EFI_SMM_SW_DISPATCH2_PROTOCOL This,
IN EFI_SMM_HANDLER_ENTRY_POINT2  DispatchFunction,
IN OUT EFI_SMM_SW_REGISTER_CONTEXT RegContext,
OUT EFI_HANDLE DispatchHandle 
)

Register a child SMI source dispatch function for the specified software SMI.

This service registers a function (DispatchFunction) which will be called when the software SMI source specified by RegContext->SwSmiCpuIndex is detected. On return, DispatchHandle contains a unique handle which may be used later to unregister the function using UnRegister().

Parameters
[in]ThisPointer to the EFI_SMM_SW_DISPATCH2_PROTOCOL instance.
[in]DispatchFunctionFunction to register for handler when the specified software SMI is generated.
[in,out]RegContextPointer 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 SMI input value the dispatch function should be invoked for.
[out]DispatchHandleHandle generated by the dispatcher to track the function instance.
Return values
EFI_SUCCESSThe dispatch function has been successfully registered and the SMI source has been enabled.
EFI_DEVICE_ERRORThe SW driver was unable to enable the SMI source.
EFI_INVALID_PARAMETERRegisterContext is invalid. The SW SMI input value is not within valid range.
EFI_OUT_OF_RESOURCESThere is not enough memory (system or SMM) to manage this child.
EFI_OUT_OF_RESOURCESA unique software SMI value could not be assigned for this dispatch.

Definition at line 236 of file PchSmiDispatchSmm.c.

◆ SmmSwDispatch2UnRegister()

EFI_STATUS EFIAPI SmmSwDispatch2UnRegister ( IN CONST EFI_SMM_SW_DISPATCH2_PROTOCOL This,
IN EFI_HANDLE  DispatchHandle 
)

Unregister a child SMI source dispatch function for the specified software SMI.

This service removes the handler associated with DispatchHandle so that it will no longer be called in response to a software SMI.

Parameters
[in]ThisPointer to the EFI_SMM_SW_DISPATCH2_PROTOCOL instance.
[in]DispatchHandleHandle of dispatch function to deregister.
Return values
EFI_SUCCESSThe dispatch function has been successfully unregistered.
EFI_INVALID_PARAMETERThe DispatchHandle was not valid.

Definition at line 304 of file PchSmiDispatchSmm.c.

◆ SmmSwDispatcher()

EFI_STATUS SmmSwDispatcher ( IN EFI_HANDLE  DispatchHandle,
IN CONST VOID *  RegisterContext,
IN OUT VOID *  CommBuffer,
IN OUT UINTN CommBufferSize 
)

Dispatch registered SMM handlers

Parameters
DispatchHandleThe unique handle assigned to this handler by SmiHandlerRegister().
RegisterContextPoints to an optional handler context which was specified when the handler was registered.
CommBufferA pointer to a collection of data in memory that will be conveyed from a non-SMM environment into an SMM environment.
CommBufferSizeThe size of the CommBuffer.
Returns
Status Code

Definition at line 90 of file PchSmiDispatchSmm.c.

Variable Documentation

◆ gSmmSwDispatch2

Initial value:
= {
MAXIMUM_SWI_VALUE
}
EFI_STATUS EFIAPI SmmSwDispatch2UnRegister(IN CONST EFI_SMM_SW_DISPATCH2_PROTOCOL *This, IN EFI_HANDLE DispatchHandle)
EFI_STATUS EFIAPI SmmSwDispatch2Register(IN CONST EFI_SMM_SW_DISPATCH2_PROTOCOL *This, IN EFI_SMM_HANDLER_ENTRY_POINT2 DispatchFunction, IN OUT EFI_SMM_SW_REGISTER_CONTEXT *RegContext, OUT EFI_HANDLE *DispatchHandle)

Definition at line 324 of file PchSmiDispatchSmm.c.

◆ mSmiPchReg

SMM_PCH_REGISTER mSmiPchReg

Definition at line 20 of file PchSmiDispatchSmm.c.

◆ mSmmCpuProtocol

EFI_SMM_CPU_PROTOCOL* mSmmCpuProtocol

Definition at line 22 of file PchSmiDispatchSmm.c.

◆ mSmmSwDispatch2Queue

LIST_ENTRY mSmmSwDispatch2Queue = INITIALIZE_LIST_HEAD_VARIABLE (mSmmSwDispatch2Queue)

Definition at line 23 of file PchSmiDispatchSmm.c.