History log of /src/sys/dev/uart/uart_dev_ns8250.c (Results 1 – 25 of 475)
Revision Date Author Comments
# d2dea8b4 02-Feb-2025 Michal Meloun <mmel@FreeBSD.org>

arm: Add EARLY_PRINTF for ns8250 on arm/aarch64 platforms.

Reviewed by: adrian (previous version)
MFC after: 3 weeks


# a685a263 06-Aug-2025 Justin Hibbits <jhibbits@FreeBSD.org>

uart: Add ns8250 ACPI entry for SPCR rev 2

Summary:
SPCR rev 2 adds a series of new device types, with 0x12 being
"16550-compatible with parameters defined in the Generic Address
Structure". Since

uart: Add ns8250 ACPI entry for SPCR rev 2

Summary:
SPCR rev 2 adds a series of new device types, with 0x12 being
"16550-compatible with parameters defined in the Generic Address
Structure". Since we look for the parameters already in the GAS there's
nothing extra for us to do beyond adding the entry so that it probes
successfully.

Reviewed by: imp, andrew
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D51771

show more ...


# 25ec7ca8 13-Aug-2025 Andrew Turner <andrew@FreeBSD.org>

uart: Remove the unused cd_port_subtype

This is now unused. It was used for the SPCR interface type, but that
has now been split out into a new struct.

Reviewed by: imp, jhibbits
Sponsored by: Arm

uart: Remove the unused cd_port_subtype

This is now unused. It was used for the SPCR interface type, but that
has now been split out into a new struct.

Reviewed by: imp, jhibbits
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D51879

show more ...


# e822f1d6 13-Aug-2025 Andrew Turner <andrew@FreeBSD.org>

uart: Add UART_ACPI_SPCR_CLASS

We don't care about most of acpi_uart_compat_data in the spcr code.
Split out the mapping from the SPCR interface type to uart class into
a new struct. This allows new

uart: Add UART_ACPI_SPCR_CLASS

We don't care about most of acpi_uart_compat_data in the spcr code.
Split out the mapping from the SPCR interface type to uart class into
a new struct. This allows new SPCR interface types to be added that
don't have an entry in the DSDT, e.g. some PCI uarts may not.

Reviewed by: imp, jhibbits
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D51878

show more ...


# 0d2fd5b9 10-Nov-2024 Andriy Gapon <avg@FreeBSD.org>

ns8250: use LSR_THRE instead of LSR_TEMT for checking tx flush

LSR_TEMT bit is set if both transmit hold and shift registers are
empty, but the flush command flushes only the hold register.

While h

ns8250: use LSR_THRE instead of LSR_TEMT for checking tx flush

LSR_TEMT bit is set if both transmit hold and shift registers are
empty, but the flush command flushes only the hold register.

While here, update the diagnostic message to report which registers
could not be flushed.

MFC after: 2 weeks

show more ...


# 09ef5387 20-Nov-2024 Justin Hibbits <jhibbits@FreeBSD.org>

uart: Add primitive noise filtering on RX

A long cable attached to the UART can act as an antenna if disconnected
from the other end. This can cause noise on the receive side, possibly
as reflectio

uart: Add primitive noise filtering on RX

A long cable attached to the UART can act as an antenna if disconnected
from the other end. This can cause noise on the receive side, possibly
as reflections from the transmit side, leading to an interrupt storm.
Filter this by adding a threshold of received characters without TX
ready, above which characters are dropped. This is disabled by default,
but has been tested with a threshold of 1000+. A high threshold is
recommended to avoid dropping characters during, for instance, a large
copy/paste from the other end.

Sponsored by: Juniper Networks, Inc.

show more ...


# 8190dfbb 14-Oct-2024 Warner Losh <imp@FreeBSD.org>

uart/ns8250: Add support for computing rclk

When instructed to do so, compute the rclk (baud rate generator clock)
based on the currently programmed divisor and the communicated baud
rate. We only

uart/ns8250: Add support for computing rclk

When instructed to do so, compute the rclk (baud rate generator clock)
based on the currently programmed divisor and the communicated baud
rate. We only do this once and only for consoles that tell us the
configured rate and flag we can likely safely compute rclk.

Sponsored by: Netflix
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D47076

show more ...


# 56139f72 14-Oct-2024 Warner Losh <imp@FreeBSD.org>

uart/ns8250: Disable interrupts sooner

Disable interrupts before we set the parameters for the UART. Usually,
it makes no difference, but it's possible that setting the baud rate, etc
could create p

uart/ns8250: Disable interrupts sooner

Disable interrupts before we set the parameters for the UART. Usually,
it makes no difference, but it's possible that setting the baud rate, etc
could create problems if there's data pending, so move the interrupt
disabling ealier.

Sponsored by: Netflix
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D47075

show more ...


# 4097cd06 14-Oct-2024 Warner Losh <imp@FreeBSD.org>

uart/ns8250: Factor out reading the divisor

We have two copies (soon to be three) of reading the divisor. Since it's
a complicated tricky process, abstract it to its own routine.

Sponsored by: Net

uart/ns8250: Factor out reading the divisor

We have two copies (soon to be three) of reading the divisor. Since it's
a complicated tricky process, abstract it to its own routine.

Sponsored by: Netflix
Reviewed by: andrew, markj
Differential Revision: https://reviews.freebsd.org/D47074

show more ...


# db4a3bae 14-Oct-2024 Warner Losh <imp@FreeBSD.org>

uart/ns8250: Tweak printfs to always prefix messages with uart:

It can be confusing when the ns8250 driver prints error messages with
just ns8250 as the prefix. Add uart: to the live and commented o

uart/ns8250: Tweak printfs to always prefix messages with uart:

It can be confusing when the ns8250 driver prints error messages with
just ns8250 as the prefix. Add uart: to the live and commented out
printfs.

Sponsored by: Netflix
Reviewed by: andrew, markj
Differential Revision: https://reviews.freebsd.org/D47073

show more ...


# ab03b790 02-Oct-2024 Warner Losh <imp@FreeBSD.org>

uart: Add entry for an Intel UART

While we really should infer this baud-clock rate in some cases, use the
right baud-clock for this device.

Sponsored by: Netflix


# 9840598a 23-Jul-2024 Andrew Turner <andrew@FreeBSD.org>

dev/uart: Add APMC0D08 as found in the Intel E2100

This uart has the requirement for 32-bit sized and aligned memory
accesses. It is also described in the Serial Port Console Redirection
Table (SPCR

dev/uart: Add APMC0D08 as found in the Intel E2100

This uart has the requirement for 32-bit sized and aligned memory
accesses. It is also described in the Serial Port Console Redirection
Table (SPCR) with a different interface type value.

Reviewed by: imp
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D45834

show more ...


# 46a968ec 19-Feb-2024 Bjoern A. Zeeb <bz@FreeBSD.org>

dev/uart: name uart_class_set DATA_SET macro UART_CLASS()

Use the macro "UART_CLASS()" for the newly created data set
'uart_class_set' as we do for other data sets.
This further hides the data set n

dev/uart: name uart_class_set DATA_SET macro UART_CLASS()

Use the macro "UART_CLASS()" for the newly created data set
'uart_class_set' as we do for other data sets.
This further hides the data set name.
Also add UART_CLASS for quicc, which was previously not done.

MFC after: 1 week
Improves: 949670f8f466 dev/uart: Use a linker set to find uart classes
Obtained from: jhb, https://github.com/freebsd/freebsd/commit/269e99ac86902127bfaee1500d8747a3c7be5912
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D43981

show more ...


# 949670f8 08-Jan-2024 Andrew Turner <andrew@FreeBSD.org>

dev/uart: Use a linker set to find uart classes

When the uart is configured via the environment we need to find the
uart class with a specified name. Currently to do this with an
incomplete list of

dev/uart: Use a linker set to find uart classes

When the uart is configured via the environment we need to find the
uart class with a specified name. Currently to do this with an
incomplete list of uarts. As we may not have included all uarts in the
kernel each class is defined as weak.

Switch to a linker set so the list is always up to date based on what
is included in the kernel, and the class can be static.

Reviewed by: imp
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D43361

show more ...


# 20289092 08-Jan-2024 Andrew Turner <andrew@FreeBSD.org>

sys: Simplify enabling EARLY_PRINTF uarts

Support selecting the early uart with "options EARLY_PRINTF=foo" in
the kernel configuration file. This allows us to not have to change
source files when en

sys: Simplify enabling EARLY_PRINTF uarts

Support selecting the early uart with "options EARLY_PRINTF=foo" in
the kernel configuration file. This allows us to not have to change
source files when enabling EARLY_PRINTF, simplifying enabling it.

New uart drivers can be enabled by defining a new early_printf_foo
value to be unique, then using "#if CHECK_EARLY_PRINTF(foo)" to decide
when to enable the uart.

While here add pl011 early printf support.

Reviewed by: imp (earlier version)
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D43360

show more ...


# 353e4c5a 12-Jan-2024 Marius Strobl <marius@FreeBSD.org>

uart(4): Honor hardware state of NS8250-class for tsw_busy

In 9750d9e5, I brought the equivalent of the TS_BUSY flag back in a
mostly hardware-agnostic way in order to fix tty_drain() and, thus,
TIO

uart(4): Honor hardware state of NS8250-class for tsw_busy

In 9750d9e5, I brought the equivalent of the TS_BUSY flag back in a
mostly hardware-agnostic way in order to fix tty_drain() and, thus,
TIOCDRAIN for UARTs with TX FIFOs. This proved to be sufficient for
fixing the regression reported. So in light of the release cycle of
FreeBSD 10.3, I decided that this change was be good enough for the
time being and opted to go with the smallest possible yet generic
(for all UARTs driven by uart(4)) solution addressing the problem at
hand.

However, at least for the NS8250-class the above isn't a complete
fix as these UARTs only trigger an interrupt when the TX FIFO became
empty. At this point, there still can be an outstanding character
left in the transmit shift register as indicated via the LSR. Thus,
this change adds the 3rd (besides the tty(4) and generic uart(4) bits)
part I had in my tree ever since, adding a uart_txbusy method to be
queried in addition for tsw_busy and hooking it up as appropriate
for the NS8250-class.

As it turns out, the exact equivalent of this 3rd part later on was
implemented for uftdi(4) in 9ad221a5.

While at it, explain the rational behind the deliberately missing
locking in uart_tty_busy() (also applying to the generic sc_txbusy
testing already present).

show more ...


# fdafd315 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

sys: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remov

sys: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix

show more ...


# f25b0d6d 08-Nov-2023 Oskar Holmlund <oh@FreeBSD.org>

UART: Remove ingenic xburst (mips) code from ns8250 driver

Since ingenic JZ4780 SOC support has been removed there is no need
to support ingenic quirks in the UART driver.
Invert of commit b192bae67

UART: Remove ingenic xburst (mips) code from ns8250 driver

Since ingenic JZ4780 SOC support has been removed there is no need
to support ingenic quirks in the UART driver.
Invert of commit b192bae67ea835b7e431225bad375b5d5fe4297f

Reviewed by: imp, manu
Approved by: imp, manu (mentor)
Differential Revision: https://reviews.freebsd.org/D42497

show more ...


# a113f9dd 20-Oct-2023 Warner Losh <imp@FreeBSD.org>

uart: Support EARLY_PRINTF on x86 for port-mapped COM ports

Support early printf for the ns8250 uart driver. Adding
options UART_NS8250_EARLY_PORT=0xYYY
options EARLY_PRINTF
to your kernel config

uart: Support EARLY_PRINTF on x86 for port-mapped COM ports

Support early printf for the ns8250 uart driver. Adding
options UART_NS8250_EARLY_PORT=0xYYY
options EARLY_PRINTF
to your kernel config will enable it. The code is rather simple minded,
so caveat emptor. This will enable printf before cninit. cninit
automatically disables this and switches to the real routine. It only
works for port-mapped COM ports, and only if you know the port's address
at compile time. It's intended for be a debugging aide, not a general
purpose thing.

Sponsored by: Netflix
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D42306

show more ...


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix

show more ...


# 8ea7fa16 14-Mar-2023 Wei Hu <whu@FreeBSD.org>

uart: Don't change settings or throttle putc for Hyper-V

Azure setup does not like it when FreeBSD overrides the settings of the
UART device. When Hyper-V is detected, don't do this and also don't
t

uart: Don't change settings or throttle putc for Hyper-V

Azure setup does not like it when FreeBSD overrides the settings of the
UART device. When Hyper-V is detected, don't do this and also don't
throttle putc() output. This is a workaround for the early boot hang
of FreeBSD on Azure.

Tested on Azure, ESXi (VM with serial port), and SG-8200

PR: 264267
Reviewed by: kevans, whu
Tested by: whu
Obtained from: Rubicon Communications, LLC (Netgate)
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC (Netgate)

show more ...


# 5ad8c32c 28-Oct-2022 Colin Percival <cperciva@FreeBSD.org>

ns8250: Fix sense of LSR_TEMT FCR check

When flushing the UART, we need to drain manually if LSR_TEMT is
*not* asserted, aka. if the transmit FIFO is not empty.

Reported by: void <void@f-m.fm>
Fixe

ns8250: Fix sense of LSR_TEMT FCR check

When flushing the UART, we need to drain manually if LSR_TEMT is
*not* asserted, aka. if the transmit FIFO is not empty.

Reported by: void <void@f-m.fm>
Fixes: c4b68e7e53bb "ns8250: Check if flush via FCR succeeded"
Differential Revision: https://reviews.freebsd.org/D37185

show more ...


# c4b68e7e 13-Oct-2022 Colin Percival <cperciva@FreeBSD.org>

ns8250: Check if flush via FCR succeeded

The emulated UART in the Firecracker VMM (aka the implementation in the
rust-vmm/vm-superio project) includes FIFOs but does not implement the
FCR register,

ns8250: Check if flush via FCR succeeded

The emulated UART in the Firecracker VMM (aka the implementation in the
rust-vmm/vm-superio project) includes FIFOs but does not implement the
FCR register, which is used by ns8250_flush to flush the FIFOs.

Check the LSR to see if there is still data in the FIFOs and call
ns8250_drain if necessary.

Discussed with: emaste, imp, jrtc27
Sponsored by: https://patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D36979

show more ...


# 39d6144d 12-Aug-2022 Colin Percival <cperciva@FreeBSD.org>

ns8250_drain: Drain without DELAY first

In virtual machines with virtual UARTs which have fictitious baud
rates, it may be possible to drain the receive queue very quickly,
without needing to DELAY

ns8250_drain: Drain without DELAY first

In virtual machines with virtual UARTs which have fictitious baud
rates, it may be possible to drain the receive queue very quickly,
without needing to DELAY after each character. Attempt to read
(and discard) the receive queue as fast as possible, stopping for
a DELAY only when LSR_RXRDY is no longer asserted; assume that we
have finished draining the queue when LSR_RXRDY is asserted both
before and after a DELAY.

This speeds up the boot process in FreeBSD/Firecracker by 27 ms.

Reviewed by: imp, jrtc27
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D36184

show more ...


12345678910>>...19