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

Go to the source code of this file.

Macros

#define UNIT_TEST_NAME   "EfiMpServiceProtocol Unit Test"
 
#define UNIT_TEST_VERSION   "0.1"
 

Functions

EFI_STATUS MpServicesUnitTestGetMpServices (OUT MP_SERVICES *MpServices)
 
EFI_STATUS MpServicesUnitTestGetNumberOfProcessors (IN MP_SERVICES MpServices, OUT UINTN *NumberOfProcessors, OUT UINTN *NumberOfEnabledProcessors)
 
EFI_STATUS MpServicesUnitTestGetProcessorInfo (IN MP_SERVICES MpServices, IN UINTN ProcessorNumber, OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer)
 
EFI_STATUS MpServicesUnitTestStartupAllAPs (IN MP_SERVICES MpServices, IN EFI_AP_PROCEDURE Procedure, IN BOOLEAN SingleThread, IN UINTN TimeoutInMicroSeconds, IN VOID *ProcedureArgument)
 
EFI_STATUS MpServicesUnitTestStartupThisAP (IN MP_SERVICES MpServices, IN EFI_AP_PROCEDURE Procedure, IN UINTN ProcessorNumber, IN UINTN TimeoutInMicroSeconds, IN VOID *ProcedureArgument)
 
EFI_STATUS MpServicesUnitTestSwitchBSP (IN MP_SERVICES MpServices, IN UINTN ProcessorNumber, IN BOOLEAN EnableOldBSP)
 
EFI_STATUS MpServicesUnitTestEnableDisableAP (IN MP_SERVICES MpServices, IN UINTN ProcessorNumber, IN BOOLEAN EnableAP, IN UINT32 *HealthFlag)
 
EFI_STATUS MpServicesUnitTestWhoAmI (IN MP_SERVICES MpServices, OUT UINTN *ProcessorNumber)
 
EFI_STATUS EFIAPI EfiMpServiceProtocolUnitTest (VOID)
 
EFI_STATUS EFIAPI DxeEntryPoint (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Detailed Description

PEI Module to test EfiMpServiceProtocol.

Copyright (c) 2022, Intel Corporation. All rights reserved.

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

Definition in file EfiMpServiceProtocolUnitTest.c.

Macro Definition Documentation

◆ UNIT_TEST_NAME

#define UNIT_TEST_NAME   "EfiMpServiceProtocol Unit Test"

Definition at line 14 of file EfiMpServiceProtocolUnitTest.c.

◆ UNIT_TEST_VERSION

#define UNIT_TEST_VERSION   "0.1"

Definition at line 15 of file EfiMpServiceProtocolUnitTest.c.

Function Documentation

◆ DxeEntryPoint()

EFI_STATUS EFIAPI DxeEntryPoint ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Standard DXE driver or UEFI application entry point for unit test execution from DXE or UEFI Shell. Initialize the unit test framework, suite, and unit tests for the EfiMpServiceProtocol and run the unit test.

Parameters
[in]ImageHandleThe firmware allocated handle for the EFI image.
[in]SystemTableA pointer to the EFI System Table.

Definition at line 254 of file EfiMpServiceProtocolUnitTest.c.

◆ EfiMpServiceProtocolUnitTest()

EFI_STATUS EFIAPI EfiMpServiceProtocolUnitTest ( VOID  )

Initialize the unit test framework, suite and unit tests for the EfiMpServiceProtocol and run the unit tests.

Return values
EFI_SUCCESSInitialize the unit test framework, suite, unit tests and run the unit tests successfully.
OthersInitialize the unit test framework, suite, unit tests or run the unit tests unsuccessfully.

Definition at line 198 of file EfiMpServiceProtocolUnitTest.c.

◆ MpServicesUnitTestEnableDisableAP()

EFI_STATUS MpServicesUnitTestEnableDisableAP ( IN MP_SERVICES  MpServices,
IN UINTN  ProcessorNumber,
IN BOOLEAN  EnableAP,
IN UINT32 *  HealthFlag 
)

Caller enables or disables an AP from this point onward.

Parameters
[in]MpServicesMP_SERVICES structure.
[in]ProcessorNumberThe handle number of the AP.
[in]EnableAPSpecifies the new state for the processor for enabled, FALSE for disabled.
[in]HealthFlagIf not NULL, a pointer to a value that specifies the new health status of the AP.
Return values
EFI_SUCCESSCaller enables or disables an AP successfully.
OthersCaller enables or disables an AP unsuccessfully.

Definition at line 161 of file EfiMpServiceProtocolUnitTest.c.

◆ MpServicesUnitTestGetMpServices()

EFI_STATUS MpServicesUnitTestGetMpServices ( OUT MP_SERVICES MpServices)

Get EFI_MP_SERVICES_PROTOCOL pointer.

Parameters
[out]MpServicesPointer to the buffer where EFI_MP_SERVICES_PROTOCOL is stored
Return values
EFI_SUCCESSEFI_MP_SERVICES_PROTOCOL interface is returned
EFI_NOT_FOUNDEFI_MP_SERVICES_PROTOCOL interface is not found

Definition at line 26 of file EfiMpServiceProtocolUnitTest.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 46 of file EfiMpServiceProtocolUnitTest.c.

◆ MpServicesUnitTestGetProcessorInfo()

EFI_STATUS MpServicesUnitTestGetProcessorInfo ( IN MP_SERVICES  MpServices,
IN UINTN  ProcessorNumber,
OUT EFI_PROCESSOR_INFORMATION ProcessorInfoBuffer 
)

Get detailed information on the requested logical processor.

Parameters
[in]MpServicesMP_SERVICES structure.
[in]ProcessorNumberThe handle number of the processor.
[out]ProcessorInfoBufferPointer to the buffer where the processor information is stored.
Return values
EFI_SUCCESSGet information on the requested logical processor successfully
OthersGet information on the requested logical processor unsuccessfully

Definition at line 66 of file EfiMpServiceProtocolUnitTest.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 92 of file EfiMpServiceProtocolUnitTest.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 118 of file EfiMpServiceProtocolUnitTest.c.

◆ MpServicesUnitTestSwitchBSP()

EFI_STATUS MpServicesUnitTestSwitchBSP ( IN MP_SERVICES  MpServices,
IN UINTN  ProcessorNumber,
IN BOOLEAN  EnableOldBSP 
)

Switch the requested AP to be the BSP from that point onward.

Parameters
[in]MpServicesMP_SERVICES structure.
[in]ProcessorNumberThe handle number of AP that is to become the new BSP.
[in]EnableOldBSPIf TRUE, the old BSP will be listed as an enabled AP. Otherwise, it will be disabled.
Return values
EFI_SUCCESSSwitch the requested AP to be the BSP successfully
OthersSwitch the requested AP to be the BSP unsuccessfully

Definition at line 140 of file EfiMpServiceProtocolUnitTest.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 181 of file EfiMpServiceProtocolUnitTest.c.