diff options
author | tychon <tychon@FreeBSD.org> | 2014-03-16 12:31:28 +0000 |
---|---|---|
committer | tychon <tychon@FreeBSD.org> | 2014-03-16 12:31:28 +0000 |
commit | e4c43b07804f907e8bc336b4e033b557fd377d8c (patch) | |
tree | 46a6d5b76bafc19907ff025272dbf6937ed33ff3 /usr.sbin/bhyve | |
parent | eb89966ba21df35a35f06ca6180b816cf293529f (diff) | |
download | FreeBSD-src-e4c43b07804f907e8bc336b4e033b557fd377d8c.zip FreeBSD-src-e4c43b07804f907e8bc336b4e033b557fd377d8c.tar.gz |
Support the bootloader's single 16-bit 'outw' access to the Divisor
Latch MSB and LSB registers.
Approved by: neel (co-mentor)
Diffstat (limited to 'usr.sbin/bhyve')
-rw-r--r-- | usr.sbin/bhyve/pci_lpc.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/usr.sbin/bhyve/pci_lpc.c b/usr.sbin/bhyve/pci_lpc.c index 0ef9403..ddeb9bd 100644 --- a/usr.sbin/bhyve/pci_lpc.c +++ b/usr.sbin/bhyve/pci_lpc.c @@ -125,15 +125,27 @@ lpc_uart_io_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes, int offset; struct lpc_uart_softc *sc = arg; - if (bytes != 1) - return (-1); - offset = port - sc->iobase; - if (in) - *eax = uart_read(sc->uart_softc, offset); - else - uart_write(sc->uart_softc, offset, *eax); + switch (bytes) { + case 1: + if (in) + *eax = uart_read(sc->uart_softc, offset); + else + uart_write(sc->uart_softc, offset, *eax); + break; + case 2: + if (in) { + *eax = uart_read(sc->uart_softc, offset); + *eax |= uart_read(sc->uart_softc, offset + 1) << 8; + } else { + uart_write(sc->uart_softc, offset, *eax); + uart_write(sc->uart_softc, offset + 1, *eax >> 8); + } + break; + default: + return (-1); + } return (0); } |