From owner-svn-src-head@freebsd.org Wed Jul 18 22:45:46 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D71B1039F17; Wed, 18 Jul 2018 22:45:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0B5E070A4F; Wed, 18 Jul 2018 22:45:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E1A75209FB; Wed, 18 Jul 2018 22:45:45 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6IMjjZC076041; Wed, 18 Jul 2018 22:45:45 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6IMjj6q076040; Wed, 18 Jul 2018 22:45:45 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201807182245.w6IMjj6q076040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 18 Jul 2018 22:45:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336464 - head/stand/efi/loader X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/efi/loader X-SVN-Commit-Revision: 336464 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2018 22:45:46 -0000 Author: imp Date: Wed Jul 18 22:45:45 2018 New Revision: 336464 URL: https://svnweb.freebsd.org/changeset/base/336464 Log: If the console is already set, don't override it. If console=X is specified on the command line, it's effectively overridden by the current code. It shouldn't do that. Modified: head/stand/efi/loader/main.c Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Wed Jul 18 22:45:26 2018 (r336463) +++ head/stand/efi/loader/main.c Wed Jul 18 22:45:45 2018 (r336464) @@ -567,7 +567,6 @@ main(int argc, CHAR16 *argv[]) * 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(); /* @@ -579,49 +578,49 @@ main(int argc, CHAR16 *argv[]) if (!has_kbd && (howto & RB_PROBE)) howto |= RB_SERIAL | RB_MULTIPLE; howto &= ~RB_PROBE; - uhowto = parse_uefi_con_out(); /* * We now have two notions of console. howto should be viewed as - * overrides. + * overrides. If console is already set, don't set it again. */ #define VIDEO_ONLY 0 #define SERIAL_ONLY RB_SERIAL #define VID_SER_BOTH RB_MULTIPLE #define SER_VID_BOTH (RB_SERIAL | RB_MULTIPLE) #define CON_MASK (RB_SERIAL | RB_MULTIPLE) - - 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); - } else { - /* - * We detected some kind of serial in the override, but ConOut - * has no serial, so we have to sort out which case it really is. - */ - switch (howto & CON_MASK) { - case SERIAL_ONLY: - setenv("console", "comconsole", 1); - break; - case VID_SER_BOTH: - setenv("console", "efi comconsole", 1); - break; - case SER_VID_BOTH: - setenv("console", "comconsole efi", 1); - break; - /* case VIDEO_ONLY can't happen -- it's the first if above */ + if (getenv("console") == NULL) { + 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); + } else { + /* + * We detected some kind of serial in the override, but ConOut + * has no serial, so we have to sort out which case it really is. + */ + switch (howto & CON_MASK) { + case SERIAL_ONLY: + setenv("console", "comconsole", 1); + break; + case VID_SER_BOTH: + setenv("console", "efi comconsole", 1); + break; + case SER_VID_BOTH: + setenv("console", "comconsole efi", 1); + break; + /* case VIDEO_ONLY can't happen -- it's the first if above */ + } } } /*