| 1 |
|
| 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/interface/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 |
|
| 24 | uint32_t secs;
|
| 25 | uint32_t nsecs;
|
| 26 | uint64_t system_time;
|
| 27 | };
|
| 28 | DEFINE_GUEST_HANDLE_STRUCT(xenpf_settime32_t);
|
| 29 | #define XENPF_settime64 62
|
| 30 | struct xenpf_settime64 {
|
| 31 |
|
| 32 | uint64_t secs;
|
| 33 | uint32_t nsecs;
|
| 34 | uint32_t mbz;
|
| 35 | uint64_t system_time;
|
| 36 | };
|
| 37 | DEFINE_GUEST_HANDLE_STRUCT(xenpf_settime64_t);
|
| 38 |
|
| 39 | |
| 40 | * Request memory range (@mfn, @mfn+@nr_mfns-1) to have type @type.
|
| 41 | * On x86, @type is an architecture-defined MTRR memory type.
|
| 42 | * On success, returns the MTRR that was used (@reg) and a handle that can
|
| 43 | * be passed to XENPF_DEL_MEMTYPE to accurately tear down the new setting.
|
| 44 | * (x86-specific).
|
| 45 |
|
| 46 | #define XENPF_add_memtype 31
|
| 47 | struct xenpf_add_memtype {
|
| 48 |
|
| 49 | xen_pfn_t mfn;
|
| 50 | uint64_t nr_mfns;
|
| 51 | uint32_t type;
|
| 52 |
|
| 53 | uint32_t handle;
|
| 54 | uint32_t reg;
|
| 55 | };
|
| 56 | DEFINE_GUEST_HANDLE_STRUCT(xenpf_add_memtype_t);
|
| 57 |
|
| 58 | |
| 59 | * Tear down an existing memory-range type. If @handle is remembered then it
|
| 60 | * should be passed in to accurately tear down the correct setting (in case
|
| 61 | * of overlapping memory regions with differing types). If it is not known
|
| 62 | * then @handle should be set to zero. In all cases @reg must be set.
|
| 63 | * (x86-specific).
|
| 64 |
|
| 65 | #define XENPF_del_memtype 32
|
| 66 | struct xenpf_del_memtype {
|
| 67 |
|
| 68 | uint32_t handle;
|
| 69 | uint32_t reg;
|
| 70 | };
|
| 71 | DEFINE_GUEST_HANDLE_STRUCT(xenpf_del_memtype_t);
|
| 72 |
|
| 73 |
|
| 74 | #define XENPF_read_memtype 33
|
| 75 | struct xenpf_read_memtype {
|
| 76 |
|
| 77 | uint32_t reg;
|
| 78 |
|
| 79 | xen_pfn_t mfn;
|
| 80 | uint64_t nr_mfns;
|
| 81 | uint32_t type;
|
| 82 | };
|
| 83 | DEFINE_GUEST_HANDLE_STRUCT(xenpf_read_memtype_t);
|
| 84 |
|
| 85 | #define XENPF_microcode_update 35
|
| 86 | struct xenpf_microcode_update {
|
| 87 |
|
| 88 | GUEST_HANDLE(void) data;
|
| 89 | uint32_t length;
|
| 90 | };
|
| 91 | DEFINE_GUEST_HANDLE_STRUCT(xenpf_microcode_update_t);
|
| 92 |
|
| 93 | #define XENPF_platform_quirk 39
|
| 94 | #define QUIRK_NOIRQBALANCING 1
|
| 95 | #define QUIRK_IOAPIC_BAD_REGSEL 2
|
| 96 | #define QUIRK_IOAPIC_GOOD_REGSEL 3
|
| 97 | struct xenpf_platform_quirk {
|
| 98 |
|
| 99 | uint32_t quirk_id;
|
| 100 | };
|
| 101 | DEFINE_GUEST_HANDLE_STRUCT(xenpf_platform_quirk_t);
|
| 102 |
|
| 103 | #define XENPF_efi_runtime_call 49
|
| 104 | #define XEN_EFI_get_time 1
|
| 105 | #define XEN_EFI_set_time 2
|
| 106 | #define XEN_EFI_get_wakeup_time 3
|
| 107 | #define XEN_EFI_set_wakeup_time 4
|
| 108 | #define XEN_EFI_get_next_high_monotonic_count 5
|
| 109 | #define XEN_EFI_get_variable 6
|
| 110 | #define XEN_EFI_set_variable 7
|
| 111 | #define XEN_EFI_get_next_variable_name 8
|
| 112 | #define XEN_EFI_query_variable_info 9
|
| 113 | #define XEN_EFI_query_capsule_capabilities 10
|
| 114 | #define XEN_EFI_update_capsule 11
|
| 115 |
|
| 116 | struct xenpf_efi_runtime_call {
|
| 117 | uint32_t function;
|
| 118 | |
| 119 | * This field is generally used for per sub-function flags (defined
|
| 120 | * below), except for the XEN_EFI_get_next_high_monotonic_count case,
|
| 121 | * where it holds the single returned value.
|
| 122 |
|
| 123 | uint32_t misc;
|
| 124 | xen_ulong_t status;
|
| 125 | union {
|
| 126 | #define XEN_EFI_GET_TIME_SET_CLEARS_NS 0x00000001
|
| 127 | struct {
|
| 128 | struct xenpf_efi_time {
|
| 129 | uint16_t year;
|
| 130 | uint8_t month;
|
| 131 | uint8_t day;
|
| 132 | uint8_t hour;
|
| 133 | uint8_t min;
|
| 134 | uint8_t sec;
|
| 135 | uint32_t ns;
|
| 136 | int16_t tz;
|
| 137 | uint8_t daylight;
|
| 138 | } time;
|
| 139 | uint32_t resolution;
|
| 140 | uint32_t accuracy;
|
| 141 | } get_time;
|
| 142 |
|
| 143 | struct xenpf_efi_time set_time;
|
| 144 |
|
| 145 | #define XEN_EFI_GET_WAKEUP_TIME_ENABLED 0x00000001
|
| 146 | #define XEN_EFI_GET_WAKEUP_TIME_PENDING 0x00000002
|
| 147 | struct xenpf_efi_time get_wakeup_time;
|
| 148 |
|
| 149 | #define XEN_EFI_SET_WAKEUP_TIME_ENABLE 0x00000001
|
| 150 | #define XEN_EFI_SET_WAKEUP_TIME_ENABLE_ONLY 0x00000002
|
| 151 | struct xenpf_efi_time set_wakeup_time;
|
| 152 |
|
| 153 | #define XEN_EFI_VARIABLE_NON_VOLATILE 0x00000001
|
| 154 | #define XEN_EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
|
| 155 | #define XEN_EFI_VARIABLE_RUNTIME_ACCESS 0x00000004
|
| 156 | struct {
|
| 157 | GUEST_HANDLE(void) name;
|
| 158 | xen_ulong_t size;
|
| 159 | GUEST_HANDLE(void) data;
|
| 160 | struct xenpf_efi_guid {
|
| 161 | uint32_t data1;
|
| 162 | uint16_t data2;
|
| 163 | uint16_t data3;
|
| 164 | uint8_t data4[8];
|
| 165 | } vendor_guid;
|
| 166 | } get_variable, set_variable;
|
| 167 |
|
| 168 | struct {
|
| 169 | xen_ulong_t size;
|
| 170 | GUEST_HANDLE(void) name;
|
| 171 | struct xenpf_efi_guid vendor_guid;
|
| 172 | } get_next_variable_name;
|
| 173 |
|
| 174 | struct {
|
| 175 | uint32_t attr;
|
| 176 | uint64_t max_store_size;
|
| 177 | uint64_t remain_store_size;
|
| 178 | uint64_t max_size;
|
| 179 | } query_variable_info;
|
| 180 |
|
| 181 | struct {
|
| 182 | GUEST_HANDLE(void) capsule_header_array;
|
| 183 | xen_ulong_t capsule_count;
|
| 184 | uint64_t max_capsule_size;
|
| 185 | uint32_t reset_type;
|
| 186 | } query_capsule_capabilities;
|
| 187 |
|
| 188 | struct {
|
| 189 | GUEST_HANDLE(void) capsule_header_array;
|
| 190 | xen_ulong_t capsule_count;
|
| 191 | uint64_t sg_list;
|
| 192 | } update_capsule;
|
| 193 | } u;
|
| 194 | };
|
| 195 | DEFINE_GUEST_HANDLE_STRUCT(xenpf_efi_runtime_call);
|
| 196 |
|
| 197 | #define XEN_FW_EFI_VERSION 0
|
| 198 | #define XEN_FW_EFI_CONFIG_TABLE 1
|
| 199 | #define XEN_FW_EFI_VENDOR 2
|
| 200 | #define XEN_FW_EFI_MEM_INFO 3
|
| 201 | #define XEN_FW_EFI_RT_VERSION 4
|
| 202 |
|
| 203 | #define XENPF_firmware_info 50
|
| 204 | #define XEN_FW_DISK_INFO 1
|
| 205 | #define XEN_FW_DISK_MBR_SIGNATURE 2
|
| 206 | #define XEN_FW_VBEDDC_INFO 3
|
| 207 | #define XEN_FW_EFI_INFO 4
|
| 208 | #define XEN_FW_KBD_SHIFT_FLAGS 5
|
| 209 |
|
| 210 | struct xenpf_firmware_info {
|
| 211 |
|
| 212 | uint32_t type;
|
| 213 | uint32_t index;
|
| 214 |
|
| 215 | union {
|
| 216 | struct {
|
| 217 |
|
| 218 | uint8_t device;
|
| 219 | uint8_t version;
|
| 220 | uint16_t interface_support;
|
| 221 |
|
| 222 | uint16_t legacy_max_cylinder;
|
| 223 | uint8_t legacy_max_head;
|
| 224 | uint8_t legacy_sectors_per_track;
|
| 225 |
|
| 226 |
|
| 227 | GUEST_HANDLE(void) edd_params;
|
| 228 | } disk_info;
|
| 229 | struct {
|
| 230 | uint8_t device;
|
| 231 | uint32_t mbr_signature;
|
| 232 | } disk_mbr_signature;
|
| 233 | struct {
|
| 234 |
|
| 235 | uint8_t capabilities;
|
| 236 | uint8_t edid_transfer_time;
|
| 237 |
|
| 238 | GUEST_HANDLE(uchar) edid;
|
| 239 | } vbeddc_info;
|
| 240 |
|
| 241 | union xenpf_efi_info {
|
| 242 | uint32_t version;
|
| 243 | struct {
|
| 244 | uint64_t addr;
|
| 245 | uint32_t nent;
|
| 246 | } cfg;
|
| 247 | struct {
|
| 248 | uint32_t revision;
|
| 249 | uint32_t bufsz;
|
| 250 | GUEST_HANDLE(void) name;
|
| 251 |
|
| 252 | } vendor;
|
| 253 | struct {
|
| 254 | uint64_t addr;
|
| 255 | uint64_t size;
|
| 256 | uint64_t attr;
|
| 257 | uint32_t type;
|
| 258 | } mem;
|
| 259 | } efi_info;
|
| 260 |
|
| 261 | uint8_t kbd_shift_flags;
|
| 262 | } u;
|
| 263 | };
|
| 264 | DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t);
|
| 265 |
|
| 266 | #define XENPF_enter_acpi_sleep 51
|
| 267 | struct xenpf_enter_acpi_sleep {
|
| 268 |
|
| 269 | uint16_t val_a;
|
| 270 | uint16_t val_b;
|
| 271 | uint32_t sleep_state;
|
| 272 | #define XENPF_ACPI_SLEEP_EXTENDED 0x00000001
|
| 273 | uint32_t flags;
|
| 274 | };
|
| 275 | DEFINE_GUEST_HANDLE_STRUCT(xenpf_enter_acpi_sleep_t);
|
| 276 |
|
| 277 | #define XENPF_change_freq 52
|
| 278 | struct xenpf_change_freq {
|
| 279 |
|
| 280 | uint32_t flags;
|
| 281 | uint32_t cpu;
|
| 282 | uint64_t freq;
|
| 283 | };
|
| 284 | DEFINE_GUEST_HANDLE_STRUCT(xenpf_change_freq_t);
|
| 285 |
|
| 286 | |
| 287 | * Get idle times (nanoseconds since boot) for physical CPUs specified in the
|
| 288 | * @cpumap_bitmap with range [0..@cpumap_nr_cpus-1]. The @idletime array is
|
| 289 | * indexed by CPU number; only entries with the corresponding @cpumap_bitmap
|
| 290 | * bit set are written to. On return, @cpumap_bitmap is modified so that any
|
| 291 | * non-existent CPUs are cleared. Such CPUs have their @idletime array entry
|
| 292 | * cleared.
|
| 293 |
|
| 294 | #define XENPF_getidletime 53
|
| 295 | struct xenpf_getidletime {
|
| 296 |
|
| 297 |
|
| 298 | GUEST_HANDLE(uchar) cpumap_bitmap;
|
| 299 |
|
| 300 |
|
| 301 | uint32_t cpumap_nr_cpus;
|
| 302 |
|
| 303 | GUEST_HANDLE(uint64_t) idletime;
|
| 304 |
|
| 305 |
|
| 306 | uint64_t now;
|
| 307 | };
|
| 308 | DEFINE_GUEST_HANDLE_STRUCT(xenpf_getidletime_t);
|
| 309 |
|
| 310 | #define XENPF_set_processor_pminfo 54
|
| 311 |
|
| 312 |
|
| 313 | #define XEN_PROCESSOR_PM_CX 1
|
| 314 | #define XEN_PROCESSOR_PM_PX 2
|
| 315 | #define XEN_PROCESSOR_PM_TX 4
|
| 316 |
|
| 317 |
|
| 318 | #define XEN_PM_CX 0
|
| 319 | #define XEN_PM_PX 1
|
| 320 | #define XEN_PM_TX 2
|
| 321 | #define XEN_PM_PDC 3
|
| 322 |
|
| 323 | #define XEN_PX_PCT 1
|
| 324 | #define XEN_PX_PSS 2
|
| 325 | #define XEN_PX_PPC 4
|
| 326 | #define XEN_PX_PSD 8
|
| 327 |
|
| 328 | struct xen_power_register {
|
| 329 | uint32_t space_id;
|
| 330 | uint32_t bit_width;
|
| 331 | uint32_t bit_offset;
|
| 332 | uint32_t access_size;
|
| 333 | uint64_t address;
|
| 334 | };
|
| 335 |
|
| 336 | struct xen_processor_csd {
|
| 337 | uint32_t domain;
|
| 338 | uint32_t coord_type;
|
| 339 | uint32_t num;
|
| 340 | };
|
| 341 | DEFINE_GUEST_HANDLE_STRUCT(xen_processor_csd);
|
| 342 |
|
| 343 | struct xen_processor_cx {
|
| 344 | struct xen_power_register reg;
|
| 345 | uint8_t type;
|
| 346 | uint32_t latency;
|
| 347 | uint32_t power;
|
| 348 | uint32_t dpcnt;
|
| 349 | GUEST_HANDLE(xen_processor_csd) dp;
|
| 350 | };
|
| 351 | DEFINE_GUEST_HANDLE_STRUCT(xen_processor_cx);
|
| 352 |
|
| 353 | struct xen_processor_flags {
|
| 354 | uint32_t bm_control:1;
|
| 355 | uint32_t bm_check:1;
|
| 356 | uint32_t has_cst:1;
|
| 357 | uint32_t power_setup_done:1;
|
| 358 | uint32_t bm_rld_set:1;
|
| 359 | };
|
| 360 |
|
| 361 | struct xen_processor_power {
|
| 362 | uint32_t count;
|
| 363 | struct xen_processor_flags flags;
|
| 364 | GUEST_HANDLE(xen_processor_cx) states;
|
| 365 | };
|
| 366 |
|
| 367 | struct xen_pct_register {
|
| 368 | uint8_t descriptor;
|
| 369 | uint16_t length;
|
| 370 | uint8_t space_id;
|
| 371 | uint8_t bit_width;
|
| 372 | uint8_t bit_offset;
|
| 373 | uint8_t reserved;
|
| 374 | uint64_t address;
|
| 375 | };
|
| 376 |
|
| 377 | struct xen_processor_px {
|
| 378 | uint64_t core_frequency;
|
| 379 | uint64_t power;
|
| 380 | uint64_t transition_latency;
|
| 381 | uint64_t bus_master_latency;
|
| 382 | uint64_t control;
|
| 383 | uint64_t status;
|
| 384 | };
|
| 385 | DEFINE_GUEST_HANDLE_STRUCT(xen_processor_px);
|
| 386 |
|
| 387 | struct xen_psd_package {
|
| 388 | uint64_t num_entries;
|
| 389 | uint64_t revision;
|
| 390 | uint64_t domain;
|
| 391 | uint64_t coord_type;
|
| 392 | uint64_t num_processors;
|
| 393 | };
|
| 394 |
|
| 395 | struct xen_processor_performance {
|
| 396 | uint32_t flags;
|
| 397 | uint32_t platform_limit;
|
| 398 | struct xen_pct_register control_register;
|
| 399 | struct xen_pct_register status_register;
|
| 400 | uint32_t state_count;
|
| 401 | GUEST_HANDLE(xen_processor_px) states;
|
| 402 | struct xen_psd_package domain_info;
|
| 403 | uint32_t shared_type;
|
| 404 | };
|
| 405 | DEFINE_GUEST_HANDLE_STRUCT(xen_processor_performance);
|
| 406 |
|
| 407 | struct xenpf_set_processor_pminfo {
|
| 408 |
|
| 409 | uint32_t id;
|
| 410 | uint32_t type;
|
| 411 | union {
|
| 412 | struct xen_processor_power power;
|
| 413 | struct xen_processor_performance perf;
|
| 414 | GUEST_HANDLE(uint32_t) pdc;
|
| 415 | };
|
| 416 | };
|
| 417 | DEFINE_GUEST_HANDLE_STRUCT(xenpf_set_processor_pminfo);
|
| 418 |
|
| 419 | #define XENPF_get_cpuinfo 55
|
| 420 | struct xenpf_pcpuinfo {
|
| 421 |
|
| 422 | uint32_t xen_cpuid;
|
| 423 |
|
| 424 |
|
| 425 | uint32_t max_present;
|
| 426 | #define XEN_PCPU_FLAGS_ONLINE 1
|
| 427 |
|
| 428 | #define XEN_PCPU_FLAGS_INVALID 2
|
| 429 | uint32_t flags;
|
| 430 | uint32_t apic_id;
|
| 431 | uint32_t acpi_id;
|
| 432 | };
|
| 433 | DEFINE_GUEST_HANDLE_STRUCT(xenpf_pcpuinfo);
|
| 434 |
|
| 435 | #define XENPF_cpu_online 56
|
| 436 | #define XENPF_cpu_offline 57
|
| 437 | struct xenpf_cpu_ol {
|
| 438 | uint32_t cpuid;
|
| 439 | };
|
| 440 | DEFINE_GUEST_HANDLE_STRUCT(xenpf_cpu_ol);
|
| 441 |
|
| 442 | #define XENPF_cpu_hotadd 58
|
| 443 | struct xenpf_cpu_hotadd {
|
| 444 | uint32_t apic_id;
|
| 445 | uint32_t acpi_id;
|
| 446 | uint32_t pxm;
|
| 447 | };
|
| 448 |
|
| 449 | #define XENPF_mem_hotadd 59
|
| 450 | struct xenpf_mem_hotadd {
|
| 451 | uint64_t spfn;
|
| 452 | uint64_t epfn;
|
| 453 | uint32_t pxm;
|
| 454 | uint32_t flags;
|
| 455 | };
|
| 456 |
|
| 457 | #define XENPF_core_parking 60
|
| 458 | struct xenpf_core_parking {
|
| 459 |
|
| 460 | #define XEN_CORE_PARKING_SET 1
|
| 461 | #define XEN_CORE_PARKING_GET 2
|
| 462 | uint32_t type;
|
| 463 |
|
| 464 |
|
| 465 | uint32_t idle_nums;
|
| 466 | };
|
| 467 | DEFINE_GUEST_HANDLE_STRUCT(xenpf_core_parking);
|
| 468 |
|
| 469 | #define XENPF_get_symbol 63
|
| 470 | struct xenpf_symdata {
|
| 471 |
|
| 472 | uint32_t namelen;
|
| 473 |
|
| 474 |
|
| 475 | uint32_t symnum;
|
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
|
| 480 | GUEST_HANDLE(char) name;
|
| 481 | uint64_t address;
|
| 482 | char type;
|
| 483 | };
|
| 484 | DEFINE_GUEST_HANDLE_STRUCT(xenpf_symdata);
|
| 485 |
|
| 486 | #define XENPF_get_dom0_console 64
|
| 487 |
|
| 488 | struct xen_platform_op {
|
| 489 | uint32_t cmd;
|
| 490 | uint32_t interface_version;
|
| 491 | union {
|
| 492 | struct xenpf_settime32 settime32;
|
| 493 | struct xenpf_settime64 settime64;
|
| 494 | struct xenpf_add_memtype add_memtype;
|
| 495 | struct xenpf_del_memtype del_memtype;
|
| 496 | struct xenpf_read_memtype read_memtype;
|
| 497 | struct xenpf_microcode_update microcode;
|
| 498 | struct xenpf_platform_quirk platform_quirk;
|
| 499 | struct xenpf_efi_runtime_call efi_runtime_call;
|
| 500 | struct xenpf_firmware_info firmware_info;
|
| 501 | struct xenpf_enter_acpi_sleep enter_acpi_sleep;
|
| 502 | struct xenpf_change_freq change_freq;
|
| 503 | struct xenpf_getidletime getidletime;
|
| 504 | struct xenpf_set_processor_pminfo set_pminfo;
|
| 505 | struct xenpf_pcpuinfo pcpu_info;
|
| 506 | struct xenpf_cpu_ol cpu_ol;
|
| 507 | struct xenpf_cpu_hotadd cpu_add;
|
| 508 | struct xenpf_mem_hotadd mem_add;
|
| 509 | struct xenpf_core_parking core_parking;
|
| 510 | struct xenpf_symdata symdata;
|
| 511 | struct dom0_vga_console_info dom0_console;
|
| 512 | uint8_t pad[128];
|
| 513 | } u;
|
| 514 | };
|
| 515 | DEFINE_GUEST_HANDLE_STRUCT(xen_platform_op_t);
|
| 516 |
|
| 517 | #endif
|