TianoCore EDK2 master
|
#include <PiPei.h>
#include <Guid/ProcessorResourceHob.h>
#include <Library/PeiServicesLib.h>
#include <Library/MpInitLib.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DebugLib.h>
#include <Library/CpuLib.h>
#include <Library/SynchronizationLib.h>
#include <Library/TimerLib.h>
#include <Library/HobLib.h>
Go to the source code of this file.
Data Structures | |
struct | CPU_AP_DATA |
struct | CPU_INFO_IN_HOB |
struct | MP_CPU_EXCHANGE_INFO |
struct | MP_CPU_DATA |
Macros | |
#define | WAKEUP_AP_SIGNAL SIGNATURE_32 ('S', 'T', 'A', 'P') |
#define | CPU_INIT_MP_LIB_HOB_GUID |
Typedefs | |
typedef struct MP_CPU_DATA | CPU_MP_DATA |
Functions | |
CPU_MP_DATA * | GetCpuMpData (VOID) |
VOID | SaveCpuMpData (IN CPU_MP_DATA *CpuMpData) |
VOID | WakeUpAP (IN CPU_MP_DATA *CpuMpData, IN BOOLEAN Broadcast, IN UINTN ProcessorNumber, IN EFI_AP_PROCEDURE Procedure OPTIONAL, IN VOID *ProcedureArgument OPTIONAL, IN BOOLEAN WakeUpDisabledAps) |
VOID | InitMpGlobalData (IN CPU_MP_DATA *CpuMpData) |
EFI_STATUS | StartupAllCPUsWorker (IN EFI_AP_PROCEDURE Procedure, IN BOOLEAN SingleThread, IN BOOLEAN ExcludeBsp, IN EFI_EVENT WaitEvent OPTIONAL, IN UINTN TimeoutInMicroseconds, IN VOID *ProcedureArgument OPTIONAL, OUT UINTN **FailedCpuList OPTIONAL) |
EFI_STATUS | StartupThisAPWorker (IN EFI_AP_PROCEDURE Procedure, IN UINTN ProcessorNumber, IN EFI_EVENT WaitEvent OPTIONAL, IN UINTN TimeoutInMicroseconds, IN VOID *ProcedureArgument OPTIONAL, OUT BOOLEAN *Finished OPTIONAL) |
EFI_STATUS | EnableDisableApWorker (IN UINTN ProcessorNumber, IN BOOLEAN EnableAP, IN UINT32 *HealthFlag OPTIONAL) |
CPU_MP_DATA * | GetCpuMpDataFromGuidedHob (VOID) |
EFI_STATUS | CheckThisAP (IN UINTN ProcessorNumber) |
EFI_STATUS | CheckAllAPs (VOID) |
VOID | CheckAndUpdateApsStatus (VOID) |
VOID | EnableDebugAgent (VOID) |
Variables | |
EFI_GUID | mCpuInitMpLibHobGuid |
Common header file for LoongArch MP Initialize Library.
Copyright (c) 2024, Loongson Technology Corporation Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file MpLib.h.
#define CPU_INIT_MP_LIB_HOB_GUID |
#define WAKEUP_AP_SIGNAL SIGNATURE_32 ('S', 'T', 'A', 'P') |
typedef struct MP_CPU_DATA CPU_MP_DATA |
EFI_STATUS CheckAllAPs | ( | VOID | ) |
Checks status of all APs.
This function checks whether all APs have finished task assigned by StartupAllAPs(), and whether timeout expires.
EFI_SUCCESS | All APs have finished task assigned by StartupAllAPs(). |
EFI_TIMEOUT | The timeout expires. |
EFI_NOT_READY | APs have not finished task and timeout has not expired. |
VOID CheckAndUpdateApsStatus | ( | VOID | ) |
Checks APs status and updates APs status if needed.
Definition at line 235 of file DxeMpLib.c.
EFI_STATUS CheckThisAP | ( | IN UINTN | ProcessorNumber | ) |
Checks status of specified AP.
This function checks whether the specified AP has finished the task assigned by StartupThisAP(), and whether timeout expires.
[in] | ProcessorNumber | The handle number of processor. |
EFI_SUCCESS | Specified AP has finished task assigned by StartupThisAPs(). |
EFI_TIMEOUT | The timeout expires. |
EFI_NOT_READY | Specified AP has not finished task and timeout has not expired. |
VOID EnableDebugAgent | ( | VOID | ) |
Enable Debug Agent to support source debugging on AP function. This instance will added in the future.
Enable Debug Agent to support source debugging on AP function.
Definition at line 40 of file DxeMpLib.c.
EFI_STATUS EnableDisableApWorker | ( | IN UINTN | ProcessorNumber, |
IN BOOLEAN | EnableAP, | ||
IN UINT32 *HealthFlag | OPTIONAL | ||
) |
Worker function to let the caller enable or disable an AP from this point onward. This service may only be called from the BSP. This instance will be added in the future.
[in] | ProcessorNumber | The handle number of AP. |
[in] | EnableAP | Specifies the new state for the processor for enabled, FALSE for disabled. |
[in] | HealthFlag | If not NULL, a pointer to a value that specifies the new health status of the AP. |
EFI_SUCCESS | The specified AP was enabled or disabled successfully. |
others | Failed to Enable/Disable AP. |
Worker function to let the caller enable or disable an AP from this point onward. This service may only be called from the BSP.
[in] | ProcessorNumber | The handle number of AP. |
[in] | EnableAP | Specifies the new state for the processor for enabled, FALSE for disabled. |
[in] | HealthFlag | If not NULL, a pointer to a value that specifies the new health status of the AP. |
EFI_SUCCESS | The specified AP was enabled or disabled successfully. |
others | Failed to Enable/Disable AP. |
CPU_MP_DATA * GetCpuMpData | ( | VOID | ) |
Get the pointer to CPU MP Data structure.
Get pointer to CPU MP Data structure.
Get pointer to CPU MP Data structure. For BSP, the pointer is retrieved from HOB. For AP, the structure is stored in the top of each AP's stack.
Definition at line 56 of file DxeMpLib.c.
CPU_MP_DATA * GetCpuMpDataFromGuidedHob | ( | VOID | ) |
VOID InitMpGlobalData | ( | IN CPU_MP_DATA * | CpuMpData | ) |
Initialize global data for MP support.
[in] | CpuMpData | The pointer to CPU MP Data structure. |
Install Notify
Definition at line 499 of file DxeMpLib.c.
VOID SaveCpuMpData | ( | IN CPU_MP_DATA * | CpuMpData | ) |
Save the pointer to CPU MP Data structure.
[in] | CpuMpData | The pointer to CPU MP Data structure will be saved. |
Definition at line 70 of file DxeMpLib.c.
EFI_STATUS StartupAllCPUsWorker | ( | IN EFI_AP_PROCEDURE | Procedure, |
IN BOOLEAN | SingleThread, | ||
IN BOOLEAN | ExcludeBsp, | ||
IN EFI_EVENT WaitEvent | OPTIONAL, | ||
IN UINTN | TimeoutInMicroseconds, | ||
IN VOID *ProcedureArgument | OPTIONAL, | ||
OUT UINTN **FailedCpuList | OPTIONAL | ||
) |
Worker function to execute a caller provided function on all enabled APs.
[in] | Procedure | A pointer to the function to be run on enabled APs of the system. |
[in] | SingleThread | If TRUE, then all the enabled APs execute the function specified by Procedure one by one, in ascending order of processor handle number. If FALSE, then all the enabled APs execute the function specified by Procedure simultaneously. |
[in] | WaitEvent | The event created by the caller with CreateEvent() service. |
[in] | TimeoutInMicroseconds | Indicates the time limit in microseconds for APs to return from Procedure, either for blocking or non-blocking mode. |
[in] | ProcedureArgument | The parameter passed into Procedure for all APs. |
[out] | FailedCpuList | If all APs finish successfully, then its content is set to NULL. If not all APs finish before timeout expires, then its content is set to address of the buffer holding handle numbers of the failed APs. |
EFI_SUCCESS | In blocking mode, all APs have finished before the timeout expired. |
EFI_SUCCESS | In non-blocking mode, function has been dispatched to all enabled APs. |
others | Failed to Startup all APs. |
Worker function to execute a caller provided function on all enabled APs.
[in] | Procedure | A pointer to the function to be run on enabled APs of the system. |
[in] | SingleThread | If TRUE, then all the enabled APs execute the function specified by Procedure one by one, in ascending order of processor handle number. If FALSE, then all the enabled APs execute the function specified by Procedure simultaneously. |
[in] | ExcludeBsp | Whether let BSP also trig this task. |
[in] | WaitEvent | The event created by the caller with CreateEvent() service. |
[in] | TimeoutInMicroseconds | Indicates the time limit in microseconds for APs to return from Procedure, either for blocking or non-blocking mode. |
[in] | ProcedureArgument | The parameter passed into Procedure for all APs. |
[out] | FailedCpuList | If all APs finish successfully, then its content is set to NULL. If not all APs finish before timeout expires, then its content is set to address of the buffer holding handle numbers of the failed APs. |
EFI_SUCCESS | In blocking mode, all APs have finished before the timeout expired. |
EFI_SUCCESS | In non-blocking mode, function has been dispatched to all enabled APs. |
others | Failed to Startup all APs. |
EFI_STATUS StartupThisAPWorker | ( | IN EFI_AP_PROCEDURE | Procedure, |
IN UINTN | ProcessorNumber, | ||
IN EFI_EVENT WaitEvent | OPTIONAL, | ||
IN UINTN | TimeoutInMicroseconds, | ||
IN VOID *ProcedureArgument | OPTIONAL, | ||
OUT BOOLEAN *Finished | OPTIONAL | ||
) |
Worker function to let the caller get one enabled AP to execute a caller-provided function.
[in] | Procedure | A pointer to the function to be run on enabled APs of the system. |
[in] | ProcessorNumber | The handle number of the AP. |
[in] | WaitEvent | The event created by the caller with CreateEvent() service. |
[in] | TimeoutInMicroseconds | Indicates the time limit in microseconds for APs to return from Procedure, either for blocking or non-blocking mode. |
[in] | ProcedureArgument | The parameter passed into Procedure for all APs. |
[out] | Finished | If AP returns from Procedure before the timeout expires, its content is set to TRUE. Otherwise, the value is set to FALSE. |
EFI_SUCCESS | In blocking mode, specified AP finished before the timeout expires. |
others | Failed to Startup AP. |
VOID WakeUpAP | ( | IN CPU_MP_DATA * | CpuMpData, |
IN BOOLEAN | Broadcast, | ||
IN UINTN | ProcessorNumber, | ||
IN EFI_AP_PROCEDURE Procedure | OPTIONAL, | ||
IN VOID *ProcedureArgument | OPTIONAL, | ||
IN BOOLEAN | WakeUpDisabledAps | ||
) |
This function will be called by BSP to wakeup AP.
[in] | CpuMpData | Pointer to CPU MP Data |
[in] | Broadcast | TRUE: Send broadcast IPI to all APs FALSE: Send IPI to AP by ApicId |
[in] | ProcessorNumber | The handle number of specified processor |
[in] | Procedure | The function to be invoked by AP |
[in] | ProcedureArgument | The argument to be passed into AP function |
[in] | WakeUpDisabledAps | Whether need to wake up disabled APs in broadcast mode. |
This function will be called by BSP to wakeup AP.
[in] | CpuMpData | Pointer to CPU MP Data |
[in] | Broadcast | TRUE: Send broadcast IPI to all APs FALSE: Send IPI to AP by ApicId |
[in] | ProcessorNumber | The handle number of specified processor |
[in] | Procedure | The function to be invoked by AP |
[in] | ProcedureArgument | The argument to be passed into AP function |
[in] | WakeUpDisabledAps | Whether need to wake up disabled APs in broadcast mode. Currently not used on LoongArch. |