iPXE
Functions | Variables
efiprefix.c File Reference
#include <stdlib.h>
#include <errno.h>
#include <ipxe/device.h>
#include <ipxe/init.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/efi_driver.h>
#include <ipxe/efi/efi_snp.h>
#include <ipxe/efi/efi_autoboot.h>
#include <ipxe/efi/efi_autoexec.h>
#include <ipxe/efi/efi_cachedhcp.h>
#include <ipxe/efi/efi_watchdog.h>
#include <ipxe/efi/efi_veto.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER)
 
EFI_STATUS EFIAPI _efi_start (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab)
 EFI entry point. More...
 
static void efi_init_application (void)
 Initialise EFI application. More...
 
struct init_fn efi_init_application_fn __init_fn (INIT_NORMAL)
 EFI application initialisation function. More...
 
static int efi_probe (struct root_device *rootdev __unused)
 Probe EFI root bus. More...
 
static void efi_remove (struct root_device *rootdev __unused)
 Remove EFI root bus. More...
 

Variables

static struct root_driver efi_root_driver
 EFI root device driver. More...
 
struct root_device efi_root_device __root_device
 EFI root device. More...
 

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER  )

◆ _efi_start()

EFI_STATUS EFIAPI _efi_start ( EFI_HANDLE  image_handle,
EFI_SYSTEM_TABLE systab 
)

EFI entry point.

Parameters
image_handleImage handle
systabSystem table
Return values
efircEFI return status code

Definition at line 42 of file efiprefix.c.

43  {
44  EFI_STATUS efirc;
45  int rc;
46 
47  /* Initialise stack cookie */
48  efi_init_stack_guard ( image_handle );
49 
50  /* Initialise EFI environment */
51  if ( ( efirc = efi_init ( image_handle, systab ) ) != 0 )
52  goto err_init;
53 
54  /* Claim SNP devices for use by iPXE */
55  efi_snp_claim();
56 
57  /* Start watchdog holdoff timer */
59 
60  /* Call to main() */
61  if ( ( rc = main() ) != 0 ) {
62  efirc = EFIRC ( rc );
63  goto err_main;
64  }
65 
66  err_main:
69  efi_loaded_image->Unload ( image_handle );
71  err_init:
72  return efirc;
73 }
EFI_LOADED_IMAGE_PROTOCOL * efi_loaded_image
Loaded image protocol for this image.
Definition: efi_init.c:36
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
static void efi_init_stack_guard(EFI_HANDLE handle)
Initialise stack cookie.
Definition: efi.h:322
static void efi_snp_claim(void)
Claim network devices for use by iPXE.
Definition: efi_snp.h:88
void efi_driver_reconnect_all(void)
Reconnect original EFI drivers to all possible devices.
Definition: efi_driver.c:595
static void efi_watchdog_start(void)
Start EFI watchdog holdoff timer.
Definition: efi_watchdog.h:17
static void efi_watchdog_stop(void)
Stop EFI watchdog holdoff timer.
Definition: efi_watchdog.h:26
EFI_IMAGE_UNLOAD Unload
Definition: LoadedImage.h:79
static void efi_snp_release(void)
Release network devices for use via SNP.
Definition: efi_snp.h:96
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:35
EFI_STATUS efi_init(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab)
Initialise EFI environment.
Definition: efi_init.c:170
__asmcall int main(void)
Main entry point.
Definition: main.c:28
#define EFIRC(rc)
Convert an iPXE status code to an EFI status code.
Definition: efi.h:154

References efi_driver_reconnect_all(), efi_init(), efi_init_stack_guard(), efi_loaded_image, efi_snp_claim(), efi_snp_release(), efi_watchdog_start(), efi_watchdog_stop(), EFIRC, main(), rc, and EFI_LOADED_IMAGE_PROTOCOL::Unload.

◆ efi_init_application()

static void efi_init_application ( void  )
static

Initialise EFI application.

Definition at line 79 of file efiprefix.c.

79  {
81 
82  /* Identify autoboot device, if any */
84 
85  /* Store cached DHCP packet, if any */
87 
88  /* Load autoexec script, if any */
90 }
EFI_LOADED_IMAGE_PROTOCOL * efi_loaded_image
Loaded image protocol for this image.
Definition: efi_init.c:36
int efi_cachedhcp_record(EFI_HANDLE device)
Record cached DHCP packet.
Definition: efi_cachedhcp.c:45
A hardware device.
Definition: device.h:73
int efi_set_autoboot_ll_addr(EFI_HANDLE device)
Identify autoboot device.
Definition: efi_autoboot.c:45
Definition: efi.h:50
EFI_HANDLE DeviceHandle
The device handle that the EFI Image was loaded from.
Definition: LoadedImage.h:61
int efi_autoexec_load(EFI_HANDLE device)
Load autoexec script.
Definition: efi_autoexec.c:59

References EFI_LOADED_IMAGE_PROTOCOL::DeviceHandle, efi_autoexec_load(), efi_cachedhcp_record(), efi_loaded_image, and efi_set_autoboot_ll_addr().

◆ __init_fn()

struct init_fn efi_init_application_fn __init_fn ( INIT_NORMAL  )

EFI application initialisation function.

◆ efi_probe()

static int efi_probe ( struct root_device *rootdev  __unused)
static

Probe EFI root bus.

Parameters
rootdevEFI root device

Definition at line 102 of file efiprefix.c.

102  {
103 
104  /* Remove any vetoed drivers */
105  efi_veto();
106 
107  /* Connect our drivers */
108  return efi_driver_connect_all();
109 }
int efi_driver_connect_all(void)
Connect EFI driver to all possible devices.
Definition: efi_driver.c:573
void efi_veto(void)
Remove any vetoed drivers.
Definition: efi_veto.c:561

References efi_driver_connect_all(), and efi_veto().

◆ efi_remove()

static void efi_remove ( struct root_device *rootdev  __unused)
static

Remove EFI root bus.

Parameters
rootdevEFI root device

Definition at line 116 of file efiprefix.c.

116  {
117 
118  /* Disconnect our drivers */
120 }
void efi_driver_disconnect_all(void)
Disconnect EFI driver from all possible devices.
Definition: efi_driver.c:584

References efi_driver_disconnect_all().

Variable Documentation

◆ efi_root_driver

struct root_driver efi_root_driver
static
Initial value:
= {
.probe = efi_probe,
.remove = efi_remove,
}
static void efi_remove(struct root_device *rootdev __unused)
Remove EFI root bus.
Definition: efiprefix.c:116
static int efi_probe(struct root_device *rootdev __unused)
Probe EFI root bus.
Definition: efiprefix.c:102

EFI root device driver.

Definition at line 123 of file efiprefix.c.

◆ __root_device

struct root_device efi_root_device __root_device
Initial value:
= {
.dev = { .name = "EFI" },
.driver = &efi_root_driver,
}
static struct root_driver efi_root_driver
EFI root device driver.
Definition: efiprefix.c:123

EFI root device.

Definition at line 129 of file efiprefix.c.