From nobody@FreeBSD.org  Tue Jun 18 19:00:00 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	by hub.freebsd.org (Postfix) with ESMTP id E1D8465A
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 18 Jun 2013 19:00:00 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121])
	by mx1.freebsd.org (Postfix) with ESMTP id D4D001D91
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 18 Jun 2013 19:00:00 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r5IJ003N073337
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 18 Jun 2013 19:00:00 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r5IJ004T073335;
	Tue, 18 Jun 2013 19:00:00 GMT
	(envelope-from nobody)
Message-Id: <201306181900.r5IJ004T073335@oldred.freebsd.org>
Date: Tue, 18 Jun 2013 19:00:00 GMT
From: Luiz Otavio O Souza <loos.br@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] [rpi] serial console eats some characters at moutroot prompt
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         179688
>Category:       arm
>Synopsis:       [patch] [rpi] serial console eats some characters at moutroot prompt
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-arm
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 18 19:10:00 UTC 2013
>Closed-Date:    Mon Feb 24 07:41:23 MST 2014
>Last-Modified:  Mon Feb 24 07:41:23 MST 2014
>Originator:     Luiz Otavio O Souza
>Release:        -head r251700
>Organization:
>Environment:
FreeBSD raspberry-pi 10.0-CURRENT FreeBSD 10.0-CURRENT #11 r251700M: Tue Jun 18 13:06:54 BRT 2013     root@devel:/data/rpi/rpi/obj/arm.armv6/data/rpi/rpi/src/sys/RPI-B  arm
>Description:
While at mountroot prompt the rpi uart driver eats some characters, making very hard to type something right.

ray@ suggested to not enable the uart interrupts in uart_bus_attach() routine for the console device and that seems to also works fine for rpi.
>How-To-Repeat:
Boot a kernel from BOOTP (or boot a kernel from SD card without a valid root partition) and try to type at mountroot prompt. You need to keep the keys pressed for a while to see some output.
>Fix:
Apply the attached patch. It is a copy from the workaround used on uart_dev_imx.c.

Patch attached with submission follows:

Index: dev/uart/uart_dev_pl011.c
===================================================================
--- dev/uart/uart_dev_pl011.c	(revision 251700)
+++ dev/uart/uart_dev_pl011.c	(working copy)
@@ -273,8 +273,13 @@
 	struct uart_bas *bas;
 
 	bas = &sc->sc_bas;
-	/* Enable RX & TX interrupts */
-	__uart_setreg(bas, UART_IMSC, (UART_RXREADY | UART_TXEMPTY));
+	/* XXX workaround to have working console on manut prompt */
+	if (sc->sc_sysdev != NULL && sc->sc_sysdev->type == UART_DEV_CONSOLE){
+		/* Don't enable interrupts */
+	} else {
+		/* Enable RX & TX interrupts */
+		__uart_setreg(bas, UART_IMSC, (UART_RXREADY | UART_TXEMPTY));
+	}
 	/* Clear RX & TX interrupts */
 	__uart_setreg(bas, UART_ICR, IMSC_MASK_ALL);
 


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: imp 
State-Changed-When: Mon Feb 24 07:41:04 MST 2014 
State-Changed-Why:  
Fixed in head, soon to be fixed in stable... 

http://www.freebsd.org/cgi/query-pr.cgi?pr=179688 
>Unformatted:
