controlvmchannel.h revision c242233e5b578ef08362d98171c10519876d0d93
1/* Copyright (C) 2010 - 2013 UNISYS CORPORATION
2 * All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or (at
7 * your option) any later version.
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 "commontypes.h"
21#include "channel.h"
22#include "controlframework.h"
23enum { INVALID_GUEST_FIRMWARE, SAMPLE_GUEST_FIRMWARE,
24	    TIANO32_GUEST_FIRMWARE, TIANO64_GUEST_FIRMWARE
25};
26
27/* {2B3C2D10-7EF5-4ad8-B966-3448B7386B3D} */
28#define ULTRA_CONTROLVM_CHANNEL_PROTOCOL_GUID	\
29		UUID_LE(0x2b3c2d10, 0x7ef5, 0x4ad8, \
30				0xb9, 0x66, 0x34, 0x48, 0xb7, 0x38, 0x6b, 0x3d)
31
32static const uuid_le UltraControlvmChannelProtocolGuid =
33	ULTRA_CONTROLVM_CHANNEL_PROTOCOL_GUID;
34
35#define ULTRA_CONTROLVM_CHANNEL_PROTOCOL_SIGNATURE \
36	ULTRA_CHANNEL_PROTOCOL_SIGNATURE
37#define CONTROLVM_MESSAGE_MAX     64
38
39/* Must increment this whenever you insert or delete fields within
40* this channel struct.  Also increment whenever you change the meaning
41* of fields within this channel struct so as to break pre-existing
42* software.  Note that you can usually add fields to the END of the
43* channel struct withOUT needing to increment this. */
44#define ULTRA_CONTROLVM_CHANNEL_PROTOCOL_VERSIONID  1
45
46#define ULTRA_CONTROLVM_CHANNEL_OK_CLIENT(pChannel, logCtx)           \
47	(ULTRA_check_channel_client(pChannel, \
48		UltraControlvmChannelProtocolGuid, \
49		"controlvm", \
50		sizeof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL), \
51		ULTRA_CONTROLVM_CHANNEL_PROTOCOL_VERSIONID, \
52		ULTRA_CONTROLVM_CHANNEL_PROTOCOL_SIGNATURE, \
53		__FILE__, __LINE__, logCtx))
54#define ULTRA_CONTROLVM_CHANNEL_OK_SERVER(actualBytes, logCtx)        \
55	(ULTRA_check_channel_server(UltraControlvmChannelProtocolGuid,	\
56				    "controlvm",			\
57				    sizeof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL), \
58				    actualBytes, __FILE__, __LINE__, logCtx))
59
60#define MY_DEVICE_INDEX 0
61#define MAX_MACDATA_LEN 8 /* number of bytes for MAC address in config packet */
62#define MAX_SERIAL_NUM	32
63
64#define DISK_ZERO_PUN_NUMBER	1  /* Target ID on the SCSI bus for LUN 0 */
65#define DISK_ZERO_LUN_NUMBER	3  /* Logical Unit Number */
66
67/* Defines for various channel queues... */
68#define CONTROLVM_QUEUE_REQUEST		0
69#define CONTROLVM_QUEUE_RESPONSE	1
70#define	CONTROLVM_QUEUE_EVENT		2
71#define CONTROLVM_QUEUE_ACK		3
72
73/* Max number of messages stored during IOVM creation to be reused
74 * after crash */
75#define CONTROLVM_CRASHMSG_MAX		2
76
77/** Ids for commands that may appear in either queue of a ControlVm channel.
78 *
79 *  Commands that are initiated by the command partition (CP), by an IO or
80 *  console service partition (SP), or by a guest partition (GP)are:
81 *  - issued on the RequestQueue queue (q #0) in the ControlVm channel
82 *  - responded to on the ResponseQueue queue (q #1) in the ControlVm channel
83 *
84 *  Events that are initiated by an IO or console service partition (SP) or
85 *  by a guest partition (GP) are:
86 *  - issued on the EventQueue queue (q #2) in the ControlVm channel
87 *  - responded to on the EventAckQueue queue (q #3) in the ControlVm channel
88 */
89typedef enum  {
90	CONTROLVM_INVALID = 0,
91	/* SWITCH commands required Parameter: SwitchNumber  */
92	/* BUS commands required Parameter: BusNumber  */
93	CONTROLVM_BUS_CREATE = 0x101,	/* CP --> SP, GP */
94	CONTROLVM_BUS_DESTROY = 0x102,	/* CP --> SP, GP */
95	CONTROLVM_BUS_CONFIGURE = 0x104,	/* CP --> SP */
96	CONTROLVM_BUS_CHANGESTATE = 0x105,	/* CP --> SP, GP */
97	CONTROLVM_BUS_CHANGESTATE_EVENT = 0x106, /* SP, GP --> CP */
98/* DEVICE commands required Parameter: BusNumber, DeviceNumber  */
99
100	CONTROLVM_DEVICE_CREATE = 0x201,	/* CP --> SP, GP */
101	CONTROLVM_DEVICE_DESTROY = 0x202,	/* CP --> SP, GP */
102	CONTROLVM_DEVICE_CONFIGURE = 0x203,	/* CP --> SP */
103	CONTROLVM_DEVICE_CHANGESTATE = 0x204,	/* CP --> SP, GP */
104	CONTROLVM_DEVICE_CHANGESTATE_EVENT = 0x205, /* SP, GP --> CP */
105	CONTROLVM_DEVICE_RECONFIGURE = 0x206,	/* CP --> Boot */
106/* DISK commands required Parameter: BusNumber, DeviceNumber  */
107	CONTROLVM_DISK_CREATE = 0x221,	/* CP --> SP */
108	CONTROLVM_DISK_DESTROY = 0x222,	/* CP --> SP */
109	CONTROLVM_DISK_CONFIGURE = 0x223,	/* CP --> SP */
110	CONTROLVM_DISK_CHANGESTATE = 0x224,	/* CP --> SP */
111/* CHIPSET commands */
112	CONTROLVM_CHIPSET_INIT = 0x301,	/* CP --> SP, GP */
113	CONTROLVM_CHIPSET_STOP = 0x302,	/* CP --> SP, GP */
114	CONTROLVM_CHIPSET_SHUTDOWN = 0x303,	/* CP --> SP */
115	CONTROLVM_CHIPSET_READY = 0x304,	/* CP --> SP */
116	CONTROLVM_CHIPSET_SELFTEST = 0x305,	/* CP --> SP */
117
118} CONTROLVM_ID;
119
120struct InterruptInfo {
121	 /**< specifies interrupt info. It is used to send interrupts
122	  *   for this channel. The peer at the end of this channel
123	  *   who has registered an interrupt (using recv fields
124	  *   above) will receive the interrupt. Passed as a parameter
125	  *   to Issue_VMCALL_IO_QUEUE_TRANSITION, which generates the
126	  *   interrupt.  Currently this is used by IOPart-SP to wake
127	  *   up GP when Data Channel transitions from empty to
128	  *   non-empty.*/
129	U64 sendInterruptHandle;
130
131	 /**< specifies interrupt handle. It is used to retrieve the
132	  *   corresponding interrupt pin from Monitor; and the
133	  *   interrupt pin is used to connect to the corresponding
134	  *   intrrupt.  Used by IOPart-GP only. */
135	U64 recvInterruptHandle;
136
137	 /**< specifies interrupt vector. It, interrupt pin, and shared are
138	  *   used to connect to the corresponding interrupt.  Used by
139	  *   IOPart-GP only. */
140	U32 recvInterruptVector;
141
142    /**< specifies if the recvInterrupt is shared.  It, interrupt pin
143     *   and vector are used to connect to 0 = not shared; 1 = shared.
144     *   the corresponding interrupt.  Used by IOPart-GP only. */
145	u8 recvInterruptShared;
146	u8 reserved[3];	/* Natural alignment purposes */
147};
148
149struct PciId {
150	U16 Domain;
151	u8 Bus;
152	u8 Slot;
153	u8 Func;
154	u8 Reserved[3];	/* Natural alignment purposes */
155};
156
157struct PciConfigHdr {
158	U16 VendorId;
159	U16 SubSysVendor;
160	U16 DeviceId;
161	U16 SubSysDevice;
162	U32 ClassCode;
163	U32 Reserved;		/* Natural alignment purposes */
164};
165
166struct ScsiId {
167	U32 Bus;
168	U32 Target;
169	U32 Lun;
170	U32 Host; /* Command should ignore this for *
171		   * DiskArrival/RemovalEvents */
172};
173
174struct WWID {
175	U32 wwid1;
176	U32 wwid2;
177};
178
179struct virtDiskInfo  {
180	U32 switchNo;		/* defined by SWITCH_CREATE */
181	U32 externalPortNo;	/* 0 for SAS RAID provided (external)
182				 * virtual disks, 1 for virtual disk
183				 * images, 2 for gold disk images */
184	U16 VirtualDiskIndex;	/* Index of disk descriptor in the
185				 * VirtualDisk segment associated with
186				 * externalPortNo */
187	U16 Reserved1;
188	U32 Reserved2;
189};
190
191typedef enum {
192	CONTROLVM_ACTION_NONE = 0,
193	CONTROLVM_ACTION_SET_RESTORE = 0x05E7,
194	CONTROLVM_ACTION_CLEAR_RESTORE = 0x0C18,
195	CONTROLVM_ACTION_RESTORING = 0x08E5,
196	CONTROLVM_ACTION_RESTORE_BUSY = 0x0999,
197	CONTROLVM_ACTION_CLEAR_NVRAM = 0xB01
198} CONTROLVM_ACTION;
199
200typedef enum _ULTRA_TOOL_ACTIONS {
201	    /* enumeration that defines intended action  */
202	    ULTRA_TOOL_ACTION_NONE = 0,	/* normal boot of boot disk */
203	ULTRA_TOOL_ACTION_INSTALL = 1,	/* install source disk(s) to boot
204					 * disk */
205	ULTRA_TOOL_ACTION_CAPTURE = 2,	/* capture boot disk to target disk(s)
206					 * as 'gold image' */
207	ULTRA_TOOL_ACTION_REPAIR = 3,	/* use source disk(s) to repair
208					 * installation on boot disk */
209	ULTRA_TOOL_ACTION_CLEAN = 4,	/* 'scrub' virtual disk before
210					 * releasing back to storage pool */
211	ULTRA_TOOL_ACTION_UPGRADE = 5,	/* upgrade to use content of images
212					 * referenced from newer blueprint */
213	ULTRA_TOOL_ACTION_DIAG = 6,	/* use tool to invoke diagnostic script
214					 * provided by blueprint */
215	ULTRA_TOOL_ACTION_FAILED = 7,	/* used when tool fails installation
216					   and cannot continue */
217	ULTRA_TOOL_ACTION_COUNT = 8
218} ULTRA_TOOL_ACTIONS;
219
220typedef struct _ULTRA_EFI_SPAR_INDICATION  {
221	U64 BootToFirmwareUI:1;	/* Bit 0: Stop in uefi ui */
222	U64 ClearNvram:1;	/* Bit 1: Clear NVRAM */
223	U64 ClearCmos:1;	/* Bit 2: Clear CMOS */
224	U64 BootToTool:1;	/* Bit 3: Run install tool */
225	/* remaining bits are available */
226} ULTRA_EFI_SPAR_INDICATION;
227
228typedef enum {
229	ULTRA_CHIPSET_FEATURE_REPLY = 0x00000001,
230	ULTRA_CHIPSET_FEATURE_PARA_HOTPLUG = 0x00000002,
231	ULTRA_CHIPSET_FEATURE_PCIVBUS = 0x00000004
232} ULTRA_CHIPSET_FEATURE;
233
234/** This is the common structure that is at the beginning of every
235 *  ControlVm message (both commands and responses) in any ControlVm
236 *  queue.  Commands are easily distinguished from responses by
237 *  looking at the flags.response field.
238 */
239typedef struct _CONTROLVM_MESSAGE_HEADER  {
240	U32 Id;		/* See CONTROLVM_ID. */
241	/* For requests, indicates the message type. */
242	/* For responses, indicates the type of message we are responding to. */
243
244	U32 MessageSize;	/* Includes size of this struct + size
245				 * of message */
246	U32 SegmentIndex;	/* Index of segment containing Vm
247				 * message/information */
248	U32 CompletionStatus;	/* Error status code or result of
249				 * message completion */
250	struct  {
251		U32 failed:1;		   /**< =1 in a response to * signify
252					    * failure */
253		U32 responseExpected:1;   /**< =1 in all messages that expect a
254					   * response (Control ignores this
255					   * bit) */
256		U32 server:1;		   /**< =1 in all bus & device-related
257					    * messages where the message
258					    * receiver is to act as the bus or
259					    * device server */
260		U32 testMessage:1;	   /**< =1 for testing use only
261					    * (Control and Command ignore this
262					    * bit) */
263		U32 partialCompletion:1;  /**< =1 if there are forthcoming
264					   * responses/acks associated
265					   * with this message */
266		U32 preserve:1;	       /**< =1 this is to let us know to
267					* preserve channel contents
268					* (for running guests)*/
269		U32 writerInDiag:1;	/**< =1 the DiagWriter is active in the
270					 * Diagnostic Partition*/
271
272		    /* remaining bits in this 32-bit word are available */
273	} Flags;
274	U32 Reserved;		/* Natural alignment */
275	U64 MessageHandle;	/* Identifies the particular message instance,
276				 * and is used to match particular */
277	/* request instances with the corresponding response instance. */
278	U64 PayloadVmOffset;	/* Offset of payload area from start of this
279				 * instance of ControlVm segment */
280	U32 PayloadMaxBytes;	/* Maximum bytes allocated in payload
281				 * area of ControlVm segment */
282	U32 PayloadBytes;	/* Actual number of bytes of payload
283				 * area to copy between IO/Command; */
284	/* if non-zero, there is a payload to copy. */
285} CONTROLVM_MESSAGE_HEADER;
286
287typedef struct _CONTROLVM_PACKET_DEVICE_CREATE  {
288	U32 busNo;	   /**< bus # (0..n-1) from the msg receiver's
289			    * perspective */
290
291	    /* Control uses header SegmentIndex field to access bus number... */
292	U32 devNo;	   /**< bus-relative (0..n-1) device number */
293	U64 channelAddr;  /**< Guest physical address of the channel, which
294			*   can be dereferenced by the receiver
295			*   of this ControlVm command */
296	U64 channelBytes; /**< specifies size of the channel in bytes */
297	uuid_le dataTypeGuid;/**< specifies format of data in channel */
298	uuid_le devInstGuid; /**< instance guid for the device */
299	struct InterruptInfo intr; /**< specifies interrupt information */
300} CONTROLVM_PACKET_DEVICE_CREATE;	/* for CONTROLVM_DEVICE_CREATE */
301
302typedef struct _CONTROLVM_PACKET_DEVICE_CONFIGURE  {
303	U32 busNo;	      /**< bus # (0..n-1) from the msg
304			       * receiver's perspective */
305
306	    /* Control uses header SegmentIndex field to access bus number... */
307	U32 devNo;	      /**< bus-relative (0..n-1) device number */
308} CONTROLVM_PACKET_DEVICE_CONFIGURE;	/* for CONTROLVM_DEVICE_CONFIGURE */
309
310typedef struct _CONTROLVM_MESSAGE_DEVICE_CREATE  {
311	CONTROLVM_MESSAGE_HEADER Header;
312	CONTROLVM_PACKET_DEVICE_CREATE Packet;
313} CONTROLVM_MESSAGE_DEVICE_CREATE;	/* total 128 bytes */
314
315typedef struct _CONTROLVM_MESSAGE_DEVICE_CONFIGURE  {
316	CONTROLVM_MESSAGE_HEADER Header;
317	CONTROLVM_PACKET_DEVICE_CONFIGURE Packet;
318} CONTROLVM_MESSAGE_DEVICE_CONFIGURE;	/* total 56 bytes */
319
320/* This is the format for a message in any ControlVm queue. */
321typedef struct _CONTROLVM_MESSAGE_PACKET  {
322	union  {
323
324		/* BEGIN Request messages */
325		struct  {
326			U32 busNo;	      /*< bus # (0..n-1) from the msg
327					       * receiver's perspective */
328
329	    /* Control uses header SegmentIndex field to access bus number... */
330			U32 deviceCount;      /*< indicates the max number of
331					       * devices on this bus */
332			U64 channelAddr;     /*< Guest physical address of the
333					      *   channel, which can be
334					      *   dereferenced by the receiver
335					      *   of this ControlVm command */
336			U64 channelBytes;    /*< size of the channel in bytes */
337			uuid_le busDataTypeGuid;/*< indicates format of data in
338						    bus channel */
339			uuid_le busInstGuid;    /*< instance guid for the bus */
340		} createBus;	/* for CONTROLVM_BUS_CREATE */
341		struct  {
342			U32 busNo;	      /*< bus # (0..n-1) from the msg
343					       * receiver's perspective */
344
345	    /* Control uses header SegmentIndex field to access bus number... */
346			U32 reserved;	/* Natural alignment purposes */
347		} destroyBus;	/* for CONTROLVM_BUS_DESTROY */
348		struct  {
349			U32 busNo;		    /*< bus # (0..n-1) from the
350						     * msg receiver's
351						     * perspective */
352
353	    /* Control uses header SegmentIndex field to access bus number... */
354			U32 reserved1;		    /* for alignment purposes */
355			U64 guestHandle;	    /* This is used to convert
356					 *  guest physical address to real
357					 *  physical address for DMA, for ex. */
358			U64 recvBusInterruptHandle;/*< specifies interrupt
359					 *   info. It is used by SP to register
360					 *   to receive interrupts from the CP.
361					 *   This interrupt is used for bus
362					 *   level notifications.  The
363					 *   corresponding
364					 *   sendBusInterruptHandle is kept in
365					 *   CP. */
366		} configureBus;	/* for CONTROLVM_BUS_CONFIGURE */
367
368		/* for CONTROLVM_DEVICE_CREATE */
369		CONTROLVM_PACKET_DEVICE_CREATE createDevice;
370		struct  {
371			U32 busNo;	      /*< bus # (0..n-1) from the msg
372					       * receiver's perspective */
373
374	    /* Control uses header SegmentIndex field to access bus number... */
375			U32 devNo;	      /*< bus-relative (0..n-1) device
376					       * number */
377		} destroyDevice;	/* for CONTROLVM_DEVICE_DESTROY */
378
379		/* for CONTROLVM_DEVICE_CONFIGURE */
380		CONTROLVM_PACKET_DEVICE_CONFIGURE configureDevice;
381		struct  {
382			U32 busNo;	      /*< bus # (0..n-1) from the msg
383					       * receiver's perspective */
384
385	    /* Control uses header SegmentIndex field to access bus number... */
386			U32 devNo;	      /*< bus-relative (0..n-1) device
387					       * number */
388		} reconfigureDevice;	/* for CONTROLVM_DEVICE_RECONFIGURE */
389		struct  {
390			U32 busNo;
391			ULTRA_SEGMENT_STATE state;
392			u8 reserved[2];	/* Natural alignment purposes */
393		} busChangeState;	/* for CONTROLVM_BUS_CHANGESTATE */
394		struct  {
395			U32 busNo;
396			U32 devNo;
397			ULTRA_SEGMENT_STATE state;
398			struct  {
399				U32 physicalDevice:1;	/* =1 if message is for
400							 * a physical device */
401			/* remaining bits in this 32-bit word are available */
402			} flags;
403			u8 reserved[2];	/* Natural alignment purposes */
404		} deviceChangeState;	/* for CONTROLVM_DEVICE_CHANGESTATE */
405		struct  {
406			U32 busNo;
407			U32 devNo;
408			ULTRA_SEGMENT_STATE state;
409			u8 reserved[6];	/* Natural alignment purposes */
410		} deviceChangeStateEvent; /* for CONTROLVM_DEVICE_CHANGESTATE_EVENT */
411		struct  {
412			U32 busCount; /*< indicates the max number of busses */
413			U32 switchCount; /*< indicates the max number of
414					  *   switches (applicable for service
415					  *   partition only) */
416			ULTRA_CHIPSET_FEATURE features;
417			U32 platformNumber;	/* Platform Number */
418		} initChipset;	/* for CONTROLVM_CHIPSET_INIT */
419		struct  {
420			U32 Options; /*< reserved */
421			U32 Test;    /*< bit 0 set to run embedded selftest */
422		} chipsetSelftest;	/* for CONTROLVM_CHIPSET_SELFTEST */
423
424		    /* END Request messages */
425
426		    /* BEGIN Response messages */
427
428		    /* END Response messages */
429
430		    /* BEGIN Event messages */
431
432		    /* END Event messages */
433
434		    /* BEGIN Ack messages */
435
436		    /* END Ack messages */
437		U64 addr;	    /*< a physical address of something, that
438				     *   can be dereferenced by the receiver of
439				     *   this ControlVm command (depends on
440				     *   command id) */
441		U64 handle;	    /*< a handle of something (depends on
442				     * command id) */
443	};
444} CONTROLVM_MESSAGE_PACKET;
445
446/* All messages in any ControlVm queue have this layout. */
447typedef struct _CONTROLVM_MESSAGE  {
448	CONTROLVM_MESSAGE_HEADER hdr;
449	CONTROLVM_MESSAGE_PACKET cmd;
450} CONTROLVM_MESSAGE;
451
452typedef struct _DEVICE_MAP  {
453	GUEST_PHYSICAL_ADDRESS DeviceChannelAddress;
454	U64 DeviceChannelSize;
455	U32 CA_Index;
456	U32 Reserved;		/* natural alignment */
457	U64 Reserved2;		/* Align structure on 32-byte boundary */
458} DEVICE_MAP;
459
460typedef struct _GUEST_DEVICES  {
461	DEVICE_MAP VideoChannel;
462	DEVICE_MAP KeyboardChannel;
463	DEVICE_MAP NetworkChannel;
464	DEVICE_MAP StorageChannel;
465	DEVICE_MAP ConsoleChannel;
466	U32 PartitionIndex;
467	U32 Pad;
468} GUEST_DEVICES;
469
470typedef struct _ULTRA_CONTROLVM_CHANNEL_PROTOCOL  {
471	 CHANNEL_HEADER Header;
472	 GUEST_PHYSICAL_ADDRESS gpControlVm;	/* guest physical address of
473						 * this channel */
474	 GUEST_PHYSICAL_ADDRESS gpPartitionTables; /* guest physical address of
475						    * partition tables */
476	 GUEST_PHYSICAL_ADDRESS gpDiagGuest;	/* guest physical address of
477						 * diagnostic channel */
478	 GUEST_PHYSICAL_ADDRESS gpBootRomDisk;	/* guest phys addr of (read
479						 * only) Boot ROM disk */
480	 GUEST_PHYSICAL_ADDRESS gpBootRamDisk;	/* guest phys addr of writable
481						 * Boot RAM disk */
482	 GUEST_PHYSICAL_ADDRESS gpAcpiTable;	/* guest phys addr of acpi
483						 * table */
484	 GUEST_PHYSICAL_ADDRESS gpControlChannel; /* guest phys addr of control
485						   * channel */
486	 GUEST_PHYSICAL_ADDRESS gpDiagRomDisk;	/* guest phys addr of diagnostic
487						 * ROM disk */
488	 GUEST_PHYSICAL_ADDRESS gpNvram;	/* guest phys addr of NVRAM
489						 * channel */
490	 U64 RequestPayloadOffset;	/* Offset to request payload area */
491	 U64 EventPayloadOffset;	/* Offset to event payload area */
492	 U32 RequestPayloadBytes;	/* Bytes available in request payload
493					 * area */
494	 U32 EventPayloadBytes;	/* Bytes available in event payload area */
495	 U32 ControlChannelBytes;
496	 U32 NvramChannelBytes;	/* Bytes in PartitionNvram segment */
497	 U32 MessageBytes;	/* sizeof(CONTROLVM_MESSAGE) */
498	 U32 MessageCount;	/* CONTROLVM_MESSAGE_MAX */
499	 GUEST_PHYSICAL_ADDRESS gpSmbiosTable;	/* guest phys addr of SMBIOS
500						 * tables */
501	 GUEST_PHYSICAL_ADDRESS gpPhysicalSmbiosTable;	/* guest phys addr of
502							 * SMBIOS table  */
503	 /* ULTRA_MAX_GUESTS_PER_SERVICE */
504	 GUEST_DEVICES gpObsoleteGuestDevices[16];
505
506	 /* guest physical address of EFI firmware image base  */
507	 GUEST_PHYSICAL_ADDRESS VirtualGuestFirmwareImageBase;
508
509	 /* guest physical address of EFI firmware entry point  */
510	 GUEST_PHYSICAL_ADDRESS VirtualGuestFirmwareEntryPoint;
511
512	 /* guest EFI firmware image size  */
513	 U64 VirtualGuestFirmwareImageSize;
514
515	 /* GPA = 1MB where EFI firmware image is copied to  */
516	 GUEST_PHYSICAL_ADDRESS VirtualGuestFirmwareBootBase;
517	 GUEST_PHYSICAL_ADDRESS VirtualGuestImageBase;
518	 GUEST_PHYSICAL_ADDRESS VirtualGuestImageSize;
519	 U64 PrototypeControlChannelOffset;
520	 GUEST_PHYSICAL_ADDRESS VirtualGuestPartitionHandle;
521
522	 U16 RestoreAction;	/* Restore Action field to restore the guest
523				 * partition */
524	U16 DumpAction;		/* For Windows guests it shows if the visordisk
525				 * is running in dump mode */
526	U16 NvramFailCount;
527	U16 SavedCrashMsgCount;	/* = CONTROLVM_CRASHMSG_MAX */
528	U32 SavedCrashMsgOffset;	/* Offset to request payload area needed
529					 * for crash dump */
530	U32 InstallationError;	/* Type of error encountered during
531				 * installation */
532	U32 InstallationTextId;	/* Id of string to display */
533	U16 InstallationRemainingSteps;	/* Number of remaining installation
534					 * steps (for progress bars) */
535	u8 ToolAction;		/* ULTRA_TOOL_ACTIONS Installation Action
536				 * field */
537	u8 Reserved;		/* alignment */
538	ULTRA_EFI_SPAR_INDICATION EfiSparIndication;
539	ULTRA_EFI_SPAR_INDICATION EfiSparIndicationSupported;
540	U32 SPReserved;
541	u8 Reserved2[28];	/* Force signals to begin on 128-byte cache
542				 * line */
543	SIGNAL_QUEUE_HEADER RequestQueue;	/* Service or guest partition
544						 * uses this queue to send
545						 * requests to Control */
546	SIGNAL_QUEUE_HEADER ResponseQueue;	/* Control uses this queue to
547						 * respond to service or guest
548						 * partition requests */
549	SIGNAL_QUEUE_HEADER EventQueue;		/* Control uses this queue to
550						 * send events to service or
551						 * guest partition */
552	SIGNAL_QUEUE_HEADER EventAckQueue;	/* Service or guest partition
553						 * uses this queue to ack
554						 * Control events */
555
556	 /* Request fixed-size message pool - does not include payload */
557	 CONTROLVM_MESSAGE RequestMsg[CONTROLVM_MESSAGE_MAX];
558
559	 /* Response fixed-size message pool - does not include payload */
560	 CONTROLVM_MESSAGE ResponseMsg[CONTROLVM_MESSAGE_MAX];
561
562	 /* Event fixed-size message pool - does not include payload */
563	 CONTROLVM_MESSAGE EventMsg[CONTROLVM_MESSAGE_MAX];
564
565	 /* Ack fixed-size message pool - does not include payload */
566	 CONTROLVM_MESSAGE EventAckMsg[CONTROLVM_MESSAGE_MAX];
567
568	 /* Message stored during IOVM creation to be reused after crash */
569	 CONTROLVM_MESSAGE SavedCrashMsg[CONTROLVM_CRASHMSG_MAX];
570} ULTRA_CONTROLVM_CHANNEL_PROTOCOL;
571
572/* Offsets for VM channel attributes... */
573#define VM_CH_REQ_QUEUE_OFFSET \
574	offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, RequestQueue)
575#define VM_CH_RESP_QUEUE_OFFSET \
576	offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, ResponseQueue)
577#define VM_CH_EVENT_QUEUE_OFFSET \
578	offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, EventQueue)
579#define VM_CH_ACK_QUEUE_OFFSET \
580	offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, EventAckQueue)
581#define VM_CH_REQ_MSG_OFFSET \
582	offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, RequestMsg)
583#define VM_CH_RESP_MSG_OFFSET \
584	offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, ResponseMsg)
585#define VM_CH_EVENT_MSG_OFFSET \
586	offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, EventMsg)
587#define VM_CH_ACK_MSG_OFFSET \
588	offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, EventAckMsg)
589#define VM_CH_CRASH_MSG_OFFSET \
590	offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL, SavedCrashMsg)
591
592/* The following header will be located at the beginning of PayloadVmOffset for
593 *  various ControlVm commands. The receiver of a ControlVm command with a
594 *  PayloadVmOffset will dereference this address and then use ConnectionOffset,
595 *  InitiatorOffset, and TargetOffset to get the location of UTF-8 formatted
596 *  strings that can be parsed to obtain command-specific information. The value
597 *  of TotalLength should equal PayloadBytes.  The format of the strings at
598 *  PayloadVmOffset will take different forms depending on the message.  See the
599 *  following Wiki page for more information:
600 *  https://ustr-linux-1.na.uis.unisys.com/spar/index.php/ControlVm_Parameters_Area
601 */
602typedef struct _ULTRA_CONTROLVM_PARAMETERS_HEADER  {
603	U32 TotalLength;
604	U32 HeaderLength;
605	U32 ConnectionOffset;
606	U32 ConnectionLength;
607	U32 InitiatorOffset;
608	U32 InitiatorLength;
609	U32 TargetOffset;
610	U32 TargetLength;
611	U32 ClientOffset;
612	U32 ClientLength;
613	U32 NameOffset;
614	U32 NameLength;
615	uuid_le Id;
616	U32 Revision;
617	U32 Reserved;		/* Natural alignment */
618} ULTRA_CONTROLVM_PARAMETERS_HEADER;
619
620#endif				/* __CONTROLVMCHANNEL_H__ */
621