From owner-svn-src-all@FreeBSD.ORG Sun Dec 22 23:33:27 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E16F7A8B; Sun, 22 Dec 2013 23:33:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B1A5D11EB; Sun, 22 Dec 2013 23:33:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBMNXRqe082889; Sun, 22 Dec 2013 23:33:27 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBMNXRIr082888; Sun, 22 Dec 2013 23:33:27 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201312222333.rBMNXRIr082888@svn.freebsd.org> From: Warner Losh Date: Sun, 22 Dec 2013 23:33:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259753 - stable/9/sys/arm/at91 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Dec 2013 23:33:28 -0000 Author: imp Date: Sun Dec 22 23:33:27 2013 New Revision: 259753 URL: http://svnweb.freebsd.org/changeset/base/259753 Log: Direct Commit of mountroot> prompt fix r259748 (since there's no sane branching relationship between that branch and this one and since the more general fix in head may be too risky for a stbale branch this mature): Fix mountroot> prompt eating most of the characters by not enabling RXRDY interrupts in the attach routine. Instead, defer this until the first interrupt we see after the device is opened. Given the console use case, we're guaranteed to get a TXRDY interrupt before any reads are posted due to boot messages, which makes this work. The real fix is to use cngrab/cnungrab function pointers to disable RXRDY interrupts while grabbed. However, that touches the MI uart code, so was disallowed for 10.0 due to the lateness of the hour this fix was proposed. It works for mountroot, the most common atmel kernel prompt use cases, but wouldn't work for GELI since it prompts later in the boot process. Modified: stable/9/sys/arm/at91/uart_dev_at91usart.c Modified: stable/9/sys/arm/at91/uart_dev_at91usart.c ============================================================================== --- stable/9/sys/arm/at91/uart_dev_at91usart.c Sun Dec 22 23:31:04 2013 (r259752) +++ stable/9/sys/arm/at91/uart_dev_at91usart.c Sun Dec 22 23:33:27 2013 (r259753) @@ -63,7 +63,8 @@ struct at91_usart_softc { bus_dma_tag_t tx_tag; bus_dmamap_t tx_map; uint32_t flags; -#define HAS_TIMEOUT 1 +#define HAS_TIMEOUT 0x1 +#define NEEDS_RXRDY 0x4 bus_dma_tag_t rx_tag; struct at91_usart_rx ping_pong[2]; struct at91_usart_rx *ping; @@ -425,7 +426,13 @@ at91_usart_bus_attach(struct uart_softc WR4(&sc->sc_bas, USART_IER, USART_CSR_TIMEOUT | USART_CSR_RXBUFF | USART_CSR_ENDRX); } else { - WR4(&sc->sc_bas, USART_IER, USART_CSR_RXRDY); + /* + * Defer turning on the RXRDY bit until we're opened. This is to make the + * mountroot prompt work before we've opened the console. This is a workaround + * for not being able to change the UART interface for the 10.0 release. + */ + atsc->flags |= NEEDS_RXRDY; + /* WR4(&sc->sc_bas, USART_IER, USART_CSR_RXRDY); */ } WR4(&sc->sc_bas, USART_IER, USART_CSR_RXBRK); errout: @@ -530,6 +537,13 @@ at91_usart_bus_ipend(struct uart_softc * ipend = 0; atsc = (struct at91_usart_softc *)sc; uart_lock(sc->sc_hwmtx); + + /* Kludge -- Enable the RXRDY we deferred in attach */ + if (sc->sc_opened && (atsc->flags & NEEDS_RXRDY)) { + WR4(&sc->sc_bas, USART_IER, USART_CSR_RXRDY); + atsc->flags &= ~NEEDS_RXRDY; + } + csr = RD4(&sc->sc_bas, USART_CSR); if (csr & USART_CSR_ENDTX) { bus_dmamap_sync(atsc->tx_tag, atsc->tx_map,