summaryrefslogtreecommitdiff
path: root/usr.sbin/bhyve/pci_lpc.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/bhyve/pci_lpc.c')
-rw-r--r--usr.sbin/bhyve/pci_lpc.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/usr.sbin/bhyve/pci_lpc.c b/usr.sbin/bhyve/pci_lpc.c
index 4ebdd7039cbc..3f7df55b5ffd 100644
--- a/usr.sbin/bhyve/pci_lpc.c
+++ b/usr.sbin/bhyve/pci_lpc.c
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
#include "pci_emul.h"
#include "pci_irq.h"
#include "pci_lpc.h"
+#include "pctestdev.h"
#include "uart_emul.h"
#define IO_ICU1 0x20
@@ -80,6 +81,8 @@ static struct lpc_uart_softc {
static const char *lpc_uart_names[LPC_UART_NUM] = { "COM1", "COM2" };
+static bool pctestdev_present;
+
/*
* LPC device configuration is in the following form:
* <lpc_device_name>[,<options>]
@@ -107,6 +110,18 @@ lpc_device_parse(const char *opts)
goto done;
}
}
+ if (strcasecmp(lpcdev, pctestdev_getname()) == 0) {
+ if (pctestdev_present) {
+ EPRINTLN("More than one %s device conf is "
+ "specified; only one is allowed.",
+ pctestdev_getname());
+ } else if (pctestdev_parse(str) == 0) {
+ pctestdev_present = true;
+ error = 0;
+ free(cpy);
+ goto done;
+ }
+ }
}
done:
@@ -124,6 +139,7 @@ lpc_print_supported_devices()
printf("bootrom\n");
for (i = 0; i < LPC_UART_NUM; i++)
printf("%s\n", lpc_uart_names[i]);
+ printf("%s\n", pctestdev_getname());
}
const char *
@@ -232,6 +248,13 @@ lpc_init(struct vmctx *ctx)
sc->enabled = 1;
}
+ /* pc-testdev */
+ if (pctestdev_present) {
+ error = pctestdev_init(ctx);
+ if (error)
+ return (error);
+ }
+
return (0);
}