Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Apr 2018 18:38:25 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r332127 - in stable/11/stand/efi: include libefi loader
Message-ID:  <201804061838.w36IcPql002265@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Fri Apr  6 18:38:25 2018
New Revision: 332127
URL: https://svnweb.freebsd.org/changeset/base/332127

Log:
  MFC r329268, r329517
  
  r329268:
  efi: Only scan the BLKIO MEDIA once
  
  Scan only the BLOCK IO MEDIA once instead of each time for each type of
  device (fd, cd and hdd).
  Leave the mechanism to free and reprobe all devices if one day we want
  to implement a "dev rescan" thing.
  
  r329517:
  efi: Do not pad the efi devpath structure
  
  This solve problem when booting with efi on armv7

Modified:
  stable/11/stand/efi/include/efidevp.h
  stable/11/stand/efi/include/efilib.h
  stable/11/stand/efi/libefi/efipart.c
  stable/11/stand/efi/loader/main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/efi/include/efidevp.h
==============================================================================
--- stable/11/stand/efi/include/efidevp.h	Fri Apr  6 18:25:03 2018	(r332126)
+++ stable/11/stand/efi/include/efidevp.h	Fri Apr  6 18:38:25 2018	(r332127)
@@ -31,6 +31,8 @@ Revision History
 // Device Path structures - Section C
 //
 
+#pragma pack(1)
+
 typedef struct _EFI_DEVICE_PATH {
         UINT8                           Type;
         UINT8                           SubType;
@@ -450,5 +452,7 @@ typedef struct _EFI_DEVICE_PATH_TO_TEXT_PROTOCOL {
 	EFI_DEVICE_PATH_TO_TEXT_NODE ConvertDeviceNodeToText;
 	EFI_DEVICE_PATH_TO_TEXT_PATH ConvertDevicePathToText;
 } EFI_DEVICE_PATH_TO_TEXT_PROTOCOL;
+
+#pragma pack()
 
 #endif

Modified: stable/11/stand/efi/include/efilib.h
==============================================================================
--- stable/11/stand/efi/include/efilib.h	Fri Apr  6 18:25:03 2018	(r332126)
+++ stable/11/stand/efi/include/efilib.h	Fri Apr  6 18:38:25 2018	(r332127)
@@ -106,4 +106,7 @@ int wcscmp(CHAR16 *, CHAR16 *);
 void cpy8to16(const char *, CHAR16 *, size_t);
 void cpy16to8(const CHAR16 *, char *, size_t);
 
+/* efipart.c */
+int	efipart_inithandles(void);
+
 #endif	/* _LOADER_EFILIB_H */

Modified: stable/11/stand/efi/libefi/efipart.c
==============================================================================
--- stable/11/stand/efi/libefi/efipart.c	Fri Apr  6 18:25:03 2018	(r332126)
+++ stable/11/stand/efi/libefi/efipart.c	Fri Apr  6 18:38:25 2018	(r332127)
@@ -148,7 +148,7 @@ efiblk_pdinfo_count(pdinfo_list_t *pdi)
 	return (i);
 }
 
-static int
+int
 efipart_inithandles(void)
 {
 	UINTN sz;
@@ -176,6 +176,10 @@ efipart_inithandles(void)
 
 	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);
 }
 
@@ -319,11 +323,7 @@ efipart_updatefd(void)
 static int
 efipart_initfd(void)
 {
-	int rv;
 
-	rv = efipart_inithandles();
-	if (rv != 0)
-		return (rv);
 	STAILQ_INIT(&fdinfo);
 
 	efipart_updatefd();
@@ -439,11 +439,7 @@ efipart_updatecd(void)
 static int
 efipart_initcd(void)
 {
-	int rv;
 
-	rv = efipart_inithandles();
-	if (rv != 0)
-		return (rv);
 	STAILQ_INIT(&cdinfo);
 
 	efipart_updatecd();
@@ -685,11 +681,7 @@ efipart_updatehd(void)
 static int
 efipart_inithd(void)
 {
-	int rv;
 
-	rv = efipart_inithandles();
-	if (rv != 0)
-		return (rv);
 	STAILQ_INIT(&hdinfo);
 
 	efipart_updatehd();

Modified: stable/11/stand/efi/loader/main.c
==============================================================================
--- stable/11/stand/efi/loader/main.c	Fri Apr  6 18:25:03 2018	(r332126)
+++ stable/11/stand/efi/loader/main.c	Fri Apr  6 18:38:25 2018	(r332127)
@@ -456,11 +456,15 @@ main(int argc, CHAR16 *argv[])
 	}
 
 	/*
-	 * 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++)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804061838.w36IcPql002265>