xref: /titanic_52/usr/src/uts/i86pc/sys/xpv_support.h (revision 29493bd8e037cbaea9095b34172305abb589cb6b)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_XPV_SUPPORT_H
28 #define	_SYS_XPV_SUPPORT_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #define	__XEN_INTERFACE_VERSION__	__XEN_LATEST_INTERFACE_VERSION__
37 
38 #if !defined(_ASM)
39 
40 #include <sys/types.h>
41 #include <sys/inttypes.h>
42 #include <sys/dditypes.h>
43 
44 typedef ulong_t mfn_t;
45 typedef uint64_t maddr_t;
46 #define	mfn_to_ma(mfn)	((maddr_t)(mfn) << MMU_PAGESHIFT)
47 #define	MFN_INVALID (-(mfn_t)1)
48 
49 #define	IPL_DEBUG	15	/* domain debug interrupt */
50 #define	IPL_CONS	9
51 #define	IPL_VIF		6
52 #define	IPL_VBD		5
53 #define	IPL_EVTCHN	1
54 
55 #define	INVALID_EVTCHN 0
56 
57 typedef uint_t (*ec_handler_fcn_t)();
58 
59 extern int ec_init(dev_info_t *);
60 extern void ec_fini();
61 extern void ec_bind_evtchn_to_handler(int, pri_t, ec_handler_fcn_t, void *);
62 extern void ec_unbind_evtchn(int);
63 extern void ec_notify_via_evtchn(uint_t);
64 extern void hypervisor_mask_event(uint_t);
65 extern void hypervisor_unmask_event(uint_t);
66 
67 extern int xen_bind_interdomain(int, int, int *);
68 extern int xen_alloc_unbound_evtchn(int, int *);
69 extern int xen_xlate_errcode(int error);
70 extern void *xen_alloc_pages(pgcnt_t cnt);
71 extern void kbm_map_ma(maddr_t ma, uintptr_t va, uint_t level);
72 
73 /*
74  * Stub functions to allow the FE drivers to build without littering them
75  * with #ifdefs
76  */
77 extern void balloon_drv_added(int64_t);
78 extern long balloon_free_pages(uint_t, mfn_t *, caddr_t, pfn_t *);
79 extern void xen_release_pfn(pfn_t, caddr_t);
80 extern void reassign_pfn(pfn_t, mfn_t);
81 
82 extern int xen_is_64bit;
83 
84 #define	IN_XPV_PANIC()	(__lintzero)
85 
86 #ifdef __cplusplus
87 }
88 #endif
89 
90 #endif	/* __ASM */
91 #endif	/* _SYS_XPV_SUPPORT_H */
92