lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180114143254.15429-6-andriy.shevchenko@linux.intel.com>
Date:   Sun, 14 Jan 2018 16:32:54 +0200
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     "H. Peter Anvin" <hpa@...or.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, x86@...nel.org,
        linux-kernel@...r.kernel.org
Cc:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: [PATCH v1 6/6] x86/boot: Support nocfg parameter for earlyprintk

If by BIOS or by other means serial port is configured user might want to
skip reconfiguration in the boot code.

Add support of 'nocfg' parameter to earlyprintk.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
 arch/x86/boot/early_serial_console.c | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/arch/x86/boot/early_serial_console.c b/arch/x86/boot/early_serial_console.c
index ef10926ab9e5..f4759f485d8e 100644
--- a/arch/x86/boot/early_serial_console.c
+++ b/arch/x86/boot/early_serial_console.c
@@ -67,7 +67,7 @@ static void early_serial_configure(unsigned long port, int baud)
 	serial_out(port, LCR, c & ~DLAB);
 }
 
-static void early_serial_init(unsigned long port, int baud)
+static void early_serial_init(unsigned long port, int baud, bool configure)
 {
 	/* Assign serial I/O accessors */
 	if (port > IO_SPACE_LIMIT) {
@@ -82,7 +82,8 @@ static void early_serial_init(unsigned long port, int baud)
 		return;
 	}
 
-	early_serial_configure(port, baud);
+	if (configure)
+		early_serial_configure(port, baud);
 
 	early_serial_base = port;
 }
@@ -93,6 +94,7 @@ static void parse_earlyprintk(void)
 	char arg[64];
 	int pos = 0;
 	unsigned long port = 0;
+	bool configure = true;
 
 	if (cmdline_find_option("earlyprintk", arg, sizeof arg) > 0) {
 		char *e;
@@ -133,12 +135,16 @@ static void parse_earlyprintk(void)
 		if (arg[pos] == ',')
 			pos++;
 
-		baud = simple_strtoull(arg + pos, &e, 0);
-		if (baud == 0 || arg + pos == e)
-			baud = DEFAULT_BAUD;
+		if (strncmp(arg + pos, "nocfg", 5)) {
+			baud = simple_strtoull(arg + pos, &e, 0);
+			if (baud == 0 || arg + pos == e)
+				baud = DEFAULT_BAUD;
+		} else {
+			configure = false;
+		}
 	}
 
-	early_serial_init(port, baud);
+	early_serial_init(port, baud, configure);
 }
 
 #define BASE_BAUD (1843200/16)
@@ -162,6 +168,7 @@ static void parse_console_uart8250(void)
 	char optstr[64], *options;
 	int baud = DEFAULT_BAUD;
 	unsigned long port = 0;
+	bool configure = true;
 
 	/*
 	 * console=uart8250,io,0x3f8,115200n8
@@ -179,12 +186,16 @@ static void parse_console_uart8250(void)
 	else
 		return;
 
-	if (options && (options[0] == ','))
-		baud = simple_strtoull(options + 1, &options, 0);
-	else
+	if (options[0] == ',') {
+		if (strncmp(options + 1, "nocfg", 5))
+			baud = simple_strtoull(options + 1, &options, 0);
+		else
+			configure = false;
+	} else {
 		baud = probe_baud(port);
+	}
 
-	early_serial_init(port, baud);
+	early_serial_init(port, baud, configure);
 }
 
 void console_init(void)
-- 
2.15.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ