xref: /freebsd/sys/xen/hypervisor.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
13a6d1fcfSKip Macy /******************************************************************************
23a6d1fcfSKip Macy  * hypervisor.h
33a6d1fcfSKip Macy   *
43a6d1fcfSKip Macy  * Linux-specific hypervisor handling.
53a6d1fcfSKip Macy  *
63a6d1fcfSKip Macy  * Copyright (c) 2002, K A Fraser
73a6d1fcfSKip Macy  */
83a6d1fcfSKip Macy 
912678024SDoug Rabson #ifndef __XEN_HYPERVISOR_H__
1012678024SDoug Rabson #define __XEN_HYPERVISOR_H__
1112678024SDoug Rabson 
123a6d1fcfSKip Macy #include <sys/cdefs.h>
133a6d1fcfSKip Macy #include <sys/systm.h>
14ad7dd514SElliott Mitchell #include <contrib/xen/xen.h>
15ad7dd514SElliott Mitchell #include <contrib/xen/platform.h>
16ad7dd514SElliott Mitchell #include <contrib/xen/event_channel.h>
17ad7dd514SElliott Mitchell #include <contrib/xen/physdev.h>
18ad7dd514SElliott Mitchell #include <contrib/xen/sched.h>
19ad7dd514SElliott Mitchell #include <contrib/xen/callback.h>
20ad7dd514SElliott Mitchell #include <contrib/xen/memory.h>
21ad7dd514SElliott Mitchell #include <contrib/xen/hvm/dm_op.h>
223a6d1fcfSKip Macy #include <machine/xen/hypercall.h>
233a6d1fcfSKip Macy 
243a6d1fcfSKip Macy static inline int
HYPERVISOR_console_write(const char * str,int count)25a231723cSRoger Pau MonnĂ© HYPERVISOR_console_write(const char *str, int count)
263a6d1fcfSKip Macy {
273a6d1fcfSKip Macy     return HYPERVISOR_console_io(CONSOLEIO_write, count, str);
283a6d1fcfSKip Macy }
293a6d1fcfSKip Macy 
303a6d1fcfSKip Macy static inline int
HYPERVISOR_yield(void)313a6d1fcfSKip Macy HYPERVISOR_yield(void)
323a6d1fcfSKip Macy {
333a6d1fcfSKip Macy 
34*ecdcad65SElliott Mitchell 	return (HYPERVISOR_sched_op(SCHEDOP_yield, NULL));
353a6d1fcfSKip Macy }
363a6d1fcfSKip Macy 
373a6d1fcfSKip Macy static inline void
HYPERVISOR_shutdown(unsigned int reason)383a6d1fcfSKip Macy HYPERVISOR_shutdown(unsigned int reason)
393a6d1fcfSKip Macy {
403a6d1fcfSKip Macy 	struct sched_shutdown sched_shutdown = {
413a6d1fcfSKip Macy 		.reason = reason
423a6d1fcfSKip Macy 	};
433a6d1fcfSKip Macy 
443a6d1fcfSKip Macy 	HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
453a6d1fcfSKip Macy }
463a6d1fcfSKip Macy 
4712678024SDoug Rabson #endif /* __XEN_HYPERVISOR_H__ */
48