TianoCore EDK2 master
Loading...
Searching...
No Matches
MpServicesInternal.h File Reference
#include <Protocol/Cpu.h>
#include <Protocol/MpService.h>
#include <Library/BaseLib.h>
#include <Library/UefiLib.h>

Go to the source code of this file.

Data Structures

struct  CPU_AP_DATA
 
struct  CPU_MP_DATA
 

Macros

#define AP_STACK_SIZE   0x1000
 

Enumerations

enum  CPU_STATE {
  CpuStateIdle , CpuStateReady , CpuStateBlocked , CpuStateBusy ,
  CpuStateFinished , CpuStateDisabled , CpuStateIdle , CpuStateReady ,
  CpuStateBusy , CpuStateFinished , CpuStateDisabled , CpuStateIdle ,
  CpuStateReady , CpuStateBusy , CpuStateFinished , CpuStateDisabled
}
 

Functions

VOID ApEntryPoint (VOID)
 
VOID ApProcedure (VOID)
 
STATIC EFI_STATUS EFIAPI DispatchCpu (IN UINTN ProcessorIndex)
 
STATIC BOOLEAN IsProcessorBSP (UINTN ProcessorIndex)
 
STATIC BOOLEAN IsCurrentProcessorBSP (VOID)
 
STATIC BOOLEAN IsProcessorEnabled (UINTN ProcessorIndex)
 
STATIC VOID SetApProcedure (IN CPU_AP_DATA *CpuData, IN EFI_AP_PROCEDURE Procedure, IN VOID *ProcedureArgument)
 
CPU_STATE GetApState (IN CPU_AP_DATA *CpuData)
 
STATIC EFI_STATUS GetNextBlockedNumber (OUT UINTN *NextNumber)
 
STATIC UINTN CalculateAndStallInterval (IN UINTN Timeout)
 
STATIC VOID StartupAllAPsPrepareState (IN BOOLEAN SingleThread)
 
STATIC EFI_STATUS StartupAllAPsWithWaitEvent (IN EFI_AP_PROCEDURE Procedure, IN VOID *ProcedureArgument, IN EFI_EVENT WaitEvent, IN UINTN TimeoutInMicroseconds, IN BOOLEAN SingleThread, IN UINTN **FailedCpuList)
 
STATIC EFI_STATUS StartupAllAPsNoWaitEvent (IN EFI_AP_PROCEDURE Procedure, IN VOID *ProcedureArgument, IN UINTN TimeoutInMicroseconds, IN BOOLEAN SingleThread, IN UINTN **FailedCpuList)
 
STATIC VOID AddProcessorToFailedList (UINTN ProcessorIndex, CPU_STATE ApState)
 
STATIC VOID ProcessStartupAllAPsTimeout (VOID)
 
STATIC VOID EFIAPI CheckAllAPsStatus (IN EFI_EVENT Event, IN VOID *Context)
 
STATIC VOID EFIAPI CheckThisAPStatus (IN EFI_EVENT Event, IN VOID *Context)
 
STATIC EFI_STATUS FillInProcessorInformation (IN BOOLEAN BSP, IN UINTN Mpidr, IN UINTN ProcessorIndex)
 
STATIC VOID EFIAPI ReadyToBootSignaled (IN EFI_EVENT Event, IN VOID *Context)
 

Detailed Description

Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
Portions copyright (c) 2011, Apple Inc. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file MpServicesInternal.h.

Macro Definition Documentation

◆ AP_STACK_SIZE

#define AP_STACK_SIZE   0x1000

Definition at line 20 of file MpServicesInternal.h.

Enumeration Type Documentation

◆ CPU_STATE

enum CPU_STATE

Definition at line 33 of file MpServicesInternal.h.

Function Documentation

◆ AddProcessorToFailedList()

STATIC VOID AddProcessorToFailedList ( UINTN  ProcessorIndex,
CPU_STATE  ApState 
)

Adds the specified processor the list of failed processors.

Parameters
ProcessorIndexThe processor index to add.
ApStateProcessor state.

Definition at line 985 of file ArmPsciMpServicesDxe.c.

◆ ApEntryPoint()

VOID ApEntryPoint ( VOID  )

Secondary core entry point.

◆ ApProcedure()

VOID ApProcedure ( VOID  )

C entry-point for the AP. This function gets called from the assembly function ApEntryPoint.

Definition at line 1531 of file ArmPsciMpServicesDxe.c.

◆ CalculateAndStallInterval()

STATIC UINTN CalculateAndStallInterval ( IN UINTN  Timeout)

Stalls the BSP for the minimum of gPollInterval and Timeout.

Parameters
[in]TimeoutThe time limit in microseconds remaining for APs to return from Procedure.
Return values
StallTimeTime of execution stall.

Stalls the BSP for the minimum of POLL_INTERVAL_US and Timeout.

Parameters
[in]TimeoutThe time limit in microseconds remaining for APs to return from Procedure.
Return values
StallTimeTime of execution stall.

Calculated and stalled the interval time by BSP to check whether the APs have finished.

Parameters
[in]TimeoutThe time limit in microseconds for APs to return from Procedure.
Return values
StallTimeTime of execution stall.

Definition at line 217 of file ArmPsciMpServicesDxe.c.

◆ CheckAllAPsStatus()

STATIC VOID EFIAPI CheckAllAPsStatus ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

If a timeout is specified in StartupAllAps(), a timer is set, which invokes this procedure periodically to check whether all APs have finished.

Parameters
[in]EventThe WaitEvent the user supplied.
[in]ContextThe event context.

Definition at line 1123 of file ArmPsciMpServicesDxe.c.

◆ CheckThisAPStatus()

STATIC VOID EFIAPI CheckThisAPStatus ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Invoked periodically via a timer to check the state of the processor.

Parameters
EventThe event supplied by the timer expiration.
ContextThe processor context.

Definition at line 1176 of file ArmPsciMpServicesDxe.c.

◆ DispatchCpu()

STATIC EFI_STATUS EFIAPI DispatchCpu ( IN UINTN  ProcessorIndex)

Turns on the specified core using PSCI and executes the user-supplied function that's been configured via a previous call to SetApProcedure.

Parameters
ProcessorIndexThe index of the core to turn on.
Return values
EFI_SUCCESSThe processor was successfully turned on.
EFI_DEVICE_ERRORAn error occurred turning the processor on.

Turns on the specified core using PSCI and executes the user-supplied function that's been configured via a previous call to SetApProcedure.

Parameters
ProcessorIndexThe index of the core to turn on.
Return values
EFI_SUCCESSSuccess.
EFI_DEVICE_ERRORThe processor could not be turned on.

Definition at line 83 of file ArmPsciMpServicesDxe.c.

◆ FillInProcessorInformation()

STATIC EFI_STATUS FillInProcessorInformation ( IN BOOLEAN  BSP,
IN UINTN  Mpidr,
IN UINTN  ProcessorIndex 
)

This function is called by all processors (both BSP and AP) once and collects MP related data.

Parameters
BSPTRUE if the processor is the BSP.
MpidrThe MPIDR for the specified processor. This should be the full MPIDR and not only the affinity bits.
ProcessorIndexThe index of the processor.
Returns
EFI_SUCCESS if the data for the processor collected and filled in.

Definition at line 1231 of file ArmPsciMpServicesDxe.c.

◆ GetApState()

CPU_STATE GetApState ( IN CPU_AP_DATA CpuData)

Get the Application Processors state.

Parameters
[in]CpuDataThe pointer to CPU_AP_DATA of specified AP
Returns
The AP status

Get the Application Processors state.

Parameters
[in]CpuDataThe pointer to CPU_AP_DATA of specified AP.
Returns
The AP status.

Definition at line 142 of file ArmPsciMpServicesDxe.c.

◆ GetNextBlockedNumber()

STATIC EFI_STATUS GetNextBlockedNumber ( OUT UINTN NextNumber)

Returns the index of the next processor that is blocked.

Parameters
[out]NextNumberThe index of the next blocked processor.
Return values
EFI_SUCCESSSuccessfully found the next blocked processor.
EFI_NOT_FOUNDThere are no blocked processors.

Definition at line 182 of file ArmPsciMpServicesDxe.c.

◆ IsCurrentProcessorBSP()

STATIC BOOLEAN IsCurrentProcessorBSP ( VOID  )

Returns whether the processor executing this function is the BSP.

Returns
Whether the current processor is the BSP.

Definition at line 1575 of file ArmPsciMpServicesDxe.c.

◆ IsProcessorBSP()

STATIC BOOLEAN IsProcessorBSP ( UINTN  ProcessorIndex)

Returns whether the specified processor is the BSP.

Parameters
[in]ProcessorIndexThe index the processor to check.
Returns
TRUE if the processor is the BSP, FALSE otherwise.

Definition at line 124 of file ArmPsciMpServicesDxe.c.

◆ IsProcessorEnabled()

STATIC BOOLEAN IsProcessorEnabled ( UINTN  ProcessorIndex)

Returns whether the specified processor is enabled.

Parameters
[in]ProcessorIndexThe index of the processor to check.
Returns
TRUE if the processor is enabled, FALSE otherwise.

Definition at line 1599 of file ArmPsciMpServicesDxe.c.

◆ ProcessStartupAllAPsTimeout()

STATIC VOID ProcessStartupAllAPsTimeout ( VOID  )

Handles the StartupAllAPs case where the timeout has occurred.

Definition at line 1022 of file ArmPsciMpServicesDxe.c.

◆ ReadyToBootSignaled()

STATIC VOID EFIAPI ReadyToBootSignaled ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Event notification function called when the EFI_EVENT_GROUP_READY_TO_BOOT is signaled. After this point, non-blocking mode is no longer allowed.

Parameters
EventEvent whose notification function is being invoked.
ContextThe pointer to the notification function's context, which is implementation-dependent.

Definition at line 1397 of file ArmPsciMpServicesDxe.c.

◆ SetApProcedure()

STATIC VOID SetApProcedure ( IN CPU_AP_DATA CpuData,
IN EFI_AP_PROCEDURE  Procedure,
IN VOID *  ProcedureArgument 
)

Configures the processor context with the user-supplied procedure and argument.

Parameters
CpuDataThe processor context.
ProcedureThe user-supplied procedure.
ProcedureArgumentThe user-supplied procedure argument.

Definition at line 159 of file ArmPsciMpServicesDxe.c.

◆ StartupAllAPsNoWaitEvent()

STATIC EFI_STATUS StartupAllAPsNoWaitEvent ( IN EFI_AP_PROCEDURE  Procedure,
IN VOID *  ProcedureArgument,
IN UINTN  TimeoutInMicroseconds,
IN BOOLEAN  SingleThread,
IN UINTN **  FailedCpuList 
)

Handles execution of StartupAllAPs when no wait event has been specified.

Parameters
ProcedureThe user-supplied procedure.
ProcedureArgumentThe user-supplied procedure argument.
TimeoutInMicrosecondsThe timeout for the work to be completed. Zero indicates an infinite timeout.
SingleThreadWhether the APs will execute sequentially.
FailedCpuListUser-supplied pointer for list of failed CPUs.
Returns
EFI_SUCCESS on success.

Definition at line 1765 of file ArmPsciMpServicesDxe.c.

◆ StartupAllAPsPrepareState()

STATIC VOID StartupAllAPsPrepareState ( IN BOOLEAN  SingleThread)

Sets up the state for the StartupAllAPs function.

Parameters
SingleThreadWhether the APs will execute sequentially.

Definition at line 1617 of file ArmPsciMpServicesDxe.c.

◆ StartupAllAPsWithWaitEvent()

STATIC EFI_STATUS StartupAllAPsWithWaitEvent ( IN EFI_AP_PROCEDURE  Procedure,
IN VOID *  ProcedureArgument,
IN EFI_EVENT  WaitEvent,
IN UINTN  TimeoutInMicroseconds,
IN BOOLEAN  SingleThread,
IN UINTN **  FailedCpuList 
)

Handles execution of StartupAllAPs when a WaitEvent has been specified.

Parameters
ProcedureThe user-supplied procedure.
ProcedureArgumentThe user-supplied procedure argument.
WaitEventThe wait event to be signaled when the work is complete or a timeout has occurred.
TimeoutInMicrosecondsThe timeout for the work to be completed. Zero indicates an infinite timeout.
SingleThreadWhether the APs will execute sequentially.
FailedCpuListUser-supplied pointer for list of failed CPUs.
Returns
EFI_SUCCESS on success.

Definition at line 1692 of file ArmPsciMpServicesDxe.c.