Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Apr 2019 20:10:03 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r346703 - head/stand/efi/loader
Message-ID:  <201904252010.x3PKA3MF039537@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Thu Apr 25 20:10:02 2019
New Revision: 346703
URL: https://svnweb.freebsd.org/changeset/base/346703

Log:
  Move initialization of the block device handles earlier (we're just
  snagging them from UEFI BIOS). Call the device type init routines
  earlier as well, as they don't depend on how the console is
  setup. This will allow us to read files earlier in boot, so any rare
  error messages that this might move only to the EFI console will be an
  acceptable price to pay. Also tweak the order of has_kbd so it resides
  next to the rest of the console code. It needs to be after we initialize
  the buffer cache.

Modified:
  head/stand/efi/loader/main.c

Modified: head/stand/efi/loader/main.c
==============================================================================
--- head/stand/efi/loader/main.c	Thu Apr 25 20:09:49 2019	(r346702)
+++ head/stand/efi/loader/main.c	Thu Apr 25 20:10:02 2019	(r346703)
@@ -783,13 +783,30 @@ main(int argc, CHAR16 *argv[])
 	/* Init the time source */
 	efi_time_init();
 
-	has_kbd = has_keyboard();
-
 	/*
 	 * Initialise the block cache. Set the upper limit.
 	 */
 	bcache_init(32768, 512);
 
+	/*
+	 * Scan the BLOCK IO MEDIA handles then
+	 * march through the device switch probing for things.
+	 */
+	i = efipart_inithandles();
+	if (i != 0 && i != ENOENT) {
+		printf("efipart_inithandles failed with ERRNO %d, expect "
+		    "failures\n", i);
+	}
+
+	for (i = 0; devsw[i] != NULL; i++)
+		if (devsw[i]->dv_init != NULL)
+			(devsw[i]->dv_init)();
+
+	/*
+	 * Detect console settings two different ways: one via the command
+	 * args (eg -h) or via the UEFI ConOut variable.
+	 */
+	has_kbd = has_keyboard();
 	howto = parse_args(argc, argv);
 	if (!has_kbd && (howto & RB_PROBE))
 		howto |= RB_SERIAL | RB_MULTIPLE;
@@ -852,20 +869,6 @@ main(int argc, CHAR16 *argv[])
 	if ((s = getenv("fail_timeout")) != NULL)
 		fail_timeout = strtol(s, NULL, 10);
 
-	/*
-	 * Scan the BLOCK IO MEDIA handles then
-	 * march through the device switch probing for things.
-	 */
-	i = efipart_inithandles();
-	if (i != 0 && i != ENOENT) {
-		printf("efipart_inithandles failed with ERRNO %d, expect "
-		    "failures\n", i);
-	}
-
-	for (i = 0; devsw[i] != NULL; i++)
-		if (devsw[i]->dv_init != NULL)
-			(devsw[i]->dv_init)();
-
 	printf("%s\n", bootprog_info);
 	printf("   Command line arguments:");
 	for (i = 0; i < argc; i++)
@@ -877,8 +880,6 @@ main(int argc, CHAR16 *argv[])
 	printf("   EFI Firmware: %S (rev %d.%02d)\n", ST->FirmwareVendor,
 	    ST->FirmwareRevision >> 16, ST->FirmwareRevision & 0xffff);
 	printf("   Console: %s (%#x)\n", getenv("console"), howto);
-
-
 
 	/* Determine the devpath of our image so we can prefer it. */
 	text = efi_devpath_name(boot_img->FilePath);



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