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