iPXE
efi_mp.c File Reference

EFI multiprocessor API implementation. More...

#include <string.h>
#include <errno.h>
#include <ipxe/mp.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/Protocol/MpService.h>

Go to the source code of this file.

Data Structures

struct  efi_mp_func_data
 EFI multiprocessor function call data. More...

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 EFI_REQUEST_PROTOCOL (EFI_MP_SERVICES_PROTOCOL, &efimp)
static EFIAPI VOID efi_mp_call (VOID *buffer)
 Call multiprocessor function on current CPU.
static void efi_mp_exec_boot (mp_func_t func, void *opaque)
 Execute a multiprocessor function on the boot processor.
static void efi_mp_start_all (mp_func_t func, void *opaque)
 Start a multiprocessor function on all application processors.
 PROVIDE_MPAPI_INLINE (efi, mp_address)
 PROVIDE_MPAPI (efi, mp_exec_boot, efi_mp_exec_boot)
 PROVIDE_MPAPI (efi, mp_start_all, efi_mp_start_all)

Variables

static EFI_MP_SERVICES_PROTOCOLefimp
 Multiprocessor services protocol.

Detailed Description

EFI multiprocessor API implementation.

Definition in file efi_mp.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ EFI_REQUEST_PROTOCOL()

EFI_REQUEST_PROTOCOL ( EFI_MP_SERVICES_PROTOCOL ,
& efimp )

References efimp.

◆ efi_mp_call()

EFIAPI VOID efi_mp_call ( VOID * buffer)
static

Call multiprocessor function on current CPU.

Parameters
bufferMultiprocessor function call data

Definition at line 55 of file efi_mp.c.

55 {
57
58 /* Call multiprocessor function */
59 mp_call ( data->func, data->opaque );
60}
uint8_t data[48]
Additional event data.
Definition ena.h:11
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
Definition netvsc.h:5
void __asmcall mp_call(mp_addr_t func, mp_addr_t opaque)
Call a multiprocessor function from C code on the current CPU.
EFI multiprocessor function call data.
Definition efi_mp.c:39

References buffer, data, EFIAPI, mp_call(), and VOID.

Referenced by efi_mp_exec_boot(), and efi_mp_start_all().

◆ efi_mp_exec_boot()

void efi_mp_exec_boot ( mp_func_t func,
void * opaque )
static

Execute a multiprocessor function on the boot processor.

Parameters
funcMultiprocessor function
opaqueOpaque data pointer

Definition at line 68 of file efi_mp.c.

68 {
70
71 /* Construct call data */
72 data.func = mp_address ( func );
73 data.opaque = mp_address ( opaque );
74
75 /* Call multiprocesor function */
76 efi_mp_call ( &data );
77}
static mp_address(void *address)
Calculate address as seen by a multiprocessor function.
Definition bios_mp.h:27
static EFIAPI VOID efi_mp_call(VOID *buffer)
Call multiprocessor function on current CPU.
Definition efi_mp.c:55
mp_addr_t opaque
Opaque data pointer.
Definition efi_mp.c:43
mp_addr_t func
Multiprocessor function.
Definition efi_mp.c:41

References data, efi_mp_call(), efi_mp_func_data::func, mp_address(), and efi_mp_func_data::opaque.

Referenced by PROVIDE_MPAPI().

◆ efi_mp_start_all()

void efi_mp_start_all ( mp_func_t func,
void * opaque )
static

Start a multiprocessor function on all application processors.

Parameters
funcMultiprocessor function
opaqueOpaque data pointer

Definition at line 85 of file efi_mp.c.

85 {
87 EFI_STATUS efirc;
88 int rc;
89
90 /* Do nothing if MP services is not present */
91 if ( ! efimp ) {
92 DBGC ( func, "EFIMP has no multiprocessor services\n" );
93 return;
94 }
95
96 /* Construct call data */
97 data.func = mp_address ( func );
98 data.opaque = mp_address ( opaque );
99
100 /* Start up all application processors */
101 if ( ( efirc = efimp->StartupAllAPs ( efimp, efi_mp_call, FALSE, NULL,
102 0, &data, NULL ) ) != 0 ) {
103 rc = -EEFI ( efirc );
104 DBGC ( func, "EFIMP could not start APs: %s\n",
105 strerror ( rc ) );
106 return;
107 }
108}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
struct arbelprm_rc_send_wqe rc
Definition arbel.h:3
static EFI_MP_SERVICES_PROTOCOL * efimp
Multiprocessor services protocol.
Definition efi_mp.c:47
#define DBGC(...)
Definition compiler.h:505
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition efi.h:175
char * strerror(int errno)
Retrieve string representation of error number.
Definition strerror.c:79
#define FALSE
Definition tlan.h:45

References data, DBGC, EEFI, efi_mp_call(), efimp, FALSE, efi_mp_func_data::func, mp_address(), NULL, efi_mp_func_data::opaque, rc, and strerror().

Referenced by PROVIDE_MPAPI().

◆ PROVIDE_MPAPI_INLINE()

PROVIDE_MPAPI_INLINE ( efi ,
mp_address  )

References mp_address().

◆ PROVIDE_MPAPI() [1/2]

PROVIDE_MPAPI ( efi ,
mp_exec_boot ,
efi_mp_exec_boot  )

◆ PROVIDE_MPAPI() [2/2]

PROVIDE_MPAPI ( efi ,
mp_start_all ,
efi_mp_start_all  )

Variable Documentation

◆ efimp

EFI_MP_SERVICES_PROTOCOL* efimp
static

Multiprocessor services protocol.

Definition at line 47 of file efi_mp.c.

Referenced by efi_mp_start_all(), and EFI_REQUEST_PROTOCOL().