/* Set to EFI_SUCCESS when initialized */
extern efi_status_t efi_obj_list_initialized;
+/* Flag used by the selftest to avoid detaching devices in ExitBootServices() */
+extern bool efi_st_keep_devices;
+
/* EFI system partition */
extern struct efi_system_partition {
enum if_type if_type;
/* Flag to disable timer activity in ExitBootServices() */
static bool timers_enabled = true;
+/* Flag used by the selftest to avoid detaching devices in ExitBootServices() */
+bool efi_st_keep_devices;
+
/* List of all events registered by RegisterProtocolNotify() */
LIST_HEAD(efi_register_notify_events);
list_del(&evt->link);
}
- if IS_ENABLED(CONFIG_USB_DEVICE)
- udc_disconnect();
- board_quiesce_devices();
- dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL);
+ if (!efi_st_keep_devices) {
+ if IS_ENABLED(CONFIG_USB_DEVICE)
+ udc_disconnect();
+ board_quiesce_devices();
+ dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL);
+ }
/* Patch out unsupported runtime function */
efi_runtime_detach();
efi_status_t ret;
struct efi_mem_desc *memory_map;
+ /* Do not detach devices in ExitBootServices. We need the console. */
+ efi_st_keep_devices = true;
+
ret = boottime->get_memory_map(&map_size, NULL, &map_key, &desc_size,
&desc_version);
if (ret != EFI_BUFFER_TOO_SMALL) {