TianoCore EDK2 master
|
Go to the source code of this file.
Macros | |
#define | INVALID_APIC_ID 0xFFFFFFFF |
Functions | |
CPU_STATE | GetApState (IN CPU_AP_DATA *CpuData) |
VOID | SetApState (IN CPU_AP_DATA *CpuData, IN CPU_STATE State) |
UINT32 | GetApicId (VOID) |
EFI_STATUS | GetProcessorNumber (IN CPU_MP_DATA *CpuMpData, OUT UINTN *ProcessorNumber) |
VOID | SortApicId (IN CPU_MP_DATA *CpuMpData) |
PROCESSOR_RESOURCE_DATA * | GetProcessorResourceDataFromGuidedHob (VOID) |
UINTN | CollectProcessorCount (IN CPU_MP_DATA *CpuMpData) |
VOID | InitializeApData (IN OUT CPU_MP_DATA *CpuMpData, IN UINTN ProcessorNumber, IN UINT32 BistData) |
VOID EFIAPI | ApWakeupFunction (IN UINTN ApIndex, IN MP_CPU_EXCHANGE_INFO *ExchangeInfo) |
UINT64 | CalculateTimeout (IN UINTN TimeoutInMicroseconds, OUT UINT64 *CurrentTime) |
BOOLEAN | CheckTimeout (IN OUT UINT64 *PreviousTime, IN UINT64 *TotalTime, IN UINT64 Timeout) |
VOID | TimedWaitForApFinish (IN CPU_MP_DATA *CpuMpData, IN UINT32 FinishedApLimit, IN UINT32 TimeLimit) |
VOID | WaitApWakeup (IN volatile UINT32 *ApStartupSignalBuffer) |
VOID | FillExchangeInfoData (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) |
EFI_STATUS | GetNextWaitingProcessorNumber (OUT UINTN *NextProcessorNumber) |
EFI_STATUS | CheckThisAP (IN UINTN ProcessorNumber) |
EFI_STATUS | CheckAllAPs (VOID) |
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 EFIAPI | MpInitLibStartupAllCPUs (IN EFI_AP_PROCEDURE Procedure, IN UINTN TimeoutInMicroseconds, IN VOID *ProcedureArgument OPTIONAL) |
EFI_STATUS EFIAPI | MpInitLibInitialize (VOID) |
EFI_STATUS EFIAPI | MpInitLibGetProcessorInfo (IN UINTN ProcessorNumber, OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer, OUT EFI_HEALTH_FLAGS *HealthData OPTIONAL) |
EFI_STATUS EFIAPI | MpInitLibWhoAmI (OUT UINTN *ProcessorNumber) |
EFI_STATUS EFIAPI | MpInitLibGetNumberOfProcessors (OUT UINTN *NumberOfProcessors OPTIONAL, OUT UINTN *NumberOfEnabledProcessors OPTIONAL) |
CPU_MP_DATA * | GetCpuMpDataFromGuidedHob (VOID) |
Variables | |
EFI_GUID | mCpuInitMpLibHobGuid = CPU_INIT_MP_LIB_HOB_GUID |
LoongArch64 CPU MP Initialize Library common functions.
Copyright (c) 2024, Loongson Technology Corporation Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file MpLib.c.
VOID EFIAPI ApWakeupFunction | ( | IN UINTN | ApIndex, |
IN MP_CPU_EXCHANGE_INFO * | ExchangeInfo | ||
) |
Calculate timeout value and return the current performance counter value.
Calculate the number of performance counter ticks required for a timeout. If TimeoutInMicroseconds is 0, return value is also 0, which is recognized as infinity.
[in] | TimeoutInMicroseconds | Timeout value in microseconds. |
[out] | CurrentTime | Returns the current value of the performance counter. |
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. |
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. |
Checks whether timeout expires.
Check whether the number of elapsed performance counter ticks required for a timeout condition has been reached. If Timeout is zero, which means infinity, return value is always FALSE.
[in,out] | PreviousTime | On input, the value of the performance counter when it was last read. On output, the current value of the performance counter |
[in] | TotalTime | The total amount of elapsed time in performance counter ticks. |
[in] | Timeout | The number of performance counter ticks required to reach a timeout condition. |
TRUE | A timeout condition has been reached. |
FALSE | A timeout condition has not been reached. |
UINTN CollectProcessorCount | ( | IN CPU_MP_DATA * | CpuMpData | ) |
VOID FillExchangeInfoData | ( | IN CPU_MP_DATA * | CpuMpData | ) |
UINT32 GetApicId | ( | VOID | ) |
CPU_STATE GetApState | ( | IN CPU_AP_DATA * | CpuData | ) |
Get the Application Processors state.
[in] | CpuData | The pointer to CPU_AP_DATA of specified AP |
CPU_MP_DATA * GetCpuMpDataFromGuidedHob | ( | VOID | ) |
EFI_STATUS GetNextWaitingProcessorNumber | ( | OUT UINTN * | NextProcessorNumber | ) |
Searches for the next waiting AP.
Search for the next AP that is put in waiting state by single-threaded StartupAllAPs().
[out] | NextProcessorNumber | Pointer to the processor number of the next waiting AP. |
EFI_SUCCESS | The next waiting AP has been found. |
EFI_NOT_FOUND | No waiting AP exists. |
EFI_STATUS GetProcessorNumber | ( | IN CPU_MP_DATA * | CpuMpData, |
OUT UINTN * | ProcessorNumber | ||
) |
PROCESSOR_RESOURCE_DATA * GetProcessorResourceDataFromGuidedHob | ( | VOID | ) |
EFI_STATUS EFIAPI MpInitLibGetNumberOfProcessors | ( | OUT UINTN *NumberOfProcessors | OPTIONAL, |
OUT UINTN *NumberOfEnabledProcessors | OPTIONAL | ||
) |
Retrieves the number of logical processor in the platform and the number of those logical processors that are enabled on this boot. This service may only be called from the BSP.
[out] | NumberOfProcessors | Pointer to the total number of logical processors in the system, including the BSP and disabled APs. |
[out] | NumberOfEnabledProcessors | Pointer to the number of enabled logical processors that exist in system, including the BSP. |
EFI_SUCCESS | The number of logical processors and enabled logical processors was retrieved. |
EFI_DEVICE_ERROR | The calling processor is an AP. |
EFI_INVALID_PARAMETER | NumberOfProcessors is NULL and NumberOfEnabledProcessors is NULL. |
EFI_NOT_READY | MP Initialize Library is not initialized. |
EFI_STATUS EFIAPI MpInitLibGetProcessorInfo | ( | IN UINTN | ProcessorNumber, |
OUT EFI_PROCESSOR_INFORMATION * | ProcessorInfoBuffer, | ||
OUT EFI_HEALTH_FLAGS *HealthData | OPTIONAL | ||
) |
Gets detailed MP-related information on the requested processor at the instant this call is made. This service may only be called from the BSP.
[in] | ProcessorNumber | The handle number of processor. |
[out] | ProcessorInfoBuffer | A pointer to the buffer where information for the requested processor is deposited. |
[out] | HealthData | Return processor health data. |
EFI_SUCCESS | Processor information was returned. |
EFI_DEVICE_ERROR | The calling processor is an AP. |
EFI_INVALID_PARAMETER | ProcessorInfoBuffer is NULL. |
EFI_NOT_FOUND | The processor with the handle specified by ProcessorNumber does not exist in the platform. |
EFI_NOT_READY | MP Initialize Library is not initialized. |
EFI_STATUS EFIAPI MpInitLibInitialize | ( | VOID | ) |
MP Initialize Library initialization.
This service will allocate AP reset vector and wakeup all APs to do APs initialization.
This service must be invoked before all other MP Initialize Library service are invoked.
EFI_SUCCESS | MP initialization succeeds. |
Others | MP initialization fails. |
EFI_STATUS EFIAPI MpInitLibStartupAllCPUs | ( | IN EFI_AP_PROCEDURE | Procedure, |
IN UINTN | TimeoutInMicroseconds, | ||
IN VOID *ProcedureArgument | OPTIONAL | ||
) |
This service executes a caller provided function on all enabled CPUs.
[in] | Procedure | A pointer to the function to be run on enabled APs of the system. See type EFI_AP_PROCEDURE. |
[in] | TimeoutInMicroseconds | Indicates the time limit in microseconds for APs to return from Procedure, either for blocking or non-blocking mode. Zero means infinity. TimeoutInMicroseconds is ignored for BSP. |
[in] | ProcedureArgument | The parameter passed into Procedure for all APs. |
EFI_SUCCESS | In blocking mode, all CPUs have finished before the timeout expired. |
EFI_SUCCESS | In non-blocking mode, function has been dispatched to all enabled CPUs. |
EFI_DEVICE_ERROR | Caller processor is AP. |
EFI_NOT_READY | Any enabled APs are busy. |
EFI_NOT_READY | MP Initialize Library is not initialized. |
EFI_TIMEOUT | In blocking mode, the timeout expired before all enabled APs have finished. |
EFI_INVALID_PARAMETER | Procedure is NULL. |
EFI_STATUS EFIAPI MpInitLibWhoAmI | ( | OUT UINTN * | ProcessorNumber | ) |
This return the handle number for the calling processor. This service may be called from the BSP and APs.
[out] | ProcessorNumber | Pointer to the handle number of AP. The range is from 0 to the total number of logical processors minus 1. The total number of logical processors can be retrieved by MpInitLibGetNumberOfProcessors(). |
EFI_SUCCESS | The current processor handle number was returned in ProcessorNumber. |
EFI_INVALID_PARAMETER | ProcessorNumber is NULL. |
EFI_NOT_READY | MP Initialize Library is not initialized. |
VOID SetApState | ( | IN CPU_AP_DATA * | CpuData, |
IN CPU_STATE | State | ||
) |
Set the Application Processors state.
[in] | CpuData | The pointer to CPU_AP_DATA of specified AP |
[in] | State | The AP status |
VOID SortApicId | ( | 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 | ||
) |
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 TimedWaitForApFinish | ( | IN CPU_MP_DATA * | CpuMpData, |
IN UINT32 | FinishedApLimit, | ||
IN UINT32 | TimeLimit | ||
) |
Helper function that waits until the finished AP count reaches the specified limit, or the specified timeout elapses (whichever comes first).
[in] | CpuMpData | Pointer to CPU MP Data. |
[in] | FinishedApLimit | The number of finished APs to wait for. |
[in] | TimeLimit | The number of microseconds to wait for. |
VOID WaitApWakeup | ( | IN volatile UINT32 * | ApStartupSignalBuffer | ) |
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. Currently not used on LoongArch. |