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] [day] [month] [year] [list]
Date:	Mon, 24 Sep 2007 18:14:17 +0100 (BST)
From:	"Maciej W. Rozycki" <macro@...ux-mips.org>
To:	Russell King <rmk+lkml@....linux.org.uk>
cc:	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org,
	Yinghai.Lu@....COM, bryan.wu@...log.com, dilinger@...ued.net,
	kraxel@...hat.com, lethal@...ux-sh.org, rgetz@...ckfin.uclinux.org,
	vapier.adi@...il.com
Subject: Re: [PATCH] kernel/printk.c: Concerns about the console handover

On Fri, 21 Sep 2007, Russell King wrote:

> >  I see no problem with implementing the ->pm() call as something like:
> > 
> > void zs_pm(struct uart_port uport, unsigned int state, unsigned int oldstate)
> > {
> > 	struct zs_port *zport = to_zport(uport);
> > 
> > 	if (state < 3)
> > 		zport->regs[5] |= TxENAB;
> > 	else
> > 		zport->regs[5] &= ~TxENAB;
> > 	write_zsreg(zport, R5, zport->regs[5]);
> > }
> > 
> > itself, but it looks more like a workaround than a fix to me.  I'll have 
> > to think about it and also double-check it is safe.  The SCC is about as 
> > complicated as you can get with a serial port.
> 
> You will need the serial patch from the above mbox.

 I have got it now and tried together with the function above and some 
minor adjustments as appropriate elsewhere.  It seems to work; by 
coincidence (because of the sequence the bootstrap initialisation of the 
console and the serial core is done) it even works when the selected real 
console is other than the bootstrap one.  I do not particularly like to 
have things working by accident and I stand by what I said previously 
about this approach looking hackish to me.

 Though lacking better proposals I suppose this will have to stay.  Here 
is a change I have implemented; if no further comments are seen, I will 
submit it for inclusion.

  Maciej

patch-mips-2.6.23-rc5-20070904-zs-pm-4
diff -up --recursive --new-file linux-mips-2.6.23-rc5-20070904.macro/drivers/serial/zs.c linux-mips-2.6.23-rc5-20070904/drivers/serial/zs.c
--- linux-mips-2.6.23-rc5-20070904.macro/drivers/serial/zs.c	2007-09-04 04:55:44.000000000 +0000
+++ linux-mips-2.6.23-rc5-20070904/drivers/serial/zs.c	2007-09-22 20:25:10.000000000 +0000
@@ -787,7 +787,6 @@ static int zs_startup(struct uart_port *
 	zport->regs[1] &= ~RxINT_MASK;
 	zport->regs[1] |= RxINT_ALL | TxINT_ENAB | EXT_INT_ENAB;
 	zport->regs[3] |= RxENABLE;
-	zport->regs[5] |= TxENAB;
 	zport->regs[15] |= BRKIE;
 	write_zsreg(zport, R1, zport->regs[1]);
 	write_zsreg(zport, R3, zport->regs[3]);
@@ -814,7 +813,6 @@ static void zs_shutdown(struct uart_port
 
 	spin_lock_irqsave(&scc->zlock, flags);
 
-	zport->regs[5] &= ~TxENAB;
 	zport->regs[3] &= ~RxENABLE;
 	write_zsreg(zport, R5, zport->regs[5]);
 	write_zsreg(zport, R3, zport->regs[3]);
@@ -959,6 +957,23 @@ static void zs_set_termios(struct uart_p
 	spin_unlock_irqrestore(&scc->zlock, flags);
 }
 
+/*
+ * Hack alert!
+ * Required solely so that the initial PROM-based console
+ * works undisturbed in parallel with this one.
+ */
+static void zs_pm(struct uart_port *uport, unsigned int state,
+		  unsigned int oldstate)
+{
+	struct zs_port *zport = to_zport(uport);
+
+	if (state < 3)
+		zport->regs[5] |= TxENAB;
+	else
+		zport->regs[5] &= ~TxENAB;
+	write_zsreg(zport, R5, zport->regs[5]);
+}
+
 
 static const char *zs_type(struct uart_port *uport)
 {
@@ -1041,6 +1056,7 @@ static struct uart_ops zs_ops = {
 	.startup	= zs_startup,
 	.shutdown	= zs_shutdown,
 	.set_termios	= zs_set_termios,
+	.pm		= zs_pm,
 	.type		= zs_type,
 	.release_port	= zs_release_port,
 	.request_port	= zs_request_port,
@@ -1190,6 +1206,7 @@ static int __init zs_console_setup(struc
 		return ret;
 
 	zs_reset(zport);
+	zs_pm(uport, 0, -1);
 
 	if (options)
 		uart_parse_options(options, &baud, &parity, &bits, &flow);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ