The efi_unload() function is currently missing the calls to raise and
restore the TPL. This has the side effect of causing iPXE to return
from the driver unload entry point at TPL_CALLBACK, which will cause
unexpected behaviour (typically a system lockup) shortly afterwards.
Fix by adding the missing calls to raise and restore the TPL.
Debugged-by: Petr Borsodi <petr.borsodi@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
static EFI_STATUS EFIAPI efi_unload ( EFI_HANDLE image_handle __unused ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_SYSTEM_TABLE *systab = efi_systab;
+ struct efi_saved_tpl tpl;
DBGC ( systab, "EFI image unloading\n" );
+ /* Raise TPL */
+ efi_raise_tpl ( &tpl );
+
/* Shut down */
shutdown_exit();
DBGC ( systab, "EFI image unloaded\n" );
+ /* Restore TPL */
+ efi_restore_tpl ( &tpl );
+
return 0;
}