svn commit: r263236 - head/usr.sbin/bhyve

Tycho Nightingale tychon at FreeBSD.org
Sun Mar 16 12:31:28 UTC 2014


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);
 }


More information about the svn-src-all mailing list