115 unsigned long cookie = 0;
116 unsigned int rotation = ( 8 *
sizeof ( cookie ) / 4 );
122 cookie ^= ( (
unsigned long )
handle );
124 cookie ^= ( (
unsigned long ) &
handle );
160 void *device_path_copy;
161 size_t device_path_len;
179 DBGC ( systab,
"EFI provided no BootServices entry point\n" );
184 DBGC ( systab,
"EFI provided no RuntimeServices entry " 189 DBGC ( systab,
"EFI handle %p systab %p\n", image_handle, systab );
199 DBGC ( systab,
"EFI protocol %s is at %p\n",
203 DBGC ( systab,
"EFI does not provide protocol %s\n",
207 goto err_missing_protocol;
214 DBGC ( systab,
"EFI configuration table %s is at %p\n",
217 DBGC ( systab,
"EFI does not provide configuration " 221 goto err_missing_table;
234 DBGC ( systab,
"EFI could not get loaded image protocol: %s",
237 goto err_no_loaded_image;
239 DBGC ( systab,
"EFI image base address %p\n",
250 DBGC ( systab,
"EFI could not get loaded image's device path: " 253 goto err_no_device_path;
263 &device_path_copy ) ) != 0 ) {
265 goto err_alloc_device_path;
269 DBGC ( systab,
"EFI image device path %s\n",
281 DBGC ( systab,
"EFI could not create ExitBootServices event: " 283 goto err_create_event;
288 DBGC ( systab,
"EFI could not install driver: %s\n",
291 goto err_driver_install;
304 err_alloc_device_path:
308 err_missing_protocol:
323 DBGC ( systab,
"EFI image unloading\n" );
343 DBGC ( systab,
"EFI image unloaded\n" );
360 DBGC (
efi_systab,
"EFI stack check failed (cookie %#lx); aborting\n",
void efi_driver_uninstall(void)
Uninstall EFI driver.
union edd_device_path device_path
Device path.
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
void ** protocol
Variable containing pointer to protocol structure.
EFI_LOADED_IMAGE_PROTOCOL * efi_loaded_image
Loaded image protocol for this image.
struct arbelprm_rc_send_wqe rc
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
const wchar_t * efi_cmdline
EFI command line (may not be wNUL-terminated.
EFI_LOCATE_PROTOCOL LocateProtocol
void efi_raise_tpl(struct efi_saved_tpl *tpl)
Raise task priority level to internal level.
#define efi_open_unsafe(handle, protocol, interface)
Open protocol for unsafe persistent use.
EFI_GUID efi_loaded_image_protocol_guid
Loaded image protocol GUID.
size_t efi_path_len(EFI_DEVICE_PATH_PROTOCOL *path)
Find length of device path (excluding terminator)
EFI_CLOSE_EVENT CloseEvent
VOID * ImageBase
The base address at which the image was loaded.
This protocol can be used on any device handle to obtain generic path/location information concerning...
EFI_TPL efi_internal_tpl
Internal task priority level.
#define EFI_PROTOCOLS
EFI protocol table.
FILE_LICENCE(GPL2_OR_LATER)
#define EVT_SIGNAL_EXIT_BOOT_SERVICES
UEFI 2.0 Loaded image protocol definition.
#define EFI_CONFIG_TABLES
EFI configuration table table.
An EFI configuration table used by iPXE.
EFI_STATUS(EFIAPI * EFI_EXIT)(IN EFI_HANDLE ImageHandle, IN EFI_STATUS ExitStatus, IN UINTN ExitDataSize, IN CHAR16 *ExitData OPTIONAL)
Terminates a loaded EFI image and returns control to boot services.
EFI_DEVICE_PATH_PROTOCOL * efi_loaded_image_path
Device path for the loaded image's device handle.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
EFI configuration tables.
#define EFI_NOT_AVAILABLE_YET
If this value is returned by an API, it means the capability is not yet installed/available/ready to ...
Can be used on any image handle to obtain information about the loaded image.
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL * ConOut
A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface that is associated with ConsoleOutHandle.
static EFI_EVENT efi_shutdown_event
Event used to signal shutdown.
unsigned long build_id
Build ID.
EFI_TPL current
Current external TPL.
static EFIAPI void efi_shutdown_hook(EFI_EVENT event __unused, void *context __unused)
Shut down in preparation for booting an OS.
#define EFI_COMPROMISED_DATA
Enumeration of EFI_STATUS.
#define __unused
Declare a variable or data structure as unused.
EFI_CREATE_EVENT CreateEvent
static void shutdown_exit(void)
Shut down system for exit back to firmware.
const char * efi_devpath_text(EFI_DEVICE_PATH_PROTOCOL *path)
Get textual representation of device path.
VOID * LoadOptions
A pointer to the image's binary load options.
#define __BIG_ENDIAN
Constant representing big-endian byte order.
An EFI protocol used by iPXE.
char * strerror(int errno)
Retrieve string representation of error number.
EFI_HANDLE efi_image_handle
Image handle passed to entry point.
void efi_driver_disconnect_all(void)
Disconnect EFI driver from all possible devices.
EFI_TPL previous
Previous external TPL.
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
#define efi_open(handle, protocol, interface)
Open protocol for ephemeral use.
unsigned long __stack_chk_guard
Stack cookie.
static unsigned int rotation
EFI_GUID efi_device_path_protocol_guid
Device path protocol GUID.
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
void ** table
Variable containing pointer to configuration table.
UINT32 LoadOptionsSize
The size in bytes of LoadOptions.
int required
Protocol is required.
EFI_RUNTIME_SERVICES * RuntimeServices
A pointer to the EFI Runtime Services Table.
UINTN EFI_TPL
Task priority level.
An EFI saved task priority level.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
unsigned long profile_timestamp(void)
EFI_STATUS efi_init(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab)
Initialise EFI environment.
static EFI_EXIT efi_exit
Exit function.
EFI_SYSTEM_TABLE * efi_systab
EFI_SYSTEM_TABLE * _C2(PLATFORM, _systab)
System table passed to entry point.
size_t efi_cmdline_len
Length of EFI command line (in bytes)
EFI_RESTORE_TPL RestoreTPL
The data portions of a loaded Boot Serves Driver, and the default data allocation type used by a Boot...
unsigned long efi_stack_cookie(EFI_HANDLE handle)
Construct a stack cookie value.
int required
Table is required for operation.
static EFI_STATUS EFIAPI efi_unload(EFI_HANDLE image_handle)
Shut down EFI environment.
void __stack_chk_fail(void)
Abort on stack check failure.
static void shutdown_boot(void)
Shut down system for OS boot.
void efi_restore_tpl(struct efi_saved_tpl *tpl)
Restore task priority level.
#define NULL
NULL pointer (VOID *)
void * efi_find_table(EFI_GUID *guid)
Look up EFI configuration table.
int efi_driver_install(void)
Install EFI driver.
#define EFIRC(rc)
Convert an iPXE status code to an EFI status code.
EFI_HANDLE DeviceHandle
The device handle that the EFI Image was loaded from.
EFI_ALLOCATE_POOL AllocatePool
int efi_shutdown_in_progress
EFI shutdown is in progress.
EFI_TPL efi_external_tpl
External task priority level.