[efi] Do not unconditionally raise back to internal TPL
Most TPL manipulation is handled by efi_raise_tpl()/efi_restore_tpl() pairs. The exceptions are the places where we need to temporarily drop to a lower TPL in order to allow a timer interrupt to occur. These currently assume that they are called only from code that is already running at the internal TPL (generally TPL_CALLBACK). This assumption is not always correct. In particular, the call from _efi_start() to efi_driver_reconnect_all() takes place after the SNP devices have been released and so will be running at the external TPL. Create an efi_drop_tpl()/efi_undrop_tpl() pair to abstract away the temporary lowering of the TPL, and ensure that the TPL is always raised back to its original level rather than being unconditionally raised to the internal TPL. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -84,6 +84,12 @@ struct efi_saved_tpl {
|
||||
EFI_TPL previous;
|
||||
};
|
||||
|
||||
/** An EFI dropped task priority level */
|
||||
struct efi_dropped_tpl {
|
||||
/** Current TPL */
|
||||
EFI_TPL current;
|
||||
};
|
||||
|
||||
/** An EFI protocol used by iPXE */
|
||||
struct efi_protocol {
|
||||
/** GUID */
|
||||
@@ -408,6 +414,8 @@ extern EFI_STATUS efi_init ( EFI_HANDLE image_handle,
|
||||
EFI_SYSTEM_TABLE *systab );
|
||||
extern void efi_raise_tpl ( struct efi_saved_tpl *tpl );
|
||||
extern void efi_restore_tpl ( struct efi_saved_tpl *tpl );
|
||||
extern void efi_drop_tpl ( struct efi_dropped_tpl *tpl );
|
||||
extern void efi_undrop_tpl ( struct efi_dropped_tpl *tpl );
|
||||
extern int efi_open_untyped ( EFI_HANDLE handle, EFI_GUID *protocol,
|
||||
void **interface );
|
||||
extern int efi_open_unsafe_untyped ( EFI_HANDLE handle, EFI_GUID *protocol,
|
||||
|
||||
Reference in New Issue
Block a user