TianoCore EDK2 master
Loading...
Searching...
No Matches
CpuService.c File Reference
#include "PiSmmCpuCommon.h"

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI SmmGetProcessorInfo (IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This, IN UINTN ProcessorNumber, OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer)
 
EFI_STATUS EFIAPI SmmSwitchBsp (IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This, IN UINTN ProcessorNumber)
 
EFI_STATUS EFIAPI SmmAddProcessor (IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This, IN UINT64 ProcessorId, OUT UINTN *ProcessorNumber)
 
EFI_STATUS EFIAPI SmmRemoveProcessor (IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This, IN UINTN ProcessorNumber)
 
EFI_STATUS EFIAPI SmmWhoAmI (IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This, OUT UINTN *ProcessorNumber)
 
VOID SmmCpuUpdate (VOID)
 
EFI_STATUS EFIAPI SmmRegisterExceptionHandler (IN EFI_SMM_CPU_SERVICE_PROTOCOL *This, IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler)
 
EFI_STATUS InitializeSmmCpuServices (IN EFI_HANDLE Handle)
 
EFI_STATUS EFIAPI SmmCpuRendezvous (IN EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL *This, IN BOOLEAN BlockingMode)
 

Variables

EFI_SMM_CPU_SERVICE_PROTOCOL mSmmCpuService
 
EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL mSmmCpuRendezvousService
 

Detailed Description

Implementation of SMM CPU Services Protocol.

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

Definition in file CpuService.c.

Function Documentation

◆ InitializeSmmCpuServices()

EFI_STATUS InitializeSmmCpuServices ( IN EFI_HANDLE  Handle)

Initialize SMM CPU Services.

It installs EFI SMM CPU Services Protocol.

Parameters
ImageHandleThe firmware allocated handle for the EFI image.
Return values
EFI_SUCCESSEFI SMM CPU Services Protocol was installed successfully.
OTHERFail to install Protocol.

Definition at line 373 of file CpuService.c.

◆ SmmAddProcessor()

EFI_STATUS EFIAPI SmmAddProcessor ( IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL This,
IN UINT64  ProcessorId,
OUT UINTN ProcessorNumber 
)

Notify that a processor was hot-added.

Parameters
[in]ThisA pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.
[in]ProcessorIdLocal APIC ID of the hot-added processor.
[out]ProcessorNumberThe handle number of the hot-added processor.
Return values
EFI_SUCCESSThe hot-addition of the specified processors was successfully notified.
EFI_UNSUPPORTEDHot addition of processor is not supported.
EFI_NOT_FOUNDThe processor with the handle specified by ProcessorNumber does not exist.
EFI_INVALID_PARAMETERProcessorNumber is invalid.
EFI_ALREADY_STARTEDThe processor is already online in the system.

Definition at line 128 of file CpuService.c.

◆ SmmCpuRendezvous()

EFI_STATUS EFIAPI SmmCpuRendezvous ( IN EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL This,
IN BOOLEAN  BlockingMode 
)

Wait for all processors enterring SMM until all CPUs are already synchronized or not.

If BlockingMode is False, timeout value is zero.

Parameters
ThisA pointer to the EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL instance.
BlockingModeBlocking mode or non-blocking mode.
Return values
EFI_SUCCESSAll avaiable APs arrived.
EFI_TIMEOUTWait for all APs until timeout.

Definition at line 414 of file CpuService.c.

◆ SmmCpuUpdate()

VOID SmmCpuUpdate ( VOID  )

Update the SMM CPU list per the pending operation.

This function is called after return from SMI handlers.

Definition at line 296 of file CpuService.c.

◆ SmmGetProcessorInfo()

EFI_STATUS EFIAPI SmmGetProcessorInfo ( IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL This,
IN UINTN  ProcessorNumber,
OUT EFI_PROCESSOR_INFORMATION ProcessorInfoBuffer 
)

Gets processor information on the requested processor at the instant this call is made.

Parameters
[in]ThisA pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.
[in]ProcessorNumberThe handle number of processor.
[out]ProcessorInfoBufferA pointer to the buffer where information for the requested processor is deposited.
Return values
EFI_SUCCESSProcessor information was returned.
EFI_INVALID_PARAMETERProcessorInfoBuffer is NULL.
EFI_INVALID_PARAMETERProcessorNumber is invalid.
EFI_NOT_FOUNDThe processor with the handle specified by ProcessorNumber does not exist in the platform.

Definition at line 47 of file CpuService.c.

◆ SmmRegisterExceptionHandler()

EFI_STATUS EFIAPI SmmRegisterExceptionHandler ( IN EFI_SMM_CPU_SERVICE_PROTOCOL This,
IN EFI_EXCEPTION_TYPE  ExceptionType,
IN EFI_CPU_INTERRUPT_HANDLER  InterruptHandler 
)

Register exception handler.

Parameters
ThisA pointer to the SMM_CPU_SERVICE_PROTOCOL instance.
ExceptionTypeDefines which interrupt or exception to hook. Type EFI_EXCEPTION_TYPE and the valid values for this parameter are defined in EFI_DEBUG_SUPPORT_PROTOCOL of the UEFI 2.0 specification.
InterruptHandlerA pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called when a processor interrupt occurs. If this parameter is NULL, then the handler will be uninstalled.
Return values
EFI_SUCCESSThe handler for the processor interrupt was successfully installed or uninstalled.
EFI_ALREADY_STARTEDInterruptHandler is not NULL, and a handler for InterruptType was previously installed.
EFI_INVALID_PARAMETERInterruptHandler is NULL, and a handler for InterruptType was not previously installed.
EFI_UNSUPPORTEDThe interrupt specified by InterruptType is not supported.

Definition at line 353 of file CpuService.c.

◆ SmmRemoveProcessor()

EFI_STATUS EFIAPI SmmRemoveProcessor ( IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL This,
IN UINTN  ProcessorNumber 
)

Notify that a processor was hot-removed.

Parameters
[in]ThisA pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.
[in]ProcessorNumberThe handle number of the hot-added processor.
Return values
EFI_SUCCESSThe hot-removal of the specified processors was successfully notified.
EFI_UNSUPPORTEDHot removal of processor is not supported.
EFI_UNSUPPORTEDHot removal of BSP is not supported.
EFI_UNSUPPORTEDHot removal of a processor with pending hot-plug operation is not supported.
EFI_INVALID_PARAMETERProcessorNumber is invalid.

Definition at line 207 of file CpuService.c.

◆ SmmSwitchBsp()

EFI_STATUS EFIAPI SmmSwitchBsp ( IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL This,
IN UINTN  ProcessorNumber 
)

This service switches the requested AP to be the BSP since the next SMI.

Parameters
[in]ThisA pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.
[in]ProcessorNumberThe handle number of AP that is to become the new BSP.
Return values
EFI_SUCCESSBSP will be switched in next SMI.
EFI_UNSUPPORTEDSwitching the BSP or a processor to be hot-removed is not supported.
EFI_NOT_FOUNDThe processor with the handle specified by ProcessorNumber does not exist.
EFI_INVALID_PARAMETERProcessorNumber is invalid.

Definition at line 84 of file CpuService.c.

◆ SmmWhoAmI()

EFI_STATUS EFIAPI SmmWhoAmI ( IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL This,
OUT UINTN ProcessorNumber 
)

This return the handle number for the calling processor.

Parameters
[in]ThisA pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.
[out]ProcessorNumberThe handle number of currently executing processor.
Return values
EFI_SUCCESSThe current processor handle number was returned in ProcessorNumber.
EFI_INVALID_PARAMETERProcessorNumber is NULL.

Definition at line 259 of file CpuService.c.

Variable Documentation

◆ mSmmCpuRendezvousService

EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL mSmmCpuRendezvousService
Initial value:
= {
}
EFI_STATUS EFIAPI SmmCpuRendezvous(IN EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL *This, IN BOOLEAN BlockingMode)
Definition: CpuService.c:414

Definition at line 26 of file CpuService.c.

◆ mSmmCpuService

Initial value:
= {
}
EFI_STATUS EFIAPI SmmSwitchBsp(IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This, IN UINTN ProcessorNumber)
Definition: CpuService.c:84
EFI_STATUS EFIAPI SmmRegisterExceptionHandler(IN EFI_SMM_CPU_SERVICE_PROTOCOL *This, IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler)
Definition: CpuService.c:353
EFI_STATUS EFIAPI SmmAddProcessor(IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This, IN UINT64 ProcessorId, OUT UINTN *ProcessorNumber)
Definition: CpuService.c:128
EFI_STATUS EFIAPI SmmWhoAmI(IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This, OUT UINTN *ProcessorNumber)
Definition: CpuService.c:259
EFI_STATUS EFIAPI SmmGetProcessorInfo(IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This, IN UINTN ProcessorNumber, OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer)
Definition: CpuService.c:47
EFI_STATUS EFIAPI SmmRemoveProcessor(IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This, IN UINTN ProcessorNumber)
Definition: CpuService.c:207

Definition at line 14 of file CpuService.c.