iPXE
|
#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_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... | |
static void * | efi_find_table (EFI_GUID *guid) |
Look up EFI configuration table. 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_PROTOCOL * | efi_loaded_image |
Loaded image protocol for this image. More... | |
EFI_DEVICE_PATH_PROTOCOL * | efi_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... | |
FILE_LICENCE | ( | GPL2_OR_LATER | ) |
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.
|
static |
Shut down EFI environment.
image_handle | Image handle |
Definition at line 335 of file efi_init.c.
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().
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 83 of file efi_init.c.
References efi_internal_tpl, efi_shutdown_in_progress, shutdown_boot(), and TPL_NOTIFY.
Referenced by efi_init().
|
static |
Look up EFI configuration table.
guid | Configuration table GUID |
table | Configuration table, or NULL |
Definition at line 112 of file efi_init.c.
References EFI_SYSTEM_TABLE::ConfigurationTable, efi_systab, guid, memcmp(), NULL, EFI_SYSTEM_TABLE::NumberOfTableEntries, EFI_CONFIGURATION_TABLE::VendorGuid, and EFI_CONFIGURATION_TABLE::VendorTable.
Referenced by efi_init().
unsigned long efi_stack_cookie | ( | EFI_HANDLE | handle | ) |
Construct a stack cookie value.
handle | Image handle |
cookie | Stack cookie |
Definition at line 131 of file efi_init.c.
References __BIG_ENDIAN, __BYTE_ORDER, build_id, handle, profile_timestamp(), and rotation.
Referenced by efi_init_stack_guard().
EFI_STATUS efi_init | ( | EFI_HANDLE | image_handle, |
EFI_SYSTEM_TABLE * | systab | ||
) |
Initialise EFI environment.
image_handle | Image handle |
systab | System table |
efirc | EFI return status code |
Definition at line 171 of file efi_init.c.
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_PROTOCOL_GET_PROTOCOL, 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_BOOT_SERVICES::OpenProtocol, 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().
void __stack_chk_fail | ( | void | ) |
Abort on stack check failure.
Definition at line 372 of file efi_init.c.
References __stack_chk_guard, DBGC, EEFI, EFI_COMPROMISED_DATA, efi_exit, efi_image_handle, efi_systab, NULL, rc, and strerror().
void efi_raise_tpl | ( | struct efi_saved_tpl * | tpl | ) |
Raise task priority level to internal level.
tpl | Saved TPL |
Definition at line 399 of file efi_init.c.
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().
void efi_restore_tpl | ( | struct efi_saved_tpl * | tpl | ) |
Restore task priority level.
tpl | Saved TPL |
Definition at line 415 of file efi_init.c.
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().
EFI_HANDLE efi_image_handle |
Image handle passed to entry point.
Definition at line 34 of file efi_init.c.
Referenced by __stack_chk_fail(), chained_locate(), chained_supported(), efi_block_exec(), efi_block_local(), efi_block_match(), efi_block_root(), efi_block_scan(), efi_cachedhcp_record(), efi_child_add(), efi_child_del(), efi_console_init(), efi_driver_install(), efi_driver_uninstall(), efi_dump_image(), efi_file_install(), efi_file_uninstall(), efi_handle_name(), efi_image_exec(), efi_image_probe(), efi_init(), efi_local_open_root(), efi_locate_device(), efi_service_add(), efi_service_del(), efi_set_autoboot_ll_addr(), efi_shim_inhibit_pxe(), efi_snp_probe(), efi_snp_remove(), efi_veto_find(), efi_veto_uninstall(), efidev_alloc(), efipci_close(), efipci_discover_one(), efipci_open(), efipci_root_close(), efipci_root_open(), mnpnet_start(), mnpnet_stop(), nii_pci_close(), nii_pci_open(), nii_start(), nii_stop(), snpnet_start(), snpnet_stop(), snpnet_supported(), usbio_close(), usbio_open(), usbio_path(), usbio_start(), usbio_stop(), and usbio_supported().
EFI_LOADED_IMAGE_PROTOCOL* efi_loaded_image |
Loaded image protocol for this image.
Definition at line 37 of file efi_init.c.
Referenced by _efi_start(), chained_locate(), efi_autoexec_filesystem(), efi_autoexec_load(), efi_autoexec_network(), efi_init(), efi_init_application(), and efi_local_open_path().
EFI_DEVICE_PATH_PROTOCOL* efi_loaded_image_path |
Device path for the loaded image's device handle.
Definition at line 40 of file efi_init.c.
Referenced by efi_init(), efi_init_application(), efi_local_open_volume(), efi_path_net_probe(), and efi_unload().
EFI_TPL efi_internal_tpl = TPL_CALLBACK |
Internal task priority level.
Definition at line 52 of file efi_init.c.
Referenced by efi_currticks(), efi_entropy_disable(), efi_raise_tpl(), efi_shutdown_hook(), and nii_issue_cpb_db().
EFI_TPL efi_external_tpl = TPL_APPLICATION |
External task priority level.
Definition at line 55 of file efi_init.c.
Referenced by efi_currticks(), efi_entropy_enable(), efi_raise_tpl(), and efi_restore_tpl().
int efi_shutdown_in_progress |
EFI shutdown is in progress.
Definition at line 58 of file efi_init.c.
Referenced by efi_block_unhook(), efi_cpu_nap(), efi_currticks(), efi_pxe_uninstall(), efi_shutdown_hook(), efi_snp_hii_uninstall(), efi_snp_remove(), efi_usb_uninstall(), mnpnet_close(), mnpnet_poll(), mnpnet_stop(), mnpnet_transmit(), snpnet_close(), snpnet_poll(), snpnet_stop(), snpnet_transmit(), usbio_endpoint_enqueue(), and usbio_endpoint_poll().
|
static |
Event used to signal shutdown.
Definition at line 61 of file efi_init.c.
Referenced by efi_init(), and efi_unload().
unsigned long __stack_chk_guard |
Stack cookie.
Definition at line 64 of file efi_init.c.
Referenced by __stack_chk_fail(), and efi_init_stack_guard().
|
static |
Exit function.
Cached to minimise external dependencies when a stack check failure is triggered.
Definition at line 71 of file efi_init.c.
Referenced by __stack_chk_fail(), and efi_init().