static EFI_STATUS EFIAPI
efi_driver_supported ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
EFI_HANDLE device, EFI_DEVICE_PATH_PROTOCOL *child ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
struct efi_driver *efidrv;
+ EFI_TPL saved_tpl;
int rc;
DBGCP ( device, "EFIDRV %s DRIVER_SUPPORTED",
return EFI_ALREADY_STARTED;
}
+ /* Raise TPL */
+ saved_tpl = bs->RaiseTPL ( TPL_CALLBACK );
+
/* Look for a driver claiming to support this device */
for_each_table_entry ( efidrv, EFI_DRIVERS ) {
if ( ( rc = efidrv->supported ( device ) ) == 0 ) {
DBGC ( device, "EFIDRV %s has driver \"%s\"\n",
efi_handle_name ( device ), efidrv->name );
+ bs->RestoreTPL ( saved_tpl );
return 0;
}
}
DBGCP ( device, "EFIDRV %s has no driver\n",
efi_handle_name ( device ) );
+ bs->RestoreTPL ( saved_tpl );
return EFI_UNSUPPORTED;
}
} path;
EFI_DEVICE_PATH_PROTOCOL *path_end;
size_t path_len;
+ EFI_TPL saved_tpl;
EFI_STATUS efirc;
int rc;
goto err_already_started;
}
+ /* Raise TPL */
+ saved_tpl = bs->RaiseTPL ( TPL_CALLBACK );
+
/* Do nothing if we are currently disconnecting drivers */
if ( efi_driver_disconnecting ) {
DBGC ( device, "EFIDRV %s refusing to start during "
DBGC ( device, "EFIDRV %s using driver \"%s\"\n",
efi_handle_name ( device ),
efidev->driver->name );
+ bs->RestoreTPL ( saved_tpl );
return 0;
}
DBGC ( device, "EFIDRV %s could not start driver \"%s\": %s\n",
}
err_open_path:
err_disconnecting:
+ bs->RestoreTPL ( saved_tpl );
err_already_started:
return efirc;
}
efi_driver_stop ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
EFI_HANDLE device, UINTN num_children,
EFI_HANDLE *children ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
struct efi_driver *efidrv;
struct efi_device *efidev;
+ EFI_TPL saved_tpl;
UINTN i;
DBGC ( device, "EFIDRV %s DRIVER_STOP", efi_handle_name ( device ) );
return EFI_DEVICE_ERROR;
}
+ /* Raise TPL */
+ saved_tpl = bs->RaiseTPL ( TPL_CALLBACK );
+
/* Stop this device */
efidrv = efidev->driver;
assert ( efidrv != NULL );
list_del ( &efidev->dev.siblings );
free ( efidev );
+ bs->RestoreTPL ( saved_tpl );
return 0;
}