xref: /freebsd/sys/amd64/vmm/io/vatpit.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1e883c9bbSTycho Nightingale /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3ebc3c37cSMarcelo Araujo  *
4e883c9bbSTycho Nightingale  * Copyright (c) 2014 Tycho Nightingale <tycho.nightingale@pluribusnetworks.com>
5e883c9bbSTycho Nightingale  * Copyright (c) 2011 NetApp, Inc.
6e883c9bbSTycho Nightingale  * All rights reserved.
7e883c9bbSTycho Nightingale  *
8e883c9bbSTycho Nightingale  * Redistribution and use in source and binary forms, with or without
9e883c9bbSTycho Nightingale  * modification, are permitted provided that the following conditions
10e883c9bbSTycho Nightingale  * are met:
11e883c9bbSTycho Nightingale  * 1. Redistributions of source code must retain the above copyright
12e883c9bbSTycho Nightingale  *    notice, this list of conditions and the following disclaimer.
13e883c9bbSTycho Nightingale  * 2. Redistributions in binary form must reproduce the above copyright
14e883c9bbSTycho Nightingale  *    notice, this list of conditions and the following disclaimer in the
15e883c9bbSTycho Nightingale  *    documentation and/or other materials provided with the distribution.
16e883c9bbSTycho Nightingale  *
17e883c9bbSTycho Nightingale  * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND
18e883c9bbSTycho Nightingale  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19e883c9bbSTycho Nightingale  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20e883c9bbSTycho Nightingale  * ARE DISCLAIMED.  IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE
21e883c9bbSTycho Nightingale  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22e883c9bbSTycho Nightingale  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23e883c9bbSTycho Nightingale  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24e883c9bbSTycho Nightingale  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25e883c9bbSTycho Nightingale  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26e883c9bbSTycho Nightingale  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27e883c9bbSTycho Nightingale  * SUCH DAMAGE.
28e883c9bbSTycho Nightingale  */
29e883c9bbSTycho Nightingale 
30e883c9bbSTycho Nightingale #ifndef _VATPIT_H_
31e883c9bbSTycho Nightingale #define	_VATPIT_H_
32e883c9bbSTycho Nightingale 
33de4da6cdSDmitry Chagin #include <x86/timerreg.h>
34e883c9bbSTycho Nightingale 
3579d6ca33STycho Nightingale #define	NMISC_PORT	0x61
3679d6ca33STycho Nightingale 
37483d953aSJohn Baldwin struct vm_snapshot_meta;
38483d953aSJohn Baldwin 
39e883c9bbSTycho Nightingale struct vatpit *vatpit_init(struct vm *vm);
40e883c9bbSTycho Nightingale void vatpit_cleanup(struct vatpit *vatpit);
41e883c9bbSTycho Nightingale 
429388bc1eSJohn Baldwin int vatpit_handler(struct vm *vm, bool in, int port, int bytes, uint32_t *eax);
439388bc1eSJohn Baldwin int vatpit_nmisc_handler(struct vm *vm, bool in, int port, int bytes,
44d6aa08c3STycho Nightingale     uint32_t *eax);
45483d953aSJohn Baldwin #ifdef BHYVE_SNAPSHOT
46483d953aSJohn Baldwin int vatpit_snapshot(struct vatpit *vatpit, struct vm_snapshot_meta *meta);
47483d953aSJohn Baldwin #endif
48e883c9bbSTycho Nightingale 
49e883c9bbSTycho Nightingale #endif	/* _VATPIT_H_ */
50