]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
bhyve: Move device model-independent UART code into a separate file
authorMark Johnston <markj@FreeBSD.org>
Thu, 21 Mar 2024 04:20:37 +0000 (00:20 -0400)
committerMark Johnston <markj@FreeBSD.org>
Thu, 21 Mar 2024 05:04:48 +0000 (01:04 -0400)
commitd1c5d0cfcc1733c243d87f20477b115db4cf24b6
tree9807075b10a09d5a8aeed1ea0f818d39d99cb029
parent6b3db5d7793f57fa0020a78d61aae7ec318557cc
bhyve: Move device model-independent UART code into a separate file

Currently bhyve implements a ns16550-compatible UART in uart_emul.c.
This file also contains generic code to manage RX FIFOs and to handle
reading from and writing to a TTY.  bhyve instantiates UARTs to
implement COM devices (via pci_lpc.c) and PCI UART devices.

The arm64 port will bring with it a PL011 device model which is used as
the default console (i.e., no COM ports).  To simplify its integration,
add a UART "backend" layer which lets UART device models allocate an RX
FIFO and interact with TTYs without duplicating code.  In particular,
code in uart_backend.* is to be shared among device models, and the
namespace for uart_emul.* is changed to uart_ns16550_*.

This is based on andrew@'s work in
https://github.com/zxombie/freebsd/tree/bhyvearm64 but I've made a
number of changes, particularly with respect to naming and source code
organization.

No functional change intended.

Reviewed by: corvink, jhb
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40993
usr.sbin/bhyve/Makefile
usr.sbin/bhyve/amd64/pci_lpc.c
usr.sbin/bhyve/pci_uart.c
usr.sbin/bhyve/uart_backend.c [new file with mode: 0644]
usr.sbin/bhyve/uart_backend.h [new file with mode: 0644]
usr.sbin/bhyve/uart_emul.c
usr.sbin/bhyve/uart_emul.h