xref: /freebsd/sys/amd64/vmm/io/vhpet.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
108e3ff32SNeel Natu /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3c49761ddSPedro F. Giffuni  *
408e3ff32SNeel Natu  * Copyright (c) 2013 Tycho Nightingale <tycho.nightingale@pluribusnetworks.com>
508e3ff32SNeel Natu  * Copyright (c) 2013 Neel Natu <neel@freebsd.org>
608e3ff32SNeel Natu  * All rights reserved.
708e3ff32SNeel Natu  *
808e3ff32SNeel Natu  * Redistribution and use in source and binary forms, with or without
908e3ff32SNeel Natu  * modification, are permitted provided that the following conditions
1008e3ff32SNeel Natu  * are met:
1108e3ff32SNeel Natu  * 1. Redistributions of source code must retain the above copyright
1208e3ff32SNeel Natu  *    notice, this list of conditions and the following disclaimer.
1308e3ff32SNeel Natu  * 2. Redistributions in binary form must reproduce the above copyright
1408e3ff32SNeel Natu  *    notice, this list of conditions and the following disclaimer in the
1508e3ff32SNeel Natu  *    documentation and/or other materials provided with the distribution.
1608e3ff32SNeel Natu  *
1708e3ff32SNeel Natu  * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND
1808e3ff32SNeel Natu  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1908e3ff32SNeel Natu  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2008e3ff32SNeel Natu  * ARE DISCLAIMED.  IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE
2108e3ff32SNeel Natu  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2208e3ff32SNeel Natu  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2308e3ff32SNeel Natu  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2408e3ff32SNeel Natu  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2508e3ff32SNeel Natu  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2608e3ff32SNeel Natu  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2708e3ff32SNeel Natu  * SUCH DAMAGE.
2808e3ff32SNeel Natu  */
2908e3ff32SNeel Natu 
3008e3ff32SNeel Natu #ifndef _VHPET_H_
3108e3ff32SNeel Natu #define	_VHPET_H_
3208e3ff32SNeel Natu 
3308e3ff32SNeel Natu #define	VHPET_BASE	0xfed00000
3408e3ff32SNeel Natu #define	VHPET_SIZE	1024
3508e3ff32SNeel Natu 
360f435e64SJohn Baldwin #ifdef _KERNEL
37483d953aSJohn Baldwin struct vm_snapshot_meta;
38483d953aSJohn Baldwin 
3908e3ff32SNeel Natu struct vhpet *vhpet_init(struct vm *vm);
4008e3ff32SNeel Natu void 	vhpet_cleanup(struct vhpet *vhpet);
41d3956e46SJohn Baldwin int	vhpet_mmio_write(struct vcpu *vcpu, uint64_t gpa, uint64_t val,
4208e3ff32SNeel Natu 	    int size, void *arg);
43d3956e46SJohn Baldwin int	vhpet_mmio_read(struct vcpu *vcpu, uint64_t gpa, uint64_t *val,
4408e3ff32SNeel Natu 	    int size, void *arg);
4508e3ff32SNeel Natu int	vhpet_getcap(struct vm_hpet_cap *cap);
46483d953aSJohn Baldwin #ifdef BHYVE_SNAPSHOT
47483d953aSJohn Baldwin int	vhpet_snapshot(struct vhpet *vhpet, struct vm_snapshot_meta *meta);
48483d953aSJohn Baldwin int	vhpet_restore_time(struct vhpet *vhpet);
49483d953aSJohn Baldwin #endif
5008e3ff32SNeel Natu 
510f435e64SJohn Baldwin #endif /* _KERNEL */
520f435e64SJohn Baldwin 
5308e3ff32SNeel Natu #endif	/* _VHPET_H_ */
54