/** @file\r
CPU DXE MP support\r
\r
- Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
#ifndef _CPU_MP_H_\r
#define _CPU_MP_H_\r
\r
-#include <Protocol/MpService.h>\r
-#include <Library/SynchronizationLib.h>\r
-\r
/**\r
Initialize Multi-processor support.\r
\r
VOID\r
);\r
\r
-typedef\r
-VOID\r
-(EFIAPI *STACKLESS_AP_ENTRY_POINT)(\r
- VOID\r
- );\r
-\r
-/**\r
- Starts the Application Processors and directs them to jump to the\r
- specified routine.\r
-\r
- The processor jumps to this code in flat mode, but the processor's\r
- stack is not initialized.\r
-\r
- @retval EFI_SUCCESS The APs were started\r
-\r
-**/\r
-EFI_STATUS\r
-StartApsStackless (\r
- VOID\r
- );\r
-\r
-/**\r
- The AP entry point that the Startup-IPI target code will jump to.\r
-\r
- The processor jumps to this code in flat mode, but the processor's\r
- stack is not initialized.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-AsmApEntryPoint (\r
- VOID\r
- );\r
-\r
-/**\r
- Releases the lock preventing other APs from using the shared AP\r
- stack.\r
-\r
- Once the AP has transitioned to using a new stack, it can call this\r
- function to allow another AP to proceed with using the shared stack.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-AsmApDoneWithCommonStack (\r
- VOID\r
- );\r
-\r
-typedef enum {\r
- CpuStateIdle,\r
- CpuStateBlocked,\r
- CpuStateReady,\r
- CpuStateBuzy,\r
- CpuStateFinished\r
-} CPU_STATE;\r
-\r
-/**\r
- Define Individual Processor Data block.\r
-\r
-**/\r
-typedef struct {\r
- EFI_PROCESSOR_INFORMATION Info;\r
- SPIN_LOCK CpuDataLock;\r
- volatile CPU_STATE State;\r
-\r
- EFI_AP_PROCEDURE Procedure;\r
- VOID *Parameter;\r
- BOOLEAN *Finished;\r
- INTN Timeout;\r
- EFI_EVENT WaitEvent;\r
- BOOLEAN TimeoutActive;\r
- EFI_EVENT CheckThisAPEvent;\r
- VOID *TopOfStack;\r
-} CPU_DATA_BLOCK;\r
-\r
-/**\r
- Define MP data block which consumes individual processor block.\r
-\r
-**/\r
-typedef struct {\r
- CPU_DATA_BLOCK *CpuDatas;\r
- UINTN NumberOfProcessors;\r
- UINTN NumberOfEnabledProcessors;\r
-\r
- EFI_AP_PROCEDURE Procedure;\r
- VOID *ProcedureArgument;\r
- UINTN StartCount;\r
- UINTN FinishCount;\r
- BOOLEAN SingleThread;\r
- UINTN **FailedList;\r
- UINTN FailedListIndex;\r
- INTN Timeout;\r
- EFI_EVENT WaitEvent;\r
- BOOLEAN TimeoutActive;\r
- EFI_EVENT CheckAllAPsEvent;\r
-} MP_SYSTEM_DATA;\r
-\r
-/**\r
- This function is called by all processors (both BSP and AP) once and collects MP related data.\r
-\r
- @param Bsp TRUE if the CPU is BSP\r
- @param ProcessorNumber The specific processor number\r
-\r
- @retval EFI_SUCCESS Data for the processor collected and filled in\r
-\r
-**/\r
-EFI_STATUS\r
-FillInProcessorInformation (\r
- IN BOOLEAN Bsp,\r
- IN UINTN ProcessorNumber\r
- );\r
-\r
/**\r
This service retrieves the number of logical processor in the platform\r
and the number of those logical processors that are enabled on this boot.\r
and releases the BSP to continue with other tasks.\r
-# The caller can use the CheckEvent() and WaitForEvent() services to check\r
the state of the WaitEvent created in step 1.\r
- -# When the APs complete their task or TimeoutInMicroSecondss expires, the MP\r
+ -# When the APs complete their task or TimeoutInMicroSeconds expires, the MP\r
Service signals WaitEvent by calling the EFI SignalEvent() function. If\r
FailedCpuList is not NULL, its content is available when WaitEvent is\r
signaled. If all APs returned from Procedure prior to the timeout, then\r
This function is used to dispatch one enabled AP to the function specified by\r
Procedure passing in the argument specified by ProcedureArgument. If WaitEvent\r
is NULL, execution is in blocking mode. The BSP waits until the AP finishes or\r
- TimeoutInMicroSecondss expires. Otherwise, execution is in non-blocking mode.\r
+ TimeoutInMicroSeconds expires. Otherwise, execution is in non-blocking mode.\r
BSP proceeds to the next task without waiting for the AP. If a non-blocking mode\r
is requested after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT is signaled,\r
then EFI_UNSUPPORTED must be returned.\r
@retval EFI_UNSUPPORTED Switching the BSP cannot be completed prior to\r
this service returning.\r
@retval EFI_UNSUPPORTED Switching the BSP is not supported.\r
- @retval EFI_SUCCESS The calling processor is an AP.\r
+ @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
@retval EFI_NOT_FOUND The processor with the handle specified by\r
ProcessorNumber does not exist.\r
@retval EFI_INVALID_PARAMETER ProcessorNumber specifies the current BSP or\r
OUT UINTN *ProcessorNumber\r
);\r
\r
-/**\r
- Terminate AP's task and set it to idle state.\r
-\r
- This function terminates AP's task due to timeout by sending INIT-SIPI,\r
- and sends it to idle state.\r
-\r
- @param CpuData the pointer to CPU_DATA_BLOCK of specified AP\r
-\r
-**/\r
-VOID\r
-ResetProcessorToIdleState (\r
- IN CPU_DATA_BLOCK *CpuData\r
- );\r
-\r
-/**\r
- Prepares Startup Code for APs.\r
- This function prepares Startup Code for APs.\r
-\r
- @retval EFI_SUCCESS The APs were started\r
- @retval EFI_OUT_OF_RESOURCES Cannot allocate memory to start APs\r
-\r
-**/\r
-EFI_STATUS\r
-PrepareAPStartupCode (\r
- VOID\r
- );\r
-\r
-/**\r
- Free the code buffer of startup AP.\r
-\r
-**/\r
-VOID\r
-FreeApStartupCode (\r
- VOID\r
- );\r
-\r
-/**\r
- Resets the Application Processor and directs it to jump to the\r
- specified routine.\r
-\r
- The processor jumps to this code in flat mode, but the processor's\r
- stack is not initialized.\r
-\r
- @param ProcessorId the AP of ProcessorId was reset\r
-**/\r
-VOID\r
-ResetApStackless (\r
- IN UINT32 ProcessorId\r
- );\r
-\r
#endif // _CPU_MP_H_\r
\r