iPXE
Functions | Variables
efi_init.c File Reference
#include <string.h>
#include <errno.h>
#include <endian.h>
#include <ipxe/init.h>
#include <ipxe/rotate.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/efi_table.h>
#include <ipxe/efi/efi_driver.h>
#include <ipxe/efi/efi_path.h>
#include <ipxe/efi/efi_cmdline.h>
#include <ipxe/efi/Protocol/LoadedImage.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER)
 
EFI_SYSTEM_TABLE_C2 (PLATFORM, _systab)
 System table passed to entry point. More...
 
static EFI_STATUS EFIAPI efi_unload (EFI_HANDLE image_handle __unused)
 Shut down EFI environment. More...
 
static EFIAPI void efi_shutdown_hook (EFI_EVENT event __unused, void *context __unused)
 Shut down in preparation for booting an OS. More...
 
unsigned long efi_stack_cookie (EFI_HANDLE handle)
 Construct a stack cookie value. More...
 
EFI_STATUS efi_init (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab)
 Initialise EFI environment. More...
 
void __stack_chk_fail (void)
 Abort on stack check failure. More...
 
void efi_raise_tpl (struct efi_saved_tpl *tpl)
 Raise task priority level to internal level. More...
 
void efi_restore_tpl (struct efi_saved_tpl *tpl)
 Restore task priority level. More...
 

Variables

EFI_HANDLE efi_image_handle
 Image handle passed to entry point. More...
 
EFI_LOADED_IMAGE_PROTOCOLefi_loaded_image
 Loaded image protocol for this image. More...
 
EFI_DEVICE_PATH_PROTOCOLefi_loaded_image_path
 Device path for the loaded image's device handle. More...
 
EFI_TPL efi_internal_tpl = TPL_CALLBACK
 Internal task priority level. More...
 
EFI_TPL efi_external_tpl = TPL_APPLICATION
 External task priority level. More...
 
int efi_shutdown_in_progress
 EFI shutdown is in progress. More...
 
static EFI_EVENT efi_shutdown_event
 Event used to signal shutdown. More...
 
unsigned long __stack_chk_guard
 Stack cookie. More...
 
static EFI_EXIT efi_exit
 Exit function. More...
 

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER  )

◆ _C2()

EFI_SYSTEM_TABLE* _C2 ( PLATFORM  ,
_systab   
)

System table passed to entry point.

We construct the symbol name efi_systab via the PLATFORM macro. This ensures that the symbol is defined only in EFI builds, and so prevents EFI code from being incorrectly linked in to a non-EFI build.

◆ efi_unload()

static EFI_STATUS EFIAPI efi_unload ( EFI_HANDLE image_handle  __unused)
static

Shut down EFI environment.

Parameters
image_handleImage handle

Definition at line 318 of file efi_init.c.

318  {
320  EFI_SYSTEM_TABLE *systab = efi_systab;
321  struct efi_saved_tpl tpl;
322 
323  DBGC ( systab, "EFI image unloading\n" );
324 
325  /* Raise TPL */
326  efi_raise_tpl ( &tpl );
327 
328  /* Shut down */
329  shutdown_exit();
330 
331  /* Disconnect any remaining devices */
333 
334  /* Uninstall driver binding protocol */
336 
337  /* Uninstall exit boot services event */
339 
340  /* Free copy of loaded image's device handle's device path */
342 
343  DBGC ( systab, "EFI image unloaded\n" );
344 
345  /* Restore TPL */
346  efi_restore_tpl ( &tpl );
347 
348  return 0;
349 }
void efi_driver_uninstall(void)
Uninstall EFI driver.
Definition: efi_driver.c:420
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
void efi_raise_tpl(struct efi_saved_tpl *tpl)
Raise task priority level to internal level.
Definition: efi_init.c:382
#define DBGC(...)
Definition: compiler.h:505
EFI_CLOSE_EVENT CloseEvent
Definition: UefiSpec.h:1958
EFI_DEVICE_PATH_PROTOCOL * efi_loaded_image_path
Device path for the loaded image's device handle.
Definition: efi_init.c:41
static EFI_EVENT efi_shutdown_event
Event used to signal shutdown.
Definition: efi_init.c:62
static void shutdown_exit(void)
Shut down system for exit back to firmware.
Definition: init.h:85
EFI Boot Services Table.
Definition: UefiSpec.h:1930
void efi_driver_disconnect_all(void)
Disconnect EFI driver from all possible devices.
Definition: efi_driver.c:647
EFI System Table.
Definition: UefiSpec.h:2043
EFI_FREE_POOL FreePool
Definition: UefiSpec.h:1949
An EFI saved task priority level.
Definition: efi.h:79
EFI_SYSTEM_TABLE * efi_systab
void efi_restore_tpl(struct efi_saved_tpl *tpl)
Restore task priority level.
Definition: efi_init.c:398

References EFI_SYSTEM_TABLE::BootServices, EFI_BOOT_SERVICES::CloseEvent, DBGC, efi_driver_disconnect_all(), efi_driver_uninstall(), efi_loaded_image_path, efi_raise_tpl(), efi_restore_tpl(), efi_shutdown_event, efi_systab, EFI_BOOT_SERVICES::FreePool, and shutdown_exit().

Referenced by efi_init().

◆ efi_shutdown_hook()

static EFIAPI void efi_shutdown_hook ( EFI_EVENT event  __unused,
void *context  __unused 
)
static

Shut down in preparation for booting an OS.

This hook gets called at ExitBootServices time in order to make sure that everything is properly shut down before the OS takes over.

Definition at line 84 of file efi_init.c.

85  {
86 
87  /* This callback is invoked at TPL_NOTIFY in order to ensure
88  * that we have an opportunity to shut down cleanly before
89  * other shutdown hooks perform destructive operations such as
90  * disabling the IOMMU.
91  *
92  * Modify the internal task priority level so that no code
93  * attempts to raise from TPL_NOTIFY to TPL_CALLBACK (which
94  * would trigger a fatal exception).
95  */
97 
98  /* Mark shutdown as being in progress, to indicate that large
99  * parts of the system (e.g. timers) are no longer functional.
100  */
102 
103  /* Shut down iPXE */
104  shutdown_boot();
105 }
EFI_TPL efi_internal_tpl
Internal task priority level.
Definition: efi_init.c:53
#define TPL_NOTIFY
Definition: UefiSpec.h:649
static void shutdown_boot(void)
Shut down system for OS boot.
Definition: init.h:77
int efi_shutdown_in_progress
EFI shutdown is in progress.
Definition: efi_init.c:59

References efi_internal_tpl, efi_shutdown_in_progress, shutdown_boot(), and TPL_NOTIFY.

Referenced by efi_init().

◆ efi_stack_cookie()

unsigned long efi_stack_cookie ( EFI_HANDLE  handle)

Construct a stack cookie value.

Parameters
handleImage handle
Return values
cookieStack cookie

Definition at line 114 of file efi_init.c.

114  {
115  unsigned long cookie = 0;
116  unsigned int rotation = ( 8 * sizeof ( cookie ) / 4 );
117 
118  /* There is no viable source of entropy available at this
119  * point. Construct a value that is at least likely to vary
120  * between platforms and invocations.
121  */
122  cookie ^= ( ( unsigned long ) handle );
123  cookie = roll ( cookie, rotation );
124  cookie ^= ( ( unsigned long ) &handle );
125  cookie = roll ( cookie, rotation );
126  cookie ^= profile_timestamp();
127  cookie = roll ( cookie, rotation );
128  cookie ^= build_id;
129 
130  /* Ensure that the value contains a NUL byte, to act as a
131  * runaway string terminator. Construct the NUL using a shift
132  * rather than a mask, to avoid losing valuable entropy in the
133  * lower-order bits.
134  */
135  cookie <<= 8;
136 
137  /* Ensure that the NUL byte is placed at the bottom of the
138  * stack cookie, to avoid potential disclosure via an
139  * unterminated string.
140  */
141  if ( __BYTE_ORDER == __BIG_ENDIAN )
142  cookie >>= 8;
143 
144  return cookie;
145 }
#define __BYTE_ORDER
Definition: endian.h:6
unsigned long build_id
Build ID.
Definition: version.c:61
#define __BIG_ENDIAN
Constant representing big-endian byte order.
Definition: endian.h:21
static unsigned int rotation
Definition: rotate.h:22
unsigned long profile_timestamp(void)
uint16_t handle
Handle.
Definition: smbios.h:16

References __BIG_ENDIAN, __BYTE_ORDER, build_id, handle, profile_timestamp(), and rotation.

Referenced by efi_init_stack_guard().

◆ efi_init()

EFI_STATUS efi_init ( EFI_HANDLE  image_handle,
EFI_SYSTEM_TABLE systab 
)

Initialise EFI environment.

Parameters
image_handleImage handle
systabSystem table
Return values
efircEFI return status code

Definition at line 154 of file efi_init.c.

155  {
156  EFI_BOOT_SERVICES *bs;
157  struct efi_protocol *prot;
158  struct efi_config_table *tab;
160  void *device_path_copy;
161  size_t device_path_len;
162  EFI_STATUS efirc;
163  int rc;
164 
165  /* Store image handle and system table pointer for future use */
166  efi_image_handle = image_handle;
167  efi_systab = systab;
168 
169  /* Sanity checks */
170  if ( ! systab ) {
171  efirc = EFI_NOT_AVAILABLE_YET;
172  goto err_sanity;
173  }
174  if ( ! systab->ConOut ) {
175  efirc = EFI_NOT_AVAILABLE_YET;
176  goto err_sanity;
177  }
178  if ( ! systab->BootServices ) {
179  DBGC ( systab, "EFI provided no BootServices entry point\n" );
180  efirc = EFI_NOT_AVAILABLE_YET;
181  goto err_sanity;
182  }
183  if ( ! systab->RuntimeServices ) {
184  DBGC ( systab, "EFI provided no RuntimeServices entry "
185  "point\n" );
186  efirc = EFI_NOT_AVAILABLE_YET;
187  goto err_sanity;
188  }
189  DBGC ( systab, "EFI handle %p systab %p\n", image_handle, systab );
190  bs = systab->BootServices;
191 
192  /* Store abort function pointer */
193  efi_exit = bs->Exit;
194 
195  /* Look up used protocols */
197  if ( ( efirc = bs->LocateProtocol ( &prot->guid, NULL,
198  prot->protocol ) ) == 0 ) {
199  DBGC ( systab, "EFI protocol %s is at %p\n",
200  efi_guid_ntoa ( &prot->guid ),
201  *(prot->protocol) );
202  } else {
203  DBGC ( systab, "EFI does not provide protocol %s\n",
204  efi_guid_ntoa ( &prot->guid ) );
205  /* Fail if protocol is required */
206  if ( prot->required )
207  goto err_missing_protocol;
208  }
209  }
210 
211  /* Look up used configuration tables */
213  if ( ( *(tab->table) = efi_find_table ( &tab->guid ) ) ) {
214  DBGC ( systab, "EFI configuration table %s is at %p\n",
215  efi_guid_ntoa ( &tab->guid ), *(tab->table) );
216  } else {
217  DBGC ( systab, "EFI does not provide configuration "
218  "table %s\n", efi_guid_ntoa ( &tab->guid ) );
219  if ( tab->required ) {
220  efirc = EFI_NOT_AVAILABLE_YET;
221  goto err_missing_table;
222  }
223  }
224  }
225 
226  /* Get loaded image protocol
227  *
228  * We assume that our loaded image protocol will not be
229  * uninstalled while our image code is still running.
230  */
231  if ( ( rc = efi_open_unsafe ( image_handle,
233  &efi_loaded_image ) ) != 0 ) {
234  DBGC ( systab, "EFI could not get loaded image protocol: %s",
235  strerror ( rc ) );
236  efirc = EFIRC ( rc );
237  goto err_no_loaded_image;
238  }
239  DBGC ( systab, "EFI image base address %p\n",
241 
242  /* Record command line */
245 
246  /* Get loaded image's device handle's device path */
249  &device_path ) ) != 0 ) {
250  DBGC ( systab, "EFI could not get loaded image's device path: "
251  "%s", strerror ( rc ) );
252  efirc = EFIRC ( rc );
253  goto err_no_device_path;
254  }
255 
256  /* Make a copy of the loaded image's device handle's device
257  * path, since the device handle itself may become invalidated
258  * when we load our own drivers.
259  */
260  device_path_len = ( efi_path_len ( device_path ) +
261  sizeof ( EFI_DEVICE_PATH_PROTOCOL ) );
262  if ( ( efirc = bs->AllocatePool ( EfiBootServicesData, device_path_len,
263  &device_path_copy ) ) != 0 ) {
264  rc = -EEFI ( efirc );
265  goto err_alloc_device_path;
266  }
267  memcpy ( device_path_copy, device_path, device_path_len );
268  efi_loaded_image_path = device_path_copy;
269  DBGC ( systab, "EFI image device path %s\n",
271 
272  /* EFI is perfectly capable of gracefully shutting down any
273  * loaded devices if it decides to fall back to a legacy boot.
274  * For no particularly comprehensible reason, it doesn't
275  * bother doing so when ExitBootServices() is called.
276  */
277  if ( ( efirc = bs->CreateEvent ( EVT_SIGNAL_EXIT_BOOT_SERVICES,
279  NULL, &efi_shutdown_event ) ) != 0 ) {
280  rc = -EEFI ( efirc );
281  DBGC ( systab, "EFI could not create ExitBootServices event: "
282  "%s\n", strerror ( rc ) );
283  goto err_create_event;
284  }
285 
286  /* Install driver binding protocol */
287  if ( ( rc = efi_driver_install() ) != 0 ) {
288  DBGC ( systab, "EFI could not install driver: %s\n",
289  strerror ( rc ) );
290  efirc = EFIRC ( rc );
291  goto err_driver_install;
292  }
293 
294  /* Install image unload method */
296 
297  return 0;
298 
300  err_driver_install:
302  err_create_event:
304  err_alloc_device_path:
305  err_no_device_path:
306  err_no_loaded_image:
307  err_missing_table:
308  err_missing_protocol:
309  err_sanity:
310  return efirc;
311 }
void efi_driver_uninstall(void)
Uninstall EFI driver.
Definition: efi_driver.c:420
union edd_device_path device_path
Device path.
Definition: edd.h:24
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
void ** protocol
Variable containing pointer to protocol structure.
Definition: efi.h:91
EFI_LOADED_IMAGE_PROTOCOL * efi_loaded_image
Loaded image protocol for this image.
Definition: efi_init.c:38
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:174
const wchar_t * efi_cmdline
EFI command line (may not be wNUL-terminated.
Definition: efi_cmdline.c:45
EFI_LOCATE_PROTOCOL LocateProtocol
Definition: UefiSpec.h:2008
#define efi_open_unsafe(handle, protocol, interface)
Open protocol for unsafe persistent use.
Definition: efi.h:458
EFI_GUID guid
GUID.
Definition: efi.h:89
#define DBGC(...)
Definition: compiler.h:505
EFI_GUID efi_loaded_image_protocol_guid
Loaded image protocol GUID.
Definition: efi_guid.c:272
size_t efi_path_len(EFI_DEVICE_PATH_PROTOCOL *path)
Find length of device path (excluding terminator)
Definition: efi_path.c:173
EFI_CLOSE_EVENT CloseEvent
Definition: UefiSpec.h:1958
VOID * ImageBase
The base address at which the image was loaded.
Definition: LoadedImage.h:69
This protocol can be used on any device handle to obtain generic path/location information concerning...
Definition: DevicePath.h:45
#define TPL_NOTIFY
Definition: UefiSpec.h:649
#define EFI_PROTOCOLS
EFI protocol table.
Definition: efi.h:97
#define EVT_SIGNAL_EXIT_BOOT_SERVICES
Definition: UefiSpec.h:455
#define EFI_CONFIG_TABLES
EFI configuration table table.
Definition: efi.h:141
An EFI configuration table used by iPXE.
Definition: efi.h:131
EFI_DEVICE_PATH_PROTOCOL * efi_loaded_image_path
Device path for the loaded image's device handle.
Definition: efi_init.c:41
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define EFI_NOT_AVAILABLE_YET
If this value is returned by an API, it means the capability is not yet installed/available/ready to ...
Definition: PiMultiPhase.h:56
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL * ConOut
A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface that is associated with ConsoleOutHandle.
Definition: UefiSpec.h:2079
static EFI_EVENT efi_shutdown_event
Event used to signal shutdown.
Definition: efi_init.c:62
static EFIAPI void efi_shutdown_hook(EFI_EVENT event __unused, void *context __unused)
Shut down in preparation for booting an OS.
Definition: efi_init.c:84
EFI_CREATE_EVENT CreateEvent
Definition: UefiSpec.h:1954
const char * efi_devpath_text(EFI_DEVICE_PATH_PROTOCOL *path)
Get textual representation of device path.
Definition: efi_debug.c:247
VOID * LoadOptions
A pointer to the image's binary load options.
Definition: LoadedImage.h:64
An EFI protocol used by iPXE.
Definition: efi.h:87
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
EFI Boot Services Table.
Definition: UefiSpec.h:1930
EFI_HANDLE efi_image_handle
Image handle passed to entry point.
Definition: efi_init.c:35
EFI_IMAGE_UNLOAD Unload
Definition: LoadedImage.h:73
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
Definition: tables.h:385
#define efi_open(handle, protocol, interface)
Open protocol for ephemeral use.
Definition: efi.h:443
EFI_GUID efi_device_path_protocol_guid
Device path protocol GUID.
Definition: efi_guid.c:168
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:725
EFI_FREE_POOL FreePool
Definition: UefiSpec.h:1949
void ** table
Variable containing pointer to configuration table.
Definition: efi.h:135
UINT32 LoadOptionsSize
The size in bytes of LoadOptions.
Definition: LoadedImage.h:63
int required
Protocol is required.
Definition: efi.h:93
EFI_RUNTIME_SERVICES * RuntimeServices
A pointer to the EFI Runtime Services Table.
Definition: UefiSpec.h:2094
EFI_GUID guid
GUID.
Definition: efi.h:133
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
static EFI_EXIT efi_exit
Exit function.
Definition: efi_init.c:72
EFI_SYSTEM_TABLE * efi_systab
size_t efi_cmdline_len
Length of EFI command line (in bytes)
Definition: efi_cmdline.c:48
The data portions of a loaded Boot Serves Driver, and the default data allocation type used by a Boot...
int required
Table is required for operation.
Definition: efi.h:137
static EFI_STATUS EFIAPI efi_unload(EFI_HANDLE image_handle)
Shut down EFI environment.
Definition: efi_init.c:318
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
void * efi_find_table(EFI_GUID *guid)
Look up EFI configuration table.
Definition: efi_table.c:44
int efi_driver_install(void)
Install EFI driver.
Definition: efi_driver.c:387
#define EFIRC(rc)
Convert an iPXE status code to an EFI status code.
Definition: efi.h:166
EFI_HANDLE DeviceHandle
The device handle that the EFI Image was loaded from.
Definition: LoadedImage.h:55
EFI_ALLOCATE_POOL AllocatePool
Definition: UefiSpec.h:1948

References EFI_BOOT_SERVICES::AllocatePool, EFI_SYSTEM_TABLE::BootServices, EFI_BOOT_SERVICES::CloseEvent, EFI_SYSTEM_TABLE::ConOut, EFI_BOOT_SERVICES::CreateEvent, DBGC, device_path, EFI_LOADED_IMAGE_PROTOCOL::DeviceHandle, EEFI, efi_cmdline, efi_cmdline_len, EFI_CONFIG_TABLES, efi_device_path_protocol_guid, efi_devpath_text(), efi_driver_install(), efi_driver_uninstall(), efi_exit, efi_find_table(), efi_guid_ntoa(), efi_image_handle, efi_loaded_image, efi_loaded_image_path, efi_loaded_image_protocol_guid, EFI_NOT_AVAILABLE_YET, efi_open, efi_open_unsafe, efi_path_len(), EFI_PROTOCOLS, efi_shutdown_event, efi_shutdown_hook(), efi_systab, efi_unload(), EfiBootServicesData, EFIRC, EVT_SIGNAL_EXIT_BOOT_SERVICES, EFI_BOOT_SERVICES::Exit, for_each_table_entry, EFI_BOOT_SERVICES::FreePool, efi_protocol::guid, efi_config_table::guid, EFI_LOADED_IMAGE_PROTOCOL::ImageBase, EFI_LOADED_IMAGE_PROTOCOL::LoadOptions, EFI_LOADED_IMAGE_PROTOCOL::LoadOptionsSize, EFI_BOOT_SERVICES::LocateProtocol, memcpy(), NULL, efi_protocol::protocol, rc, efi_protocol::required, efi_config_table::required, EFI_SYSTEM_TABLE::RuntimeServices, strerror(), efi_config_table::table, TPL_NOTIFY, and EFI_LOADED_IMAGE_PROTOCOL::Unload.

Referenced by _efi_start(), and _efidrv_start().

◆ __stack_chk_fail()

void __stack_chk_fail ( void  )

Abort on stack check failure.

Definition at line 355 of file efi_init.c.

355  {
356  EFI_STATUS efirc;
357  int rc;
358 
359  /* Report failure (when debugging) */
360  DBGC ( efi_systab, "EFI stack check failed (cookie %#lx); aborting\n",
362 
363  /* Attempt to exit cleanly with an error status */
364  if ( efi_exit ) {
366  0, NULL );
367  rc = -EEFI ( efirc );
368  DBGC ( efi_systab, "EFI stack check exit failed: %s\n",
369  strerror ( rc ) );
370  }
371 
372  /* If the exit fails for any reason, lock the system */
373  while ( 1 ) {}
374 
375 }
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:174
#define DBGC(...)
Definition: compiler.h:505
#define EFI_COMPROMISED_DATA
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:145
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
EFI_HANDLE efi_image_handle
Image handle passed to entry point.
Definition: efi_init.c:35
unsigned long __stack_chk_guard
Stack cookie.
Definition: efi_init.c:65
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
static EFI_EXIT efi_exit
Exit function.
Definition: efi_init.c:72
EFI_SYSTEM_TABLE * efi_systab
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321

References __stack_chk_guard, DBGC, EEFI, EFI_COMPROMISED_DATA, efi_exit, efi_image_handle, efi_systab, NULL, rc, and strerror().

◆ efi_raise_tpl()

void efi_raise_tpl ( struct efi_saved_tpl tpl)

Raise task priority level to internal level.

Parameters
tplSaved TPL

Definition at line 382 of file efi_init.c.

382  {
384 
385  /* Record current external TPL */
386  tpl->previous = efi_external_tpl;
387 
388  /* Raise TPL and record previous TPL as new external TPL */
389  tpl->current = bs->RaiseTPL ( efi_internal_tpl );
390  efi_external_tpl = tpl->current;
391 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
EFI_RAISE_TPL RaiseTPL
Definition: UefiSpec.h:1939
EFI_TPL efi_internal_tpl
Internal task priority level.
Definition: efi_init.c:53
EFI_TPL current
Current external TPL.
Definition: efi.h:81
EFI Boot Services Table.
Definition: UefiSpec.h:1930
EFI_TPL previous
Previous external TPL.
Definition: efi.h:83
EFI_SYSTEM_TABLE * efi_systab
EFI_TPL efi_external_tpl
External task priority level.
Definition: efi_init.c:56

References EFI_SYSTEM_TABLE::BootServices, efi_saved_tpl::current, efi_external_tpl, efi_internal_tpl, efi_systab, efi_saved_tpl::previous, and EFI_BOOT_SERVICES::RaiseTPL.

Referenced by _efidrv_start(), efi_driver_start(), efi_driver_stop(), efi_snp_add_claim(), efi_snp_get_status(), efi_snp_initialize(), efi_snp_receive(), efi_snp_reset(), efi_snp_shutdown(), efi_snp_transmit(), efi_snp_wait_for_packet(), efi_unload(), efi_usb_async_interrupt_transfer(), efi_usb_bulk_transfer(), efi_usb_control_transfer(), efi_usb_get_string_descriptor(), efi_usb_sync_interrupt_transfer(), efi_vlan_find(), efi_vlan_remove(), and efi_vlan_set().

◆ efi_restore_tpl()

void efi_restore_tpl ( struct efi_saved_tpl tpl)

Restore task priority level.

Parameters
tplSaved TPL

Definition at line 398 of file efi_init.c.

398  {
400 
401  /* Restore external TPL */
402  efi_external_tpl = tpl->previous;
403 
404  /* Restore TPL */
405  bs->RestoreTPL ( tpl->current );
406 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
EFI_TPL current
Current external TPL.
Definition: efi.h:81
EFI Boot Services Table.
Definition: UefiSpec.h:1930
EFI_TPL previous
Previous external TPL.
Definition: efi.h:83
EFI_SYSTEM_TABLE * efi_systab
EFI_RESTORE_TPL RestoreTPL
Definition: UefiSpec.h:1940
EFI_TPL efi_external_tpl
External task priority level.
Definition: efi_init.c:56

References EFI_SYSTEM_TABLE::BootServices, efi_saved_tpl::current, efi_external_tpl, efi_systab, efi_saved_tpl::previous, and EFI_BOOT_SERVICES::RestoreTPL.

Referenced by _efidrv_start(), efi_driver_start(), efi_driver_stop(), efi_snp_add_claim(), efi_snp_get_status(), efi_snp_initialize(), efi_snp_receive(), efi_snp_reset(), efi_snp_shutdown(), efi_snp_transmit(), efi_snp_wait_for_packet(), efi_unload(), efi_usb_async_interrupt_transfer(), efi_usb_bulk_transfer(), efi_usb_control_transfer(), efi_usb_get_string_descriptor(), efi_usb_sync_interrupt_transfer(), efi_vlan_find(), efi_vlan_remove(), and efi_vlan_set().

Variable Documentation

◆ efi_image_handle

EFI_HANDLE efi_image_handle

◆ efi_loaded_image

EFI_LOADED_IMAGE_PROTOCOL* efi_loaded_image

◆ efi_loaded_image_path

EFI_DEVICE_PATH_PROTOCOL* efi_loaded_image_path

Device path for the loaded image's device handle.

Definition at line 41 of file efi_init.c.

Referenced by efi_init(), efi_init_application(), efi_local_open_volume(), efi_path_net_probe(), and efi_unload().

◆ efi_internal_tpl

EFI_TPL efi_internal_tpl = TPL_CALLBACK

Internal task priority level.

Definition at line 53 of file efi_init.c.

Referenced by efi_connect(), efi_currticks(), efi_disconnect(), efi_entropy_disable(), efi_raise_tpl(), efi_shutdown_hook(), and nii_issue_cpb_db().

◆ efi_external_tpl

EFI_TPL efi_external_tpl = TPL_APPLICATION

External task priority level.

Definition at line 56 of file efi_init.c.

Referenced by efi_connect(), efi_currticks(), efi_disconnect(), efi_entropy_enable(), efi_raise_tpl(), and efi_restore_tpl().

◆ efi_shutdown_in_progress

int efi_shutdown_in_progress

◆ efi_shutdown_event

EFI_EVENT efi_shutdown_event
static

Event used to signal shutdown.

Definition at line 62 of file efi_init.c.

Referenced by efi_init(), and efi_unload().

◆ __stack_chk_guard

unsigned long __stack_chk_guard

Stack cookie.

Definition at line 65 of file efi_init.c.

Referenced by __stack_chk_fail(), and efi_init_stack_guard().

◆ efi_exit

EFI_EXIT efi_exit
static

Exit function.

Cached to minimise external dependencies when a stack check failure is triggered.

Definition at line 72 of file efi_init.c.

Referenced by __stack_chk_fail(), and efi_init().