Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/vmm/io/vatpit.c
Show All 23 Lines | |||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
* SUCH DAMAGE. | * SUCH DAMAGE. | ||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include "opt_bhyve_snapshot.h" | |||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <sys/queue.h> | #include <sys/queue.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <machine/vmm.h> | #include <machine/vmm.h> | ||||
#include <machine/vmm_snapshot.h> | |||||
#include "vmm_ktr.h" | #include "vmm_ktr.h" | ||||
#include "vatpic.h" | #include "vatpic.h" | ||||
#include "vioapic.h" | #include "vioapic.h" | ||||
#include "vatpit.h" | #include "vatpit.h" | ||||
static MALLOC_DEFINE(M_VATPIT, "atpit", "bhyve virtual atpit (8254)"); | static MALLOC_DEFINE(M_VATPIT, "atpit", "bhyve virtual atpit (8254)"); | ||||
▲ Show 20 Lines • Show All 417 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
int i; | int i; | ||||
for (i = 0; i < 3; i++) | for (i = 0; i < 3; i++) | ||||
callout_drain(&vatpit->channel[i].callout); | callout_drain(&vatpit->channel[i].callout); | ||||
free(vatpit, M_VATPIT); | free(vatpit, M_VATPIT); | ||||
} | } | ||||
#ifdef BHYVE_SNAPSHOT | |||||
int | |||||
vatpit_snapshot(struct vatpit *vatpit, struct vm_snapshot_meta *meta) | |||||
{ | |||||
int ret; | |||||
int i; | |||||
struct channel *channel; | |||||
SNAPSHOT_VAR_OR_LEAVE(vatpit->freq_bt.sec, meta, ret, done); | |||||
SNAPSHOT_VAR_OR_LEAVE(vatpit->freq_bt.frac, meta, ret, done); | |||||
/* properly restore timers; they will NOT work currently */ | |||||
printf("%s: snapshot restore does not reset timers!\r\n", __func__); | |||||
for (i = 0; i < nitems(vatpit->channel); i++) { | |||||
channel = &vatpit->channel[i]; | |||||
SNAPSHOT_VAR_OR_LEAVE(channel->mode, meta, ret, done); | |||||
SNAPSHOT_VAR_OR_LEAVE(channel->initial, meta, ret, done); | |||||
SNAPSHOT_VAR_OR_LEAVE(channel->now_bt.sec, meta, ret, done); | |||||
SNAPSHOT_VAR_OR_LEAVE(channel->now_bt.frac, meta, ret, done); | |||||
SNAPSHOT_BUF_OR_LEAVE(channel->cr, sizeof(channel->cr), | |||||
meta, ret, done); | |||||
SNAPSHOT_BUF_OR_LEAVE(channel->ol, sizeof(channel->ol), | |||||
meta, ret, done); | |||||
SNAPSHOT_VAR_OR_LEAVE(channel->slatched, meta, ret, done); | |||||
SNAPSHOT_VAR_OR_LEAVE(channel->status, meta, ret, done); | |||||
SNAPSHOT_VAR_OR_LEAVE(channel->crbyte, meta, ret, done); | |||||
SNAPSHOT_VAR_OR_LEAVE(channel->frbyte, meta, ret, done); | |||||
SNAPSHOT_VAR_OR_LEAVE(channel->callout_bt.sec, meta, ret, done); | |||||
SNAPSHOT_VAR_OR_LEAVE(channel->callout_bt.frac, meta, ret, | |||||
done); | |||||
} | |||||
done: | |||||
return (ret); | |||||
} | |||||
#endif |