132 unsigned long cookie = 0;
133 unsigned int rotation = ( 8 *
sizeof ( cookie ) / 4 );
139 cookie ^= ( (
unsigned long )
handle );
141 cookie ^= ( (
unsigned long ) &
handle );
178 void *device_path_copy;
179 size_t device_path_len;
197 DBGC ( systab,
"EFI provided no BootServices entry point\n" );
202 DBGC ( systab,
"EFI provided no RuntimeServices entry " 207 DBGC ( systab,
"EFI handle %p systab %p\n", image_handle, systab );
217 DBGC ( systab,
"EFI protocol %s is at %p\n",
221 DBGC ( systab,
"EFI does not provide protocol %s\n",
225 goto err_missing_protocol;
232 DBGC ( systab,
"EFI configuration table %s is at %p\n",
235 DBGC ( systab,
"EFI does not provide configuration " 239 goto err_missing_table;
247 &loaded_image, image_handle,
NULL,
250 DBGC ( systab,
"EFI could not get loaded image protocol: %s",
252 goto err_no_loaded_image;
255 DBGC ( systab,
"EFI image base address %p\n",
268 DBGC ( systab,
"EFI could not get loaded image's device path: " 270 goto err_no_device_path;
280 &device_path_copy ) ) != 0 ) {
282 goto err_alloc_device_path;
286 DBGC ( systab,
"EFI image device path %s\n",
298 DBGC ( systab,
"EFI could not create ExitBootServices event: " 300 goto err_create_event;
305 DBGC ( systab,
"EFI could not install driver: %s\n",
308 goto err_driver_install;
321 err_alloc_device_path:
325 err_missing_protocol:
340 DBGC ( systab,
"EFI image unloading\n" );
360 DBGC ( systab,
"EFI image unloaded\n" );
377 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
128 bit buffer containing a unique identifier value.
void efi_raise_tpl(struct efi_saved_tpl *tpl)
Raise task priority level to internal level.
VOID * EFI_EVENT
Handle to an event structure.
EFI_GUID VendorGuid
The 128-bit GUID value that uniquely identifies the system configuration table.
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
#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 * efi_find_table(EFI_GUID *guid)
Look up EFI configuration table.
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 EFI_OPEN_PROTOCOL_GET_PROTOCOL
#define __BIG_ENDIAN
Constant representing big-endian byte order.
An EFI protocol used by iPXE.
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
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.
unsigned long __stack_chk_guard
Stack cookie.
static unsigned int rotation
EFI_GUID efi_device_path_protocol_guid
Device path protocol GUID.
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.
UINTN NumberOfTableEntries
The number of system configuration tables in the buffer ConfigurationTable.
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_OPEN_PROTOCOL OpenProtocol
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.
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
void efi_restore_tpl(struct efi_saved_tpl *tpl)
Restore task priority level.
#define NULL
NULL pointer (VOID *)
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
EFI_CONFIGURATION_TABLE * ConfigurationTable
A pointer to the system configuration tables.
int efi_shutdown_in_progress
EFI shutdown is in progress.
VOID * VendorTable
A pointer to the table associated with VendorGuid.
EFI_TPL efi_external_tpl
External task priority level.