drivers/intel/fsp2_0: Add support for MP services2 PPI

Add support for MP services2 PPIs, which is slight modification
over MP services 1 PPIs. A new API StartupAllCPUs have been added
to allow running a task on BSP and all APs. Also the EFI_PEI_SERVICES
parameter has been removed from all MP PPI APIs.

This implementation also selects the respective MP services PPI version
supported for SoCs

BUG=b:169196864

Change-Id: Id74baf17fb90147d229c78be90268fdc3ec1badc
Signed-off-by: Aamir Bohra <aamir.bohra@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/49474
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Aamir Bohra 2021-02-04 20:57:51 +05:30 committed by Patrick Georgi
parent 5f262be24c
commit 30cca6ca2a
14 changed files with 527 additions and 89 deletions

View File

@ -268,7 +268,4 @@ config SOC_INTEL_COMMON_FSP_RESET
Common code block to handle platform reset request raised by FSP. The FSP
will use the FSP EAS v2.0 section 12.2.2 (OEM Status Code) to indicate that
a reset is required.
source "src/drivers/intel/fsp2_0/ppi/Kconfig"
endif

View File

@ -11,10 +11,36 @@
#include <efi/efi_datatype.h>
#include <fsp/soc_binding.h>
/*
* SOC must call this function to get required EFI_PEI_MP_SERVICES_PPI
* structure.
*/
efi_pei_mp_services_ppi *mp_fill_ppi_services_data(void);
/* SOC must call this function to get required EFI_PEI_MP_SERVICES_PPI structure */
void *mp_fill_ppi_services_data(void);
/* get the number of logical processors in the platform */
efi_return_status_t mp_get_number_of_processors(efi_uintn_t *number_of_processors,
efi_uintn_t *number_of_enabled_processors);
/* get processor info such as id, status */
efi_return_status_t mp_get_processor_info(efi_uintn_t processor_number,
efi_processor_information *processor_info_buffer);
/* executes a caller provided function on all enabled APs */
efi_return_status_t mp_startup_all_aps(efi_ap_procedure procedure,
efi_uintn_t timeout_usec, void *argument);
/* executes a caller provided function on all enabled APs + BSP */
efi_return_status_t mp_startup_all_cpus(efi_ap_procedure procedure,
efi_uintn_t timeout_usec, void *argument);
/* executes a caller provided function on specific AP */
efi_return_status_t mp_startup_this_ap(efi_ap_procedure procedure,
efi_uintn_t processor_number, efi_uintn_t timeout_usec, void *argument);
/* get the processor instance */
efi_return_status_t mp_identify_processor(efi_uintn_t *processor_number);
/* for the APIs that are not supported/required */
static inline efi_return_status_t mp_api_unsupported(void)
{
return FSP_UNSUPPORTED;
}
#endif /* MP_SERVICE_PPI_H */

View File

@ -5,7 +5,24 @@ config MP_SERVICES_PPI
default n
depends on SOC_INTEL_COMMON_BLOCK_CPU_MPINIT
help
This option allows SoC user to create MP service PPI for Intel
FSP usage, coreboot will provide EFI_PEI_MP_SERVICES_PPI structure
definitions along with all APIs as per EDK2 specification. Intel FSP
will use this PPI to run CPU feature programming on APs.
This option allows to create MP service PPI for Intel FSP usage.
Intel FSP will use this PPI to run CPU feature programming on APs.
config MP_SERVICES_PPI_V1
bool
default n
select MP_SERVICES_PPI
help
This option provides EFI_PEI_MP_SERVICES_PPI structure definitions
along with all APIs as per EDK2 specification.
config MP_SERVICES_PPI_V2
bool
default n
select MP_SERVICES_PPI
help
This option provides EDKII_PEI_MP_SERVICES2_PPI structure definitions
along with all APIs as per EDK2 specification. MP services2 PPI is slight
modification over MP services1 PPIs. A new API StartupAllCPUs have been
added to allow running a task on BSP and all APs. Also the EFI_PEI_SERVICES
parameter has been removed from all MP PPI APIs.

View File

@ -1,3 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
ramstage-$(CONFIG_MP_SERVICES_PPI) += mp_service_ppi.c
ramstage-$(CONFIG_MP_SERVICES_PPI_V1) += mp_service1.c
ramstage-$(CONFIG_MP_SERVICES_PPI_V2) += mp_service2.c

View File

@ -0,0 +1,76 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <fsp/api.h>
#include <fsp/ppi/mp_service_ppi.h>
#include <Ppi/MpServices.h>
typedef EFI_PEI_MP_SERVICES_PPI efi_pei_mp_services_ppi;
static efi_return_status_t mps1_get_number_of_processors(const
efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2,
efi_uintn_t *number_of_processors, efi_uintn_t *number_of_enabled_processors)
{
return mp_get_number_of_processors(number_of_processors, number_of_enabled_processors);
}
static efi_return_status_t mps1_get_processor_info(const
efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2,
efi_uintn_t processor_number,
efi_processor_information *processor_info_buffer)
{
return mp_get_processor_info(processor_number, processor_info_buffer);
}
static efi_return_status_t mps1_startup_all_aps(const
efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2,
efi_ap_procedure procedure, efi_boolean_t ignored3,
efi_uintn_t timeout_usec, void *argument)
{
return mp_startup_all_aps(procedure, timeout_usec, argument);
}
static efi_return_status_t mps1_startup_this_ap(const
efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2,
efi_ap_procedure procedure, efi_uintn_t processor_number,
efi_uintn_t timeout_usec, void *argument)
{
return mp_startup_this_ap(procedure, processor_number, timeout_usec, argument);
}
static efi_return_status_t mps1_switch_bsp(const efi_pei_services **ignored1,
efi_pei_mp_services_ppi *ignored2, efi_uintn_t ignored3,
efi_boolean_t ignored4)
{
return mp_api_unsupported();
}
static efi_return_status_t mps1_enable_disable_ap(const
efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2,
efi_uintn_t ignored3, efi_boolean_t ignored4, efi_uint32_t *ignored5)
{
return mp_api_unsupported();
}
static efi_return_status_t mps1_identify_processor(const
efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2,
efi_uintn_t *processor_number)
{
return mp_identify_processor(processor_number);
}
/* EDK2 UEFIPKG Open Source MP Service PPI to be installed */
static efi_pei_mp_services_ppi mp_service1_ppi = {
mps1_get_number_of_processors,
mps1_get_processor_info,
mps1_startup_all_aps,
mps1_startup_this_ap,
mps1_switch_bsp,
mps1_enable_disable_ap,
mps1_identify_processor,
};
void *mp_fill_ppi_services_data(void)
{
return (void *)&mp_service1_ppi;
}

View File

@ -0,0 +1,86 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <fsp/api.h>
#include <fsp/ppi/mp_service_ppi.h>
#include <Ppi/MpServices2.h>
typedef EDKII_PEI_MP_SERVICES2_PPI efi_pei_mp_services_ppi;
static efi_return_status_t mps2_get_number_of_processors(
efi_pei_mp_services_ppi *ignored1,
efi_uintn_t *number_of_processors,
efi_uintn_t *number_of_enabled_processors)
{
return mp_get_number_of_processors(number_of_processors, number_of_enabled_processors);
}
static efi_return_status_t mps2_get_processor_info(
efi_pei_mp_services_ppi *ignored1,
efi_uintn_t processor_number,
efi_processor_information *processor_info_buffer)
{
return mp_get_processor_info(processor_number, processor_info_buffer);
}
static efi_return_status_t mps2_startup_all_aps(
efi_pei_mp_services_ppi *ignored1,
efi_ap_procedure procedure, efi_boolean_t ignored2,
efi_uintn_t timeout_usec, void *argument)
{
return mp_startup_all_aps(procedure, timeout_usec, argument);
}
static efi_return_status_t mps2_startup_all_cpus(
efi_pei_mp_services_ppi *ignored1,
efi_ap_procedure procedure,
efi_uintn_t timeout_usec, void *argument)
{
return mp_startup_all_cpus(procedure, timeout_usec, argument);
}
static efi_return_status_t mps2_startup_this_ap(
efi_pei_mp_services_ppi *ignored1,
efi_ap_procedure procedure, efi_uintn_t processor_number,
efi_uintn_t timeout_usec, void *argument)
{
return mp_startup_this_ap(procedure, processor_number, timeout_usec, argument);
}
static efi_return_status_t mps2_switch_bsp(
efi_pei_mp_services_ppi *ignored1, efi_uintn_t ignored2,
efi_boolean_t ignored3)
{
return mp_api_unsupported();
}
static efi_return_status_t mps2_enable_disable_ap(
efi_pei_mp_services_ppi *ignored1,
efi_uintn_t ignored2, efi_boolean_t ignored3, efi_uint32_t *ignored4)
{
return mp_api_unsupported();
}
static efi_return_status_t mps2_identify_processor(
efi_pei_mp_services_ppi *ignored1,
efi_uintn_t *processor_number)
{
return mp_identify_processor(processor_number);
}
/* EDK2 UEFIPKG Open Source MP Services 2 PPI to be installed */
static efi_pei_mp_services_ppi mp_service2_ppi = {
mps2_get_number_of_processors,
mps2_get_processor_info,
mps2_startup_all_aps,
mps2_startup_this_ap,
mps2_switch_bsp,
mps2_enable_disable_ap,
mps2_identify_processor,
mps2_startup_all_cpus,
};
void *mp_fill_ppi_services_data(void)
{
return (void *)&mp_service2_ppi;
}

View File

@ -12,9 +12,7 @@
#define BSP_CPU_SLOT 0
#define SINGLE_CHIP_PACKAGE 0
static efi_return_status_t mp_get_number_of_processors(const
efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2,
efi_uintn_t *number_of_processors,
efi_return_status_t mp_get_number_of_processors(efi_uintn_t *number_of_processors,
efi_uintn_t *number_of_enabled_processors)
{
if (number_of_processors == NULL || number_of_enabled_processors ==
@ -27,9 +25,7 @@ static efi_return_status_t mp_get_number_of_processors(const
return FSP_SUCCESS;
}
static efi_return_status_t mp_get_processor_info(const
efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2,
efi_uintn_t processor_number,
efi_return_status_t mp_get_processor_info(efi_uintn_t processor_number,
efi_processor_information *processor_info_buffer)
{
unsigned int num_virt_cores, num_phys_cores;
@ -62,9 +58,7 @@ static efi_return_status_t mp_get_processor_info(const
return FSP_SUCCESS;
}
static efi_return_status_t mp_startup_all_aps(const
efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2,
efi_ap_procedure procedure, efi_boolean_t ignored3,
efi_return_status_t mp_startup_all_aps(efi_ap_procedure procedure,
efi_uintn_t timeout_usec, void *argument)
{
if (cpu_index() < 0)
@ -82,14 +76,34 @@ static efi_return_status_t mp_startup_all_aps(const
return FSP_SUCCESS;
}
static efi_return_status_t mp_startup_this_ap(const
efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2,
efi_ap_procedure procedure, efi_uintn_t processor_number,
efi_return_status_t mp_startup_all_cpus(efi_ap_procedure procedure,
efi_uintn_t timeout_usec, void *argument)
{
if (cpu_index() < 0)
return FSP_DEVICE_ERROR;
if (procedure == NULL)
return FSP_INVALID_PARAMETER;
/* Run on BSP */
procedure(argument);
/* Run on APs */
if (mp_run_on_aps((void *)procedure, argument,
MP_RUN_ON_ALL_CPUS, timeout_usec)) {
printk(BIOS_DEBUG, "%s: Exit with Failure\n", __func__);
return FSP_NOT_STARTED;
}
return FSP_SUCCESS;
}
efi_return_status_t mp_startup_this_ap(efi_ap_procedure procedure,
efi_uintn_t processor_number, efi_uintn_t timeout_usec, void *argument)
{
if (cpu_index() < 0)
return FSP_DEVICE_ERROR;
if (processor_number > get_cpu_count())
return FSP_NOT_FOUND;
@ -108,25 +122,7 @@ static efi_return_status_t mp_startup_this_ap(const
return FSP_SUCCESS;
}
static efi_return_status_t mp_switch_bsp(const efi_pei_services **ignored1,
efi_pei_mp_services_ppi *ignored2, efi_uintn_t ignored3,
efi_boolean_t ignored4)
{
/* FSP don't need this API hence return unsupported */
return FSP_UNSUPPORTED;
}
static efi_return_status_t mp_enable_disable_ap(const
efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2,
efi_uintn_t ignored3, efi_boolean_t ignored4, efi_uint32_t *ignored5)
{
/* FSP don't need this API hence return unsupported */
return FSP_UNSUPPORTED;
}
static efi_return_status_t mp_identify_processor(const
efi_pei_services **ignored1, efi_pei_mp_services_ppi *ignored2,
efi_uintn_t *processor_number)
efi_return_status_t mp_identify_processor(efi_uintn_t *processor_number)
{
int index;
@ -142,22 +138,3 @@ static efi_return_status_t mp_identify_processor(const
return FSP_SUCCESS;
}
/*
* EDK2 UEFIPKG Open Source MP Service PPI to be installed
*/
static efi_pei_mp_services_ppi mp_service_ppi = {
mp_get_number_of_processors,
mp_get_processor_info,
mp_startup_all_aps,
mp_startup_this_ap,
mp_switch_bsp,
mp_enable_disable_ap,
mp_identify_processor,
};
efi_pei_mp_services_ppi *mp_fill_ppi_services_data(void)
{
return &mp_service_ppi;
}

View File

@ -3,66 +3,44 @@
/* Create EFI equivalent datatype in coreboot based on UEFI specification */
#ifndef __EFI_DATATYPE_H__
#define __EFI_DATATYPE_H__
#include <Base.h>
#include <PiPei.h>
#include <Ppi/MpServices.h>
/* Basic Data types */
/* 8-byte unsigned value. */
typedef UINT64 efi_uint64_t;
/* 8-byte signed value. */
typedef INT64 efi_int64_t;
/* 4-byte unsigned value. */
typedef UINT32 efi_uint32_t;
/* 4-byte signed value. */
typedef INT32 efi_int32_t;
/* 2-byte unsigned value. */
typedef UINT16 efi_uint16_t;
/* 2-byte Character. */
typedef CHAR16 efi_char16_t;
/* 2-byte signed value. */
typedef INT16 efi_int16_t;
/* Logical Boolean. */
typedef BOOLEAN efi_boolean_t;
/* 1-byte unsigned value. */
typedef UINT8 efi_uint8_t;
/* 1-byte Character */
typedef CHAR8 efi_char8_t;
/* 1-byte signed value */
typedef INT8 efi_int8_t;
/* Unsigned value of native width. */
typedef UINTN efi_uintn_t;
/* Signed value of native width. */
typedef INTN efi_intn_t;
/* Status codes common to all execution phases */
typedef EFI_STATUS efi_return_status_t;
/* Data structure */
/* Data structure for EFI_PEI_SERVICE. */
typedef EFI_PEI_SERVICES efi_pei_services;
/* Data structure for UEFI PI Multi-processor PPI */
typedef EFI_PEI_MP_SERVICES_PPI efi_pei_mp_services_ppi;
/* Structure that describes information about a logical CPU. */
typedef EFI_PROCESSOR_INFORMATION efi_processor_information;
/*
* The function prototype for invoking a function on an
* Application Processor.

View File

@ -34,7 +34,7 @@ config CPU_SPECIFIC_OPTIONS
select INTEL_GMA_ADD_VBT if RUN_FSP_GOP
select IOAPIC
select INTEL_TME
select MP_SERVICES_PPI
select MP_SERVICES_PPI_V2
select MRC_SETTINGS_PROTECT
select PARALLEL_MP
select PARALLEL_MP_AP_WORK

View File

@ -26,7 +26,7 @@ config CPU_SPECIFIC_OPTIONS
select INTEL_GMA_ACPI
select INTEL_GMA_ADD_VBT if RUN_FSP_GOP
select IOAPIC
select MP_SERVICES_PPI
select MP_SERVICES_PPI_V1
select MRC_SETTINGS_PROTECT
select PARALLEL_MP
select PARALLEL_MP_AP_WORK

View File

@ -26,7 +26,7 @@ config CPU_SPECIFIC_OPTIONS
select INTEL_GMA_ACPI
select INTEL_GMA_ADD_VBT if RUN_FSP_GOP
select IOAPIC
select MP_SERVICES_PPI
select MP_SERVICES_PPI_V1
select MRC_SETTINGS_PROTECT
select PARALLEL_MP
select PARALLEL_MP_AP_WORK

View File

@ -27,7 +27,7 @@ config CPU_SPECIFIC_OPTIONS
select INTEL_GMA_ACPI
select INTEL_GMA_ADD_VBT if RUN_FSP_GOP
select IOAPIC
select MP_SERVICES_PPI
select MP_SERVICES_PPI_V1
select MRC_SETTINGS_PROTECT
select PARALLEL_MP
select PARALLEL_MP_AP_WORK

View File

@ -30,7 +30,7 @@ config CPU_SPECIFIC_OPTIONS
select INTEL_GMA_ACPI
select INTEL_GMA_ADD_VBT if RUN_FSP_GOP
select IOAPIC
select MP_SERVICES_PPI
select MP_SERVICES_PPI_V1
select MRC_SETTINGS_PROTECT
select PARALLEL_MP
select PARALLEL_MP_AP_WORK

View File

@ -0,0 +1,279 @@
/** @file
This file declares EDKII Multi-processor service PPI.
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __EDKII_PEI_MP_SERVICES2_PPI_H__
#define __EDKII_PEI_MP_SERVICES2_PPI_H__
#include <Ppi/MpServices.h>
#define EDKII_PEI_MP_SERVICES2_PPI_GUID \
{ \
0x5cb9cb3d, 0x31a4, 0x480c, { 0x94, 0x98, 0x29, 0xd2, 0x69, 0xba, 0xcf, 0xba} \
}
typedef struct _EDKII_PEI_MP_SERVICES2_PPI EDKII_PEI_MP_SERVICES2_PPI;
/**
Get the number of CPU's.
@param[in] This Pointer to this instance of the PPI.
@param[out] NumberOfProcessors Pointer to the total number of logical processors in
the system, including the BSP and disabled APs.
@param[out] NumberOfEnabledProcessors
Number of processors in the system that are enabled.
@retval EFI_SUCCESS The number of logical processors and enabled
logical processors was retrieved.
@retval EFI_DEVICE_ERROR The calling processor is an AP.
@retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL.
NumberOfEnabledProcessors is NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EDKII_PEI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS) (
IN EDKII_PEI_MP_SERVICES2_PPI *This,
OUT UINTN *NumberOfProcessors,
OUT UINTN *NumberOfEnabledProcessors
);
/**
Get information on a specific CPU.
@param[in] This Pointer to this instance of the PPI.
@param[in] ProcessorNumber Pointer to the total number of logical processors in
the system, including the BSP and disabled APs.
@param[out] ProcessorInfoBuffer Number of processors in the system that are enabled.
@retval EFI_SUCCESS Processor information was returned.
@retval EFI_DEVICE_ERROR The calling processor is an AP.
@retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL.
@retval EFI_NOT_FOUND The processor with the handle specified by
ProcessorNumber does not exist in the platform.
**/
typedef
EFI_STATUS
(EFIAPI *EDKII_PEI_MP_SERVICES_GET_PROCESSOR_INFO) (
IN EDKII_PEI_MP_SERVICES2_PPI *This,
IN UINTN ProcessorNumber,
OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer
);
/**
Activate all of the application proessors.
@param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.
@param[in] Procedure A pointer to the function to be run on enabled APs of
the system.
@param[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.
@param[in] TimeoutInMicroSeconds
Indicates the time limit in microseconds for APs to
return from Procedure, for blocking mode only. Zero
means infinity. If the timeout expires before all APs
return from Procedure, then Procedure on the failed APs
is terminated. All enabled APs are available for next
function assigned by EFI_PEI_MP_SERVICES_PPI.StartupAllAPs()
or EFI_PEI_MP_SERVICES_PPI.StartupThisAP(). If the
timeout expires in blocking mode, BSP returns
EFI_TIMEOUT.
@param[in] ProcedureArgument The parameter passed into Procedure for all APs.
@retval EFI_SUCCESS In blocking mode, all APs have finished before the
timeout expired.
@retval EFI_DEVICE_ERROR Caller processor is AP.
@retval EFI_NOT_STARTED No enabled APs exist in the system.
@retval EFI_NOT_READY Any enabled APs are busy.
@retval EFI_TIMEOUT In blocking mode, the timeout expired before all
enabled APs have finished.
@retval EFI_INVALID_PARAMETER Procedure is NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EDKII_PEI_MP_SERVICES_STARTUP_ALL_APS) (
IN EDKII_PEI_MP_SERVICES2_PPI *This,
IN EFI_AP_PROCEDURE Procedure,
IN BOOLEAN SingleThread,
IN UINTN TimeoutInMicroSeconds,
IN VOID *ProcedureArgument OPTIONAL
);
/**
Activate a specific application processor.
@param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.
@param[in] Procedure A pointer to the function to be run on enabled APs of
the system.
@param[in] ProcessorNumber The handle number of the 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
EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors().
@param[in] TimeoutInMicroSeconds
Indicates the time limit in microseconds for APs to
return from Procedure, for blocking mode only. Zero
means infinity. If the timeout expires before all APs
return from Procedure, then Procedure on the failed APs
is terminated. All enabled APs are available for next
function assigned by EFI_PEI_MP_SERVICES_PPI.StartupAllAPs()
or EFI_PEI_MP_SERVICES_PPI.StartupThisAP(). If the
timeout expires in blocking mode, BSP returns
EFI_TIMEOUT.
@param[in] ProcedureArgument The parameter passed into Procedure for all APs.
@retval EFI_SUCCESS In blocking mode, specified AP finished before the
timeout expires.
@retval EFI_DEVICE_ERROR The calling processor is an AP.
@retval EFI_TIMEOUT In blocking mode, the timeout expired before the
specified AP has finished.
@retval EFI_NOT_FOUND The processor with the handle specified by
ProcessorNumber does not exist.
@retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP or disabled AP.
@retval EFI_INVALID_PARAMETER Procedure is NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EDKII_PEI_MP_SERVICES_STARTUP_THIS_AP) (
IN EDKII_PEI_MP_SERVICES2_PPI *This,
IN EFI_AP_PROCEDURE Procedure,
IN UINTN ProcessorNumber,
IN UINTN TimeoutInMicroseconds,
IN VOID *ProcedureArgument OPTIONAL
);
/**
Switch the boot strap processor.
@param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.
@param[in] ProcessorNumber The handle number of the 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
EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors().
@param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an enabled
AP. Otherwise, it will be disabled.
@retval EFI_SUCCESS BSP successfully switched.
@retval EFI_UNSUPPORTED Switching the BSP cannot be completed prior to this
service returning.
@retval EFI_UNSUPPORTED Switching the BSP is not supported.
@retval EFI_DEVICE_ERROR The calling processor is an AP.
@retval EFI_NOT_FOUND The processor with the handle specified by
ProcessorNumber does not exist.
@retval EFI_INVALID_PARAMETER ProcessorNumber specifies the current BSP or a disabled
AP.
@retval EFI_NOT_READY The specified AP is busy.
**/
typedef
EFI_STATUS
(EFIAPI *EDKII_PEI_MP_SERVICES_SWITCH_BSP) (
IN EDKII_PEI_MP_SERVICES2_PPI *This,
IN UINTN ProcessorNumber,
IN BOOLEAN EnableOldBSP
);
/**
Enable or disable an application processor.
@param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.
@param[in] ProcessorNumber The handle number of the 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
EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors().
@param[in] EnableAP Specifies the new state for the processor for enabled,
FALSE for disabled.
@param[in] HealthFlag If not NULL, a pointer to a value that specifies the
new health status of the AP. This flag corresponds to
StatusFlag defined in EFI_PEI_MP_SERVICES_PPI.GetProcessorInfo().
Only the PROCESSOR_HEALTH_STATUS_BIT is used. All other
bits are ignored. If it is NULL, this parameter is
ignored.
@retval EFI_SUCCESS The specified AP was enabled or disabled successfully.
@retval EFI_UNSUPPORTED Enabling or disabling an AP cannot be completed prior
to this service returning.
@retval EFI_UNSUPPORTED Enabling or disabling an AP is not supported.
@retval EFI_DEVICE_ERROR The calling processor is an AP.
@retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber
does not exist.
@retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.
**/
typedef
EFI_STATUS
(EFIAPI *EDKII_PEI_MP_SERVICES_ENABLEDISABLEAP) (
IN EDKII_PEI_MP_SERVICES2_PPI *This,
IN UINTN ProcessorNumber,
IN BOOLEAN EnableAP,
IN UINT32 *HealthFlag OPTIONAL
);
/**
Identify the currently executing processor.
@param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.
@param[out] ProcessorNumber The handle number of the 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
EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors().
@retval EFI_SUCCESS The current processor handle number was returned in
ProcessorNumber.
@retval EFI_INVALID_PARAMETER ProcessorNumber is NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EDKII_PEI_MP_SERVICES_WHOAMI) (
IN EDKII_PEI_MP_SERVICES2_PPI *This,
OUT UINTN *ProcessorNumber
);
/**
Activate all of the application proessors.
@param[in] This A pointer to the EDKII_PEI_MP_SERVICES2_PPI instance.
@param[in] Procedure A pointer to the function to be run on enabled APs of
the system.
@param[in] TimeoutInMicroSeconds
Indicates the time limit in microseconds for APs to
return from Procedure, for blocking mode only. Zero
means infinity. If the timeout expires in blocking
mode, BSP returns EFI_TIMEOUT.
@param[in] ProcedureArgument The parameter passed into Procedure for all CPUs.
@retval EFI_SUCCESS In blocking mode, all APs have finished before the
timeout expired.
@retval EFI_DEVICE_ERROR Caller processor is AP.
@retval EFI_NOT_READY Any enabled APs are busy.
@retval EFI_TIMEOUT In blocking mode, the timeout expired before all
enabled APs have finished.
@retval EFI_INVALID_PARAMETER Procedure is NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EDKII_PEI_MP_SERVICES_STARTUP_ALL_CPUS) (
IN EDKII_PEI_MP_SERVICES2_PPI *This,
IN EFI_AP_PROCEDURE Procedure,
IN UINTN TimeoutInMicroSeconds,
IN VOID *ProcedureArgument OPTIONAL
);
struct _EDKII_PEI_MP_SERVICES2_PPI {
EDKII_PEI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS GetNumberOfProcessors;
EDKII_PEI_MP_SERVICES_GET_PROCESSOR_INFO GetProcessorInfo;
EDKII_PEI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs;
EDKII_PEI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP;
EDKII_PEI_MP_SERVICES_SWITCH_BSP SwitchBSP;
EDKII_PEI_MP_SERVICES_ENABLEDISABLEAP EnableDisableAP;
EDKII_PEI_MP_SERVICES_WHOAMI WhoAmI;
EDKII_PEI_MP_SERVICES_STARTUP_ALL_CPUS StartupAllCPUs;
};
extern EFI_GUID gEdkiiPeiMpServices2PpiGuid;
#endif