xref: /dflybsd-src/sys/dev/virtual/hyperv/hyperv_var.h (revision 82b778547fb437620f0453271b4db5c69a9980b4)
1*82b77854SSepherosa Ziehau /*-
2*82b77854SSepherosa Ziehau  * Copyright (c) 2016 Microsoft Corp.
3*82b77854SSepherosa Ziehau  * All rights reserved.
4*82b77854SSepherosa Ziehau  *
5*82b77854SSepherosa Ziehau  * Redistribution and use in source and binary forms, with or without
6*82b77854SSepherosa Ziehau  * modification, are permitted provided that the following conditions
7*82b77854SSepherosa Ziehau  * are met:
8*82b77854SSepherosa Ziehau  * 1. Redistributions of source code must retain the above copyright
9*82b77854SSepherosa Ziehau  *    notice unmodified, this list of conditions, and the following
10*82b77854SSepherosa Ziehau  *    disclaimer.
11*82b77854SSepherosa Ziehau  * 2. Redistributions in binary form must reproduce the above copyright
12*82b77854SSepherosa Ziehau  *    notice, this list of conditions and the following disclaimer in the
13*82b77854SSepherosa Ziehau  *    documentation and/or other materials provided with the distribution.
14*82b77854SSepherosa Ziehau  *
15*82b77854SSepherosa Ziehau  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16*82b77854SSepherosa Ziehau  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17*82b77854SSepherosa Ziehau  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18*82b77854SSepherosa Ziehau  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19*82b77854SSepherosa Ziehau  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20*82b77854SSepherosa Ziehau  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21*82b77854SSepherosa Ziehau  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22*82b77854SSepherosa Ziehau  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23*82b77854SSepherosa Ziehau  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24*82b77854SSepherosa Ziehau  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*82b77854SSepherosa Ziehau  *
26*82b77854SSepherosa Ziehau  * $FreeBSD$
27*82b77854SSepherosa Ziehau  */
28*82b77854SSepherosa Ziehau 
29*82b77854SSepherosa Ziehau #ifndef _HYPERV_VAR_H_
30*82b77854SSepherosa Ziehau #define _HYPERV_VAR_H_
31*82b77854SSepherosa Ziehau 
32*82b77854SSepherosa Ziehau #ifndef NANOSEC
33*82b77854SSepherosa Ziehau #define NANOSEC			1000000000ULL
34*82b77854SSepherosa Ziehau #endif
35*82b77854SSepherosa Ziehau #define HYPERV_TIMER_NS_FACTOR	100ULL
36*82b77854SSepherosa Ziehau #define HYPERV_TIMER_FREQ	(NANOSEC / HYPERV_TIMER_NS_FACTOR)
37*82b77854SSepherosa Ziehau 
38*82b77854SSepherosa Ziehau typedef	uint64_t	(*hyperv_tc64_t)(void);
39*82b77854SSepherosa Ziehau 
40*82b77854SSepherosa Ziehau extern u_int		hyperv_features;
41*82b77854SSepherosa Ziehau /* NOTE: This could be NULL, if there were no suitable Hyper-V time counter. */
42*82b77854SSepherosa Ziehau extern hyperv_tc64_t	hyperv_tc64;
43*82b77854SSepherosa Ziehau 
44*82b77854SSepherosa Ziehau uint64_t		hypercall_post_message(bus_addr_t);
45*82b77854SSepherosa Ziehau 
46*82b77854SSepherosa Ziehau #endif	/* !_HYPERV_VAR_H_ */
47