aboutsummaryrefslogtreecommitdiff
path: root/stand
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2019-04-22 18:33:32 +0000
committerWarner Losh <imp@FreeBSD.org>2019-04-22 18:33:32 +0000
commit36d37160640d2d0cac3e87fc68c99aaba8dc75ba (patch)
tree024c3d30e8a1a93357ca4610c3e321309e1ad931 /stand
parent148a8da8d98ce7d4ec6709ebbb580a4f94316084 (diff)
downloadsrc-36d37160640d2d0cac3e87fc68c99aaba8dc75ba.tar.gz
src-36d37160640d2d0cac3e87fc68c99aaba8dc75ba.zip
Move setting of console earlier in boot.
There's no reason we can't setup the console first thing after the arch flags are setup. We set it undconditionally to efi. This is a good default, and will get us error messages to at least the efi console no matter what. This will also prime the pump so that as other variables are set, they will take effect and the console will be correct as soon as those env vars are set. Also remove the redundant setting of the console to efi when we know the console is efi. Differential Revision: https://reviews.freebsd.org/D20014
Notes
Notes: svn path=/head/; revision=346573
Diffstat (limited to 'stand')
-rw-r--r--stand/efi/loader/main.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c
index f8b9797df641..1d7c3d551a38 100644
--- a/stand/efi/loader/main.c
+++ b/stand/efi/loader/main.c
@@ -765,6 +765,17 @@ main(int argc, CHAR16 *argv[])
/* Get our loaded image protocol interface structure. */
BS->HandleProtocol(IH, &imgid, (VOID**)&img);
+ /*
+ * Chicken-and-egg problem; we want to have console output early, but
+ * some console attributes may depend on reading from eg. the boot
+ * device, which we can't do yet. We can use printf() etc. once this is
+ * done. So, we set it to the efi console, then call console init. This
+ * gets us printf early, but also primes the pump for all future console
+ * changes to take effect, regardless of where they come from.
+ */
+ setenv("console", "efi", 1);
+ cons_probe();
+
/* Tell ZFS probe code where we booted from, if zfs configured */
efizfs_set_preferred(img->DeviceHandle);
@@ -774,15 +785,6 @@ main(int argc, CHAR16 *argv[])
has_kbd = has_keyboard();
/*
- * XXX Chicken-and-egg problem; we want to have console output
- * early, but some console attributes may depend on reading from
- * eg. the boot device, which we can't do yet. We can use
- * printf() etc. once this is done.
- */
- setenv("console", "efi", 1);
- cons_probe();
-
- /*
* Initialise the block cache. Set the upper limit.
*/
bcache_init(32768, 512);
@@ -806,17 +808,15 @@ main(int argc, CHAR16 *argv[])
if ((howto & CON_MASK) == 0) {
/* No override, uhowto is controlling and efi cons is perfect */
howto = howto | (uhowto & CON_MASK);
- setenv("console", "efi", 1);
} else if ((howto & CON_MASK) == (uhowto & CON_MASK)) {
/* override matches what UEFI told us, efi console is perfect */
- setenv("console", "efi", 1);
} else if ((uhowto & (CON_MASK)) != 0) {
/*
* We detected a serial console on ConOut. All possible
* overrides include serial. We can't really override what efi
* gives us, so we use it knowing it's the best choice.
*/
- setenv("console", "efi", 1);
+ /* Do nothing */
} else {
/*
* We detected some kind of serial in the override, but ConOut