changeset 18823:92fc8be96510

loader.efi: Only scan the BLKIO MEDIA once illumos issue #9127
author Toomas Soome <tsoome@me.com>
date Mon, 19 Feb 2018 19:14:22 +0200
parents 185a6a6be93a
children 4272f05ab956
files usr/src/boot/sys/boot/efi/include/efilib.h usr/src/boot/sys/boot/efi/libefi/efipart.c usr/src/boot/sys/boot/efi/loader/main.c
diffstat 3 files changed, 16 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/boot/sys/boot/efi/include/efilib.h	Sun Feb 18 09:35:16 2018 +0200
+++ b/usr/src/boot/sys/boot/efi/include/efilib.h	Mon Feb 19 19:14:22 2018 +0200
@@ -112,4 +112,7 @@
 bool efi_name_to_guid(const char *, EFI_GUID *);
 bool efi_guid_to_name(EFI_GUID *, char **);
 
+/* efipart.c */
+int	efipart_inithandles(void);
+
 #endif /* _LOADER_EFILIB_H */
--- a/usr/src/boot/sys/boot/efi/libefi/efipart.c	Sun Feb 18 09:35:16 2018 +0200
+++ b/usr/src/boot/sys/boot/efi/libefi/efipart.c	Mon Feb 19 19:14:22 2018 +0200
@@ -147,7 +147,7 @@
 	return (i);
 }
 
-static int
+int
 efipart_inithandles(void)
 {
 	UINTN sz;
@@ -175,6 +175,10 @@
 
 	efipart_handles = hin;
 	efipart_nhandles = sz;
+#ifdef EFIPART_DEBUG
+	printf("%s: Got %d BLOCK IO MEDIA handle(s)\n", __func__,
+	    efipart_nhandles);
+#endif
 	return (0);
 }
 
@@ -318,11 +322,7 @@
 static int
 efipart_initfd(void)
 {
-	int rv;
 
-	rv = efipart_inithandles();
-	if (rv != 0)
-		return (rv);
 	STAILQ_INIT(&fdinfo);
 
 	efipart_updatefd();
@@ -438,11 +438,7 @@
 static int
 efipart_initcd(void)
 {
-	int rv;
 
-	rv = efipart_inithandles();
-	if (rv != 0)
-		return (rv);
 	STAILQ_INIT(&cdinfo);
 
 	efipart_updatecd();
@@ -684,11 +680,7 @@
 static int
 efipart_inithd(void)
 {
-	int rv;
 
-	rv = efipart_inithandles();
-	if (rv != 0)
-		return (rv);
 	STAILQ_INIT(&hdinfo);
 
 	efipart_updatehd();
--- a/usr/src/boot/sys/boot/efi/loader/main.c	Sun Feb 18 09:35:16 2018 +0200
+++ b/usr/src/boot/sys/boot/efi/loader/main.c	Mon Feb 19 19:14:22 2018 +0200
@@ -435,11 +435,15 @@
 	}
 
 	/*
-	 * March through the device switch probing for things.
+	 * Scan the BLOCK IO MEDIA handles then
+	 * march through the device switch probing for things.
 	 */
-	for (i = 0; devsw[i] != NULL; i++)
-		if (devsw[i]->dv_init != NULL)
-			(devsw[i]->dv_init)();
+	if ((i = efipart_inithandles()) == 0) {
+		for (i = 0; devsw[i] != NULL; i++)
+			if (devsw[i]->dv_init != NULL)
+				(devsw[i]->dv_init)();
+	} else
+		printf("efipart_inithandles failed %d, expect failures", i);
 
 	printf("Command line arguments:");
 	for (i = 0; i < argc; i++) {