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