diff options
Diffstat (limited to 'usr.sbin/bhyve/pci_lpc.c')
-rw-r--r-- | usr.sbin/bhyve/pci_lpc.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/usr.sbin/bhyve/pci_lpc.c b/usr.sbin/bhyve/pci_lpc.c index 1e4b513ec494..4ebdd7039cbc 100644 --- a/usr.sbin/bhyve/pci_lpc.c +++ b/usr.sbin/bhyve/pci_lpc.c @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include <sys/types.h> #include <machine/vmm.h> +#include <machine/vmm_snapshot.h> #include <stdio.h> #include <stdlib.h> @@ -452,12 +453,35 @@ lpc_pirq_routed(void) pci_set_cfgdata8(lpc_bridge, 0x68 + pin, pirq_read(pin + 5)); } +#ifdef BHYVE_SNAPSHOT +static int +pci_lpc_snapshot(struct vm_snapshot_meta *meta) +{ + int unit, ret; + struct uart_softc *sc; + + for (unit = 0; unit < LPC_UART_NUM; unit++) { + sc = lpc_uart_softc[unit].uart_softc; + + ret = uart_snapshot(sc, meta); + if (ret != 0) + goto done; + } + +done: + return (ret); +} +#endif + struct pci_devemu pci_de_lpc = { .pe_emu = "lpc", .pe_init = pci_lpc_init, .pe_write_dsdt = pci_lpc_write_dsdt, .pe_cfgwrite = pci_lpc_cfgwrite, .pe_barwrite = pci_lpc_write, - .pe_barread = pci_lpc_read + .pe_barread = pci_lpc_read, +#ifdef BHYVE_SNAPSHOT + .pe_snapshot = pci_lpc_snapshot, +#endif }; PCI_EMUL_SET(pci_de_lpc); |