소스 검색

[efi] Ensure drivers are disconnected when ExitBootServices() is called

We hook the UEFI ExitBootServices() event and use it to trigger a call
to shutdown_boot().  This does not automatically cause drivers to be
disconnected from their devices, since device enumeration is now
handled by the UEFI core rather than by iPXE.  (Under the old and
dubiously compatible device model, iPXE used to perform its own device
enumeration and so the call to shutdown_boot() would indeed have
caused drivers to be disconnected.)

Fix by replicating parts of the dummy "EFI root device" from
efiprefix.c to efidrvprefix.c, so that the call to shutdown_boot()
will call efi_driver_disconnect_all().

Originally-fixed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 년 전
부모
커밋
755d2b8f6b
1개의 변경된 파일35개의 추가작업 그리고 0개의 파일을 삭제
  1. 35
    0
      src/arch/x86/prefix/efidrvprefix.c

+ 35
- 0
src/arch/x86/prefix/efidrvprefix.c 파일 보기

@@ -21,7 +21,9 @@ FILE_LICENCE ( GPL2_OR_LATER );
21 21
 
22 22
 #include <stdlib.h>
23 23
 #include <ipxe/init.h>
24
+#include <ipxe/device.h>
24 25
 #include <ipxe/efi/efi.h>
26
+#include <ipxe/efi/efi_driver.h>
25 27
 
26 28
 /**
27 29
  * EFI entry point
@@ -44,3 +46,36 @@ EFI_STATUS EFIAPI _efidrv_start ( EFI_HANDLE image_handle,
44 46
 
45 47
 	return 0;
46 48
 }
49
+
50
+/**
51
+ * Probe EFI root bus
52
+ *
53
+ * @v rootdev		EFI root device
54
+ */
55
+static int efi_probe ( struct root_device *rootdev __unused ) {
56
+
57
+	/* Do nothing */
58
+	return 0;
59
+}
60
+
61
+/**
62
+ * Remove EFI root bus
63
+ *
64
+ * @v rootdev		EFI root device
65
+ */
66
+static void efi_remove ( struct root_device *rootdev __unused ) {
67
+
68
+	efi_driver_disconnect_all();
69
+}
70
+
71
+/** EFI root device driver */
72
+static struct root_driver efi_root_driver = {
73
+	.probe = efi_probe,
74
+	.remove = efi_remove,
75
+};
76
+
77
+/** EFI root device */
78
+struct root_device efi_root_device __root_device = {
79
+	.dev = { .name = "EFI" },
80
+	.driver = &efi_root_driver,
81
+};

Loading…
취소
저장