xref: /freebsd/sys/xen/hypervisor.h (revision ecdcad6516c9a911a701e362f23a9d2643a6d7d0)
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  * $FreeBSD$
93a6d1fcfSKip Macy  */
103a6d1fcfSKip Macy 
1112678024SDoug Rabson #ifndef __XEN_HYPERVISOR_H__
1212678024SDoug Rabson #define __XEN_HYPERVISOR_H__
1312678024SDoug Rabson 
143a6d1fcfSKip Macy #include <sys/cdefs.h>
153a6d1fcfSKip Macy #include <sys/systm.h>
16ad7dd514SElliott Mitchell #include <contrib/xen/xen.h>
17ad7dd514SElliott Mitchell #include <contrib/xen/platform.h>
18ad7dd514SElliott Mitchell #include <contrib/xen/event_channel.h>
19ad7dd514SElliott Mitchell #include <contrib/xen/physdev.h>
20ad7dd514SElliott Mitchell #include <contrib/xen/sched.h>
21ad7dd514SElliott Mitchell #include <contrib/xen/callback.h>
22ad7dd514SElliott Mitchell #include <contrib/xen/memory.h>
23ad7dd514SElliott Mitchell #include <contrib/xen/hvm/dm_op.h>
243a6d1fcfSKip Macy #include <machine/xen/hypercall.h>
253a6d1fcfSKip Macy 
263a6d1fcfSKip Macy static inline int
27a231723cSRoger Pau Monné HYPERVISOR_console_write(const char *str, int count)
283a6d1fcfSKip Macy {
293a6d1fcfSKip Macy     return HYPERVISOR_console_io(CONSOLEIO_write, count, str);
303a6d1fcfSKip Macy }
313a6d1fcfSKip Macy 
323a6d1fcfSKip Macy static inline int
333a6d1fcfSKip Macy HYPERVISOR_yield(void)
343a6d1fcfSKip Macy {
353a6d1fcfSKip Macy 
36*ecdcad65SElliott Mitchell 	return (HYPERVISOR_sched_op(SCHEDOP_yield, NULL));
373a6d1fcfSKip Macy }
383a6d1fcfSKip Macy 
393a6d1fcfSKip Macy static inline void
403a6d1fcfSKip Macy HYPERVISOR_shutdown(unsigned int reason)
413a6d1fcfSKip Macy {
423a6d1fcfSKip Macy 	struct sched_shutdown sched_shutdown = {
433a6d1fcfSKip Macy 		.reason = reason
443a6d1fcfSKip Macy 	};
453a6d1fcfSKip Macy 
463a6d1fcfSKip Macy 	HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
473a6d1fcfSKip Macy }
483a6d1fcfSKip Macy 
4912678024SDoug Rabson #endif /* __XEN_HYPERVISOR_H__ */
50