1 /*-
2  * Copyright (c) 2011 NetApp, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  * $FreeBSD$
27  */
28 
29 #ifndef	_DM_H_
30 #define	_DM_H_
31 
32 #include <stdbool.h>
33 #include <sys/resource.h>
34 
35 #include "types.h"
36 #include "dm_string.h"
37 #include "acrn_common.h"
38 
39 struct vmctx;
40 extern uint8_t trusty_enabled;
41 extern char *vsbl_file_name;
42 extern char *ovmf_file_name;
43 extern char *ovmf_code_file_name;
44 extern char *ovmf_vars_file_name;
45 extern char *kernel_file_name;
46 extern char *elf_file_name;
47 extern char *vmname;
48 extern bool stdio_in_use;
49 extern char *mac_seed;
50 extern bool lapic_pt;
51 extern bool is_rtvm;
52 extern bool pt_tpm2;
53 extern bool ssram;
54 extern bool vtpm2;
55 extern bool is_winvm;
56 extern bool ovmf_loaded;
57 
58 enum acrn_thread_prio {
59 	PRIO_VCPU = PRIO_MIN,
60 	PRIO_IOTHREAD = PRIO_MIN,
61 	PRIO_VIRTIO_SND,
62 	PRIO_VIRTIO_IPU,
63 	PRIO_VIRTIO_GPU
64 };
65 
66 /**
67  * @brief Convert guest physical address to host virtual address
68  *
69  * @param ctx Pointer to to struct vmctx representing VM context.
70  * @param gaddr Guest physical address base.
71  * @param len Guest physical address length.
72  *
73  * @return NULL on convert failed and host virtual address on successful.
74  */
75 void *paddr_guest2host(struct vmctx *ctx, uintptr_t gaddr, size_t len);
76 int  virtio_uses_msix(void);
77 int  guest_cpu_num(void);
78 size_t high_bios_size(void);
79 void init_debugexit(void);
80 void deinit_debugexit(void);
81 void set_thread_priority(int priority, bool reset_on_fork);
82 #endif
83