Date: Sun, 16 Mar 2014 12:31:28 +0000 (UTC) From: Tycho Nightingale <tychon@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r263236 - head/usr.sbin/bhyve Message-ID: <201403161231.s2GCVS6I055613@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: tychon Date: Sun Mar 16 12:31:28 2014 New Revision: 263236 URL: http://svnweb.freebsd.org/changeset/base/263236 Log: Support the bootloader's single 16-bit 'outw' access to the Divisor Latch MSB and LSB registers. Approved by: neel (co-mentor) Modified: head/usr.sbin/bhyve/pci_lpc.c Modified: head/usr.sbin/bhyve/pci_lpc.c ============================================================================== --- head/usr.sbin/bhyve/pci_lpc.c Sun Mar 16 11:06:05 2014 (r263235) +++ head/usr.sbin/bhyve/pci_lpc.c Sun Mar 16 12:31:28 2014 (r263236) @@ -125,15 +125,27 @@ lpc_uart_io_handler(struct vmctx *ctx, i 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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403161231.s2GCVS6I055613>