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