TianoCore EDK2 master
Loading...
Searching...
No Matches
PeiCpuExceptionHandlerUnitTest.c File Reference

Go to the source code of this file.

Functions

VOID * InitializeBspIdt (VOID)
 
EFI_STATUS MpServicesUnitTestGetNumberOfProcessors (IN MP_SERVICES MpServices, OUT UINTN *NumberOfProcessors, OUT UINTN *NumberOfEnabledProcessors)
 
EFI_STATUS MpServicesUnitTestStartupThisAP (IN MP_SERVICES MpServices, IN EFI_AP_PROCEDURE Procedure, IN UINTN ProcessorNumber, IN UINTN TimeoutInMicroSeconds, IN VOID *ProcedureArgument)
 
EFI_STATUS MpServicesUnitTestStartupAllAPs (IN MP_SERVICES MpServices, IN EFI_AP_PROCEDURE Procedure, IN BOOLEAN SingleThread, IN UINTN TimeoutInMicroSeconds, IN VOID *ProcedureArgument)
 
EFI_STATUS MpServicesUnitTestWhoAmI (IN MP_SERVICES MpServices, OUT UINTN *ProcessorNumber)
 
EFI_STATUS GetMpServices (OUT MP_SERVICES *MpServices)
 
EFI_STATUS EFIAPI PeiEntryPoint (IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices)
 

Detailed Description

Unit tests of the CpuExceptionHandlerLib.

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

Definition in file PeiCpuExceptionHandlerUnitTest.c.

Function Documentation

◆ GetMpServices()

EFI_STATUS GetMpServices ( OUT MP_SERVICES MpServices)

Get EDKII_PEI_MP_SERVICES2_PPI pointer.

Parameters
[out]MpServicesPointer to the buffer where EDKII_PEI_MP_SERVICES2_PPI is stored
Return values
EFI_SUCCESSEDKII_PEI_MP_SERVICES2_PPI interface is returned
EFI_NOT_FOUNDEDKII_PEI_MP_SERVICES2_PPI interface is not found

Definition at line 148 of file PeiCpuExceptionHandlerUnitTest.c.

◆ InitializeBspIdt()

VOID * InitializeBspIdt ( VOID  )

Initialize Bsp Idt with a new Idt table and return the IA32_DESCRIPTOR buffer. In PEIM, store original PeiServicePointer before new Idt table.

Returns
Pointer to the allocated IA32_DESCRIPTOR buffer.

Definition at line 21 of file PeiCpuExceptionHandlerUnitTest.c.

◆ MpServicesUnitTestGetNumberOfProcessors()

EFI_STATUS MpServicesUnitTestGetNumberOfProcessors ( IN MP_SERVICES  MpServices,
OUT UINTN NumberOfProcessors,
OUT UINTN NumberOfEnabledProcessors 
)

Retrieve the number of logical processor in the platform and the number of those logical processors that are enabled on this boot.

Parameters
[in]MpServicesMP_SERVICES structure.
[out]NumberOfProcessorsPointer to the total number of logical processors in the system, including the BSP and disabled APs.
[out]NumberOfEnabledProcessorsPointer to the number of processors in the system that are enabled.
Return values
EFI_SUCCESSRetrieve the number of logical processor successfully
OthersRetrieve the number of logical processor unsuccessfully

Definition at line 58 of file PeiCpuExceptionHandlerUnitTest.c.

◆ MpServicesUnitTestStartupAllAPs()

EFI_STATUS MpServicesUnitTestStartupAllAPs ( IN MP_SERVICES  MpServices,
IN EFI_AP_PROCEDURE  Procedure,
IN BOOLEAN  SingleThread,
IN UINTN  TimeoutInMicroSeconds,
IN VOID *  ProcedureArgument 
)

Execute a caller provided function on all enabled APs.

Parameters
[in]MpServicesMP_SERVICES structure.
[in]ProcedurePointer to the function to be run on enabled APs of the system.
[in]SingleThreadIf 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]TimeoutInMicroSecondsIndicates the time limit in microseconds for APs to return from Procedure, for blocking mode only. Zero means infinity.
[in]ProcedureArgumentThe parameter passed into Procedure for all APs.
Return values
EFI_SUCCESSExecute a caller provided function on all enabled APs successfully
OthersExecute a caller provided function on all enabled APs unsuccessfully

Definition at line 110 of file PeiCpuExceptionHandlerUnitTest.c.

◆ MpServicesUnitTestStartupThisAP()

EFI_STATUS MpServicesUnitTestStartupThisAP ( IN MP_SERVICES  MpServices,
IN EFI_AP_PROCEDURE  Procedure,
IN UINTN  ProcessorNumber,
IN UINTN  TimeoutInMicroSeconds,
IN VOID *  ProcedureArgument 
)

Caller gets one enabled AP to execute a caller-provided function.

Parameters
[in]MpServicesMP_SERVICES structure.
[in]ProcedurePointer to the function to be run on enabled APs of the system.
[in]ProcessorNumberThe handle number of the AP.
[in]TimeoutInMicroSecondsIndicates the time limit in microseconds for APs to return from Procedure, for blocking mode only. Zero means infinity.
[in]ProcedureArgumentThe parameter passed into Procedure for all APs.
Return values
EFI_SUCCESSCaller gets one enabled AP to execute a caller-provided function successfully
OthersCaller gets one enabled AP to execute a caller-provided function unsuccessfully

Definition at line 82 of file PeiCpuExceptionHandlerUnitTest.c.

◆ MpServicesUnitTestWhoAmI()

EFI_STATUS MpServicesUnitTestWhoAmI ( IN MP_SERVICES  MpServices,
OUT UINTN ProcessorNumber 
)

Get the handle number for the calling processor.

Parameters
[in]MpServicesMP_SERVICES structure.
[out]ProcessorNumberThe handle number for the calling processor.
Return values
EFI_SUCCESSGet the handle number for the calling processor successfully.
OthersGet the handle number for the calling processor unsuccessfully.

Definition at line 131 of file PeiCpuExceptionHandlerUnitTest.c.

◆ PeiEntryPoint()

EFI_STATUS EFIAPI PeiEntryPoint ( IN EFI_PEI_FILE_HANDLE  FileHandle,
IN CONST EFI_PEI_SERVICES **  PeiServices 
)

Entry point of CpuExceptionHandlerPeiTest PEIM.

Parameters
[in]FileHandleHandle of the file being invoked.
[in]PeiServicesDescribes the list of possible PEI Services.
Return values
EFI_SUCCESSThe PEIM executed normally.

Definition at line 166 of file PeiCpuExceptionHandlerUnitTest.c.