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