Linux Audio

Check our new training course

Loading...
v5.4
  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/interface/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_settime32             17
 39struct xenpf_settime32 {
 40	/* IN variables. */
 41	uint32_t secs;
 42	uint32_t nsecs;
 43	uint64_t system_time;
 44};
 45DEFINE_GUEST_HANDLE_STRUCT(xenpf_settime32_t);
 46#define XENPF_settime64           62
 47struct xenpf_settime64 {
 48    /* IN variables. */
 49    uint64_t secs;
 50    uint32_t nsecs;
 51    uint32_t mbz;
 52    uint64_t system_time;
 53};
 54DEFINE_GUEST_HANDLE_STRUCT(xenpf_settime64_t);
 55
 56/*
 57 * Request memory range (@mfn, @mfn+@nr_mfns-1) to have type @type.
 58 * On x86, @type is an architecture-defined MTRR memory type.
 59 * On success, returns the MTRR that was used (@reg) and a handle that can
 60 * be passed to XENPF_DEL_MEMTYPE to accurately tear down the new setting.
 61 * (x86-specific).
 62 */
 63#define XENPF_add_memtype         31
 64struct xenpf_add_memtype {
 65	/* IN variables. */
 66	xen_pfn_t mfn;
 67	uint64_t nr_mfns;
 68	uint32_t type;
 69	/* OUT variables. */
 70	uint32_t handle;
 71	uint32_t reg;
 72};
 73DEFINE_GUEST_HANDLE_STRUCT(xenpf_add_memtype_t);
 74
 75/*
 76 * Tear down an existing memory-range type. If @handle is remembered then it
 77 * should be passed in to accurately tear down the correct setting (in case
 78 * of overlapping memory regions with differing types). If it is not known
 79 * then @handle should be set to zero. In all cases @reg must be set.
 80 * (x86-specific).
 81 */
 82#define XENPF_del_memtype         32
 83struct xenpf_del_memtype {
 84	/* IN variables. */
 85	uint32_t handle;
 86	uint32_t reg;
 87};
 88DEFINE_GUEST_HANDLE_STRUCT(xenpf_del_memtype_t);
 89
 90/* Read current type of an MTRR (x86-specific). */
 91#define XENPF_read_memtype        33
 92struct xenpf_read_memtype {
 93	/* IN variables. */
 94	uint32_t reg;
 95	/* OUT variables. */
 96	xen_pfn_t mfn;
 97	uint64_t nr_mfns;
 98	uint32_t type;
 99};
100DEFINE_GUEST_HANDLE_STRUCT(xenpf_read_memtype_t);
101
102#define XENPF_microcode_update    35
103struct xenpf_microcode_update {
104	/* IN variables. */
105	GUEST_HANDLE(void) data;          /* Pointer to microcode data */
106	uint32_t length;                  /* Length of microcode data. */
107};
108DEFINE_GUEST_HANDLE_STRUCT(xenpf_microcode_update_t);
109
110#define XENPF_platform_quirk      39
111#define QUIRK_NOIRQBALANCING      1 /* Do not restrict IO-APIC RTE targets */
112#define QUIRK_IOAPIC_BAD_REGSEL   2 /* IO-APIC REGSEL forgets its value    */
113#define QUIRK_IOAPIC_GOOD_REGSEL  3 /* IO-APIC REGSEL behaves properly     */
114struct xenpf_platform_quirk {
115	/* IN variables. */
116	uint32_t quirk_id;
117};
118DEFINE_GUEST_HANDLE_STRUCT(xenpf_platform_quirk_t);
119
120#define XENPF_efi_runtime_call    49
121#define XEN_EFI_get_time                      1
122#define XEN_EFI_set_time                      2
123#define XEN_EFI_get_wakeup_time               3
124#define XEN_EFI_set_wakeup_time               4
125#define XEN_EFI_get_next_high_monotonic_count 5
126#define XEN_EFI_get_variable                  6
127#define XEN_EFI_set_variable                  7
128#define XEN_EFI_get_next_variable_name        8
129#define XEN_EFI_query_variable_info           9
130#define XEN_EFI_query_capsule_capabilities   10
131#define XEN_EFI_update_capsule               11
132
133struct xenpf_efi_runtime_call {
134	uint32_t function;
135	/*
136	 * This field is generally used for per sub-function flags (defined
137	 * below), except for the XEN_EFI_get_next_high_monotonic_count case,
138	 * where it holds the single returned value.
139	 */
140	uint32_t misc;
141	xen_ulong_t status;
142	union {
143#define XEN_EFI_GET_TIME_SET_CLEARS_NS 0x00000001
144		struct {
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			} time;
156			uint32_t resolution;
157			uint32_t accuracy;
158		} get_time;
159
160		struct xenpf_efi_time set_time;
161
162#define XEN_EFI_GET_WAKEUP_TIME_ENABLED 0x00000001
163#define XEN_EFI_GET_WAKEUP_TIME_PENDING 0x00000002
164		struct xenpf_efi_time get_wakeup_time;
165
166#define XEN_EFI_SET_WAKEUP_TIME_ENABLE      0x00000001
167#define XEN_EFI_SET_WAKEUP_TIME_ENABLE_ONLY 0x00000002
168		struct xenpf_efi_time set_wakeup_time;
169
170#define XEN_EFI_VARIABLE_NON_VOLATILE       0x00000001
171#define XEN_EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
172#define XEN_EFI_VARIABLE_RUNTIME_ACCESS     0x00000004
173		struct {
174			GUEST_HANDLE(void) name;  /* UCS-2/UTF-16 string */
175			xen_ulong_t size;
176			GUEST_HANDLE(void) data;
177			struct xenpf_efi_guid {
178				uint32_t data1;
179				uint16_t data2;
180				uint16_t data3;
181				uint8_t data4[8];
182			} vendor_guid;
183		} get_variable, set_variable;
184
185		struct {
186			xen_ulong_t size;
187			GUEST_HANDLE(void) name;  /* UCS-2/UTF-16 string */
188			struct xenpf_efi_guid vendor_guid;
189		} get_next_variable_name;
190
191		struct {
192			uint32_t attr;
193			uint64_t max_store_size;
194			uint64_t remain_store_size;
195			uint64_t max_size;
196		} query_variable_info;
197
198		struct {
199			GUEST_HANDLE(void) capsule_header_array;
200			xen_ulong_t capsule_count;
201			uint64_t max_capsule_size;
202			uint32_t reset_type;
203		} query_capsule_capabilities;
204
205		struct {
206			GUEST_HANDLE(void) capsule_header_array;
207			xen_ulong_t capsule_count;
208			uint64_t sg_list; /* machine address */
209		} update_capsule;
210	} u;
211};
212DEFINE_GUEST_HANDLE_STRUCT(xenpf_efi_runtime_call);
213
214#define  XEN_FW_EFI_VERSION        0
215#define  XEN_FW_EFI_CONFIG_TABLE   1
216#define  XEN_FW_EFI_VENDOR         2
217#define  XEN_FW_EFI_MEM_INFO       3
218#define  XEN_FW_EFI_RT_VERSION     4
219
220#define XENPF_firmware_info       50
221#define XEN_FW_DISK_INFO          1 /* from int 13 AH=08/41/48 */
222#define XEN_FW_DISK_MBR_SIGNATURE 2 /* from MBR offset 0x1b8 */
223#define XEN_FW_VBEDDC_INFO        3 /* from int 10 AX=4f15 */
224#define XEN_FW_EFI_INFO           4 /* from EFI */
225#define XEN_FW_KBD_SHIFT_FLAGS    5 /* Int16, Fn02: Get keyboard shift flags. */
226
227struct xenpf_firmware_info {
228	/* IN variables. */
229	uint32_t type;
230	uint32_t index;
231	/* OUT variables. */
232	union {
233		struct {
234			/* Int13, Fn48: Check Extensions Present. */
235			uint8_t device;                   /* %dl: bios device number */
236			uint8_t version;                  /* %ah: major version      */
237			uint16_t interface_support;       /* %cx: support bitmap     */
238			/* Int13, Fn08: Legacy Get Device Parameters. */
239			uint16_t legacy_max_cylinder;     /* %cl[7:6]:%ch: max cyl # */
240			uint8_t legacy_max_head;          /* %dh: max head #         */
241			uint8_t legacy_sectors_per_track; /* %cl[5:0]: max sector #  */
242			/* Int13, Fn41: Get Device Parameters (as filled into %ds:%esi). */
243			/* NB. First uint16_t of buffer must be set to buffer size.      */
244			GUEST_HANDLE(void) edd_params;
245		} disk_info; /* XEN_FW_DISK_INFO */
246		struct {
247			uint8_t device;                   /* bios device number  */
248			uint32_t mbr_signature;           /* offset 0x1b8 in mbr */
249		} disk_mbr_signature; /* XEN_FW_DISK_MBR_SIGNATURE */
250		struct {
251			/* Int10, AX=4F15: Get EDID info. */
252			uint8_t capabilities;
253			uint8_t edid_transfer_time;
254			/* must refer to 128-byte buffer */
255			GUEST_HANDLE(uchar) edid;
256		} vbeddc_info; /* XEN_FW_VBEDDC_INFO */
257
258		union xenpf_efi_info {
259			uint32_t version;
260			struct {
261				uint64_t addr;   /* EFI_CONFIGURATION_TABLE */
262				uint32_t nent;
263			} cfg;
264			struct {
265				uint32_t revision;
266				uint32_t bufsz;  /* input, in bytes */
267				GUEST_HANDLE(void) name;
268				/* UCS-2/UTF-16 string */
269			} vendor;
270			struct {
271				uint64_t addr;
272				uint64_t size;
273				uint64_t attr;
274				uint32_t type;
275			} mem;
276		} efi_info; /* XEN_FW_EFI_INFO */
277
278		uint8_t kbd_shift_flags; /* XEN_FW_KBD_SHIFT_FLAGS */
279	} u;
280};
281DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t);
282
283#define XENPF_enter_acpi_sleep    51
284struct xenpf_enter_acpi_sleep {
285	/* IN variables */
286	uint16_t val_a;             /* PM1a control / sleep type A. */
287	uint16_t val_b;             /* PM1b control / sleep type B. */
288	uint32_t sleep_state;       /* Which state to enter (Sn). */
289#define XENPF_ACPI_SLEEP_EXTENDED 0x00000001
290	uint32_t flags;             /* XENPF_ACPI_SLEEP_*. */
291};
292DEFINE_GUEST_HANDLE_STRUCT(xenpf_enter_acpi_sleep_t);
293
294#define XENPF_change_freq         52
295struct xenpf_change_freq {
296	/* IN variables */
297	uint32_t flags; /* Must be zero. */
298	uint32_t cpu;   /* Physical cpu. */
299	uint64_t freq;  /* New frequency (Hz). */
300};
301DEFINE_GUEST_HANDLE_STRUCT(xenpf_change_freq_t);
302
303/*
304 * Get idle times (nanoseconds since boot) for physical CPUs specified in the
305 * @cpumap_bitmap with range [0..@cpumap_nr_cpus-1]. The @idletime array is
306 * indexed by CPU number; only entries with the corresponding @cpumap_bitmap
307 * bit set are written to. On return, @cpumap_bitmap is modified so that any
308 * non-existent CPUs are cleared. Such CPUs have their @idletime array entry
309 * cleared.
310 */
311#define XENPF_getidletime         53
312struct xenpf_getidletime {
313	/* IN/OUT variables */
314	/* IN: CPUs to interrogate; OUT: subset of IN which are present */
315	GUEST_HANDLE(uchar) cpumap_bitmap;
316	/* IN variables */
317	/* Size of cpumap bitmap. */
318	uint32_t cpumap_nr_cpus;
319	/* Must be indexable for every cpu in cpumap_bitmap. */
320	GUEST_HANDLE(uint64_t) idletime;
321	/* OUT variables */
322	/* System time when the idletime snapshots were taken. */
323	uint64_t now;
324};
325DEFINE_GUEST_HANDLE_STRUCT(xenpf_getidletime_t);
326
327#define XENPF_set_processor_pminfo      54
328
329/* ability bits */
330#define XEN_PROCESSOR_PM_CX	1
331#define XEN_PROCESSOR_PM_PX	2
332#define XEN_PROCESSOR_PM_TX	4
333
334/* cmd type */
335#define XEN_PM_CX   0
336#define XEN_PM_PX   1
337#define XEN_PM_TX   2
338#define XEN_PM_PDC  3
339/* Px sub info type */
340#define XEN_PX_PCT   1
341#define XEN_PX_PSS   2
342#define XEN_PX_PPC   4
343#define XEN_PX_PSD   8
344
345struct xen_power_register {
346	uint32_t     space_id;
347	uint32_t     bit_width;
348	uint32_t     bit_offset;
349	uint32_t     access_size;
350	uint64_t     address;
351};
352
353struct xen_processor_csd {
354	uint32_t    domain;      /* domain number of one dependent group */
355	uint32_t    coord_type;  /* coordination type */
356	uint32_t    num;         /* number of processors in same domain */
357};
358DEFINE_GUEST_HANDLE_STRUCT(xen_processor_csd);
359
360struct xen_processor_cx {
361	struct xen_power_register  reg; /* GAS for Cx trigger register */
362	uint8_t     type;     /* cstate value, c0: 0, c1: 1, ... */
363	uint32_t    latency;  /* worst latency (ms) to enter/exit this cstate */
364	uint32_t    power;    /* average power consumption(mW) */
365	uint32_t    dpcnt;    /* number of dependency entries */
366	GUEST_HANDLE(xen_processor_csd) dp; /* NULL if no dependency */
367};
368DEFINE_GUEST_HANDLE_STRUCT(xen_processor_cx);
369
370struct xen_processor_flags {
371	uint32_t bm_control:1;
372	uint32_t bm_check:1;
373	uint32_t has_cst:1;
374	uint32_t power_setup_done:1;
375	uint32_t bm_rld_set:1;
376};
377
378struct xen_processor_power {
379	uint32_t count;  /* number of C state entries in array below */
380	struct xen_processor_flags flags;  /* global flags of this processor */
381	GUEST_HANDLE(xen_processor_cx) states; /* supported c states */
382};
383
384struct xen_pct_register {
385	uint8_t  descriptor;
386	uint16_t length;
387	uint8_t  space_id;
388	uint8_t  bit_width;
389	uint8_t  bit_offset;
390	uint8_t  reserved;
391	uint64_t address;
392};
393
394struct xen_processor_px {
395	uint64_t core_frequency; /* megahertz */
396	uint64_t power;      /* milliWatts */
397	uint64_t transition_latency; /* microseconds */
398	uint64_t bus_master_latency; /* microseconds */
399	uint64_t control;        /* control value */
400	uint64_t status;     /* success indicator */
401};
402DEFINE_GUEST_HANDLE_STRUCT(xen_processor_px);
403
404struct xen_psd_package {
405	uint64_t num_entries;
406	uint64_t revision;
407	uint64_t domain;
408	uint64_t coord_type;
409	uint64_t num_processors;
410};
411
412struct xen_processor_performance {
413	uint32_t flags;     /* flag for Px sub info type */
414	uint32_t platform_limit;  /* Platform limitation on freq usage */
415	struct xen_pct_register control_register;
416	struct xen_pct_register status_register;
417	uint32_t state_count;     /* total available performance states */
418	GUEST_HANDLE(xen_processor_px) states;
419	struct xen_psd_package domain_info;
420	uint32_t shared_type;     /* coordination type of this processor */
421};
422DEFINE_GUEST_HANDLE_STRUCT(xen_processor_performance);
423
424struct xenpf_set_processor_pminfo {
425	/* IN variables */
426	uint32_t id;    /* ACPI CPU ID */
427	uint32_t type;  /* {XEN_PM_CX, XEN_PM_PX} */
428	union {
429		struct xen_processor_power          power;/* Cx: _CST/_CSD */
430		struct xen_processor_performance    perf; /* Px: _PPC/_PCT/_PSS/_PSD */
431		GUEST_HANDLE(uint32_t)              pdc;
432	};
433};
434DEFINE_GUEST_HANDLE_STRUCT(xenpf_set_processor_pminfo);
435
436#define XENPF_get_cpuinfo 55
437struct xenpf_pcpuinfo {
438	/* IN */
439	uint32_t xen_cpuid;
440	/* OUT */
441	/* The maxium cpu_id that is present */
442	uint32_t max_present;
443#define XEN_PCPU_FLAGS_ONLINE   1
444	/* Correponding xen_cpuid is not present*/
445#define XEN_PCPU_FLAGS_INVALID  2
446	uint32_t flags;
447	uint32_t apic_id;
448	uint32_t acpi_id;
449};
450DEFINE_GUEST_HANDLE_STRUCT(xenpf_pcpuinfo);
451
452#define XENPF_cpu_online	56
453#define XENPF_cpu_offline	57
454struct xenpf_cpu_ol {
455	uint32_t cpuid;
456};
457DEFINE_GUEST_HANDLE_STRUCT(xenpf_cpu_ol);
458
459#define XENPF_cpu_hotadd	58
460struct xenpf_cpu_hotadd {
461	uint32_t apic_id;
462	uint32_t acpi_id;
463	uint32_t pxm;
464};
465
466#define XENPF_mem_hotadd	59
467struct xenpf_mem_hotadd {
468	uint64_t spfn;
469	uint64_t epfn;
470	uint32_t pxm;
471	uint32_t flags;
472};
473
474#define XENPF_core_parking     60
475struct xenpf_core_parking {
476	/* IN variables */
477#define XEN_CORE_PARKING_SET   1
478#define XEN_CORE_PARKING_GET   2
479	uint32_t type;
480	/* IN variables:  set cpu nums expected to be idled */
481	/* OUT variables: get cpu nums actually be idled */
482	uint32_t idle_nums;
483};
484DEFINE_GUEST_HANDLE_STRUCT(xenpf_core_parking);
485
486#define XENPF_get_symbol      63
487struct xenpf_symdata {
488	/* IN/OUT variables */
489	uint32_t	namelen; /* size of 'name' buffer */
490
491	/* IN/OUT variables */
492	uint32_t	symnum; /* IN:  Symbol to read                       */
493				/* OUT: Next available symbol. If same as IN */
494				/* then  we reached the end                  */
495
496	/* OUT variables */
497	GUEST_HANDLE(char) name;
498	uint64_t	address;
499	char            type;
500};
501DEFINE_GUEST_HANDLE_STRUCT(xenpf_symdata);
502
503struct xen_platform_op {
504	uint32_t cmd;
505	uint32_t interface_version; /* XENPF_INTERFACE_VERSION */
506	union {
507		struct xenpf_settime32         settime32;
508		struct xenpf_settime64         settime64;
509		struct xenpf_add_memtype       add_memtype;
510		struct xenpf_del_memtype       del_memtype;
511		struct xenpf_read_memtype      read_memtype;
512		struct xenpf_microcode_update  microcode;
513		struct xenpf_platform_quirk    platform_quirk;
514		struct xenpf_efi_runtime_call  efi_runtime_call;
515		struct xenpf_firmware_info     firmware_info;
516		struct xenpf_enter_acpi_sleep  enter_acpi_sleep;
517		struct xenpf_change_freq       change_freq;
518		struct xenpf_getidletime       getidletime;
519		struct xenpf_set_processor_pminfo set_pminfo;
520		struct xenpf_pcpuinfo          pcpu_info;
521		struct xenpf_cpu_ol            cpu_ol;
522		struct xenpf_cpu_hotadd        cpu_add;
523		struct xenpf_mem_hotadd        mem_add;
524		struct xenpf_core_parking      core_parking;
525		struct xenpf_symdata           symdata;
526		uint8_t                        pad[128];
527	} u;
528};
529DEFINE_GUEST_HANDLE_STRUCT(xen_platform_op_t);
530
531#endif /* __XEN_PUBLIC_PLATFORM_H__ */
v3.5.6
  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
 39struct xenpf_settime {
 40	/* IN variables. */
 41	uint32_t secs;
 42	uint32_t nsecs;
 43	uint64_t system_time;
 44};
 45DEFINE_GUEST_HANDLE_STRUCT(xenpf_settime_t);
 
 
 
 
 
 
 
 
 
 46
 47/*
 48 * Request memory range (@mfn, @mfn+@nr_mfns-1) to have type @type.
 49 * On x86, @type is an architecture-defined MTRR memory type.
 50 * On success, returns the MTRR that was used (@reg) and a handle that can
 51 * be passed to XENPF_DEL_MEMTYPE to accurately tear down the new setting.
 52 * (x86-specific).
 53 */
 54#define XENPF_add_memtype         31
 55struct xenpf_add_memtype {
 56	/* IN variables. */
 57	unsigned long mfn;
 58	uint64_t nr_mfns;
 59	uint32_t type;
 60	/* OUT variables. */
 61	uint32_t handle;
 62	uint32_t reg;
 63};
 64DEFINE_GUEST_HANDLE_STRUCT(xenpf_add_memtype_t);
 65
 66/*
 67 * Tear down an existing memory-range type. If @handle is remembered then it
 68 * should be passed in to accurately tear down the correct setting (in case
 69 * of overlapping memory regions with differing types). If it is not known
 70 * then @handle should be set to zero. In all cases @reg must be set.
 71 * (x86-specific).
 72 */
 73#define XENPF_del_memtype         32
 74struct xenpf_del_memtype {
 75	/* IN variables. */
 76	uint32_t handle;
 77	uint32_t reg;
 78};
 79DEFINE_GUEST_HANDLE_STRUCT(xenpf_del_memtype_t);
 80
 81/* Read current type of an MTRR (x86-specific). */
 82#define XENPF_read_memtype        33
 83struct xenpf_read_memtype {
 84	/* IN variables. */
 85	uint32_t reg;
 86	/* OUT variables. */
 87	unsigned long mfn;
 88	uint64_t nr_mfns;
 89	uint32_t type;
 90};
 91DEFINE_GUEST_HANDLE_STRUCT(xenpf_read_memtype_t);
 92
 93#define XENPF_microcode_update    35
 94struct xenpf_microcode_update {
 95	/* IN variables. */
 96	GUEST_HANDLE(void) data;          /* Pointer to microcode data */
 97	uint32_t length;                  /* Length of microcode data. */
 98};
 99DEFINE_GUEST_HANDLE_STRUCT(xenpf_microcode_update_t);
100
101#define XENPF_platform_quirk      39
102#define QUIRK_NOIRQBALANCING      1 /* Do not restrict IO-APIC RTE targets */
103#define QUIRK_IOAPIC_BAD_REGSEL   2 /* IO-APIC REGSEL forgets its value    */
104#define QUIRK_IOAPIC_GOOD_REGSEL  3 /* IO-APIC REGSEL behaves properly     */
105struct xenpf_platform_quirk {
106	/* IN variables. */
107	uint32_t quirk_id;
108};
109DEFINE_GUEST_HANDLE_STRUCT(xenpf_platform_quirk_t);
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111#define XENPF_firmware_info       50
112#define XEN_FW_DISK_INFO          1 /* from int 13 AH=08/41/48 */
113#define XEN_FW_DISK_MBR_SIGNATURE 2 /* from MBR offset 0x1b8 */
114#define XEN_FW_VBEDDC_INFO        3 /* from int 10 AX=4f15 */
 
 
 
115struct xenpf_firmware_info {
116	/* IN variables. */
117	uint32_t type;
118	uint32_t index;
119	/* OUT variables. */
120	union {
121		struct {
122			/* Int13, Fn48: Check Extensions Present. */
123			uint8_t device;                   /* %dl: bios device number */
124			uint8_t version;                  /* %ah: major version      */
125			uint16_t interface_support;       /* %cx: support bitmap     */
126			/* Int13, Fn08: Legacy Get Device Parameters. */
127			uint16_t legacy_max_cylinder;     /* %cl[7:6]:%ch: max cyl # */
128			uint8_t legacy_max_head;          /* %dh: max head #         */
129			uint8_t legacy_sectors_per_track; /* %cl[5:0]: max sector #  */
130			/* Int13, Fn41: Get Device Parameters (as filled into %ds:%esi). */
131			/* NB. First uint16_t of buffer must be set to buffer size.      */
132			GUEST_HANDLE(void) edd_params;
133		} disk_info; /* XEN_FW_DISK_INFO */
134		struct {
135			uint8_t device;                   /* bios device number  */
136			uint32_t mbr_signature;           /* offset 0x1b8 in mbr */
137		} disk_mbr_signature; /* XEN_FW_DISK_MBR_SIGNATURE */
138		struct {
139			/* Int10, AX=4F15: Get EDID info. */
140			uint8_t capabilities;
141			uint8_t edid_transfer_time;
142			/* must refer to 128-byte buffer */
143			GUEST_HANDLE(uchar) edid;
144		} vbeddc_info; /* XEN_FW_VBEDDC_INFO */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145	} u;
146};
147DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t);
148
149#define XENPF_enter_acpi_sleep    51
150struct xenpf_enter_acpi_sleep {
151	/* IN variables */
152	uint16_t pm1a_cnt_val;      /* PM1a control value. */
153	uint16_t pm1b_cnt_val;      /* PM1b control value. */
154	uint32_t sleep_state;       /* Which state to enter (Sn). */
155	uint32_t flags;             /* Must be zero. */
 
156};
157DEFINE_GUEST_HANDLE_STRUCT(xenpf_enter_acpi_sleep_t);
158
159#define XENPF_change_freq         52
160struct xenpf_change_freq {
161	/* IN variables */
162	uint32_t flags; /* Must be zero. */
163	uint32_t cpu;   /* Physical cpu. */
164	uint64_t freq;  /* New frequency (Hz). */
165};
166DEFINE_GUEST_HANDLE_STRUCT(xenpf_change_freq_t);
167
168/*
169 * Get idle times (nanoseconds since boot) for physical CPUs specified in the
170 * @cpumap_bitmap with range [0..@cpumap_nr_cpus-1]. The @idletime array is
171 * indexed by CPU number; only entries with the corresponding @cpumap_bitmap
172 * bit set are written to. On return, @cpumap_bitmap is modified so that any
173 * non-existent CPUs are cleared. Such CPUs have their @idletime array entry
174 * cleared.
175 */
176#define XENPF_getidletime         53
177struct xenpf_getidletime {
178	/* IN/OUT variables */
179	/* IN: CPUs to interrogate; OUT: subset of IN which are present */
180	GUEST_HANDLE(uchar) cpumap_bitmap;
181	/* IN variables */
182	/* Size of cpumap bitmap. */
183	uint32_t cpumap_nr_cpus;
184	/* Must be indexable for every cpu in cpumap_bitmap. */
185	GUEST_HANDLE(uint64_t) idletime;
186	/* OUT variables */
187	/* System time when the idletime snapshots were taken. */
188	uint64_t now;
189};
190DEFINE_GUEST_HANDLE_STRUCT(xenpf_getidletime_t);
191
192#define XENPF_set_processor_pminfo      54
193
194/* ability bits */
195#define XEN_PROCESSOR_PM_CX	1
196#define XEN_PROCESSOR_PM_PX	2
197#define XEN_PROCESSOR_PM_TX	4
198
199/* cmd type */
200#define XEN_PM_CX   0
201#define XEN_PM_PX   1
202#define XEN_PM_TX   2
203#define XEN_PM_PDC  3
204/* Px sub info type */
205#define XEN_PX_PCT   1
206#define XEN_PX_PSS   2
207#define XEN_PX_PPC   4
208#define XEN_PX_PSD   8
209
210struct xen_power_register {
211	uint32_t     space_id;
212	uint32_t     bit_width;
213	uint32_t     bit_offset;
214	uint32_t     access_size;
215	uint64_t     address;
216};
217
218struct xen_processor_csd {
219	uint32_t    domain;      /* domain number of one dependent group */
220	uint32_t    coord_type;  /* coordination type */
221	uint32_t    num;         /* number of processors in same domain */
222};
223DEFINE_GUEST_HANDLE_STRUCT(xen_processor_csd);
224
225struct xen_processor_cx {
226	struct xen_power_register  reg; /* GAS for Cx trigger register */
227	uint8_t     type;     /* cstate value, c0: 0, c1: 1, ... */
228	uint32_t    latency;  /* worst latency (ms) to enter/exit this cstate */
229	uint32_t    power;    /* average power consumption(mW) */
230	uint32_t    dpcnt;    /* number of dependency entries */
231	GUEST_HANDLE(xen_processor_csd) dp; /* NULL if no dependency */
232};
233DEFINE_GUEST_HANDLE_STRUCT(xen_processor_cx);
234
235struct xen_processor_flags {
236	uint32_t bm_control:1;
237	uint32_t bm_check:1;
238	uint32_t has_cst:1;
239	uint32_t power_setup_done:1;
240	uint32_t bm_rld_set:1;
241};
242
243struct xen_processor_power {
244	uint32_t count;  /* number of C state entries in array below */
245	struct xen_processor_flags flags;  /* global flags of this processor */
246	GUEST_HANDLE(xen_processor_cx) states; /* supported c states */
247};
248
249struct xen_pct_register {
250	uint8_t  descriptor;
251	uint16_t length;
252	uint8_t  space_id;
253	uint8_t  bit_width;
254	uint8_t  bit_offset;
255	uint8_t  reserved;
256	uint64_t address;
257};
258
259struct xen_processor_px {
260	uint64_t core_frequency; /* megahertz */
261	uint64_t power;      /* milliWatts */
262	uint64_t transition_latency; /* microseconds */
263	uint64_t bus_master_latency; /* microseconds */
264	uint64_t control;        /* control value */
265	uint64_t status;     /* success indicator */
266};
267DEFINE_GUEST_HANDLE_STRUCT(xen_processor_px);
268
269struct xen_psd_package {
270	uint64_t num_entries;
271	uint64_t revision;
272	uint64_t domain;
273	uint64_t coord_type;
274	uint64_t num_processors;
275};
276
277struct xen_processor_performance {
278	uint32_t flags;     /* flag for Px sub info type */
279	uint32_t platform_limit;  /* Platform limitation on freq usage */
280	struct xen_pct_register control_register;
281	struct xen_pct_register status_register;
282	uint32_t state_count;     /* total available performance states */
283	GUEST_HANDLE(xen_processor_px) states;
284	struct xen_psd_package domain_info;
285	uint32_t shared_type;     /* coordination type of this processor */
286};
287DEFINE_GUEST_HANDLE_STRUCT(xen_processor_performance);
288
289struct xenpf_set_processor_pminfo {
290	/* IN variables */
291	uint32_t id;    /* ACPI CPU ID */
292	uint32_t type;  /* {XEN_PM_CX, XEN_PM_PX} */
293	union {
294		struct xen_processor_power          power;/* Cx: _CST/_CSD */
295		struct xen_processor_performance    perf; /* Px: _PPC/_PCT/_PSS/_PSD */
296		GUEST_HANDLE(uint32_t)              pdc;
297	};
298};
299DEFINE_GUEST_HANDLE_STRUCT(xenpf_set_processor_pminfo);
300
301#define XENPF_get_cpuinfo 55
302struct xenpf_pcpuinfo {
303	/* IN */
304	uint32_t xen_cpuid;
305	/* OUT */
306	/* The maxium cpu_id that is present */
307	uint32_t max_present;
308#define XEN_PCPU_FLAGS_ONLINE   1
309	/* Correponding xen_cpuid is not present*/
310#define XEN_PCPU_FLAGS_INVALID  2
311	uint32_t flags;
312	uint32_t apic_id;
313	uint32_t acpi_id;
314};
315DEFINE_GUEST_HANDLE_STRUCT(xenpf_pcpuinfo);
316
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
317struct xen_platform_op {
318	uint32_t cmd;
319	uint32_t interface_version; /* XENPF_INTERFACE_VERSION */
320	union {
321		struct xenpf_settime           settime;
 
322		struct xenpf_add_memtype       add_memtype;
323		struct xenpf_del_memtype       del_memtype;
324		struct xenpf_read_memtype      read_memtype;
325		struct xenpf_microcode_update  microcode;
326		struct xenpf_platform_quirk    platform_quirk;
 
327		struct xenpf_firmware_info     firmware_info;
328		struct xenpf_enter_acpi_sleep  enter_acpi_sleep;
329		struct xenpf_change_freq       change_freq;
330		struct xenpf_getidletime       getidletime;
331		struct xenpf_set_processor_pminfo set_pminfo;
332		struct xenpf_pcpuinfo          pcpu_info;
 
 
 
 
 
333		uint8_t                        pad[128];
334	} u;
335};
336DEFINE_GUEST_HANDLE_STRUCT(xen_platform_op_t);
337
338#endif /* __XEN_PUBLIC_PLATFORM_H__ */