xref: /titanic_50/usr/src/uts/common/xen/public/platform.h (revision 7ec363dc481bba196d724969022171de4687989f)
1 /******************************************************************************
2  * platform.h
3  *
4  * Hardware platform operations. Intended for use by domain-0 kernel.
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-2006, K Fraser
25  */
26 
27 #ifndef __XEN_PUBLIC_PLATFORM_H__
28 #define __XEN_PUBLIC_PLATFORM_H__
29 
30 #include "xen.h"
31 
32 #define XENPF_INTERFACE_VERSION 0x03000001
33 
34 /*
35  * Set clock such that it would read <secs,nsecs> after 00:00:00 UTC,
36  * 1 January, 1970 if the current system time was <system_time>.
37  */
38 #define XENPF_settime             17
39 struct xenpf_settime {
40     /* IN variables. */
41     uint32_t secs;
42     uint32_t nsecs;
43     uint64_t system_time;
44 };
45 typedef struct xenpf_settime xenpf_settime_t;
46 DEFINE_XEN_GUEST_HANDLE(xenpf_settime_t);
47 
48 /*
49  * Request memory range (@mfn, @mfn+@nr_mfns-1) to have type @type.
50  * On x86, @type is an architecture-defined MTRR memory type.
51  * On success, returns the MTRR that was used (@reg) and a handle that can
52  * be passed to XENPF_DEL_MEMTYPE to accurately tear down the new setting.
53  * (x86-specific).
54  */
55 #define XENPF_add_memtype         31
56 struct xenpf_add_memtype {
57     /* IN variables. */
58     xen_pfn_t mfn;
59     uint64_t nr_mfns;
60     uint32_t type;
61     /* OUT variables. */
62     uint32_t handle;
63     uint32_t reg;
64 };
65 typedef struct xenpf_add_memtype xenpf_add_memtype_t;
66 DEFINE_XEN_GUEST_HANDLE(xenpf_add_memtype_t);
67 
68 /*
69  * Tear down an existing memory-range type. If @handle is remembered then it
70  * should be passed in to accurately tear down the correct setting (in case
71  * of overlapping memory regions with differing types). If it is not known
72  * then @handle should be set to zero. In all cases @reg must be set.
73  * (x86-specific).
74  */
75 #define XENPF_del_memtype         32
76 struct xenpf_del_memtype {
77     /* IN variables. */
78     uint32_t handle;
79     uint32_t reg;
80 };
81 typedef struct xenpf_del_memtype xenpf_del_memtype_t;
82 DEFINE_XEN_GUEST_HANDLE(xenpf_del_memtype_t);
83 
84 /* Read current type of an MTRR (x86-specific). */
85 #define XENPF_read_memtype        33
86 struct xenpf_read_memtype {
87     /* IN variables. */
88     uint32_t reg;
89     /* OUT variables. */
90     xen_pfn_t mfn;
91     uint64_t nr_mfns;
92     uint32_t type;
93 };
94 typedef struct xenpf_read_memtype xenpf_read_memtype_t;
95 DEFINE_XEN_GUEST_HANDLE(xenpf_read_memtype_t);
96 
97 #define XENPF_microcode_update    35
98 struct xenpf_microcode_update {
99     /* IN variables. */
100     XEN_GUEST_HANDLE(void) data;      /* Pointer to microcode data */
101     uint32_t length;                  /* Length of microcode data. */
102 };
103 typedef struct xenpf_microcode_update xenpf_microcode_update_t;
104 DEFINE_XEN_GUEST_HANDLE(xenpf_microcode_update_t);
105 
106 #define XENPF_platform_quirk      39
107 #define QUIRK_NOIRQBALANCING      1 /* Do not restrict IO-APIC RTE targets */
108 #define QUIRK_IOAPIC_BAD_REGSEL   2 /* IO-APIC REGSEL forgets its value    */
109 #define QUIRK_IOAPIC_GOOD_REGSEL  3 /* IO-APIC REGSEL behaves properly     */
110 struct xenpf_platform_quirk {
111     /* IN variables. */
112     uint32_t quirk_id;
113 };
114 typedef struct xenpf_platform_quirk xenpf_platform_quirk_t;
115 DEFINE_XEN_GUEST_HANDLE(xenpf_platform_quirk_t);
116 
117 #define XENPF_panic_init          40
118 struct xenpf_panic_init {
119     unsigned long panic_addr;
120 };
121 typedef struct xenpf_panic_init xenpf_panic_init_t;
122 DEFINE_XEN_GUEST_HANDLE(xenpf_panic_init_t);
123 
124 struct xen_platform_op {
125     uint32_t cmd;
126     uint32_t interface_version; /* XENPF_INTERFACE_VERSION */
127     union {
128         struct xenpf_settime           settime;
129         struct xenpf_add_memtype       add_memtype;
130         struct xenpf_del_memtype       del_memtype;
131         struct xenpf_read_memtype      read_memtype;
132         struct xenpf_microcode_update  microcode;
133         struct xenpf_platform_quirk    platform_quirk;
134 	struct xenpf_panic_init        panic_init;
135         uint8_t                        pad[128];
136     } u;
137 };
138 typedef struct xen_platform_op xen_platform_op_t;
139 DEFINE_XEN_GUEST_HANDLE(xen_platform_op_t);
140 
141 #endif /* __XEN_PUBLIC_PLATFORM_H__ */
142 
143 /*
144  * Local variables:
145  * mode: C
146  * c-set-style: "BSD"
147  * c-basic-offset: 4
148  * tab-width: 4
149  * indent-tabs-mode: nil
150  * End:
151  */
152