HomeFreeBSD

uart(4): Add a concept of "unique" serial devices

Description

uart(4): Add a concept of "unique" serial devices

FreeBSD detects serial ports twice: First, very early in the boot
process, in order to obtain a usable console; and second, during
the device probe/attach process. When a UART is discovered during
device probing, FreeBSD attempts to determine whether it is a
device which was already being used as a console; without this,
the console doesn't work in userland.

Unfortunately it's possible for a UART to be mapped to a different
location in memory when it is discovered on a bus than it has when
it is announced via the ACPI SPCR table; this breaks the matching
process, which relies on comparing bus addresses.

To address this, we introduce a concept of "unique" serial devices,
i.e. devices which are guaranteed to be present *only once* on any
system. If we discover one of these during device probing, we can
match it to a same-PCI-vendor-and-device-numbers console which was
announced via the ACPI SPCR table, regardless of the differing bus
addresses.

At present, the only unique serial device is the "Amazon PCI serial
device" (vendor 0x1d0f, device 0x8250) found in some EC2 instances.
This unbreaks the serial console on those systems.

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

(cherry picked from commit ad93649d230428561db983153c546b39336fa4f1)

Details

Provenance
cpercivaAuthored on Mar 29 2022, 7:41 AM
Reviewer
imp
Differential Revision
D34703: uart(4): Add a concept of "unique" serial devices
Parents
rG7d160dc9a1a2: sysctl(8): Mention CTLFLAG_SKIP
Branches
Unknown
Tags
Unknown