From owner-svn-src-head@FreeBSD.ORG Mon Apr 1 00:44:23 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id F3CAB8BE; Mon, 1 Apr 2013 00:44:22 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E55D3A19; Mon, 1 Apr 2013 00:44:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r310iM2G054020; Mon, 1 Apr 2013 00:44:22 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r310iL9m054003; Mon, 1 Apr 2013 00:44:21 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201304010044.r310iL9m054003@svn.freebsd.org> From: Ian Lepore Date: Mon, 1 Apr 2013 00:44:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248965 - in head/sys: arm/s3c2xx0 arm/sa11x0 dev/uart mips/adm5120 mips/rt305x sparc64/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Apr 2013 00:44:23 -0000 Author: ian Date: Mon Apr 1 00:44:20 2013 New Revision: 248965 URL: http://svnweb.freebsd.org/changeset/base/248965 Log: Fix low-level uart drivers that set their fifo sizes in the softc too late. uart(4) allocates send and receiver buffers in attach() before it calls the low-level driver's attach routine. Many low-level drivers set the fifo sizes in their attach routine, which is too late. Other drivers set them in the probe() routine, so that they're available when uart(4) allocates buffers. This fixes the ones that were setting the values too late by moving the code to probe(). Modified: head/sys/arm/s3c2xx0/uart_dev_s3c2410.c head/sys/arm/sa11x0/uart_dev_sa1110.c head/sys/dev/uart/uart_dev_imx.c head/sys/dev/uart/uart_dev_pl011.c head/sys/dev/uart/uart_dev_quicc.c head/sys/dev/uart/uart_dev_sab82532.c head/sys/dev/uart/uart_dev_z8530.c head/sys/mips/adm5120/uart_dev_adm5120.c head/sys/mips/rt305x/uart_dev_rt305x.c head/sys/sparc64/pci/sbbc.c Modified: head/sys/arm/s3c2xx0/uart_dev_s3c2410.c ============================================================================== --- head/sys/arm/s3c2xx0/uart_dev_s3c2410.c Mon Apr 1 00:00:10 2013 (r248964) +++ head/sys/arm/s3c2xx0/uart_dev_s3c2410.c Mon Apr 1 00:44:20 2013 (r248965) @@ -233,14 +233,6 @@ static kobj_method_t s3c2410_methods[] = int s3c2410_bus_probe(struct uart_softc *sc) { - return (0); -} - -static int -s3c2410_bus_attach(struct uart_softc *sc) -{ - uintptr_t irq; - switch(s3c2xx0_softc->sc_cpu) { case CPU_S3C2410: sc->sc_txfifosz = 16; @@ -253,7 +245,15 @@ s3c2410_bus_attach(struct uart_softc *sc default: return (ENXIO); } - + + return (0); +} + +static int +s3c2410_bus_attach(struct uart_softc *sc) +{ + uintptr_t irq; + sc->sc_hwiflow = 0; sc->sc_hwoflow = 0; Modified: head/sys/arm/sa11x0/uart_dev_sa1110.c ============================================================================== --- head/sys/arm/sa11x0/uart_dev_sa1110.c Mon Apr 1 00:00:10 2013 (r248964) +++ head/sys/arm/sa11x0/uart_dev_sa1110.c Mon Apr 1 00:44:20 2013 (r248965) @@ -156,6 +156,8 @@ static kobj_method_t sa1110_methods[] = int sa1110_bus_probe(struct uart_softc *sc) { + sc->sc_txfifosz = 3; + sc->sc_rxfifosz = 1; return (0); } @@ -164,8 +166,6 @@ sa1110_bus_attach(struct uart_softc *sc) { bcopy(&sc->sc_sysdev->bas, &sc->sc_bas, sizeof(sc->sc_bas)); - sc->sc_txfifosz = 3; - sc->sc_rxfifosz = 1; sc->sc_hwiflow = 0; uart_setreg(&sc->sc_bas, SACOM_CR3, CR3_RXE | CR3_TXE | CR3_RIE | CR3_TIE); return (0); Modified: head/sys/dev/uart/uart_dev_imx.c ============================================================================== --- head/sys/dev/uart/uart_dev_imx.c Mon Apr 1 00:00:10 2013 (r248964) +++ head/sys/dev/uart/uart_dev_imx.c Mon Apr 1 00:44:20 2013 (r248965) @@ -187,9 +187,6 @@ imx_uart_bus_attach(struct uart_softc *s imx_uart_init(bas, 115200, 8, 1, 0); } - sc->sc_rxfifosz = 1; - sc->sc_txfifosz = 1; - (void)imx_uart_bus_getsig(sc); /* XXX workaround to have working console on manut prompt */ @@ -353,6 +350,9 @@ imx_uart_bus_probe(struct uart_softc *sc if (error) return (error); + sc->sc_rxfifosz = 1; + sc->sc_txfifosz = 1; + device_set_desc(sc->sc_dev, "imx_uart"); return (0); } Modified: head/sys/dev/uart/uart_dev_pl011.c ============================================================================== --- head/sys/dev/uart/uart_dev_pl011.c Mon Apr 1 00:00:10 2013 (r248964) +++ head/sys/dev/uart/uart_dev_pl011.c Mon Apr 1 00:44:20 2013 (r248965) @@ -278,9 +278,6 @@ uart_pl011_bus_attach(struct uart_softc /* Clear RX & TX interrupts */ __uart_setreg(bas, UART_ICR, IMSC_MASK_ALL); - sc->sc_rxfifosz = 1; - sc->sc_txfifosz = 1; - return (0); } @@ -377,6 +374,9 @@ uart_pl011_bus_probe(struct uart_softc * device_set_desc(sc->sc_dev, "PrimeCell UART (PL011)"); + sc->sc_rxfifosz = 1; + sc->sc_txfifosz = 1; + return (0); } Modified: head/sys/dev/uart/uart_dev_quicc.c ============================================================================== --- head/sys/dev/uart/uart_dev_quicc.c Mon Apr 1 00:00:10 2013 (r248964) +++ head/sys/dev/uart/uart_dev_quicc.c Mon Apr 1 00:44:20 2013 (r248965) @@ -293,9 +293,6 @@ quicc_bus_attach(struct uart_softc *sc) quicc_setup(bas, 9600, 8, 1, UART_PARITY_NONE); } - sc->sc_rxfifosz = 1; - sc->sc_txfifosz = 1; - /* Enable interrupts on the receive buffer. */ rb = quicc_read2(bas, QUICC_PRAM_SCC_RBASE(bas->chan - 1)); st = quicc_read2(bas, rb); @@ -417,6 +414,9 @@ quicc_bus_probe(struct uart_softc *sc) if (error) return (error); + sc->sc_rxfifosz = 1; + sc->sc_txfifosz = 1; + snprintf(buf, sizeof(buf), "quicc, channel %d", sc->sc_bas.chan); device_set_desc_copy(sc->sc_dev, buf); return (0); Modified: head/sys/dev/uart/uart_dev_sab82532.c ============================================================================== --- head/sys/dev/uart/uart_dev_sab82532.c Mon Apr 1 00:00:10 2013 (r248964) +++ head/sys/dev/uart/uart_dev_sab82532.c Mon Apr 1 00:44:20 2013 (r248965) @@ -407,9 +407,6 @@ sab82532_bus_attach(struct uart_softc *s if (sc->sc_sysdev == NULL) sab82532_init(bas, 9600, 8, 1, UART_PARITY_NONE); - sc->sc_rxfifosz = 32; - sc->sc_txfifosz = 32; - imr0 = SAB_IMR0_TCD|SAB_IMR0_TIME|SAB_IMR0_CDSC|SAB_IMR0_RFO| SAB_IMR0_RPF; uart_setreg(bas, SAB_IMR0, 0xff & ~imr0); @@ -592,6 +589,9 @@ sab82532_bus_probe(struct uart_softc *sc if (error) return (error); + sc->sc_rxfifosz = 32; + sc->sc_txfifosz = 32; + ch = sc->sc_bas.chan - 1 + 'A'; switch (uart_getreg(&sc->sc_bas, SAB_VSTR) & SAB_VSTR_VMASK) { Modified: head/sys/dev/uart/uart_dev_z8530.c ============================================================================== --- head/sys/dev/uart/uart_dev_z8530.c Mon Apr 1 00:00:10 2013 (r248964) +++ head/sys/dev/uart/uart_dev_z8530.c Mon Apr 1 00:44:20 2013 (r248965) @@ -332,9 +332,6 @@ z8530_bus_attach(struct uart_softc *sc) } z8530->txidle = 1; /* Report SER_INT_TXIDLE. */ - sc->sc_rxfifosz = 3; - sc->sc_txfifosz = 1; - (void)z8530_bus_getsig(sc); uart_setmreg(bas, WR_IC, IC_BRK | IC_CTS | IC_DCD); @@ -515,6 +512,9 @@ z8530_bus_probe(struct uart_softc *sc) if (error) return (error); + sc->sc_rxfifosz = 3; + sc->sc_txfifosz = 1; + ch = sc->sc_bas.chan - 1 + 'A'; snprintf(buf, sizeof(buf), "z8530, channel %c", ch); Modified: head/sys/mips/adm5120/uart_dev_adm5120.c ============================================================================== --- head/sys/mips/adm5120/uart_dev_adm5120.c Mon Apr 1 00:00:10 2013 (r248964) +++ head/sys/mips/adm5120/uart_dev_adm5120.c Mon Apr 1 00:44:20 2013 (r248965) @@ -221,9 +221,6 @@ adm5120_uart_bus_attach(struct uart_soft /* TODO: set parameters 115200, 8N1 */ } - sc->sc_rxfifosz = 16; - sc->sc_txfifosz = 16; - (void)adm5120_uart_bus_getsig(sc); #if 1 @@ -367,6 +364,9 @@ adm5120_uart_bus_probe(struct uart_softc if (error) return (error); + sc->sc_rxfifosz = 16; + sc->sc_txfifosz = 16; + ch = sc->sc_bas.chan + 'A'; snprintf(buf, sizeof(buf), "adm5120_uart, channel %c", ch); Modified: head/sys/mips/rt305x/uart_dev_rt305x.c ============================================================================== --- head/sys/mips/rt305x/uart_dev_rt305x.c Mon Apr 1 00:00:10 2013 (r248964) +++ head/sys/mips/rt305x/uart_dev_rt305x.c Mon Apr 1 00:44:20 2013 (r248965) @@ -272,9 +272,6 @@ rt305x_uart_bus_attach(struct uart_softc rt305x_uart_init(bas, 115200, 8, 1, 0); } - sc->sc_rxfifosz = 16; - sc->sc_txfifosz = 16; - (void)rt305x_uart_bus_getsig(sc); /* Enable FIFO */ @@ -438,6 +435,9 @@ rt305x_uart_bus_probe(struct uart_softc if (error) return (error); + sc->sc_rxfifosz = 16; + sc->sc_txfifosz = 16; + snprintf(buf, sizeof(buf), "rt305x_uart"); device_set_desc_copy(sc->sc_dev, buf); Modified: head/sys/sparc64/pci/sbbc.c ============================================================================== --- head/sys/sparc64/pci/sbbc.c Mon Apr 1 00:00:10 2013 (r248964) +++ head/sys/sparc64/pci/sbbc.c Mon Apr 1 00:44:20 2013 (r248965) @@ -835,13 +835,6 @@ sbbc_uart_bus_attach(struct uart_softc * bst = bas->bst; bsh = bas->bsh; - sc->sc_rxfifosz = SBBC_SRAM_READ_4(sbbc_solcons + - SBBC_CONS_OFF(cons_in_end)) - SBBC_SRAM_READ_4(sbbc_solcons + - SBBC_CONS_OFF(cons_in_begin)) - 1; - sc->sc_txfifosz = SBBC_SRAM_READ_4(sbbc_solcons + - SBBC_CONS_OFF(cons_out_end)) - SBBC_SRAM_READ_4(sbbc_solcons + - SBBC_CONS_OFF(cons_out_begin)) - 1; - uart_lock(sc->sc_hwmtx); /* @@ -995,11 +988,24 @@ sbbc_uart_bus_param(struct uart_softc *s } static int -sbbc_uart_bus_probe(struct uart_softc *sc __unused) +sbbc_uart_bus_probe(struct uart_softc *sc) { + struct uart_bas *bas; + bus_space_tag_t bst; + bus_space_handle_t bsh; - if (sbbc_console != 0) + if (sbbc_console != 0) { + bas = &sc->sc_bas; + bst = bas->bst; + bsh = bas->bsh; + sc->sc_rxfifosz = SBBC_SRAM_READ_4(sbbc_solcons + + SBBC_CONS_OFF(cons_in_end)) - SBBC_SRAM_READ_4(sbbc_solcons + + SBBC_CONS_OFF(cons_in_begin)) - 1; + sc->sc_txfifosz = SBBC_SRAM_READ_4(sbbc_solcons + + SBBC_CONS_OFF(cons_out_end)) - SBBC_SRAM_READ_4(sbbc_solcons + + SBBC_CONS_OFF(cons_out_begin)) - 1; return (0); + } return (ENXIO); }