Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/pci_e82545.c
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
#include <netinet/in.h> | #include <netinet/in.h> | ||||
#include <netinet/tcp.h> | #include <netinet/tcp.h> | ||||
#ifndef WITHOUT_CAPSICUM | #ifndef WITHOUT_CAPSICUM | ||||
#include <capsicum_helpers.h> | #include <capsicum_helpers.h> | ||||
#endif | #endif | ||||
#include <machine/vmm_snapshot.h> | #include <machine/vmm_snapshot.h> | ||||
#ifdef BHYVE_SNAPSHOT | |||||
#include "snapshot.h" | |||||
#endif | |||||
#include <err.h> | #include <err.h> | ||||
#include <errno.h> | #include <errno.h> | ||||
#include <fcntl.h> | #include <fcntl.h> | ||||
#include <md5.h> | #include <md5.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <sysexits.h> | #include <sysexits.h> | ||||
▲ Show 20 Lines • Show All 2,220 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
e82545_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl) | e82545_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl) | ||||
{ | { | ||||
char nstr[80]; | char nstr[80]; | ||||
struct e82545_softc *sc; | struct e82545_softc *sc; | ||||
const char *mac; | const char *mac; | ||||
int err; | int err; | ||||
#ifdef BHYVE_SNAPSHOT | |||||
struct vm_snapshot_dev_info *dev_info; | |||||
#endif | |||||
/* Setup our softc */ | /* Setup our softc */ | ||||
sc = calloc(1, sizeof(*sc)); | sc = calloc(1, sizeof(*sc)); | ||||
pi->pi_arg = sc; | pi->pi_arg = sc; | ||||
sc->esc_pi = pi; | sc->esc_pi = pi; | ||||
sc->esc_ctx = ctx; | sc->esc_ctx = ctx; | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | if (err) { | ||||
free(sc); | free(sc); | ||||
return (err); | return (err); | ||||
} | } | ||||
netbe_rx_enable(sc->esc_be); | netbe_rx_enable(sc->esc_be); | ||||
/* H/w initiated reset */ | /* H/w initiated reset */ | ||||
e82545_reset(sc, 0); | e82545_reset(sc, 0); | ||||
#ifdef BHYVE_SNAPSHOT | |||||
dev_info = calloc(1, sizeof(*dev_info)); | |||||
if (!dev_info) { | |||||
fprintf(stderr, "Error allocating space for snapshot struct"); | |||||
return (-1); | |||||
} | |||||
dev_info->dev_name = pi->pi_d->pe_emu; | |||||
dev_info->was_restored = 0; | |||||
dev_info->snapshot_cb = pci_snapshot; | |||||
dev_info->meta_data = pi; | |||||
insert_registered_devs(dev_info); | |||||
#endif | |||||
return (0); | return (0); | ||||
} | } | ||||
#ifdef BHYVE_SNAPSHOT | #ifdef BHYVE_SNAPSHOT | ||||
static int | static int | ||||
e82545_snapshot(struct vm_snapshot_meta *meta) | e82545_snapshot(struct vm_snapshot_meta *meta) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 162 Lines • Show Last 20 Lines |