/root/src/xen/xen/include/public/platform.h
Line | Count | Source (jump to first uncovered line) |
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 | 0 | #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 | 0 | #define XENPF_settime32 17 |
39 | | struct xenpf_settime32 { |
40 | | /* IN variables. */ |
41 | | uint32_t secs; |
42 | | uint32_t nsecs; |
43 | | uint64_t system_time; |
44 | | }; |
45 | 0 | #define XENPF_settime64 62 |
46 | | struct xenpf_settime64 { |
47 | | /* IN variables. */ |
48 | | uint64_t secs; |
49 | | uint32_t nsecs; |
50 | | uint32_t mbz; |
51 | | uint64_t system_time; |
52 | | }; |
53 | | #if __XEN_INTERFACE_VERSION__ < 0x00040600 |
54 | | #define XENPF_settime XENPF_settime32 |
55 | | #define xenpf_settime xenpf_settime32 |
56 | | #else |
57 | | #define XENPF_settime XENPF_settime64 |
58 | | #define xenpf_settime xenpf_settime64 |
59 | | #endif |
60 | | typedef struct xenpf_settime xenpf_settime_t; |
61 | | DEFINE_XEN_GUEST_HANDLE(xenpf_settime_t); |
62 | | |
63 | | /* |
64 | | * Request memory range (@mfn, @mfn+@nr_mfns-1) to have type @type. |
65 | | * On x86, @type is an architecture-defined MTRR memory type. |
66 | | * On success, returns the MTRR that was used (@reg) and a handle that can |
67 | | * be passed to XENPF_DEL_MEMTYPE to accurately tear down the new setting. |
68 | | * (x86-specific). |
69 | | */ |
70 | 0 | #define XENPF_add_memtype 31 |
71 | | struct xenpf_add_memtype { |
72 | | /* IN variables. */ |
73 | | xen_pfn_t mfn; |
74 | | uint64_t nr_mfns; |
75 | | uint32_t type; |
76 | | /* OUT variables. */ |
77 | | uint32_t handle; |
78 | | uint32_t reg; |
79 | | }; |
80 | | typedef struct xenpf_add_memtype xenpf_add_memtype_t; |
81 | | DEFINE_XEN_GUEST_HANDLE(xenpf_add_memtype_t); |
82 | | |
83 | | /* |
84 | | * Tear down an existing memory-range type. If @handle is remembered then it |
85 | | * should be passed in to accurately tear down the correct setting (in case |
86 | | * of overlapping memory regions with differing types). If it is not known |
87 | | * then @handle should be set to zero. In all cases @reg must be set. |
88 | | * (x86-specific). |
89 | | */ |
90 | 0 | #define XENPF_del_memtype 32 |
91 | | struct xenpf_del_memtype { |
92 | | /* IN variables. */ |
93 | | uint32_t handle; |
94 | | uint32_t reg; |
95 | | }; |
96 | | typedef struct xenpf_del_memtype xenpf_del_memtype_t; |
97 | | DEFINE_XEN_GUEST_HANDLE(xenpf_del_memtype_t); |
98 | | |
99 | | /* Read current type of an MTRR (x86-specific). */ |
100 | 0 | #define XENPF_read_memtype 33 |
101 | | struct xenpf_read_memtype { |
102 | | /* IN variables. */ |
103 | | uint32_t reg; |
104 | | /* OUT variables. */ |
105 | | xen_pfn_t mfn; |
106 | | uint64_t nr_mfns; |
107 | | uint32_t type; |
108 | | }; |
109 | | typedef struct xenpf_read_memtype xenpf_read_memtype_t; |
110 | | DEFINE_XEN_GUEST_HANDLE(xenpf_read_memtype_t); |
111 | | |
112 | 0 | #define XENPF_microcode_update 35 |
113 | | struct xenpf_microcode_update { |
114 | | /* IN variables. */ |
115 | | XEN_GUEST_HANDLE(const_void) data;/* Pointer to microcode data */ |
116 | | uint32_t length; /* Length of microcode data. */ |
117 | | }; |
118 | | typedef struct xenpf_microcode_update xenpf_microcode_update_t; |
119 | | DEFINE_XEN_GUEST_HANDLE(xenpf_microcode_update_t); |
120 | | |
121 | 0 | #define XENPF_platform_quirk 39 |
122 | 0 | #define QUIRK_NOIRQBALANCING 1 /* Do not restrict IO-APIC RTE targets */ |
123 | 0 | #define QUIRK_IOAPIC_BAD_REGSEL 2 /* IO-APIC REGSEL forgets its value */ |
124 | 0 | #define QUIRK_IOAPIC_GOOD_REGSEL 3 /* IO-APIC REGSEL behaves properly */ |
125 | | struct xenpf_platform_quirk { |
126 | | /* IN variables. */ |
127 | | uint32_t quirk_id; |
128 | | }; |
129 | | typedef struct xenpf_platform_quirk xenpf_platform_quirk_t; |
130 | | DEFINE_XEN_GUEST_HANDLE(xenpf_platform_quirk_t); |
131 | | |
132 | 0 | #define XENPF_efi_runtime_call 49 |
133 | | #define XEN_EFI_get_time 1 |
134 | | #define XEN_EFI_set_time 2 |
135 | | #define XEN_EFI_get_wakeup_time 3 |
136 | | #define XEN_EFI_set_wakeup_time 4 |
137 | | #define XEN_EFI_get_next_high_monotonic_count 5 |
138 | | #define XEN_EFI_get_variable 6 |
139 | | #define XEN_EFI_set_variable 7 |
140 | | #define XEN_EFI_get_next_variable_name 8 |
141 | | #define XEN_EFI_query_variable_info 9 |
142 | | #define XEN_EFI_query_capsule_capabilities 10 |
143 | | #define XEN_EFI_update_capsule 11 |
144 | | |
145 | | struct xenpf_efi_time { |
146 | | uint16_t year; |
147 | | uint8_t month; |
148 | | uint8_t day; |
149 | | uint8_t hour; |
150 | | uint8_t min; |
151 | | uint8_t sec; |
152 | | uint32_t ns; |
153 | | int16_t tz; |
154 | | uint8_t daylight; |
155 | | }; |
156 | | |
157 | | struct xenpf_efi_guid { |
158 | | uint32_t data1; |
159 | | uint16_t data2; |
160 | | uint16_t data3; |
161 | | uint8_t data4[8]; |
162 | | }; |
163 | | |
164 | | struct xenpf_efi_runtime_call { |
165 | | uint32_t function; |
166 | | /* |
167 | | * This field is generally used for per sub-function flags (defined |
168 | | * below), except for the XEN_EFI_get_next_high_monotonic_count case, |
169 | | * where it holds the single returned value. |
170 | | */ |
171 | | uint32_t misc; |
172 | | xen_ulong_t status; |
173 | | union { |
174 | | #define XEN_EFI_GET_TIME_SET_CLEARS_NS 0x00000001 |
175 | | struct { |
176 | | struct xenpf_efi_time time; |
177 | | uint32_t resolution; |
178 | | uint32_t accuracy; |
179 | | } get_time; |
180 | | |
181 | | struct xenpf_efi_time set_time; |
182 | | |
183 | | #define XEN_EFI_GET_WAKEUP_TIME_ENABLED 0x00000001 |
184 | | #define XEN_EFI_GET_WAKEUP_TIME_PENDING 0x00000002 |
185 | | struct xenpf_efi_time get_wakeup_time; |
186 | | |
187 | | #define XEN_EFI_SET_WAKEUP_TIME_ENABLE 0x00000001 |
188 | | #define XEN_EFI_SET_WAKEUP_TIME_ENABLE_ONLY 0x00000002 |
189 | | struct xenpf_efi_time set_wakeup_time; |
190 | | |
191 | | #define XEN_EFI_VARIABLE_NON_VOLATILE 0x00000001 |
192 | | #define XEN_EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002 |
193 | | #define XEN_EFI_VARIABLE_RUNTIME_ACCESS 0x00000004 |
194 | | struct { |
195 | | XEN_GUEST_HANDLE(void) name; /* UCS-2/UTF-16 string */ |
196 | | xen_ulong_t size; |
197 | | XEN_GUEST_HANDLE(void) data; |
198 | | struct xenpf_efi_guid vendor_guid; |
199 | | } get_variable, set_variable; |
200 | | |
201 | | struct { |
202 | | xen_ulong_t size; |
203 | | XEN_GUEST_HANDLE(void) name; /* UCS-2/UTF-16 string */ |
204 | | struct xenpf_efi_guid vendor_guid; |
205 | | } get_next_variable_name; |
206 | | |
207 | | #define XEN_EFI_VARINFO_BOOT_SNAPSHOT 0x00000001 |
208 | | struct { |
209 | | uint32_t attr; |
210 | | uint64_t max_store_size; |
211 | | uint64_t remain_store_size; |
212 | | uint64_t max_size; |
213 | | } query_variable_info; |
214 | | |
215 | | struct { |
216 | | XEN_GUEST_HANDLE(void) capsule_header_array; |
217 | | xen_ulong_t capsule_count; |
218 | | uint64_t max_capsule_size; |
219 | | uint32_t reset_type; |
220 | | } query_capsule_capabilities; |
221 | | |
222 | | struct { |
223 | | XEN_GUEST_HANDLE(void) capsule_header_array; |
224 | | xen_ulong_t capsule_count; |
225 | | uint64_t sg_list; /* machine address */ |
226 | | } update_capsule; |
227 | | } u; |
228 | | }; |
229 | | typedef struct xenpf_efi_runtime_call xenpf_efi_runtime_call_t; |
230 | | DEFINE_XEN_GUEST_HANDLE(xenpf_efi_runtime_call_t); |
231 | | |
232 | 0 | #define XENPF_firmware_info 50 |
233 | 0 | #define XEN_FW_DISK_INFO 1 /* from int 13 AH=08/41/48 */ |
234 | 0 | #define XEN_FW_DISK_MBR_SIGNATURE 2 /* from MBR offset 0x1b8 */ |
235 | 0 | #define XEN_FW_VBEDDC_INFO 3 /* from int 10 AX=4f15 */ |
236 | 0 | #define XEN_FW_EFI_INFO 4 /* from EFI */ |
237 | | #define XEN_FW_EFI_VERSION 0 |
238 | | #define XEN_FW_EFI_CONFIG_TABLE 1 |
239 | | #define XEN_FW_EFI_VENDOR 2 |
240 | | #define XEN_FW_EFI_MEM_INFO 3 |
241 | | #define XEN_FW_EFI_RT_VERSION 4 |
242 | | #define XEN_FW_EFI_PCI_ROM 5 |
243 | | #define XEN_FW_EFI_APPLE_PROPERTIES 6 |
244 | 0 | #define XEN_FW_KBD_SHIFT_FLAGS 5 |
245 | | struct xenpf_firmware_info { |
246 | | /* IN variables. */ |
247 | | uint32_t type; |
248 | | uint32_t index; |
249 | | /* OUT variables. */ |
250 | | union { |
251 | | struct { |
252 | | /* Int13, Fn48: Check Extensions Present. */ |
253 | | uint8_t device; /* %dl: bios device number */ |
254 | | uint8_t version; /* %ah: major version */ |
255 | | uint16_t interface_support; /* %cx: support bitmap */ |
256 | | /* Int13, Fn08: Legacy Get Device Parameters. */ |
257 | | uint16_t legacy_max_cylinder; /* %cl[7:6]:%ch: max cyl # */ |
258 | | uint8_t legacy_max_head; /* %dh: max head # */ |
259 | | uint8_t legacy_sectors_per_track; /* %cl[5:0]: max sector # */ |
260 | | /* Int13, Fn41: Get Device Parameters (as filled into %ds:%esi). */ |
261 | | /* NB. First uint16_t of buffer must be set to buffer size. */ |
262 | | XEN_GUEST_HANDLE(void) edd_params; |
263 | | } disk_info; /* XEN_FW_DISK_INFO */ |
264 | | struct { |
265 | | uint8_t device; /* bios device number */ |
266 | | uint32_t mbr_signature; /* offset 0x1b8 in mbr */ |
267 | | } disk_mbr_signature; /* XEN_FW_DISK_MBR_SIGNATURE */ |
268 | | struct { |
269 | | /* Int10, AX=4F15: Get EDID info. */ |
270 | | uint8_t capabilities; |
271 | | uint8_t edid_transfer_time; |
272 | | /* must refer to 128-byte buffer */ |
273 | | XEN_GUEST_HANDLE(uint8) edid; |
274 | | } vbeddc_info; /* XEN_FW_VBEDDC_INFO */ |
275 | | union xenpf_efi_info { |
276 | | uint32_t version; |
277 | | struct { |
278 | | uint64_t addr; /* EFI_CONFIGURATION_TABLE */ |
279 | | uint32_t nent; |
280 | | } cfg; |
281 | | struct { |
282 | | uint32_t revision; |
283 | | uint32_t bufsz; /* input, in bytes */ |
284 | | XEN_GUEST_HANDLE(void) name; /* UCS-2/UTF-16 string */ |
285 | | } vendor; |
286 | | struct { |
287 | | uint64_t addr; |
288 | | uint64_t size; |
289 | | uint64_t attr; |
290 | | uint32_t type; |
291 | | } mem; |
292 | | struct { |
293 | | /* IN variables */ |
294 | | uint16_t segment; |
295 | | uint8_t bus; |
296 | | uint8_t devfn; |
297 | | uint16_t vendor; |
298 | | uint16_t devid; |
299 | | /* OUT variables */ |
300 | | uint64_t address; |
301 | | xen_ulong_t size; |
302 | | } pci_rom; |
303 | | struct { |
304 | | /* OUT variables */ |
305 | | uint64_t address; |
306 | | xen_ulong_t size; |
307 | | } apple_properties; |
308 | | } efi_info; /* XEN_FW_EFI_INFO */ |
309 | | |
310 | | /* Int16, Fn02: Get keyboard shift flags. */ |
311 | | uint8_t kbd_shift_flags; /* XEN_FW_KBD_SHIFT_FLAGS */ |
312 | | } u; |
313 | | }; |
314 | | typedef struct xenpf_firmware_info xenpf_firmware_info_t; |
315 | | DEFINE_XEN_GUEST_HANDLE(xenpf_firmware_info_t); |
316 | | |
317 | 0 | #define XENPF_enter_acpi_sleep 51 |
318 | | struct xenpf_enter_acpi_sleep { |
319 | | /* IN variables */ |
320 | | #if __XEN_INTERFACE_VERSION__ < 0x00040300 |
321 | | uint16_t pm1a_cnt_val; /* PM1a control value. */ |
322 | | uint16_t pm1b_cnt_val; /* PM1b control value. */ |
323 | | #else |
324 | | uint16_t val_a; /* PM1a control / sleep type A. */ |
325 | | uint16_t val_b; /* PM1b control / sleep type B. */ |
326 | | #endif |
327 | | uint32_t sleep_state; /* Which state to enter (Sn). */ |
328 | 0 | #define XENPF_ACPI_SLEEP_EXTENDED 0x00000001 |
329 | | uint32_t flags; /* XENPF_ACPI_SLEEP_*. */ |
330 | | }; |
331 | | typedef struct xenpf_enter_acpi_sleep xenpf_enter_acpi_sleep_t; |
332 | | DEFINE_XEN_GUEST_HANDLE(xenpf_enter_acpi_sleep_t); |
333 | | |
334 | 0 | #define XENPF_change_freq 52 |
335 | | struct xenpf_change_freq { |
336 | | /* IN variables */ |
337 | | uint32_t flags; /* Must be zero. */ |
338 | | uint32_t cpu; /* Physical cpu. */ |
339 | | uint64_t freq; /* New frequency (Hz). */ |
340 | | }; |
341 | | typedef struct xenpf_change_freq xenpf_change_freq_t; |
342 | | DEFINE_XEN_GUEST_HANDLE(xenpf_change_freq_t); |
343 | | |
344 | | /* |
345 | | * Get idle times (nanoseconds since boot) for physical CPUs specified in the |
346 | | * @cpumap_bitmap with range [0..@cpumap_nr_cpus-1]. The @idletime array is |
347 | | * indexed by CPU number; only entries with the corresponding @cpumap_bitmap |
348 | | * bit set are written to. On return, @cpumap_bitmap is modified so that any |
349 | | * non-existent CPUs are cleared. Such CPUs have their @idletime array entry |
350 | | * cleared. |
351 | | */ |
352 | 0 | #define XENPF_getidletime 53 |
353 | | struct xenpf_getidletime { |
354 | | /* IN/OUT variables */ |
355 | | /* IN: CPUs to interrogate; OUT: subset of IN which are present */ |
356 | | XEN_GUEST_HANDLE(uint8) cpumap_bitmap; |
357 | | /* IN variables */ |
358 | | /* Size of cpumap bitmap. */ |
359 | | uint32_t cpumap_nr_cpus; |
360 | | /* Must be indexable for every cpu in cpumap_bitmap. */ |
361 | | XEN_GUEST_HANDLE(uint64) idletime; |
362 | | /* OUT variables */ |
363 | | /* System time when the idletime snapshots were taken. */ |
364 | | uint64_t now; |
365 | | }; |
366 | | typedef struct xenpf_getidletime xenpf_getidletime_t; |
367 | | DEFINE_XEN_GUEST_HANDLE(xenpf_getidletime_t); |
368 | | |
369 | 0 | #define XENPF_set_processor_pminfo 54 |
370 | | |
371 | | /* ability bits */ |
372 | 1 | #define XEN_PROCESSOR_PM_CX 1 |
373 | 0 | #define XEN_PROCESSOR_PM_PX 2 |
374 | 0 | #define XEN_PROCESSOR_PM_TX 4 |
375 | | |
376 | | /* cmd type */ |
377 | 0 | #define XEN_PM_CX 0 |
378 | 0 | #define XEN_PM_PX 1 |
379 | 0 | #define XEN_PM_TX 2 |
380 | 0 | #define XEN_PM_PDC 3 |
381 | | |
382 | | /* Px sub info type */ |
383 | 0 | #define XEN_PX_PCT 1 |
384 | 0 | #define XEN_PX_PSS 2 |
385 | 0 | #define XEN_PX_PPC 4 |
386 | 0 | #define XEN_PX_PSD 8 |
387 | | |
388 | | struct xen_power_register { |
389 | | uint32_t space_id; |
390 | | uint32_t bit_width; |
391 | | uint32_t bit_offset; |
392 | | uint32_t access_size; |
393 | | uint64_t address; |
394 | | }; |
395 | | |
396 | | struct xen_processor_csd { |
397 | | uint32_t domain; /* domain number of one dependent group */ |
398 | | uint32_t coord_type; /* coordination type */ |
399 | | uint32_t num; /* number of processors in same domain */ |
400 | | }; |
401 | | typedef struct xen_processor_csd xen_processor_csd_t; |
402 | | DEFINE_XEN_GUEST_HANDLE(xen_processor_csd_t); |
403 | | |
404 | | struct xen_processor_cx { |
405 | | struct xen_power_register reg; /* GAS for Cx trigger register */ |
406 | | uint8_t type; /* cstate value, c0: 0, c1: 1, ... */ |
407 | | uint32_t latency; /* worst latency (ms) to enter/exit this cstate */ |
408 | | uint32_t power; /* average power consumption(mW) */ |
409 | | uint32_t dpcnt; /* number of dependency entries */ |
410 | | XEN_GUEST_HANDLE(xen_processor_csd_t) dp; /* NULL if no dependency */ |
411 | | }; |
412 | | typedef struct xen_processor_cx xen_processor_cx_t; |
413 | | DEFINE_XEN_GUEST_HANDLE(xen_processor_cx_t); |
414 | | |
415 | | struct xen_processor_flags { |
416 | | uint32_t bm_control:1; |
417 | | uint32_t bm_check:1; |
418 | | uint32_t has_cst:1; |
419 | | uint32_t power_setup_done:1; |
420 | | uint32_t bm_rld_set:1; |
421 | | }; |
422 | | |
423 | | struct xen_processor_power { |
424 | | uint32_t count; /* number of C state entries in array below */ |
425 | | struct xen_processor_flags flags; /* global flags of this processor */ |
426 | | XEN_GUEST_HANDLE(xen_processor_cx_t) states; /* supported c states */ |
427 | | }; |
428 | | |
429 | | struct xen_pct_register { |
430 | | uint8_t descriptor; |
431 | | uint16_t length; |
432 | | uint8_t space_id; |
433 | | uint8_t bit_width; |
434 | | uint8_t bit_offset; |
435 | | uint8_t reserved; |
436 | | uint64_t address; |
437 | | }; |
438 | | |
439 | | struct xen_processor_px { |
440 | | uint64_t core_frequency; /* megahertz */ |
441 | | uint64_t power; /* milliWatts */ |
442 | | uint64_t transition_latency; /* microseconds */ |
443 | | uint64_t bus_master_latency; /* microseconds */ |
444 | | uint64_t control; /* control value */ |
445 | | uint64_t status; /* success indicator */ |
446 | | }; |
447 | | typedef struct xen_processor_px xen_processor_px_t; |
448 | | DEFINE_XEN_GUEST_HANDLE(xen_processor_px_t); |
449 | | |
450 | | struct xen_psd_package { |
451 | | uint64_t num_entries; |
452 | | uint64_t revision; |
453 | | uint64_t domain; |
454 | | uint64_t coord_type; |
455 | | uint64_t num_processors; |
456 | | }; |
457 | | |
458 | | struct xen_processor_performance { |
459 | | uint32_t flags; /* flag for Px sub info type */ |
460 | | uint32_t platform_limit; /* Platform limitation on freq usage */ |
461 | | struct xen_pct_register control_register; |
462 | | struct xen_pct_register status_register; |
463 | | uint32_t state_count; /* total available performance states */ |
464 | | XEN_GUEST_HANDLE(xen_processor_px_t) states; |
465 | | struct xen_psd_package domain_info; |
466 | | uint32_t shared_type; /* coordination type of this processor */ |
467 | | }; |
468 | | typedef struct xen_processor_performance xen_processor_performance_t; |
469 | | DEFINE_XEN_GUEST_HANDLE(xen_processor_performance_t); |
470 | | |
471 | | struct xenpf_set_processor_pminfo { |
472 | | /* IN variables */ |
473 | | uint32_t id; /* ACPI CPU ID */ |
474 | | uint32_t type; /* {XEN_PM_CX, XEN_PM_PX} */ |
475 | | union { |
476 | | struct xen_processor_power power;/* Cx: _CST/_CSD */ |
477 | | struct xen_processor_performance perf; /* Px: _PPC/_PCT/_PSS/_PSD */ |
478 | | XEN_GUEST_HANDLE(uint32) pdc; /* _PDC */ |
479 | | } u; |
480 | | }; |
481 | | typedef struct xenpf_set_processor_pminfo xenpf_set_processor_pminfo_t; |
482 | | DEFINE_XEN_GUEST_HANDLE(xenpf_set_processor_pminfo_t); |
483 | | |
484 | 0 | #define XENPF_get_cpuinfo 55 |
485 | | struct xenpf_pcpuinfo { |
486 | | /* IN */ |
487 | | uint32_t xen_cpuid; |
488 | | /* OUT */ |
489 | | /* The maxium cpu_id that is present */ |
490 | | uint32_t max_present; |
491 | 0 | #define XEN_PCPU_FLAGS_ONLINE 1 |
492 | | /* Correponding xen_cpuid is not present*/ |
493 | 0 | #define XEN_PCPU_FLAGS_INVALID 2 |
494 | | uint32_t flags; |
495 | | uint32_t apic_id; |
496 | | uint32_t acpi_id; |
497 | | }; |
498 | | typedef struct xenpf_pcpuinfo xenpf_pcpuinfo_t; |
499 | | DEFINE_XEN_GUEST_HANDLE(xenpf_pcpuinfo_t); |
500 | | |
501 | 0 | #define XENPF_get_cpu_version 48 |
502 | | struct xenpf_pcpu_version { |
503 | | /* IN */ |
504 | | uint32_t xen_cpuid; |
505 | | /* OUT */ |
506 | | /* The maxium cpu_id that is present */ |
507 | | uint32_t max_present; |
508 | | char vendor_id[12]; |
509 | | uint32_t family; |
510 | | uint32_t model; |
511 | | uint32_t stepping; |
512 | | }; |
513 | | typedef struct xenpf_pcpu_version xenpf_pcpu_version_t; |
514 | | DEFINE_XEN_GUEST_HANDLE(xenpf_pcpu_version_t); |
515 | | |
516 | 0 | #define XENPF_cpu_online 56 |
517 | 0 | #define XENPF_cpu_offline 57 |
518 | | struct xenpf_cpu_ol |
519 | | { |
520 | | uint32_t cpuid; |
521 | | }; |
522 | | typedef struct xenpf_cpu_ol xenpf_cpu_ol_t; |
523 | | DEFINE_XEN_GUEST_HANDLE(xenpf_cpu_ol_t); |
524 | | |
525 | 0 | #define XENPF_cpu_hotadd 58 |
526 | | struct xenpf_cpu_hotadd |
527 | | { |
528 | | uint32_t apic_id; |
529 | | uint32_t acpi_id; |
530 | | uint32_t pxm; |
531 | | }; |
532 | | |
533 | 0 | #define XENPF_mem_hotadd 59 |
534 | | struct xenpf_mem_hotadd |
535 | | { |
536 | | uint64_t spfn; |
537 | | uint64_t epfn; |
538 | | uint32_t pxm; |
539 | | uint32_t flags; |
540 | | }; |
541 | | |
542 | 0 | #define XENPF_core_parking 60 |
543 | | |
544 | 0 | #define XEN_CORE_PARKING_SET 1 |
545 | 0 | #define XEN_CORE_PARKING_GET 2 |
546 | | struct xenpf_core_parking { |
547 | | /* IN variables */ |
548 | | uint32_t type; |
549 | | /* IN variables: set cpu nums expected to be idled */ |
550 | | /* OUT variables: get cpu nums actually be idled */ |
551 | | uint32_t idle_nums; |
552 | | }; |
553 | | typedef struct xenpf_core_parking xenpf_core_parking_t; |
554 | | DEFINE_XEN_GUEST_HANDLE(xenpf_core_parking_t); |
555 | | |
556 | | /* |
557 | | * Access generic platform resources(e.g., accessing MSR, port I/O, etc) |
558 | | * in unified way. Batch resource operations in one call are supported and |
559 | | * they are always non-preemptible and executed in their original order. |
560 | | * The batch itself returns a negative integer for general errors, or a |
561 | | * non-negative integer for the number of successful operations. For the latter |
562 | | * case, the @ret in the failed entry (if any) indicates the exact error. |
563 | | */ |
564 | 0 | #define XENPF_resource_op 61 |
565 | | |
566 | 0 | #define XEN_RESOURCE_OP_MSR_READ 0 |
567 | 0 | #define XEN_RESOURCE_OP_MSR_WRITE 1 |
568 | | |
569 | | /* |
570 | | * Specially handled MSRs: |
571 | | * - MSR_IA32_TSC |
572 | | * READ: Returns the scaled system time(ns) instead of raw timestamp. In |
573 | | * multiple entry case, if other MSR read is followed by a MSR_IA32_TSC |
574 | | * read, then both reads are guaranteed to be performed atomically (with |
575 | | * IRQ disabled). The return time indicates the point of reading that MSR. |
576 | | * WRITE: Not supported. |
577 | | */ |
578 | | |
579 | | struct xenpf_resource_entry { |
580 | | union { |
581 | | uint32_t cmd; /* IN: XEN_RESOURCE_OP_* */ |
582 | | int32_t ret; /* OUT: return value for failed entry */ |
583 | | } u; |
584 | | uint32_t rsvd; /* IN: padding and must be zero */ |
585 | | uint64_t idx; /* IN: resource address to access */ |
586 | | uint64_t val; /* IN/OUT: resource value to set/get */ |
587 | | }; |
588 | | typedef struct xenpf_resource_entry xenpf_resource_entry_t; |
589 | | DEFINE_XEN_GUEST_HANDLE(xenpf_resource_entry_t); |
590 | | |
591 | | struct xenpf_resource_op { |
592 | | uint32_t nr_entries; /* number of resource entry */ |
593 | | uint32_t cpu; /* which cpu to run */ |
594 | | XEN_GUEST_HANDLE(xenpf_resource_entry_t) entries; |
595 | | }; |
596 | | typedef struct xenpf_resource_op xenpf_resource_op_t; |
597 | | DEFINE_XEN_GUEST_HANDLE(xenpf_resource_op_t); |
598 | | |
599 | 0 | #define XENPF_get_symbol 63 |
600 | | struct xenpf_symdata { |
601 | | /* IN/OUT variables */ |
602 | | uint32_t namelen; /* IN: size of name buffer */ |
603 | | /* OUT: strlen(name) of hypervisor symbol (may be */ |
604 | | /* larger than what's been copied to guest) */ |
605 | | uint32_t symnum; /* IN: Symbol to read */ |
606 | | /* OUT: Next available symbol. If same as IN then */ |
607 | | /* we reached the end */ |
608 | | |
609 | | /* OUT variables */ |
610 | | XEN_GUEST_HANDLE(char) name; |
611 | | uint64_t address; |
612 | | char type; |
613 | | }; |
614 | | typedef struct xenpf_symdata xenpf_symdata_t; |
615 | | DEFINE_XEN_GUEST_HANDLE(xenpf_symdata_t); |
616 | | |
617 | | /* |
618 | | * ` enum neg_errnoval |
619 | | * ` HYPERVISOR_platform_op(const struct xen_platform_op*); |
620 | | */ |
621 | | struct xen_platform_op { |
622 | | uint32_t cmd; |
623 | | uint32_t interface_version; /* XENPF_INTERFACE_VERSION */ |
624 | | union { |
625 | | struct xenpf_settime settime; |
626 | | struct xenpf_settime32 settime32; |
627 | | struct xenpf_settime64 settime64; |
628 | | struct xenpf_add_memtype add_memtype; |
629 | | struct xenpf_del_memtype del_memtype; |
630 | | struct xenpf_read_memtype read_memtype; |
631 | | struct xenpf_microcode_update microcode; |
632 | | struct xenpf_platform_quirk platform_quirk; |
633 | | struct xenpf_efi_runtime_call efi_runtime_call; |
634 | | struct xenpf_firmware_info firmware_info; |
635 | | struct xenpf_enter_acpi_sleep enter_acpi_sleep; |
636 | | struct xenpf_change_freq change_freq; |
637 | | struct xenpf_getidletime getidletime; |
638 | | struct xenpf_set_processor_pminfo set_pminfo; |
639 | | struct xenpf_pcpuinfo pcpu_info; |
640 | | struct xenpf_pcpu_version pcpu_version; |
641 | | struct xenpf_cpu_ol cpu_ol; |
642 | | struct xenpf_cpu_hotadd cpu_add; |
643 | | struct xenpf_mem_hotadd mem_add; |
644 | | struct xenpf_core_parking core_parking; |
645 | | struct xenpf_resource_op resource_op; |
646 | | struct xenpf_symdata symdata; |
647 | | uint8_t pad[128]; |
648 | | } u; |
649 | | }; |
650 | | typedef struct xen_platform_op xen_platform_op_t; |
651 | | DEFINE_XEN_GUEST_HANDLE(xen_platform_op_t); |
652 | | |
653 | | #endif /* __XEN_PUBLIC_PLATFORM_H__ */ |
654 | | |
655 | | /* |
656 | | * Local variables: |
657 | | * mode: C |
658 | | * c-file-style: "BSD" |
659 | | * c-basic-offset: 4 |
660 | | * tab-width: 4 |
661 | | * indent-tabs-mode: nil |
662 | | * End: |
663 | | */ |