platform.h 22 KB

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