[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-commits-all
Subject:    svn commit: r248963 - head/sys/dev/uart
From:       Ian Lepore <ian () FreeBSD ! org>
Date:       2013-03-31 23:24:04
Message-ID: 201303312324.r2VNO4Xd030736 () svn ! freebsd ! org
[Download RAW message or body]

Author: ian
Date: Sun Mar 31 23:24:04 2013
New Revision: 248963
URL: http://svnweb.freebsd.org/changeset/base/248963

Log:
  Accommodate uart devices with large FIFOs (or DMA buffers which amount
  to the same thing) by allocating the uart(4) rx buffer based on the
  device's rxfifosz rather than using a hard-coded size of 384 bytes.
  
  The  historical 384 byte size is 3 times the largest hard-coded fifo
  size in the tree, so use that ratio as a guide and allocate the buffer
  as three times rxfifosz, but never smaller than the historical size.

Modified:
  head/sys/dev/uart/uart_core.c

Modified: head/sys/dev/uart/uart_core.c
==============================================================================
--- head/sys/dev/uart/uart_core.c	Sun Mar 31 22:43:16 2013	(r248962)
+++ head/sys/dev/uart/uart_core.c	Sun Mar 31 23:24:04 2013	(r248963)
@@ -457,7 +457,13 @@ uart_bus_attach(device_t dev)
 		callout_init(&sc->sc_timer, 1);
 	}
 
-	sc->sc_rxbufsz = 384;
+	/*
+	 * Ensure there is room for at least three full FIFOs of data in the
+	 * receive buffer (handles the case of low-level drivers with huge
+	 * FIFOs), and also ensure that there is no less than the historical
+	 * size of 384 bytes (handles the typical small-FIFO case).
+	 */
+	sc->sc_rxbufsz = MAX(384, sc->sc_rxfifosz * 3);
 	sc->sc_rxbuf = malloc(sc->sc_rxbufsz * sizeof(*sc->sc_rxbuf),
 	    M_UART, M_WAITOK);
 	sc->sc_txbuf = malloc(sc->sc_txfifosz * sizeof(*sc->sc_txbuf),
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic