controlvmchannel.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2010 - 2015 UNISYS CORPORATION
  4. * All rights reserved.
  5. */
  6. #ifndef __CONTROLVMCHANNEL_H__
  7. #define __CONTROLVMCHANNEL_H__
  8. #include <linux/uuid.h>
  9. #include <linux/visorbus.h>
  10. /* {2B3C2D10-7EF5-4ad8-B966-3448B7386B3D} */
  11. #define VISOR_CONTROLVM_CHANNEL_GUID \
  12. GUID_INIT(0x2b3c2d10, 0x7ef5, 0x4ad8, \
  13. 0xb9, 0x66, 0x34, 0x48, 0xb7, 0x38, 0x6b, 0x3d)
  14. #define CONTROLVM_MESSAGE_MAX 64
  15. /*
  16. * Must increment this whenever you insert or delete fields within this channel
  17. * struct. Also increment whenever you change the meaning of fields within this
  18. * channel struct so as to break pre-existing software. Note that you can
  19. * usually add fields to the END of the channel struct withOUT needing to
  20. * increment this.
  21. */
  22. #define VISOR_CONTROLVM_CHANNEL_VERSIONID 1
  23. /* Defines for various channel queues */
  24. #define CONTROLVM_QUEUE_REQUEST 0
  25. #define CONTROLVM_QUEUE_RESPONSE 1
  26. #define CONTROLVM_QUEUE_EVENT 2
  27. #define CONTROLVM_QUEUE_ACK 3
  28. /* Max num of messages stored during IOVM creation to be reused after crash */
  29. #define CONTROLVM_CRASHMSG_MAX 2
  30. /*
  31. * struct visor_segment_state
  32. * @enabled: May enter other states.
  33. * @active: Assigned to active partition.
  34. * @alive: Configure message sent to service/server.
  35. * @revoked: Similar to partition state ShuttingDown.
  36. * @allocated: Memory (device/port number) has been selected by Command.
  37. * @known: Has been introduced to the service/guest partition.
  38. * @ready: Service/Guest partition has responded to introduction.
  39. * @operating: Resource is configured and operating.
  40. * @reserved: Natural alignment.
  41. *
  42. * Note: Don't use high bit unless we need to switch to ushort which is
  43. * non-compliant.
  44. */
  45. struct visor_segment_state {
  46. u16 enabled:1;
  47. u16 active:1;
  48. u16 alive:1;
  49. u16 revoked:1;
  50. u16 allocated:1;
  51. u16 known:1;
  52. u16 ready:1;
  53. u16 operating:1;
  54. u16 reserved:8;
  55. } __packed;
  56. static const struct visor_segment_state segment_state_running = {
  57. 1, 1, 1, 0, 1, 1, 1, 1
  58. };
  59. static const struct visor_segment_state segment_state_paused = {
  60. 1, 1, 1, 0, 1, 1, 1, 0
  61. };
  62. static const struct visor_segment_state segment_state_standby = {
  63. 1, 1, 0, 0, 1, 1, 1, 0
  64. };
  65. /*
  66. * enum controlvm_id
  67. * @CONTROLVM_INVALID:
  68. * @CONTROLVM_BUS_CREATE: CP --> SP, GP.
  69. * @CONTROLVM_BUS_DESTROY: CP --> SP, GP.
  70. * @CONTROLVM_BUS_CONFIGURE: CP --> SP.
  71. * @CONTROLVM_BUS_CHANGESTATE: CP --> SP, GP.
  72. * @CONTROLVM_BUS_CHANGESTATE_EVENT: SP, GP --> CP.
  73. * @CONTROLVM_DEVICE_CREATE: CP --> SP, GP.
  74. * @CONTROLVM_DEVICE_DESTROY: CP --> SP, GP.
  75. * @CONTROLVM_DEVICE_CONFIGURE: CP --> SP.
  76. * @CONTROLVM_DEVICE_CHANGESTATE: CP --> SP, GP.
  77. * @CONTROLVM_DEVICE_CHANGESTATE_EVENT: SP, GP --> CP.
  78. * @CONTROLVM_DEVICE_RECONFIGURE: CP --> Boot.
  79. * @CONTROLVM_CHIPSET_INIT: CP --> SP, GP.
  80. * @CONTROLVM_CHIPSET_STOP: CP --> SP, GP.
  81. * @CONTROLVM_CHIPSET_READY: CP --> SP.
  82. * @CONTROLVM_CHIPSET_SELFTEST: CP --> SP.
  83. *
  84. * Ids for commands that may appear in either queue of a ControlVm channel.
  85. *
  86. * Commands that are initiated by the command partition (CP), by an IO or
  87. * console service partition (SP), or by a guest partition (GP) are:
  88. * - issued on the RequestQueue queue (q #0) in the ControlVm channel
  89. * - responded to on the ResponseQueue queue (q #1) in the ControlVm channel
  90. *
  91. * Events that are initiated by an IO or console service partition (SP) or
  92. * by a guest partition (GP) are:
  93. * - issued on the EventQueue queue (q #2) in the ControlVm channel
  94. * - responded to on the EventAckQueue queue (q #3) in the ControlVm channel
  95. */
  96. enum controlvm_id {
  97. CONTROLVM_INVALID = 0,
  98. /*
  99. * SWITCH commands required Parameter: SwitchNumber.
  100. * BUS commands required Parameter: BusNumber
  101. */
  102. CONTROLVM_BUS_CREATE = 0x101,
  103. CONTROLVM_BUS_DESTROY = 0x102,
  104. CONTROLVM_BUS_CONFIGURE = 0x104,
  105. CONTROLVM_BUS_CHANGESTATE = 0x105,
  106. CONTROLVM_BUS_CHANGESTATE_EVENT = 0x106,
  107. /* DEVICE commands required Parameter: BusNumber, DeviceNumber */
  108. CONTROLVM_DEVICE_CREATE = 0x201,
  109. CONTROLVM_DEVICE_DESTROY = 0x202,
  110. CONTROLVM_DEVICE_CONFIGURE = 0x203,
  111. CONTROLVM_DEVICE_CHANGESTATE = 0x204,
  112. CONTROLVM_DEVICE_CHANGESTATE_EVENT = 0x205,
  113. CONTROLVM_DEVICE_RECONFIGURE = 0x206,
  114. /* CHIPSET commands */
  115. CONTROLVM_CHIPSET_INIT = 0x301,
  116. CONTROLVM_CHIPSET_STOP = 0x302,
  117. CONTROLVM_CHIPSET_READY = 0x304,
  118. CONTROLVM_CHIPSET_SELFTEST = 0x305,
  119. };
  120. /*
  121. * struct irq_info
  122. * @reserved1: Natural alignment purposes
  123. * @recv_irq_handle: Specifies interrupt handle. It is used to retrieve the
  124. * corresponding interrupt pin from Monitor; and the interrupt
  125. * pin is used to connect to the corresponding interrupt.
  126. * Used by IOPart-GP only.
  127. * @recv_irq_vector: Specifies interrupt vector. It, interrupt pin, and shared
  128. * are used to connect to the corresponding interrupt.
  129. * Used by IOPart-GP only.
  130. * @recv_irq_shared: Specifies if the recvInterrupt is shared. It, interrupt
  131. * pin and vector are used to connect to 0 = not shared;
  132. * 1 = shared the corresponding interrupt.
  133. * Used by IOPart-GP only.
  134. * @reserved: Natural alignment purposes
  135. */
  136. struct irq_info {
  137. u64 reserved1;
  138. u64 recv_irq_handle;
  139. u32 recv_irq_vector;
  140. u8 recv_irq_shared;
  141. u8 reserved[3];
  142. } __packed;
  143. /*
  144. * struct efi_visor_indication
  145. * @boot_to_fw_ui: Stop in UEFI UI
  146. * @clear_nvram: Clear NVRAM
  147. * @clear_cmos: Clear CMOS
  148. * @boot_to_tool: Run install tool
  149. * @reserved: Natural alignment
  150. */
  151. struct efi_visor_indication {
  152. u64 boot_to_fw_ui:1;
  153. u64 clear_nvram:1;
  154. u64 clear_cmos:1;
  155. u64 boot_to_tool:1;
  156. /* Remaining bits are available */
  157. u64 reserved:60;
  158. } __packed;
  159. enum visor_chipset_feature {
  160. VISOR_CHIPSET_FEATURE_REPLY = 0x00000001,
  161. VISOR_CHIPSET_FEATURE_PARA_HOTPLUG = 0x00000002,
  162. };
  163. /*
  164. * struct controlvm_message_header
  165. * @id: See CONTROLVM_ID.
  166. * @message_size: Includes size of this struct + size of message.
  167. * @segment_index: Index of segment containing Vm message/information.
  168. * @completion_status: Error status code or result of message completion.
  169. * @struct flags:
  170. * @failed: =1 in a response to signify failure.
  171. * @response_expected: =1 in all messages that expect a response.
  172. * @server: =1 in all bus & device-related messages where the
  173. * message receiver is to act as the bus or device
  174. * server.
  175. * @test_message: =1 for testing use only (Control and Command
  176. * ignore this).
  177. * @partial_completion: =1 if there are forthcoming responses/acks
  178. * associated with this message.
  179. * @preserve: =1 this is to let us know to preserve channel
  180. * contents.
  181. * @writer_in_diag: =1 the DiagWriter is active in the Diagnostic
  182. * Partition.
  183. * @reserve: Natural alignment.
  184. * @reserved: Natural alignment.
  185. * @message_handle: Identifies the particular message instance.
  186. * @payload_vm_offset: Offset of payload area from start of this instance.
  187. * @payload_max_bytes: Maximum bytes allocated in payload area of ControlVm
  188. * segment.
  189. * @payload_bytes: Actual number of bytes of payload area to copy between
  190. * IO/Command. If non-zero, there is a payload to copy.
  191. *
  192. * This is the common structure that is at the beginning of every
  193. * ControlVm message (both commands and responses) in any ControlVm
  194. * queue. Commands are easily distinguished from responses by
  195. * looking at the flags.response field.
  196. */
  197. struct controlvm_message_header {
  198. u32 id;
  199. /*
  200. * For requests, indicates the message type. For responses, indicates
  201. * the type of message we are responding to.
  202. */
  203. u32 message_size;
  204. u32 segment_index;
  205. u32 completion_status;
  206. struct {
  207. u32 failed:1;
  208. u32 response_expected:1;
  209. u32 server:1;
  210. u32 test_message:1;
  211. u32 partial_completion:1;
  212. u32 preserve:1;
  213. u32 writer_in_diag:1;
  214. u32 reserve:25;
  215. } __packed flags;
  216. u32 reserved;
  217. u64 message_handle;
  218. u64 payload_vm_offset;
  219. u32 payload_max_bytes;
  220. u32 payload_bytes;
  221. } __packed;
  222. /*
  223. * struct controlvm_packet_device_create - For CONTROLVM_DEVICE_CREATE
  224. * @bus_no: Bus # (0..n-1) from the msg receiver's end.
  225. * @dev_no: Bus-relative (0..n-1) device number.
  226. * @channel_addr: Guest physical address of the channel, which can be
  227. * dereferenced by the receiver of this ControlVm command.
  228. * @channel_bytes: Specifies size of the channel in bytes.
  229. * @data_type_uuid: Specifies format of data in channel.
  230. * @dev_inst_uuid: Instance guid for the device.
  231. * @irq_info intr: Specifies interrupt information.
  232. */
  233. struct controlvm_packet_device_create {
  234. u32 bus_no;
  235. u32 dev_no;
  236. u64 channel_addr;
  237. u64 channel_bytes;
  238. guid_t data_type_guid;
  239. guid_t dev_inst_guid;
  240. struct irq_info intr;
  241. } __packed;
  242. /*
  243. * struct controlvm_packet_device_configure - For CONTROLVM_DEVICE_CONFIGURE
  244. * @bus_no: Bus number (0..n-1) from the msg receiver's perspective.
  245. * @dev_no: Bus-relative (0..n-1) device number.
  246. */
  247. struct controlvm_packet_device_configure {
  248. u32 bus_no;
  249. u32 dev_no;
  250. } __packed;
  251. /* Total 128 bytes */
  252. struct controlvm_message_device_create {
  253. struct controlvm_message_header header;
  254. struct controlvm_packet_device_create packet;
  255. } __packed;
  256. /* Total 56 bytes */
  257. struct controlvm_message_device_configure {
  258. struct controlvm_message_header header;
  259. struct controlvm_packet_device_configure packet;
  260. } __packed;
  261. /*
  262. * struct controlvm_message_packet - This is the format for a message in any
  263. * ControlVm queue.
  264. * @struct create_bus: For CONTROLVM_BUS_CREATE.
  265. * @bus_no: Bus # (0..n-1) from the msg receiver's perspective.
  266. * @dev_count: Indicates the max number of devices on this bus.
  267. * @channel_addr: Guest physical address of the channel, which can be
  268. * dereferenced by the receiver of this ControlVM
  269. * command.
  270. * @channel_bytes: Size of the channel.
  271. * @bus_data_type_uuid: Indicates format of data in bus channel.
  272. * @bus_inst_uuid: Instance uuid for the bus.
  273. *
  274. * @struct destroy_bus: For CONTROLVM_BUS_DESTROY.
  275. * @bus_no: Bus # (0..n-1) from the msg receiver's perspective.
  276. * @reserved: Natural alignment purposes.
  277. *
  278. * @struct configure_bus: For CONTROLVM_BUS_CONFIGURE.
  279. * @bus_no: Bus # (0..n-1) from the receiver's perspective.
  280. * @reserved1: For alignment purposes.
  281. * @guest_handle: This is used to convert guest physical address to
  282. * physical address.
  283. * @recv_bus_irq_handle: Specifies interrupt info. It is used by SP to
  284. * register to receive interrupts from the CP. This
  285. * interrupt is used for bus level notifications.
  286. * The corresponding sendBusInterruptHandle is kept
  287. * in CP.
  288. *
  289. * @struct create_device: For CONTROLVM_DEVICE_CREATE.
  290. *
  291. * @struct destroy_device: For CONTROLVM_DEVICE_DESTROY.
  292. * @bus_no: Bus # (0..n-1) from the msg receiver's perspective.
  293. * @dev_no: Bus-relative (0..n-1) device number.
  294. *
  295. * @struct configure_device: For CONTROLVM_DEVICE_CONFIGURE.
  296. *
  297. * @struct reconfigure_device: For CONTROLVM_DEVICE_RECONFIGURE.
  298. * @bus_no: Bus # (0..n-1) from the msg receiver's perspective.
  299. * @dev_no: Bus-relative (0..n-1) device number.
  300. *
  301. * @struct bus_change_state: For CONTROLVM_BUS_CHANGESTATE.
  302. * @bus_no:
  303. * @struct state:
  304. * @reserved: Natural alignment purposes.
  305. *
  306. * @struct device_change_state: For CONTROLVM_DEVICE_CHANGESTATE.
  307. * @bus_no:
  308. * @dev_no:
  309. * @struct state:
  310. * @struct flags:
  311. * @phys_device: =1 if message is for a physical device.
  312. * @reserved: Natural alignment.
  313. * @reserved1: Natural alignment.
  314. * @reserved: Natural alignment purposes.
  315. *
  316. * @struct device_change_state_event: For CONTROLVM_DEVICE_CHANGESTATE_EVENT.
  317. * @bus_no:
  318. * @dev_no:
  319. * @struct state:
  320. * @reserved: Natural alignment purposes.
  321. *
  322. * @struct init_chipset: For CONTROLVM_CHIPSET_INIT.
  323. * @bus_count: Indicates the max number of busses.
  324. * @switch_count: Indicates the max number of switches.
  325. * @enum features:
  326. * @platform_number:
  327. *
  328. * @struct chipset_selftest: For CONTROLVM_CHIPSET_SELFTEST.
  329. * @options: Reserved.
  330. * @test: Bit 0 set to run embedded selftest.
  331. *
  332. * @addr: A physical address of something, that can be dereferenced by the
  333. * receiver of this ControlVm command.
  334. *
  335. * @handle: A handle of something (depends on command id).
  336. */
  337. struct controlvm_message_packet {
  338. union {
  339. struct {
  340. u32 bus_no;
  341. u32 dev_count;
  342. u64 channel_addr;
  343. u64 channel_bytes;
  344. guid_t bus_data_type_guid;
  345. guid_t bus_inst_guid;
  346. } __packed create_bus;
  347. struct {
  348. u32 bus_no;
  349. u32 reserved;
  350. } __packed destroy_bus;
  351. struct {
  352. u32 bus_no;
  353. u32 reserved1;
  354. u64 guest_handle;
  355. u64 recv_bus_irq_handle;
  356. } __packed configure_bus;
  357. struct controlvm_packet_device_create create_device;
  358. struct {
  359. u32 bus_no;
  360. u32 dev_no;
  361. } __packed destroy_device;
  362. struct controlvm_packet_device_configure configure_device;
  363. struct {
  364. u32 bus_no;
  365. u32 dev_no;
  366. } __packed reconfigure_device;
  367. struct {
  368. u32 bus_no;
  369. struct visor_segment_state state;
  370. u8 reserved[2];
  371. } __packed bus_change_state;
  372. struct {
  373. u32 bus_no;
  374. u32 dev_no;
  375. struct visor_segment_state state;
  376. struct {
  377. u32 phys_device:1;
  378. u32 reserved:31;
  379. u32 reserved1;
  380. } __packed flags;
  381. u8 reserved[2];
  382. } __packed device_change_state;
  383. struct {
  384. u32 bus_no;
  385. u32 dev_no;
  386. struct visor_segment_state state;
  387. u8 reserved[6];
  388. } __packed device_change_state_event;
  389. struct {
  390. u32 bus_count;
  391. u32 switch_count;
  392. enum visor_chipset_feature features;
  393. u32 platform_number;
  394. } __packed init_chipset;
  395. struct {
  396. u32 options;
  397. u32 test;
  398. } __packed chipset_selftest;
  399. u64 addr;
  400. u64 handle;
  401. };
  402. } __packed;
  403. /* All messages in any ControlVm queue have this layout. */
  404. struct controlvm_message {
  405. struct controlvm_message_header hdr;
  406. struct controlvm_message_packet cmd;
  407. } __packed;
  408. /*
  409. * struct visor_controlvm_channel
  410. * @struct header:
  411. * @gp_controlvm: Guest phys addr of this channel.
  412. * @gp_partition_tables: Guest phys addr of partition tables.
  413. * @gp_diag_guest: Guest phys addr of diagnostic channel.
  414. * @gp_boot_romdisk: Guest phys addr of (read* only) Boot
  415. * ROM disk.
  416. * @gp_boot_ramdisk: Guest phys addr of writable Boot RAM
  417. * disk.
  418. * @gp_acpi_table: Guest phys addr of acpi table.
  419. * @gp_control_channel: Guest phys addr of control channel.
  420. * @gp_diag_romdisk: Guest phys addr of diagnostic ROM disk.
  421. * @gp_nvram: Guest phys addr of NVRAM channel.
  422. * @request_payload_offset: Offset to request payload area.
  423. * @event_payload_offset: Offset to event payload area.
  424. * @request_payload_bytes: Bytes available in request payload area.
  425. * @event_payload_bytes: Bytes available in event payload area.
  426. * @control_channel_bytes:
  427. * @nvram_channel_bytes: Bytes in PartitionNvram segment.
  428. * @message_bytes: sizeof(CONTROLVM_MESSAGE).
  429. * @message_count: CONTROLVM_MESSAGE_MAX.
  430. * @gp_smbios_table: Guest phys addr of SMBIOS tables.
  431. * @gp_physical_smbios_table: Guest phys addr of SMBIOS table.
  432. * @gp_reserved: VISOR_MAX_GUESTS_PER_SERVICE.
  433. * @virtual_guest_firmware_image_base: Guest physical address of EFI firmware
  434. * image base.
  435. * @virtual_guest_firmware_entry_point: Guest physical address of EFI firmware
  436. * entry point.
  437. * @virtual_guest_firmware_image_size: Guest EFI firmware image size.
  438. * @virtual_guest_firmware_boot_base: GPA = 1MB where EFI firmware image is
  439. * copied to.
  440. * @virtual_guest_image_base:
  441. * @virtual_guest_image_size:
  442. * @prototype_control_channel_offset:
  443. * @virtual_guest_partition_handle:
  444. * @restore_action: Restore Action field to restore the
  445. * guest partition.
  446. * @dump_action: For Windows guests it shows if the
  447. * visordisk is in dump mode.
  448. * @nvram_fail_count:
  449. * @saved_crash_message_count: = CONTROLVM_CRASHMSG_MAX.
  450. * @saved_crash_message_offset: Offset to request payload area needed
  451. * for crash dump.
  452. * @installation_error: Type of error encountered during
  453. * installation.
  454. * @installation_text_id: Id of string to display.
  455. * @installation_remaining_steps: Number of remaining installation steps
  456. * (for progress bars).
  457. * @tool_action: VISOR_TOOL_ACTIONS Installation Action
  458. * field.
  459. * @reserved: Alignment.
  460. * @struct efi_visor_ind:
  461. * @sp_reserved:
  462. * @reserved2: Force signals to begin on 128-byte
  463. * cache line.
  464. * @struct request_queue: Guest partition uses this queue to send
  465. * requests to Control.
  466. * @struct response_queue: Control uses this queue to respond to
  467. * service or guest partition request.
  468. * @struct event_queue: Control uses this queue to send events
  469. * to guest partition.
  470. * @struct event_ack_queue: Service or guest partition uses this
  471. * queue to ack Control events.
  472. * @struct request_msg: Request fixed-size message pool -
  473. * does not include payload.
  474. * @struct response_msg: Response fixed-size message pool -
  475. * does not include payload.
  476. * @struct event_msg: Event fixed-size message pool -
  477. * does not include payload.
  478. * @struct event_ack_msg: Ack fixed-size message pool -
  479. * does not include payload.
  480. * @struct saved_crash_msg: Message stored during IOVM creation to
  481. * be reused after crash.
  482. */
  483. struct visor_controlvm_channel {
  484. struct channel_header header;
  485. u64 gp_controlvm;
  486. u64 gp_partition_tables;
  487. u64 gp_diag_guest;
  488. u64 gp_boot_romdisk;
  489. u64 gp_boot_ramdisk;
  490. u64 gp_acpi_table;
  491. u64 gp_control_channel;
  492. u64 gp_diag_romdisk;
  493. u64 gp_nvram;
  494. u64 request_payload_offset;
  495. u64 event_payload_offset;
  496. u32 request_payload_bytes;
  497. u32 event_payload_bytes;
  498. u32 control_channel_bytes;
  499. u32 nvram_channel_bytes;
  500. u32 message_bytes;
  501. u32 message_count;
  502. u64 gp_smbios_table;
  503. u64 gp_physical_smbios_table;
  504. char gp_reserved[2688];
  505. u64 virtual_guest_firmware_image_base;
  506. u64 virtual_guest_firmware_entry_point;
  507. u64 virtual_guest_firmware_image_size;
  508. u64 virtual_guest_firmware_boot_base;
  509. u64 virtual_guest_image_base;
  510. u64 virtual_guest_image_size;
  511. u64 prototype_control_channel_offset;
  512. u64 virtual_guest_partition_handle;
  513. u16 restore_action;
  514. u16 dump_action;
  515. u16 nvram_fail_count;
  516. u16 saved_crash_message_count;
  517. u32 saved_crash_message_offset;
  518. u32 installation_error;
  519. u32 installation_text_id;
  520. u16 installation_remaining_steps;
  521. u8 tool_action;
  522. u8 reserved;
  523. struct efi_visor_indication efi_visor_ind;
  524. u32 sp_reserved;
  525. u8 reserved2[28];
  526. struct signal_queue_header request_queue;
  527. struct signal_queue_header response_queue;
  528. struct signal_queue_header event_queue;
  529. struct signal_queue_header event_ack_queue;
  530. struct controlvm_message request_msg[CONTROLVM_MESSAGE_MAX];
  531. struct controlvm_message response_msg[CONTROLVM_MESSAGE_MAX];
  532. struct controlvm_message event_msg[CONTROLVM_MESSAGE_MAX];
  533. struct controlvm_message event_ack_msg[CONTROLVM_MESSAGE_MAX];
  534. struct controlvm_message saved_crash_msg[CONTROLVM_CRASHMSG_MAX];
  535. } __packed;
  536. /*
  537. * struct visor_controlvm_parameters_header
  538. *
  539. * The following header will be located at the beginning of PayloadVmOffset for
  540. * various ControlVm commands. The receiver of a ControlVm command with a
  541. * PayloadVmOffset will dereference this address and then use connection_offset,
  542. * initiator_offset, and target_offset to get the location of UTF-8 formatted
  543. * strings that can be parsed to obtain command-specific information. The value
  544. * of total_length should equal PayloadBytes. The format of the strings at
  545. * PayloadVmOffset will take different forms depending on the message.
  546. */
  547. struct visor_controlvm_parameters_header {
  548. u32 total_length;
  549. u32 header_length;
  550. u32 connection_offset;
  551. u32 connection_length;
  552. u32 initiator_offset;
  553. u32 initiator_length;
  554. u32 target_offset;
  555. u32 target_length;
  556. u32 client_offset;
  557. u32 client_length;
  558. u32 name_offset;
  559. u32 name_length;
  560. guid_t id;
  561. u32 revision;
  562. /* Natural alignment */
  563. u32 reserved;
  564. } __packed;
  565. /* General Errors------------------------------------------------------[0-99] */
  566. #define CONTROLVM_RESP_SUCCESS 0
  567. #define CONTROLVM_RESP_ALREADY_DONE 1
  568. #define CONTROLVM_RESP_IOREMAP_FAILED 2
  569. #define CONTROLVM_RESP_KMALLOC_FAILED 3
  570. #define CONTROLVM_RESP_ID_UNKNOWN 4
  571. #define CONTROLVM_RESP_ID_INVALID_FOR_CLIENT 5
  572. /* CONTROLVM_INIT_CHIPSET-------------------------------------------[100-199] */
  573. #define CONTROLVM_RESP_CLIENT_SWITCHCOUNT_NONZERO 100
  574. #define CONTROLVM_RESP_EXPECTED_CHIPSET_INIT 101
  575. /* Maximum Limit----------------------------------------------------[200-299] */
  576. /* BUS_CREATE */
  577. #define CONTROLVM_RESP_ERROR_MAX_BUSES 201
  578. /* DEVICE_CREATE */
  579. #define CONTROLVM_RESP_ERROR_MAX_DEVICES 202
  580. /* Payload and Parameter Related------------------------------------[400-499] */
  581. /* SWITCH_ATTACHEXTPORT, DEVICE_CONFIGURE */
  582. #define CONTROLVM_RESP_PAYLOAD_INVALID 400
  583. /* Multiple */
  584. #define CONTROLVM_RESP_INITIATOR_PARAMETER_INVALID 401
  585. /* DEVICE_CONFIGURE */
  586. #define CONTROLVM_RESP_TARGET_PARAMETER_INVALID 402
  587. /* DEVICE_CONFIGURE */
  588. #define CONTROLVM_RESP_CLIENT_PARAMETER_INVALID 403
  589. /* Specified[Packet Structure] Value--------------------------------[500-599] */
  590. /* SWITCH_ATTACHINTPORT */
  591. /* BUS_CONFIGURE, DEVICE_CREATE, DEVICE_CONFIG, DEVICE_DESTROY */
  592. #define CONTROLVM_RESP_BUS_INVALID 500
  593. /* SWITCH_ATTACHINTPORT*/
  594. /* DEVICE_CREATE, DEVICE_CONFIGURE, DEVICE_DESTROY */
  595. #define CONTROLVM_RESP_DEVICE_INVALID 501
  596. /* DEVICE_CREATE, DEVICE_CONFIGURE */
  597. #define CONTROLVM_RESP_CHANNEL_INVALID 502
  598. /* Partition Driver Callback Interface------------------------------[600-699] */
  599. /* BUS_CREATE, BUS_DESTROY, DEVICE_CREATE, DEVICE_DESTROY */
  600. #define CONTROLVM_RESP_VIRTPCI_DRIVER_FAILURE 604
  601. /* Unable to invoke VIRTPCI callback. VIRTPCI Callback returned error. */
  602. /* BUS_CREATE, BUS_DESTROY, DEVICE_CREATE, DEVICE_DESTROY */
  603. #define CONTROLVM_RESP_VIRTPCI_DRIVER_CALLBACK_ERROR 605
  604. /* Generic device callback returned error. */
  605. /* SWITCH_ATTACHEXTPORT, SWITCH_DETACHEXTPORT, DEVICE_CONFIGURE */
  606. #define CONTROLVM_RESP_GENERIC_DRIVER_CALLBACK_ERROR 606
  607. /* Bus Related------------------------------------------------------[700-799] */
  608. /* BUS_DESTROY */
  609. #define CONTROLVM_RESP_ERROR_BUS_DEVICE_ATTACHED 700
  610. /* Channel Related--------------------------------------------------[800-899] */
  611. /* GET_CHANNELINFO, DEVICE_DESTROY */
  612. #define CONTROLVM_RESP_CHANNEL_TYPE_UNKNOWN 800
  613. /* DEVICE_CREATE */
  614. #define CONTROLVM_RESP_CHANNEL_SIZE_TOO_SMALL 801
  615. /* Chipset Shutdown Related---------------------------------------[1000-1099] */
  616. #define CONTROLVM_RESP_CHIPSET_SHUTDOWN_FAILED 1000
  617. #define CONTROLVM_RESP_CHIPSET_SHUTDOWN_ALREADY_ACTIVE 1001
  618. /* Chipset Stop Related-------------------------------------------[1100-1199] */
  619. #define CONTROLVM_RESP_CHIPSET_STOP_FAILED_BUS 1100
  620. #define CONTROLVM_RESP_CHIPSET_STOP_FAILED_SWITCH 1101
  621. /* Device Related-------------------------------------------------[1400-1499] */
  622. #define CONTROLVM_RESP_DEVICE_UDEV_TIMEOUT 1400
  623. /* __CONTROLVMCHANNEL_H__ */
  624. #endif