iPXE
Data Structures | Functions | Variables
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. More...
 
static void efi_mp_exec_boot (mp_func_t func, void *opaque)
 Execute a multiprocessor function on the boot processor. More...
 
static void efi_mp_start_all (mp_func_t func, void *opaque)
 Start a multiprocessor function on all application processors. More...
 
 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. More...
 

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 
)

◆ efi_mp_call()

static 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  {
56  struct efi_mp_func_data *data = buffer;
57 
58  /* Call multiprocessor function */
59  mp_call ( data->func, data->opaque );
60 }
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
Definition: netvsc.h:16
void __asmcall mp_call(mp_addr_t func, mp_addr_t opaque)
Call a multiprocessor function from C code on the current CPU.
uint8_t data[48]
Additional event data.
Definition: ena.h:22
EFI multiprocessor function call data.
Definition: efi_mp.c:39

References buffer, data, and mp_call().

Referenced by efi_mp_exec_boot(), and efi_mp_start_all().

◆ efi_mp_exec_boot()

static 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  {
69  struct efi_mp_func_data data;
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 }
mp_addr_t opaque
Opaque data pointer.
Definition: efi_mp.c:43
mp_addr_t func
Multiprocessor function.
Definition: efi_mp.c:41
static mp_address(void *address)
Calculate address as seen by a multiprocessor function.
Definition: efi_mp.h:25
static EFIAPI VOID efi_mp_call(VOID *buffer)
Call multiprocessor function on current CPU.
Definition: efi_mp.c:55
uint8_t data[48]
Additional event data.
Definition: ena.h:22
EFI multiprocessor function call data.
Definition: efi_mp.c:39

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

◆ efi_mp_start_all()

static 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  {
86  struct efi_mp_func_data data;
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 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition: efi.h:171
mp_addr_t opaque
Opaque data pointer.
Definition: efi_mp.c:43
mp_addr_t func
Multiprocessor function.
Definition: efi_mp.c:41
#define DBGC(...)
Definition: compiler.h:505
static mp_address(void *address)
Calculate address as seen by a multiprocessor function.
Definition: efi_mp.h:25
static EFI_MP_SERVICES_PROTOCOL * efimp
Multiprocessor services protocol.
Definition: efi_mp.c:47
EFI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs
Definition: MpService.h:667
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
static EFIAPI VOID efi_mp_call(VOID *buffer)
Call multiprocessor function on current CPU.
Definition: efi_mp.c:55
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
uint8_t data[48]
Additional event data.
Definition: ena.h:22
#define FALSE
Definition: tlan.h:45
EFI multiprocessor function call data.
Definition: efi_mp.c:39
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321

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

◆ PROVIDE_MPAPI_INLINE()

PROVIDE_MPAPI_INLINE ( efi  ,
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().