VirtualBox

source: vbox/trunk/include/VBox/VMMDev.h@ 21223

Last change on this file since 21223 was 21223, checked in by vboxsync, 16 years ago

Moving VMMDEV bits from VBoxGuest.h to VMMDev.h

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 40.9 KB
Line 
1/** @file
2 * Virtual Device for Guest <-> VMM/Host communication (ADD,DEV).
3 */
4
5/*
6 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 *
25 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
26 * Clara, CA 95054 USA or visit http://www.sun.com if you need
27 * additional information or have any questions.
28 */
29
30#ifndef ___VBox_VMMDev_h
31#define ___VBox_VMMDev_h
32
33#include <VBox/cdefs.h>
34#include <VBox/param.h> /* for the PCI IDs. */
35#include <VBox/types.h>
36#include <VBox/err.h>
37#include <VBox/ostypes.h>
38#include <iprt/assert.h>
39
40
41RT_C_DECLS_BEGIN
42
43/** @defgroup grp_vmmdev VMM Device
44 *
45 * Note! This interface cannot be changed, it can only be extended!
46 *
47 * @{
48 */
49
50/** @todo The following is a temporary fix for the problem of accessing
51 hypervisor pointers from within guest additions */
52
53/** Hypervisor linear pointer size type.
54 * @todo r=bird: only hypervisorStart is a "hypervisor" address, all other use
55 * is guest addresses...
56 * */
57typedef RTGCPTR32 VMMDEVHYPPTR32;
58/** Hypervisor linear pointer sized type.
59 * @todo r=bird: This is never used for any "hypervisor" addresses, only guest
60 * addresses. */
61typedef RTGCPTR64 VMMDEVHYPPTR64;
62/** Hypervisor physical pointer sized type.
63 * @todo r=bird: Same confusion as with VMMDEVHYPPTR64. */
64typedef RTGCPHYS32 VMMDEVHYPPHYS32;
65/** Hypervisor physical pointer sized type.
66 * @todo r=bird: Same confusion as with VMMDEVHYPPTR64. */
67typedef RTGCPHYS64 VMMDEVHYPPHYS64;
68
69/** @def VMMDEVHYPPTR Hypervisor linear pointer sized type size type.
70 * @todo r=bird: Same confusion as with VMMDEVHYPPTR64. */
71/** @def VMMDEVHYPPHYS Hypervisor physical pointer sized type.
72 * @todo r=bird: Same confusion as with VMMDEVHYPPTR64. */
73#if defined(VBOX_WITH_64_BITS_GUESTS) && ARCH_BITS == 64
74# define VMMDEVHYPPTR VMMDEVHYPPTR64
75# define VMMDEVHYPPHYS VMMDEVHYPPHYS64
76# else
77# define VMMDEVHYPPTR VMMDEVHYPPTR32
78# define VMMDEVHYPPHYS VMMDEVHYPPHYS32
79#endif
80
81
82/** @name Mouse capability bits
83 * @{ */
84/** the guest requests absolute mouse coordinates (guest additions installed) */
85#define VMMDEV_MOUSEGUESTWANTSABS RT_BIT(0)
86/** the host wants to send absolute mouse coordinates (input not captured) */
87#define VMMDEV_MOUSEHOSTWANTSABS RT_BIT(1)
88/** the guest needs a hardware cursor on host. When guest additions are installed
89 * and the host has promised to display the cursor itself, the guest installs a
90 * hardware mouse driver. Don't ask the guest to switch to a software cursor then. */
91#define VMMDEV_MOUSEGUESTNEEDSHOSTCUR RT_BIT(2)
92/** the host is NOT able to draw the cursor itself (e.g. L4 console) */
93#define VMMDEV_MOUSEHOSTCANNOTHWPOINTER RT_BIT(3)
94/** The guest can read VMMDev events to find out about pointer movement */
95#define VMMDEV_MOUSEGUESTUSESVMMDEV RT_BIT(4)
96/** @} */
97
98/** @name Flags for pfnSetCredentials
99 * @{ */
100/** the guest should perform a logon with the credentials */
101#define VMMDEV_SETCREDENTIALS_GUESTLOGON RT_BIT(0)
102/** the guest should prevent local logons */
103#define VMMDEV_SETCREDENTIALS_NOLOCALLOGON RT_BIT(1)
104/** the guest should verify the credentials */
105#define VMMDEV_SETCREDENTIALS_JUDGE RT_BIT(15)
106/** @} */
107
108/** @name Guest capability bits.
109 * VMMDevReq_ReportGuestCapabilities, VMMDevReq_SetGuestCapabilities
110 * @{ */
111/** the guest supports seamless display rendering */
112#define VMMDEV_GUEST_SUPPORTS_SEAMLESS RT_BIT(0)
113/** the guest supports mapping guest to host windows */
114#define VMMDEV_GUEST_SUPPORTS_GUEST_HOST_WINDOW_MAPPING RT_BIT(1)
115/** the guest graphical additions are active - used for fast activation
116 * and deactivation of certain graphical operations (e.g. resizing & seamless).
117 * The legacy VMMDevReq_ReportGuestCapabilities request sets this
118 * automatically, but VMMDevReq_SetGuestCapabilities does not. */
119#define VMMDEV_GUEST_SUPPORTS_GRAPHICS RT_BIT(2)
120/** @} */
121
122/** Size of VMMDev RAM region accessible by guest.
123 * Must be big enough to contain VMMDevMemory structure (see VBoxGuest.h)
124 * For now: 4 megabyte.
125 */
126#define VMMDEV_RAM_SIZE (4 * 256 * PAGE_SIZE)
127
128/** Size of VMMDev heap region accessible by guest.
129 * (Must be a power of two (pci range).)
130 */
131#define VMMDEV_HEAP_SIZE (4 * PAGE_SIZE)
132
133
134/** @name VBoxGuest port definitions
135 * @{
136 */
137
138/** guest can (== wants to) handle absolute coordinates */
139#define VBOXGUEST_MOUSE_GUEST_CAN_ABSOLUTE RT_BIT(0)
140/** host can (== wants to) send absolute coordinates */
141#define VBOXGUEST_MOUSE_HOST_CAN_ABSOLUTE RT_BIT(1)
142/** guest can *NOT* switch to software cursor and therefore depends on the host cursor */
143#define VBOXGUEST_MOUSE_GUEST_NEEDS_HOST_CURSOR RT_BIT(2)
144/** host does NOT provide support for drawing the cursor itself (e.g. L4 console) */
145#define VBOXGUEST_MOUSE_HOST_CANNOT_HWPOINTER RT_BIT(3)
146/** The guest can read VMMDev events to find out about pointer movement */
147#define VBOXGUEST_MOUSE_GUEST_USES_VMMDEV RT_BIT(4)
148
149/** fictive start address of the hypervisor physical memory for MmMapIoSpace */
150#define HYPERVISOR_PHYSICAL_START 0xf8000000
151
152/*
153 * VMMDev Generic Request Interface
154 */
155
156/** port for generic request interface */
157#define PORT_VMMDEV_REQUEST_OFFSET 0
158
159/** Current version of the VMMDev interface.
160 *
161 * Additions are allowed to work only if
162 * additions_major == vmmdev_current && additions_minor <= vmmdev_current.
163 * Additions version is reported to host (VMMDev) by VMMDevReq_ReportGuestInfo.
164 *
165 * @remark These defines also live in the 16-bit and assembly versions of this header.
166 */
167#define VMMDEV_VERSION 0x00010004
168#define VMMDEV_VERSION_MAJOR (VMMDEV_VERSION >> 16)
169#define VMMDEV_VERSION_MINOR (VMMDEV_VERSION & 0xffff)
170
171/* Maximum request packet size */
172#define VMMDEV_MAX_VMMDEVREQ_SIZE _1M
173
174/**
175 * VMMDev request types.
176 * @note when updating this, adjust vmmdevGetRequestSize() as well
177 */
178typedef enum
179{
180 VMMDevReq_InvalidRequest = 0,
181 VMMDevReq_GetMouseStatus = 1,
182 VMMDevReq_SetMouseStatus = 2,
183 VMMDevReq_SetPointerShape = 3,
184 /** @todo implement on host side */
185 VMMDevReq_GetHostVersion = 4,
186 VMMDevReq_Idle = 5,
187 VMMDevReq_GetHostTime = 10,
188 VMMDevReq_GetHypervisorInfo = 20,
189 VMMDevReq_SetHypervisorInfo = 21,
190 VMMDevReq_SetPowerStatus = 30,
191 VMMDevReq_AcknowledgeEvents = 41,
192 VMMDevReq_CtlGuestFilterMask = 42,
193 VMMDevReq_ReportGuestInfo = 50,
194 VMMDevReq_GetDisplayChangeRequest = 51,
195 VMMDevReq_VideoModeSupported = 52,
196 VMMDevReq_GetHeightReduction = 53,
197 VMMDevReq_GetDisplayChangeRequest2 = 54,
198 VMMDevReq_ReportGuestCapabilities = 55,
199 VMMDevReq_SetGuestCapabilities = 56,
200#ifdef VBOX_WITH_HGCM
201 VMMDevReq_HGCMConnect = 60,
202 VMMDevReq_HGCMDisconnect = 61,
203#ifdef VBOX_WITH_64_BITS_GUESTS
204 VMMDevReq_HGCMCall32 = 62,
205 VMMDevReq_HGCMCall64 = 63,
206#else
207 VMMDevReq_HGCMCall = 62,
208#endif /* VBOX_WITH_64_BITS_GUESTS */
209 VMMDevReq_HGCMCancel = 64,
210#endif
211 VMMDevReq_VideoAccelEnable = 70,
212 VMMDevReq_VideoAccelFlush = 71,
213 VMMDevReq_VideoSetVisibleRegion = 72,
214 VMMDevReq_GetSeamlessChangeRequest = 73,
215 VMMDevReq_QueryCredentials = 100,
216 VMMDevReq_ReportCredentialsJudgement = 101,
217 VMMDevReq_ReportGuestStats = 110,
218 VMMDevReq_GetMemBalloonChangeRequest = 111,
219 VMMDevReq_GetStatisticsChangeRequest = 112,
220 VMMDevReq_ChangeMemBalloon = 113,
221 VMMDevReq_GetVRDPChangeRequest = 150,
222 VMMDevReq_LogString = 200,
223 VMMDevReq_SizeHack = 0x7fffffff
224} VMMDevRequestType;
225
226#ifdef VBOX_WITH_64_BITS_GUESTS
227/*
228 * Constants and structures are redefined for the guest.
229 *
230 * Host code MUST always use either *32 or *64 variant explicitely.
231 * Host source code will use VBOX_HGCM_HOST_CODE define to catch undefined
232 * data types and constants.
233 *
234 * This redefinition means that the new additions builds will use
235 * the *64 or *32 variants depending on the current architecture bit count (ARCH_BITS).
236 */
237# ifndef VBOX_HGCM_HOST_CODE
238# if ARCH_BITS == 64
239# define VMMDevReq_HGCMCall VMMDevReq_HGCMCall64
240# elif ARCH_BITS == 32
241# define VMMDevReq_HGCMCall VMMDevReq_HGCMCall32
242# else
243# error "Unsupported ARCH_BITS"
244# endif
245# endif /* !VBOX_HGCM_HOST_CODE */
246#endif /* VBOX_WITH_64_BITS_GUESTS */
247
248/** Version of VMMDevRequestHeader structure. */
249#define VMMDEV_REQUEST_HEADER_VERSION (0x10001)
250
251#pragma pack(4)
252/** generic VMMDev request header */
253typedef struct
254{
255 /** size of the structure in bytes (including body). Filled by caller */
256 uint32_t size;
257 /** version of the structure. Filled by caller */
258 uint32_t version;
259 /** type of the request */
260 VMMDevRequestType requestType;
261 /** return code. Filled by VMMDev */
262 int32_t rc;
263 /** reserved fields */
264 uint32_t reserved1;
265 uint32_t reserved2;
266} VMMDevRequestHeader;
267AssertCompileSize(VMMDevRequestHeader, 24);
268
269/** mouse status request structure */
270typedef struct
271{
272 /** header */
273 VMMDevRequestHeader header;
274 /** mouse feature mask */
275 uint32_t mouseFeatures;
276 /** mouse x position */
277 uint32_t pointerXPos;
278 /** mouse y position */
279 uint32_t pointerYPos;
280} VMMDevReqMouseStatus;
281
282/** Note VBOX_MOUSE_POINTER_* flags are used in guest video driver,
283 * values must be <= 0x8000 and must not be changed.
284 */
285
286/** pointer is visible */
287#define VBOX_MOUSE_POINTER_VISIBLE (0x0001)
288/** pointer has alpha channel */
289#define VBOX_MOUSE_POINTER_ALPHA (0x0002)
290/** pointerData contains new pointer shape */
291#define VBOX_MOUSE_POINTER_SHAPE (0x0004)
292
293/** mouse pointer shape/visibility change request */
294typedef struct
295{
296 /** header */
297 VMMDevRequestHeader header;
298 /** VBOX_MOUSE_POINTER_* bit flags */
299 uint32_t fFlags;
300 /** x coordinate of hot spot */
301 uint32_t xHot;
302 /** y coordinate of hot spot */
303 uint32_t yHot;
304 /** width of the pointer in pixels */
305 uint32_t width;
306 /** height of the pointer in scanlines */
307 uint32_t height;
308 /** Pointer data.
309 *
310 ****
311 * The data consists of 1 bpp AND mask followed by 32 bpp XOR (color) mask.
312 *
313 * For pointers without alpha channel the XOR mask pixels are 32 bit values: (lsb)BGR0(msb).
314 * For pointers with alpha channel the XOR mask consists of (lsb)BGRA(msb) 32 bit values.
315 *
316 * Guest driver must create the AND mask for pointers with alpha channel, so if host does not
317 * support alpha, the pointer could be displayed as a normal color pointer. The AND mask can
318 * be constructed from alpha values. For example alpha value >= 0xf0 means bit 0 in the AND mask.
319 *
320 * The AND mask is 1 bpp bitmap with byte aligned scanlines. Size of AND mask,
321 * therefore, is cbAnd = (width + 7) / 8 * height. The padding bits at the
322 * end of any scanline are undefined.
323 *
324 * The XOR mask follows the AND mask on the next 4 bytes aligned offset:
325 * uint8_t *pXor = pAnd + (cbAnd + 3) & ~3
326 * Bytes in the gap between the AND and the XOR mask are undefined.
327 * XOR mask scanlines have no gap between them and size of XOR mask is:
328 * cXor = width * 4 * height.
329 ****
330 *
331 * Preallocate 4 bytes for accessing actual data as p->pointerData
332 */
333 char pointerData[4];
334} VMMDevReqMousePointer;
335
336/** string log request structure */
337typedef struct
338{
339 /** header */
340 VMMDevRequestHeader header;
341 /** variable length string data */
342 char szString[1];
343} VMMDevReqLogString;
344
345/** host version request structure */
346typedef struct
347{
348 /** header */
349 VMMDevRequestHeader header;
350 /** major version */
351 uint32_t major;
352 /** minor version */
353 uint32_t minor;
354 /** build number */
355 uint32_t build;
356} VMMDevReqHostVersion;
357
358/** guest capabilites structure */
359typedef struct
360{
361 /** header */
362 VMMDevRequestHeader header;
363 /** capabilities (VMMDEV_GUEST_*) */
364 uint32_t caps;
365} VMMDevReqGuestCapabilities;
366
367/** guest capabilites structure */
368typedef struct
369{
370 /** header */
371 VMMDevRequestHeader header;
372 /** mask of capabilities to be added */
373 uint32_t u32OrMask;
374 /** mask of capabilities to be removed */
375 uint32_t u32NotMask;
376} VMMDevReqGuestCapabilities2;
377
378/** idle request structure */
379typedef struct
380{
381 /** header */
382 VMMDevRequestHeader header;
383} VMMDevReqIdle;
384
385/** host time request structure */
386typedef struct
387{
388 /** header */
389 VMMDevRequestHeader header;
390 /** time in milliseconds since unix epoch. Filled by VMMDev. */
391 uint64_t time;
392} VMMDevReqHostTime;
393
394/** hypervisor info structure */
395typedef struct
396{
397 /** header */
398 VMMDevRequestHeader header;
399 /** guest virtual address of proposed hypervisor start */
400 /** TODO: Make this 64-bit compatible */
401 VMMDEVHYPPTR32 hypervisorStart;
402 /** hypervisor size in bytes */
403 uint32_t hypervisorSize;
404} VMMDevReqHypervisorInfo;
405
406/** system power requests */
407typedef enum
408{
409 VMMDevPowerState_Invalid = 0,
410 VMMDevPowerState_Pause = 1,
411 VMMDevPowerState_PowerOff = 2,
412 VMMDevPowerState_SaveState = 3,
413 VMMDevPowerState_SizeHack = 0x7fffffff
414} VMMDevPowerState;
415
416/** system power status structure */
417typedef struct
418{
419 /** header */
420 VMMDevRequestHeader header;
421 /** power state request */
422 VMMDevPowerState powerState;
423} VMMDevPowerStateRequest;
424
425/** pending events structure */
426typedef struct
427{
428 /** header */
429 VMMDevRequestHeader header;
430 /** pending event bitmap */
431 uint32_t events;
432} VMMDevEvents;
433
434/** guest filter mask control */
435typedef struct
436{
437 /** header */
438 VMMDevRequestHeader header;
439 /** mask of events to be added to filter */
440 uint32_t u32OrMask;
441 /** mask of events to be removed from filter */
442 uint32_t u32NotMask;
443} VMMDevCtlGuestFilterMask;
444
445/** guest information structure */
446typedef struct VBoxGuestInfo
447{
448 /** The VMMDev interface version expected by additions. */
449 uint32_t additionsVersion;
450 /** guest OS type */
451 VBOXOSTYPE osType;
452 /** @todo */
453} VBoxGuestInfo;
454
455/** guest information structure */
456typedef struct
457{
458 /** header */
459 VMMDevRequestHeader header;
460 /** Guest information. */
461 VBoxGuestInfo guestInfo;
462} VMMDevReportGuestInfo;
463
464/** guest statistics values */
465#define VBOX_GUEST_STAT_CPU_LOAD_IDLE RT_BIT(0)
466#define VBOX_GUEST_STAT_CPU_LOAD_KERNEL RT_BIT(1)
467#define VBOX_GUEST_STAT_CPU_LOAD_USER RT_BIT(2)
468#define VBOX_GUEST_STAT_THREADS RT_BIT(3)
469#define VBOX_GUEST_STAT_PROCESSES RT_BIT(4)
470#define VBOX_GUEST_STAT_HANDLES RT_BIT(5)
471#define VBOX_GUEST_STAT_MEMORY_LOAD RT_BIT(6)
472#define VBOX_GUEST_STAT_PHYS_MEM_TOTAL RT_BIT(7)
473#define VBOX_GUEST_STAT_PHYS_MEM_AVAIL RT_BIT(8)
474#define VBOX_GUEST_STAT_PHYS_MEM_BALLOON RT_BIT(9)
475#define VBOX_GUEST_STAT_MEM_COMMIT_TOTAL RT_BIT(10)
476#define VBOX_GUEST_STAT_MEM_KERNEL_TOTAL RT_BIT(11)
477#define VBOX_GUEST_STAT_MEM_KERNEL_PAGED RT_BIT(12)
478#define VBOX_GUEST_STAT_MEM_KERNEL_NONPAGED RT_BIT(13)
479#define VBOX_GUEST_STAT_MEM_SYSTEM_CACHE RT_BIT(14)
480#define VBOX_GUEST_STAT_PAGE_FILE_SIZE RT_BIT(15)
481
482
483/** guest statistics structure */
484typedef struct VBoxGuestStatistics
485{
486 /** Virtual CPU id */
487 uint32_t u32CpuId;
488 /** Reported statistics */
489 uint32_t u32StatCaps;
490 /** Idle CPU load (0-100) for last interval */
491 uint32_t u32CpuLoad_Idle;
492 /** Kernel CPU load (0-100) for last interval */
493 uint32_t u32CpuLoad_Kernel;
494 /** User CPU load (0-100) for last interval */
495 uint32_t u32CpuLoad_User;
496 /** Nr of threads */
497 uint32_t u32Threads;
498 /** Nr of processes */
499 uint32_t u32Processes;
500 /** Nr of handles */
501 uint32_t u32Handles;
502 /** Memory load (0-100) */
503 uint32_t u32MemoryLoad;
504 /** Page size of guest system */
505 uint32_t u32PageSize;
506 /** Total physical memory (in 4kb pages) */
507 uint32_t u32PhysMemTotal;
508 /** Available physical memory (in 4kb pages) */
509 uint32_t u32PhysMemAvail;
510 /** Ballooned physical memory (in 4kb pages) */
511 uint32_t u32PhysMemBalloon;
512 /** Total number of committed memory (which is not necessarily in-use) (in 4kb pages) */
513 uint32_t u32MemCommitTotal;
514 /** Total amount of memory used by the kernel (in 4kb pages) */
515 uint32_t u32MemKernelTotal;
516 /** Total amount of paged memory used by the kernel (in 4kb pages) */
517 uint32_t u32MemKernelPaged;
518 /** Total amount of nonpaged memory used by the kernel (in 4kb pages) */
519 uint32_t u32MemKernelNonPaged;
520 /** Total amount of memory used for the system cache (in 4kb pages) */
521 uint32_t u32MemSystemCache;
522 /** Pagefile size (in 4kb pages) */
523 uint32_t u32PageFileSize;
524} VBoxGuestStatistics;
525
526/** guest statistics command structure */
527typedef struct
528{
529 /** header */
530 VMMDevRequestHeader header;
531 /** Guest information. */
532 VBoxGuestStatistics guestStats;
533} VMMDevReportGuestStats;
534
535/** memory balloon change request structure */
536#define VMMDEV_MAX_MEMORY_BALLOON(PhysMemTotal) ((90*PhysMemTotal)/100)
537
538typedef struct
539{
540 /** header */
541 VMMDevRequestHeader header;
542 uint32_t u32BalloonSize; /* balloon size in megabytes */
543 uint32_t u32PhysMemSize; /* guest ram size in megabytes */
544 uint32_t eventAck;
545} VMMDevGetMemBalloonChangeRequest;
546
547/** inflate/deflate memory balloon structure */
548#define VMMDEV_MEMORY_BALLOON_CHUNK_PAGES (_1M/4096)
549#define VMMDEV_MEMORY_BALLOON_CHUNK_SIZE (VMMDEV_MEMORY_BALLOON_CHUNK_PAGES*4096)
550
551typedef struct
552{
553 /** header */
554 VMMDevRequestHeader header;
555 uint32_t cPages;
556 uint32_t fInflate; /* true = inflate, false = defalte */
557 /** Physical address (RTGCPHYS) of each page, variable size. */
558 RTGCPHYS aPhysPage[1];
559} VMMDevChangeMemBalloon;
560
561/** guest statistics interval change request structure */
562typedef struct
563{
564 /** header */
565 VMMDevRequestHeader header;
566 uint32_t u32StatInterval; /* interval in seconds */
567 uint32_t eventAck;
568} VMMDevGetStatisticsChangeRequest;
569
570/** display change request structure */
571typedef struct
572{
573 /** header */
574 VMMDevRequestHeader header;
575 /** horizontal pixel resolution (0 = do not change) */
576 uint32_t xres;
577 /** vertical pixel resolution (0 = do not change) */
578 uint32_t yres;
579 /** bits per pixel (0 = do not change) */
580 uint32_t bpp;
581 /** Flag that the request is an acknowlegement for the VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST.
582 * Values: 0 - just querying, VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST - event acknowledged.
583 */
584 uint32_t eventAck;
585} VMMDevDisplayChangeRequest;
586
587typedef struct
588{
589 /** header */
590 VMMDevRequestHeader header;
591 /** horizontal pixel resolution (0 = do not change) */
592 uint32_t xres;
593 /** vertical pixel resolution (0 = do not change) */
594 uint32_t yres;
595 /** bits per pixel (0 = do not change) */
596 uint32_t bpp;
597 /** Flag that the request is an acknowlegement for the VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST.
598 * Values: 0 - just querying, VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST - event acknowledged.
599 */
600 uint32_t eventAck;
601 /** 0 for primary display, 1 for the first secondary, etc. */
602 uint32_t display;
603} VMMDevDisplayChangeRequest2;
604
605/** video mode supported request structure */
606typedef struct
607{
608 /** header */
609 VMMDevRequestHeader header;
610 /** horizontal pixel resolution (input) */
611 uint32_t width;
612 /** vertical pixel resolution (input) */
613 uint32_t height;
614 /** bits per pixel (input) */
615 uint32_t bpp;
616 /** supported flag (output) */
617 bool fSupported;
618} VMMDevVideoModeSupportedRequest;
619
620/** video modes height reduction request structure */
621typedef struct
622{
623 /** header */
624 VMMDevRequestHeader header;
625 /** height reduction in pixels (output) */
626 uint32_t heightReduction;
627} VMMDevGetHeightReductionRequest;
628
629#define VRDP_EXPERIENCE_LEVEL_ZERO 0 /* Theming disabled. */
630#define VRDP_EXPERIENCE_LEVEL_LOW 1 /* Full window dragging and desktop wallpaper disabled. */
631#define VRDP_EXPERIENCE_LEVEL_MEDIUM 2 /* Font smoothing, gradients. */
632#define VRDP_EXPERIENCE_LEVEL_HIGH 3 /* Animation effects disabled. */
633#define VRDP_EXPERIENCE_LEVEL_FULL 4 /* Everything enabled. */
634
635typedef struct
636{
637 /** header */
638 VMMDevRequestHeader header;
639 /** Whether VRDP is active or not */
640 uint8_t u8VRDPActive;
641 /** The configured experience level for active VRDP. */
642 uint32_t u32VRDPExperienceLevel;
643} VMMDevVRDPChangeRequest;
644
645
646
647#pragma pack()
648
649#ifdef VBOX_WITH_HGCM
650
651/** HGCM flags.
652 * @{
653 */
654#define VBOX_HGCM_REQ_DONE (0x1)
655#define VBOX_HGCM_REQ_CANCELLED (0x2)
656/** @} */
657
658#pragma pack(4)
659typedef struct _VMMDevHGCMRequestHeader
660{
661 /** Request header. */
662 VMMDevRequestHeader header;
663
664 /** HGCM flags. */
665 uint32_t fu32Flags;
666
667 /** Result code. */
668 int32_t result;
669} VMMDevHGCMRequestHeader;
670AssertCompileSize(VMMDevHGCMRequestHeader, 24+8);
671
672/** HGCM service location types. */
673typedef enum
674{
675 VMMDevHGCMLoc_Invalid = 0,
676 VMMDevHGCMLoc_LocalHost = 1,
677 VMMDevHGCMLoc_LocalHost_Existing = 2,
678 VMMDevHGCMLoc_SizeHack = 0x7fffffff
679} HGCMServiceLocationType;
680
681typedef struct
682{
683 char achName[128]; /**< This is really szName. */
684} HGCMServiceLocationHost;
685
686typedef struct HGCMSERVICELOCATION
687{
688 /** Type of the location. */
689 HGCMServiceLocationType type;
690
691 union
692 {
693 HGCMServiceLocationHost host;
694 } u;
695} HGCMServiceLocation;
696
697typedef struct
698{
699 /* request header */
700 VMMDevHGCMRequestHeader header;
701
702 /** IN: Description of service to connect to. */
703 HGCMServiceLocation loc;
704
705 /** OUT: Client identifier assigned by local instance of HGCM. */
706 uint32_t u32ClientID;
707} VMMDevHGCMConnect;
708
709typedef struct
710{
711 /* request header */
712 VMMDevHGCMRequestHeader header;
713
714 /** IN: Client identifier. */
715 uint32_t u32ClientID;
716} VMMDevHGCMDisconnect;
717
718typedef enum
719{
720 VMMDevHGCMParmType_Invalid = 0,
721 VMMDevHGCMParmType_32bit = 1,
722 VMMDevHGCMParmType_64bit = 2,
723 VMMDevHGCMParmType_PhysAddr = 3,
724 VMMDevHGCMParmType_LinAddr = 4, /**< In and Out */
725 VMMDevHGCMParmType_LinAddr_In = 5, /**< In (read; host<-guest) */
726 VMMDevHGCMParmType_LinAddr_Out = 6, /**< Out (write; host->guest) */
727 VMMDevHGCMParmType_LinAddr_Locked = 7, /**< Locked In and Out */
728 VMMDevHGCMParmType_LinAddr_Locked_In = 8, /**< Locked In (read; host<-guest) */
729 VMMDevHGCMParmType_LinAddr_Locked_Out = 9, /**< Locked Out (write; host->guest) */
730 VMMDevHGCMParmType_SizeHack = 0x7fffffff
731} HGCMFunctionParameterType;
732
733#ifdef VBOX_WITH_64_BITS_GUESTS
734typedef struct _HGCMFUNCTIONPARAMETER32
735{
736 HGCMFunctionParameterType type;
737 union
738 {
739 uint32_t value32;
740 uint64_t value64;
741 struct
742 {
743 uint32_t size;
744
745 union
746 {
747 VMMDEVHYPPHYS32 physAddr;
748 VMMDEVHYPPTR32 linearAddr;
749 } u;
750 } Pointer;
751 } u;
752#ifdef __cplusplus
753 void SetUInt32(uint32_t u32)
754 {
755 type = VMMDevHGCMParmType_32bit;
756 u.value64 = 0; /* init unused bits to 0 */
757 u.value32 = u32;
758 }
759
760 int GetUInt32(uint32_t *pu32)
761 {
762 if (type == VMMDevHGCMParmType_32bit)
763 {
764 *pu32 = u.value32;
765 return VINF_SUCCESS;
766 }
767 return VERR_INVALID_PARAMETER;
768 }
769
770 void SetUInt64(uint64_t u64)
771 {
772 type = VMMDevHGCMParmType_64bit;
773 u.value64 = u64;
774 }
775
776 int GetUInt64(uint64_t *pu64)
777 {
778 if (type == VMMDevHGCMParmType_64bit)
779 {
780 *pu64 = u.value64;
781 return VINF_SUCCESS;
782 }
783 return VERR_INVALID_PARAMETER;
784 }
785
786 void SetPtr(void *pv, uint32_t cb)
787 {
788 type = VMMDevHGCMParmType_LinAddr;
789 u.Pointer.size = cb;
790 u.Pointer.u.linearAddr = (VMMDEVHYPPTR32)(uintptr_t)pv;
791 }
792#endif
793} HGCMFunctionParameter32;
794
795typedef struct _HGCMFUNCTIONPARAMETER64
796{
797 HGCMFunctionParameterType type;
798 union
799 {
800 uint32_t value32;
801 uint64_t value64;
802 struct
803 {
804 uint32_t size;
805
806 union
807 {
808 VMMDEVHYPPHYS64 physAddr;
809 VMMDEVHYPPTR64 linearAddr;
810 } u;
811 } Pointer;
812 } u;
813#ifdef __cplusplus
814 void SetUInt32(uint32_t u32)
815 {
816 type = VMMDevHGCMParmType_32bit;
817 u.value64 = 0; /* init unused bits to 0 */
818 u.value32 = u32;
819 }
820
821 int GetUInt32(uint32_t *pu32)
822 {
823 if (type == VMMDevHGCMParmType_32bit)
824 {
825 *pu32 = u.value32;
826 return VINF_SUCCESS;
827 }
828 return VERR_INVALID_PARAMETER;
829 }
830
831 void SetUInt64(uint64_t u64)
832 {
833 type = VMMDevHGCMParmType_64bit;
834 u.value64 = u64;
835 }
836
837 int GetUInt64(uint64_t *pu64)
838 {
839 if (type == VMMDevHGCMParmType_64bit)
840 {
841 *pu64 = u.value64;
842 return VINF_SUCCESS;
843 }
844 return VERR_INVALID_PARAMETER;
845 }
846
847 void SetPtr(void *pv, uint32_t cb)
848 {
849 type = VMMDevHGCMParmType_LinAddr;
850 u.Pointer.size = cb;
851 u.Pointer.u.linearAddr = (uintptr_t)pv;
852 }
853#endif
854} HGCMFunctionParameter64;
855#else /* !VBOX_WITH_64_BITS_GUESTS */
856typedef struct _HGCMFUNCTIONPARAMETER
857{
858 HGCMFunctionParameterType type;
859 union
860 {
861 uint32_t value32;
862 uint64_t value64;
863 struct
864 {
865 uint32_t size;
866
867 union
868 {
869 VMMDEVHYPPHYS32 physAddr;
870 VMMDEVHYPPTR32 linearAddr;
871 } u;
872 } Pointer;
873 } u;
874#ifdef __cplusplus
875 void SetUInt32(uint32_t u32)
876 {
877 type = VMMDevHGCMParmType_32bit;
878 u.value64 = 0; /* init unused bits to 0 */
879 u.value32 = u32;
880 }
881
882 int GetUInt32(uint32_t *pu32)
883 {
884 if (type == VMMDevHGCMParmType_32bit)
885 {
886 *pu32 = u.value32;
887 return VINF_SUCCESS;
888 }
889 return VERR_INVALID_PARAMETER;
890 }
891
892 void SetUInt64(uint64_t u64)
893 {
894 type = VMMDevHGCMParmType_64bit;
895 u.value64 = u64;
896 }
897
898 int GetUInt64(uint64_t *pu64)
899 {
900 if (type == VMMDevHGCMParmType_64bit)
901 {
902 *pu64 = u.value64;
903 return VINF_SUCCESS;
904 }
905 return VERR_INVALID_PARAMETER;
906 }
907
908 void SetPtr(void *pv, uint32_t cb)
909 {
910 type = VMMDevHGCMParmType_LinAddr;
911 u.Pointer.size = cb;
912 u.Pointer.u.linearAddr = (uintptr_t)pv;
913 }
914#endif
915} HGCMFunctionParameter;
916#endif /* !VBOX_WITH_64_BITS_GUESTS */
917
918
919#ifdef VBOX_WITH_64_BITS_GUESTS
920/* Redefine the structure type for the guest code. */
921# ifndef VBOX_HGCM_HOST_CODE
922# if ARCH_BITS == 64
923# define HGCMFunctionParameter HGCMFunctionParameter64
924# elif ARCH_BITS == 32
925# define HGCMFunctionParameter HGCMFunctionParameter32
926# else
927# error "Unsupported sizeof (void *)"
928# endif
929# endif /* !VBOX_HGCM_HOST_CODE */
930#endif /* VBOX_WITH_64_BITS_GUESTS */
931
932typedef struct
933{
934 /* request header */
935 VMMDevHGCMRequestHeader header;
936
937 /** IN: Client identifier. */
938 uint32_t u32ClientID;
939 /** IN: Service function number. */
940 uint32_t u32Function;
941 /** IN: Number of parameters. */
942 uint32_t cParms;
943 /** Parameters follow in form: HGCMFunctionParameter aParms[X]; */
944} VMMDevHGCMCall;
945#pragma pack()
946
947#define VMMDEV_HGCM_CALL_PARMS(a) ((HGCMFunctionParameter *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
948#define VMMDEV_HGCM_CALL_PARMS32(a) ((HGCMFunctionParameter32 *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
949
950#ifdef VBOX_WITH_64_BITS_GUESTS
951/* Explicit defines for the host code. */
952# ifdef VBOX_HGCM_HOST_CODE
953# define VMMDEV_HGCM_CALL_PARMS32(a) ((HGCMFunctionParameter32 *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
954# define VMMDEV_HGCM_CALL_PARMS64(a) ((HGCMFunctionParameter64 *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
955# endif /* VBOX_HGCM_HOST_CODE */
956#endif /* VBOX_WITH_64_BITS_GUESTS */
957
958#define VBOX_HGCM_MAX_PARMS 32
959
960/* The Cancel request is issued using the same physical memory address
961 * as was used for the corresponding initial HGCMCall.
962 */
963typedef struct
964{
965 /* request header */
966 VMMDevHGCMRequestHeader header;
967} VMMDevHGCMCancel;
968
969#endif /* VBOX_WITH_HGCM */
970
971
972#define VBVA_F_STATUS_ACCEPTED (0x01)
973#define VBVA_F_STATUS_ENABLED (0x02)
974
975#pragma pack(4)
976
977typedef struct _VMMDevVideoAccelEnable
978{
979 /* request header */
980 VMMDevRequestHeader header;
981
982 /** 0 - disable, !0 - enable. */
983 uint32_t u32Enable;
984
985 /** The size of VBVAMEMORY::au8RingBuffer expected by driver.
986 * The host will refuse to enable VBVA if the size is not equal to
987 * VBVA_RING_BUFFER_SIZE.
988 */
989 uint32_t cbRingBuffer;
990
991 /** Guest initializes the status to 0. Host sets appropriate VBVA_F_STATUS_ flags. */
992 uint32_t fu32Status;
993
994} VMMDevVideoAccelEnable;
995
996typedef struct _VMMDevVideoAccelFlush
997{
998 /* request header */
999 VMMDevRequestHeader header;
1000
1001} VMMDevVideoAccelFlush;
1002
1003
1004typedef struct _VMMDevVideoSetVisibleRegion
1005{
1006 /* request header */
1007 VMMDevRequestHeader header;
1008
1009 /** Number of rectangles */
1010 uint32_t cRect;
1011
1012 /** Rectangle array */
1013 RTRECT Rect;
1014} VMMDevVideoSetVisibleRegion;
1015
1016
1017/** Seamless mode */
1018typedef enum
1019{
1020 VMMDev_Seamless_Disabled = 0, /* normal mode; entire guest desktop displayed */
1021 VMMDev_Seamless_Visible_Region = 1, /* visible region mode; only top-level guest windows displayed */
1022 VMMDev_Seamless_Host_Window = 2 /* windowed mode; each top-level guest window is represented in a host window */
1023} VMMDevSeamlessMode;
1024
1025typedef struct
1026{
1027 /** header */
1028 VMMDevRequestHeader header;
1029
1030 /** New seamless mode */
1031 VMMDevSeamlessMode mode;
1032 /** Flag that the request is an acknowlegement for the VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST.
1033 * Values: 0 - just querying, VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST - event acknowledged.
1034 */
1035 uint32_t eventAck;
1036} VMMDevSeamlessChangeRequest;
1037
1038#pragma pack()
1039
1040#pragma pack(1)
1041/** VBVA command header. */
1042typedef struct _VBVACMDHDR
1043{
1044 /** Coordinates of affected rectangle. */
1045 int16_t x;
1046 int16_t y;
1047 uint16_t w;
1048 uint16_t h;
1049} VBVACMDHDR;
1050#pragma pack()
1051
1052/* The VBVA ring buffer is suitable for transferring large (< 2gb) amount of data.
1053 * For example big bitmaps which do not fit to the buffer.
1054 *
1055 * Guest starts writing to the buffer by initializing a record entry in the
1056 * aRecords queue. VBVA_F_RECORD_PARTIAL indicates that the record is being
1057 * written. As data is written to the ring buffer, the guest increases off32End
1058 * for the record.
1059 *
1060 * The host reads the aRecords on flushes and processes all completed records.
1061 * When host encounters situation when only a partial record presents and
1062 * cbRecord & ~VBVA_F_RECORD_PARTIAL >= VBVA_RING_BUFFER_SIZE - VBVA_RING_BUFFER_THRESHOLD,
1063 * the host fetched all record data and updates off32Head. After that on each flush
1064 * the host continues fetching the data until the record is completed.
1065 *
1066 */
1067
1068#define VBVA_RING_BUFFER_SIZE (_4M - _1K)
1069#define VBVA_RING_BUFFER_THRESHOLD (4 * _1K)
1070
1071#define VBVA_MAX_RECORDS (64)
1072
1073#define VBVA_F_MODE_ENABLED (0x00000001)
1074#define VBVA_F_MODE_VRDP (0x00000002)
1075#define VBVA_F_MODE_VRDP_RESET (0x00000004)
1076#define VBVA_F_MODE_VRDP_ORDER_MASK (0x00000008)
1077
1078#define VBVA_F_RECORD_PARTIAL (0x80000000)
1079
1080#pragma pack(1)
1081typedef struct _VBVARECORD
1082{
1083 /** The length of the record. Changed by guest. */
1084 uint32_t cbRecord;
1085} VBVARECORD;
1086
1087typedef struct _VBVAMEMORY
1088{
1089 /** VBVA_F_MODE_* */
1090 uint32_t fu32ModeFlags;
1091
1092 /** The offset where the data start in the buffer. */
1093 uint32_t off32Data;
1094 /** The offset where next data must be placed in the buffer. */
1095 uint32_t off32Free;
1096
1097 /** The ring buffer for data. */
1098 uint8_t au8RingBuffer[VBVA_RING_BUFFER_SIZE];
1099
1100 /** The queue of record descriptions. */
1101 VBVARECORD aRecords[VBVA_MAX_RECORDS];
1102 uint32_t indexRecordFirst;
1103 uint32_t indexRecordFree;
1104
1105 /* RDP orders supported by the client. The guest reports only them
1106 * and falls back to DIRTY rects for not supported ones.
1107 *
1108 * (1 << VBVA_VRDP_*)
1109 */
1110 uint32_t fu32SupportedOrders;
1111
1112} VBVAMEMORY;
1113#pragma pack()
1114
1115/** @} */
1116
1117
1118/**
1119 * VMMDev RAM
1120 * @{
1121 */
1122
1123#pragma pack(1)
1124/** Layout of VMMDEV RAM region that contains information for guest */
1125typedef struct
1126{
1127 /** size */
1128 uint32_t u32Size;
1129 /** version */
1130 uint32_t u32Version;
1131
1132 union {
1133 /** Flag telling that VMMDev set the IRQ and acknowlegment is required */
1134 struct {
1135 bool fHaveEvents;
1136 } V1_04;
1137
1138 struct {
1139 /** Pending events flags, set by host. */
1140 uint32_t u32HostEvents;
1141 /** Mask of events the guest wants to see, set by guest. */
1142 uint32_t u32GuestEventMask;
1143 } V1_03;
1144 } V;
1145
1146 VBVAMEMORY vbvaMemory;
1147
1148} VMMDevMemory;
1149#pragma pack()
1150
1151/** Version of VMMDevMemory structure. */
1152#define VMMDEV_MEMORY_VERSION (1)
1153
1154/** @} */
1155
1156
1157/**
1158 * VMMDev events.
1159 * @{
1160 */
1161
1162/** Host mouse capabilities has been changed. */
1163#define VMMDEV_EVENT_MOUSE_CAPABILITIES_CHANGED RT_BIT(0)
1164/** HGCM event. */
1165#define VMMDEV_EVENT_HGCM RT_BIT(1)
1166/** A display change request has been issued. */
1167#define VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST RT_BIT(2)
1168/** Credentials are available for judgement. */
1169#define VMMDEV_EVENT_JUDGE_CREDENTIALS RT_BIT(3)
1170/** The guest has been restored. */
1171#define VMMDEV_EVENT_RESTORED RT_BIT(4)
1172/** Seamless mode state changed */
1173#define VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST RT_BIT(5)
1174/** Memory balloon size changed */
1175#define VMMDEV_EVENT_BALLOON_CHANGE_REQUEST RT_BIT(6)
1176/** Statistics interval changed */
1177#define VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST RT_BIT(7)
1178/** VRDP status changed. */
1179#define VMMDEV_EVENT_VRDP RT_BIT(8)
1180/** New mouse position data available */
1181#define VMMDEV_EVENT_MOUSE_POSITION_CHANGED RT_BIT(9)
1182
1183/** @} */
1184
1185
1186/*
1187 * Credentials request flags and structure
1188 */
1189
1190#define VMMDEV_CREDENTIALS_STRLEN 128
1191
1192/** query from host whether credentials are present */
1193#define VMMDEV_CREDENTIALS_QUERYPRESENCE RT_BIT(1)
1194/** read credentials from host (can be combined with clear) */
1195#define VMMDEV_CREDENTIALS_READ RT_BIT(2)
1196/** clear credentials on host (can be combined with read) */
1197#define VMMDEV_CREDENTIALS_CLEAR RT_BIT(3)
1198/** read credentials for judgement in the guest */
1199#define VMMDEV_CREDENTIALS_READJUDGE RT_BIT(8)
1200/** clear credentials for judegement on the host */
1201#define VMMDEV_CREDENTIALS_CLEARJUDGE RT_BIT(9)
1202/** report credentials acceptance by guest */
1203#define VMMDEV_CREDENTIALS_JUDGE_OK RT_BIT(10)
1204/** report credentials denial by guest */
1205#define VMMDEV_CREDENTIALS_JUDGE_DENY RT_BIT(11)
1206/** report that no judgement could be made by guest */
1207#define VMMDEV_CREDENTIALS_JUDGE_NOJUDGEMENT RT_BIT(12)
1208
1209/** flag telling the guest that credentials are present */
1210#define VMMDEV_CREDENTIALS_PRESENT RT_BIT(16)
1211/** flag telling guest that local logons should be prohibited */
1212#define VMMDEV_CREDENTIALS_NOLOCALLOGON RT_BIT(17)
1213
1214/** credentials request structure */
1215#pragma pack(4)
1216typedef struct _VMMDevCredentials
1217{
1218 /* request header */
1219 VMMDevRequestHeader header;
1220 /* request flags (in/out) */
1221 uint32_t u32Flags;
1222 /* user name (UTF-8) (out) */
1223 char szUserName[VMMDEV_CREDENTIALS_STRLEN];
1224 /* password (UTF-8) (out) */
1225 char szPassword[VMMDEV_CREDENTIALS_STRLEN];
1226 /* domain name (UTF-8) (out) */
1227 char szDomain[VMMDEV_CREDENTIALS_STRLEN];
1228} VMMDevCredentials;
1229#pragma pack()
1230
1231
1232/**
1233 * Inline helper to determine the request size for the given operation.
1234 *
1235 * @returns Size.
1236 * @param requestType The VMMDev request type.
1237 */
1238DECLINLINE(size_t) vmmdevGetRequestSize(VMMDevRequestType requestType)
1239{
1240 switch (requestType)
1241 {
1242 case VMMDevReq_GetMouseStatus:
1243 case VMMDevReq_SetMouseStatus:
1244 return sizeof(VMMDevReqMouseStatus);
1245 case VMMDevReq_SetPointerShape:
1246 return sizeof(VMMDevReqMousePointer);
1247 case VMMDevReq_GetHostVersion:
1248 return sizeof(VMMDevReqHostVersion);
1249 case VMMDevReq_Idle:
1250 return sizeof(VMMDevReqIdle);
1251 case VMMDevReq_GetHostTime:
1252 return sizeof(VMMDevReqHostTime);
1253 case VMMDevReq_GetHypervisorInfo:
1254 case VMMDevReq_SetHypervisorInfo:
1255 return sizeof(VMMDevReqHypervisorInfo);
1256 case VMMDevReq_SetPowerStatus:
1257 return sizeof(VMMDevPowerStateRequest);
1258 case VMMDevReq_AcknowledgeEvents:
1259 return sizeof(VMMDevEvents);
1260 case VMMDevReq_ReportGuestInfo:
1261 return sizeof(VMMDevReportGuestInfo);
1262 case VMMDevReq_GetDisplayChangeRequest:
1263 return sizeof(VMMDevDisplayChangeRequest);
1264 case VMMDevReq_GetDisplayChangeRequest2:
1265 return sizeof(VMMDevDisplayChangeRequest2);
1266 case VMMDevReq_VideoModeSupported:
1267 return sizeof(VMMDevVideoModeSupportedRequest);
1268 case VMMDevReq_GetHeightReduction:
1269 return sizeof(VMMDevGetHeightReductionRequest);
1270 case VMMDevReq_ReportGuestCapabilities:
1271 return sizeof(VMMDevReqGuestCapabilities);
1272 case VMMDevReq_SetGuestCapabilities:
1273 return sizeof(VMMDevReqGuestCapabilities2);
1274#ifdef VBOX_WITH_HGCM
1275 case VMMDevReq_HGCMConnect:
1276 return sizeof(VMMDevHGCMConnect);
1277 case VMMDevReq_HGCMDisconnect:
1278 return sizeof(VMMDevHGCMDisconnect);
1279#ifdef VBOX_WITH_64_BITS_GUESTS
1280 case VMMDevReq_HGCMCall32:
1281 return sizeof(VMMDevHGCMCall);
1282 case VMMDevReq_HGCMCall64:
1283 return sizeof(VMMDevHGCMCall);
1284#else
1285 case VMMDevReq_HGCMCall:
1286 return sizeof(VMMDevHGCMCall);
1287#endif /* VBOX_WITH_64_BITS_GUESTS */
1288 case VMMDevReq_HGCMCancel:
1289 return sizeof(VMMDevHGCMCancel);
1290#endif /* VBOX_WITH_HGCM */
1291 case VMMDevReq_VideoAccelEnable:
1292 return sizeof(VMMDevVideoAccelEnable);
1293 case VMMDevReq_VideoAccelFlush:
1294 return sizeof(VMMDevVideoAccelFlush);
1295 case VMMDevReq_VideoSetVisibleRegion:
1296 return sizeof(VMMDevVideoSetVisibleRegion);
1297 case VMMDevReq_GetSeamlessChangeRequest:
1298 return sizeof(VMMDevSeamlessChangeRequest);
1299 case VMMDevReq_QueryCredentials:
1300 return sizeof(VMMDevCredentials);
1301 case VMMDevReq_ReportGuestStats:
1302 return sizeof(VMMDevReportGuestStats);
1303 case VMMDevReq_GetMemBalloonChangeRequest:
1304 return sizeof(VMMDevGetMemBalloonChangeRequest);
1305 case VMMDevReq_GetStatisticsChangeRequest:
1306 return sizeof(VMMDevGetStatisticsChangeRequest);
1307 case VMMDevReq_ChangeMemBalloon:
1308 return sizeof(VMMDevChangeMemBalloon);
1309 case VMMDevReq_GetVRDPChangeRequest:
1310 return sizeof(VMMDevVRDPChangeRequest);
1311 case VMMDevReq_LogString:
1312 return sizeof(VMMDevReqLogString);
1313 default:
1314 return 0;
1315 }
1316}
1317
1318
1319/**
1320 * Initializes a request structure.
1321 *
1322 * @returns VBox status code.
1323 * @param req The request structure to initialize.
1324 * @param type The request type.
1325 */
1326DECLINLINE(int) vmmdevInitRequest(VMMDevRequestHeader *req, VMMDevRequestType type)
1327{
1328 uint32_t requestSize;
1329 if (!req)
1330 return VERR_INVALID_PARAMETER;
1331 requestSize = (uint32_t)vmmdevGetRequestSize(type);
1332 if (!requestSize)
1333 return VERR_INVALID_PARAMETER;
1334 req->size = requestSize;
1335 req->version = VMMDEV_REQUEST_HEADER_VERSION;
1336 req->requestType = type;
1337 req->rc = VERR_GENERAL_FAILURE;
1338 req->reserved1 = 0;
1339 req->reserved2 = 0;
1340 return VINF_SUCCESS;
1341}
1342
1343/** @} */
1344RT_C_DECLS_END
1345
1346#endif
1347
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette