freebsd-dev/sys/dev/uart
John Baldwin b47c1eda0c Correct baud rate error calculation.
Shifting right by 1 is not the same as dividing by 2 for signed
values.  In particular, dividing a signed value by 2 gives the integer
ceiling of the (e.g. -5 / 2 == -2) whereas shifting right by 1 always
gives the floor (-5 >> 1 == -3).

An embedded board with a 25 Mhz base clock results in an error of
-30.5% when used with a baud rate of 115200.  Using division, this
truncates to -30% and is permitted.  Using the shift, this fails and
is rejected causing TIOCSETA requests to fail with EINVAL and breaking
getty(8).

Using division gives the same error range for both over and under baud
rates and also makes the code match the behavior documented in the
existing comment about supporting boards with 25 Mhz clocks.

Reported by:	imp
MFC after:	2 weeks
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D24367
2020-04-13 20:43:57 +00:00
..
uart_bus_acpi.c Regularize my copyright notice 2019-12-04 16:56:11 +00:00
uart_bus_fdt.c
uart_bus_isa.c Regularize my copyright notice 2019-12-04 16:56:11 +00:00
uart_bus_pccard.c Regularize my copyright notice 2019-12-04 16:56:11 +00:00
uart_bus_pci.c Add Denverton UART PCI ID 2020-02-28 15:59:35 +00:00
uart_bus_puc.c Regularize my copyright notice 2019-12-04 16:56:11 +00:00
uart_bus_scc.c
uart_bus.h
uart_core.c Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many) 2020-02-26 14:26:36 +00:00
uart_cpu_acpi.c uart_cpu_acpi: Fix GCC build break from r348195 2019-05-23 20:18:46 +00:00
uart_cpu_acpi.h
uart_cpu_arm64.c
uart_cpu_fdt.c
uart_cpu_fdt.h
uart_cpu_powerpc.c
uart_cpu_x86.c
uart_cpu.h
uart_dbg.c
uart_dev_imx.c
uart_dev_imx.h
uart_dev_lowrisc.c
uart_dev_lowrisc.h
uart_dev_msm.c
uart_dev_msm.h
uart_dev_mu.c
uart_dev_mvebu.c
uart_dev_ns8250.c Correct baud rate error calculation. 2020-04-13 20:43:57 +00:00
uart_dev_ns8250.h
uart_dev_pl011.c
uart_dev_quicc.c
uart_dev_sab82532.c
uart_dev_snps.c Remove "all rights reserved" from copyright for the file that Jared McNeill 2019-12-03 21:05:33 +00:00
uart_dev_ti8250.c
uart_dev_z8530.c
uart_if.m
uart_ppstypes.h
uart_subr.c
uart_tty.c Some devices take undesired actions when RTS and DTR are 2019-06-12 18:07:04 +00:00
uart.h