xref: /freebsd/sys/contrib/xen/dom0_ops.h (revision 3a9fd8242b35884921dfc4e886f284a75870a536)
1 /******************************************************************************
2  * dom0_ops.h
3  *
4  * Process command requests from domain-0 guest OS.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  *
24  * Copyright (c) 2002-2003, B Dragovic
25  * Copyright (c) 2002-2006, K Fraser
26  */
27 
28 #ifndef __XEN_PUBLIC_DOM0_OPS_H__
29 #define __XEN_PUBLIC_DOM0_OPS_H__
30 
31 #include "xen.h"
32 #include "platform.h"
33 
34 #if __XEN_INTERFACE_VERSION__ >= 0x00030204
35 #error "dom0_ops.h is a compatibility interface only"
36 #endif
37 
38 #define DOM0_INTERFACE_VERSION XENPF_INTERFACE_VERSION
39 
40 #define DOM0_SETTIME          XENPF_settime
41 #define dom0_settime          xenpf_settime
42 #define dom0_settime_t        xenpf_settime_t
43 
44 #define DOM0_ADD_MEMTYPE      XENPF_add_memtype
45 #define dom0_add_memtype      xenpf_add_memtype
46 #define dom0_add_memtype_t    xenpf_add_memtype_t
47 
48 #define DOM0_DEL_MEMTYPE      XENPF_del_memtype
49 #define dom0_del_memtype      xenpf_del_memtype
50 #define dom0_del_memtype_t    xenpf_del_memtype_t
51 
52 #define DOM0_READ_MEMTYPE     XENPF_read_memtype
53 #define dom0_read_memtype     xenpf_read_memtype
54 #define dom0_read_memtype_t   xenpf_read_memtype_t
55 
56 #define DOM0_MICROCODE        XENPF_microcode_update
57 #define dom0_microcode        xenpf_microcode_update
58 #define dom0_microcode_t      xenpf_microcode_update_t
59 
60 #define DOM0_PLATFORM_QUIRK   XENPF_platform_quirk
61 #define dom0_platform_quirk   xenpf_platform_quirk
62 #define dom0_platform_quirk_t xenpf_platform_quirk_t
63 
64 typedef uint64_t cpumap_t;
65 
66 /* Unsupported legacy operation -- defined for API compatibility. */
67 #define DOM0_MSR                 15
68 struct dom0_msr {
69     /* IN variables. */
70     uint32_t write;
71     cpumap_t cpu_mask;
72     uint32_t msr;
73     uint32_t in1;
74     uint32_t in2;
75     /* OUT variables. */
76     uint32_t out1;
77     uint32_t out2;
78 };
79 typedef struct dom0_msr dom0_msr_t;
80 DEFINE_XEN_GUEST_HANDLE(dom0_msr_t);
81 
82 /* Unsupported legacy operation -- defined for API compatibility. */
83 #define DOM0_PHYSICAL_MEMORY_MAP 40
84 struct dom0_memory_map_entry {
85     uint64_t start, end;
86     uint32_t flags; /* reserved */
87     uint8_t  is_ram;
88 };
89 typedef struct dom0_memory_map_entry dom0_memory_map_entry_t;
90 DEFINE_XEN_GUEST_HANDLE(dom0_memory_map_entry_t);
91 
92 struct dom0_op {
93     uint32_t cmd;
94     uint32_t interface_version; /* DOM0_INTERFACE_VERSION */
95     union {
96         struct dom0_msr               msr;
97         struct dom0_settime           settime;
98         struct dom0_add_memtype       add_memtype;
99         struct dom0_del_memtype       del_memtype;
100         struct dom0_read_memtype      read_memtype;
101         struct dom0_microcode         microcode;
102         struct dom0_platform_quirk    platform_quirk;
103         struct dom0_memory_map_entry  physical_memory_map;
104         uint8_t                       pad[128];
105     } u;
106 };
107 typedef struct dom0_op dom0_op_t;
108 DEFINE_XEN_GUEST_HANDLE(dom0_op_t);
109 
110 #endif /* __XEN_PUBLIC_DOM0_OPS_H__ */
111 
112 /*
113  * Local variables:
114  * mode: C
115  * c-file-style: "BSD"
116  * c-basic-offset: 4
117  * tab-width: 4
118  * indent-tabs-mode: nil
119  * End:
120  */
121