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