Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/pci_fbuf.c
Show All 29 Lines | |||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <sys/mman.h> | #include <sys/mman.h> | ||||
#include <machine/vmm.h> | #include <machine/vmm.h> | ||||
#include <machine/vmm_snapshot.h> | |||||
#include <vmmapi.h> | #include <vmmapi.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <errno.h> | #include <errno.h> | ||||
#include <unistd.h> | #include <unistd.h> | ||||
▲ Show 20 Lines • Show All 389 Lines • ▼ Show 20 Lines | pci_fbuf_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) | ||||
error = rfb_init(sc->rfb_host, sc->rfb_port, sc->rfb_wait, sc->rfb_password); | error = rfb_init(sc->rfb_host, sc->rfb_port, sc->rfb_wait, sc->rfb_password); | ||||
done: | done: | ||||
if (error) | if (error) | ||||
free(sc); | free(sc); | ||||
return (error); | return (error); | ||||
} | } | ||||
#ifdef BHYVE_SNAPSHOT | |||||
static int | |||||
pci_fbuf_snapshot(struct vm_snapshot_meta *meta) | |||||
{ | |||||
int ret; | |||||
SNAPSHOT_BUF_OR_LEAVE(fbuf_sc->fb_base, FB_SIZE, meta, ret, err); | |||||
err: | |||||
return (ret); | |||||
} | |||||
#endif | |||||
struct pci_devemu pci_fbuf = { | struct pci_devemu pci_fbuf = { | ||||
.pe_emu = "fbuf", | .pe_emu = "fbuf", | ||||
.pe_init = pci_fbuf_init, | .pe_init = pci_fbuf_init, | ||||
.pe_barwrite = pci_fbuf_write, | .pe_barwrite = pci_fbuf_write, | ||||
.pe_barread = pci_fbuf_read | .pe_barread = pci_fbuf_read, | ||||
#ifdef BHYVE_SNAPSHOT | |||||
.pe_snapshot = pci_fbuf_snapshot, | |||||
#endif | |||||
}; | }; | ||||
PCI_EMUL_SET(pci_fbuf); | PCI_EMUL_SET(pci_fbuf); |