All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	linux-kernel@vger.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v2 7/7] x86/boot: Support nocfg parameter for earlyprintk
Date: Tue, 19 Mar 2019 21:43:25 +0300	[thread overview]
Message-ID: <20190319184325.72807-8-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20190319184325.72807-1-andriy.shevchenko@linux.intel.com>

If by BIOS or by other means the 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@linux.intel.com>
---
 arch/x86/boot/early_serial_console.c | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/arch/x86/boot/early_serial_console.c b/arch/x86/boot/early_serial_console.c
index cfc9e55cd68a..5b4a81bf5d0e 100644
--- a/arch/x86/boot/early_serial_console.c
+++ b/arch/x86/boot/early_serial_console.c
@@ -80,9 +80,10 @@ static void early_serial_use_mmio_accessors(void)
 	serial_out = mem8_serial_out;
 }
 
-static void early_serial_init(unsigned long port, int baud)
+static void early_serial_init(unsigned long port, int baud, bool configure)
 {
-	early_serial_configure(port, baud);
+	if (configure)
+		early_serial_configure(port, baud);
 
 	early_serial_base = port;
 }
@@ -101,12 +102,22 @@ static unsigned long parse_serial_port(const char *arg, int off, int *pos)
 	return port;
 }
 
+static bool parse_serial_configure(const char *arg, int off, int *pos)
+{
+	if (strncmp(arg + off, "nocfg", 5))
+		return true;
+
+	*pos = off + 5;
+	return false;
+}
+
 static void parse_earlyprintk(void)
 {
 	int baud = DEFAULT_BAUD;
 	char arg[64];
 	int pos = 0;
 	unsigned long port = 0;
+	bool configure = true;
 
 	if (cmdline_find_option("earlyprintk", arg, sizeof(arg)) > 0) {
 		char *e;
@@ -146,6 +157,11 @@ static void parse_earlyprintk(void)
 			early_serial_use_io_accessors();
 		}
 
+		if (arg[pos] == ',')
+			pos++;
+
+		configure = parse_serial_configure(arg, pos, &pos);
+
 		if (arg[pos] == ',')
 			pos++;
 
@@ -155,7 +171,7 @@ static void parse_earlyprintk(void)
 	}
 
 	if (port)
-		early_serial_init(port, baud);
+		early_serial_init(port, baud, configure);
 }
 
 #define BASE_BAUD (1843200/16)
@@ -179,6 +195,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
@@ -204,7 +221,7 @@ static void parse_console_uart8250(void)
 		baud = probe_baud(port);
 
 	if (port)
-		early_serial_init(port, baud);
+		early_serial_init(port, baud, configure);
 }
 
 void console_init(void)
-- 
2.20.1


  parent reply	other threads:[~2019-03-19 18:43 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-19 18:43 [PATCH v2 0/7] x86/boot: Enable earlyprintk for HS UARTs Andy Shevchenko
2019-03-19 18:43 ` [PATCH v2 1/7] x86/boot: Convert early_serial_base to unsigned long Andy Shevchenko
2019-03-28  8:28   ` Borislav Petkov
2019-03-28  9:09     ` Andy Shevchenko
2019-03-28 10:54       ` Borislav Petkov
2019-03-19 18:43 ` [PATCH v2 2/7] x86/boot: Introduce helpers for serial I/O Andy Shevchenko
2019-03-28 12:32   ` Borislav Petkov
2019-03-28 13:11     ` Andy Shevchenko
2019-03-28 13:28       ` Borislav Petkov
2019-03-28 13:52         ` Andy Shevchenko
2019-03-28 14:05           ` Borislav Petkov
2019-03-28 14:20             ` Andy Shevchenko
2019-03-28 14:34               ` Borislav Petkov
2019-03-28 14:51                 ` Andy Shevchenko
2019-03-19 18:43 ` [PATCH v2 3/7] x86/boot: Split out parse_serial_port() helper for earlyprintk Andy Shevchenko
2019-03-28 12:35   ` Borislav Petkov
2019-03-28 13:15     ` Andy Shevchenko
2019-03-28 13:39       ` Borislav Petkov
2019-03-28 13:50         ` Andy Shevchenko
2019-03-28 14:03           ` Borislav Petkov
2019-03-28 14:23             ` Andy Shevchenko
2019-03-28 14:35               ` Borislav Petkov
2019-03-28 14:49                 ` Andy Shevchenko
2019-03-19 18:43 ` [PATCH v2 4/7] x86/boot: Allow longer parameter list " Andy Shevchenko
2019-03-19 18:43 ` [PATCH v2 5/7] x86/boot: Add MMIO byte accessors Andy Shevchenko
2019-03-19 18:43 ` [PATCH v2 6/7] x86/boot: Introduce MMIO accessors and their support in earlyprintk Andy Shevchenko
2019-03-19 18:43 ` Andy Shevchenko [this message]
2019-03-20 15:05   ` [PATCH v2 7/7] x86/boot: Support nocfg parameter for earlyprintk Randy Dunlap
2019-03-20 15:17     ` Andy Shevchenko
2019-03-20 15:19       ` Randy Dunlap
2019-03-20 16:15         ` Andy Shevchenko
2019-03-20 16:30           ` Borislav Petkov
2019-03-20 17:29             ` Andy Shevchenko
2019-03-28 13:03   ` Borislav Petkov
2019-03-28 13:21     ` Andy Shevchenko
2019-03-28 13:42       ` Borislav Petkov
2019-03-28 14:00         ` Andy Shevchenko
2019-03-28 14:13           ` Borislav Petkov
2019-03-28 14:27             ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190319184325.72807-8-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.