VirtualBox

source: vbox/trunk/src/VBox/Devices/VMMDev/VMMDevState.h@ 51599

Last change on this file since 51599 was 51520, checked in by vboxsync, 11 years ago

VBox/Devices: Comment nits.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 11.7 KB
Line 
1/* $Id: VMMDevState.h 51520 2014-06-04 05:17:41Z vboxsync $ */
2/** @file
3 * VMMDev - Guest <-> VMM/Host communication device, internal header.
4 */
5
6/*
7 * Copyright (C) 2006-2014 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ___VMMDev_VMMDevState_h
19#define ___VMMDev_VMMDevState_h
20
21#include <VBox/VMMDev.h>
22#include <VBox/vmm/pdmdev.h>
23#include <VBox/vmm/pdmifs.h>
24#ifndef VBOX_WITHOUT_TESTING_FEATURES
25# include <iprt/test.h>
26#endif
27
28#define VMMDEV_WITH_ALT_TIMESYNC
29
30typedef struct DISPLAYCHANGEINFO
31{
32 uint32_t xres;
33 uint32_t yres;
34 uint32_t bpp;
35 uint32_t display;
36 int32_t xOrigin;
37 int32_t yOrigin;
38 bool fEnabled;
39 bool fChangeOrigin;
40} DISPLAYCHANGEINFO;
41
42typedef struct DISPLAYCHANGEREQUEST
43{
44 bool fPending;
45 bool afAlignment[3];
46 DISPLAYCHANGEINFO displayChangeRequest;
47 DISPLAYCHANGEINFO lastReadDisplayChangeRequest;
48} DISPLAYCHANGEREQUEST;
49
50typedef struct DISPLAYCHANGEDATA
51{
52 /* Which monitor is being reported to the guest. */
53 int iCurrentMonitor;
54
55 /** true if the guest responded to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST at least once */
56 bool fGuestSentChangeEventAck;
57 bool afAlignment[3];
58
59 DISPLAYCHANGEREQUEST aRequests[64]; /// @todo maxMonitors
60} DISPLAYCHANGEDATA;
61
62
63/**
64 * Credentials for automatic guest logon and host configured logon (?).
65 *
66 * This is not stored in the same block as the instance data in order to make it
67 * harder to access.
68 */
69typedef struct VMMDEVCREDS
70{
71 /** credentials for guest logon purposes */
72 struct
73 {
74 char szUserName[VMMDEV_CREDENTIALS_SZ_SIZE];
75 char szPassword[VMMDEV_CREDENTIALS_SZ_SIZE];
76 char szDomain[VMMDEV_CREDENTIALS_SZ_SIZE];
77 bool fAllowInteractiveLogon;
78 } Logon;
79
80 /** credentials for verification by guest */
81 struct
82 {
83 char szUserName[VMMDEV_CREDENTIALS_SZ_SIZE];
84 char szPassword[VMMDEV_CREDENTIALS_SZ_SIZE];
85 char szDomain[VMMDEV_CREDENTIALS_SZ_SIZE];
86 } Judge;
87} VMMDEVCREDS;
88
89
90/**
91 * Facility status entry.
92 */
93typedef struct VMMDEVFACILITYSTATUSENTRY
94{
95 /** The facility, see VBoxGuestFacilityType. */
96 uint32_t uFacility;
97 /** The status, see VBoxGuestFacilityStatus. */
98 /** @todo r=andy uint16_t vs. uint32_t (VBoxGuestFacilityStatus enum). */
99 uint16_t uStatus;
100 /** Whether this entry is fixed and cannot be reused when inactive. */
101 bool fFixed;
102 /** Explicit alignment padding / reserved for future use. MBZ. */
103 bool fPadding;
104 /** The facility flags (yet to be defined). */
105 uint32_t fFlags;
106 /** Explicit alignment padding / reserved for future use. MBZ. */
107 uint32_t uPadding;
108 /** Last update timestamp. */
109 RTTIMESPEC TimeSpecTS;
110} VMMDEVFACILITYSTATUSENTRY;
111/** Pointer to a facility status entry. */
112typedef VMMDEVFACILITYSTATUSENTRY *PVMMDEVFACILITYSTATUSENTRY;
113
114
115/** device structure containing all state information */
116typedef struct VMMDevState
117{
118 /** The PCI device structure. */
119 PCIDevice PciDev;
120 /** The critical section for this device.
121 * @remarks We use this rather than the default one, it's simpler with all
122 * the driver interfaces where we have to waste time digging out the
123 * PDMDEVINS structure. */
124 PDMCRITSECT CritSect;
125
126 /** hypervisor address space size */
127 uint32_t hypervisorSize;
128
129 /** mouse capabilities of host and guest */
130 uint32_t mouseCapabilities;
131 /** absolute mouse position in pixels */
132 int32_t mouseXAbs;
133 int32_t mouseYAbs;
134 /** Does the guest currently want the host pointer to be shown? */
135 uint32_t fHostCursorRequested;
136
137 /** Alignment padding. */
138 uint32_t u32Alignment0;
139
140 /** Pointer to device instance. */
141 PPDMDEVINSR3 pDevIns;
142 /** LUN\#0 + Status: VMMDev port base interface. */
143 PDMIBASE IBase;
144 /** LUN\#0: VMMDev port interface. */
145 PDMIVMMDEVPORT IPort;
146#ifdef VBOX_WITH_HGCM
147 /** LUN\#0: HGCM port interface. */
148 PDMIHGCMPORT IHGCMPort;
149#endif
150 /** Pointer to base interface of the driver. */
151 R3PTRTYPE(PPDMIBASE) pDrvBase;
152 /** VMMDev connector interface */
153 R3PTRTYPE(PPDMIVMMDEVCONNECTOR) pDrv;
154#ifdef VBOX_WITH_HGCM
155 /** HGCM connector interface */
156 R3PTRTYPE(PPDMIHGCMCONNECTOR) pHGCMDrv;
157#endif
158 /** Alignment padding. */
159 RTR3PTR PtrR3Alignment1;
160 /** message buffer for backdoor logging. */
161 char szMsg[512];
162 /** message buffer index. */
163 uint32_t iMsg;
164 /** Alignment padding. */
165 uint32_t u32Alignment2;
166
167 /** IRQ number assigned to the device */
168 uint32_t irq;
169 /** Current host side event flags */
170 uint32_t u32HostEventFlags;
171 /** Mask of events guest is interested in.
172 * @note The HGCM events are enabled automatically by the VMMDev device when
173 * guest issues HGCM commands. */
174 uint32_t u32GuestFilterMask;
175 /** Delayed mask of guest events */
176 uint32_t u32NewGuestFilterMask;
177 /** Flag whether u32NewGuestFilterMask is valid */
178 bool fNewGuestFilterMask;
179 /** Alignment padding. */
180 bool afAlignment3[3];
181
182 /** GC physical address of VMMDev RAM area */
183 RTGCPHYS32 GCPhysVMMDevRAM;
184 /** R3 pointer to VMMDev RAM area */
185 R3PTRTYPE(VMMDevMemory *) pVMMDevRAMR3;
186
187 /** R3 pointer to VMMDev Heap RAM area
188 */
189 R3PTRTYPE(VMMDevMemory *) pVMMDevHeapR3;
190 /** GC physical address of VMMDev Heap RAM area */
191 RTGCPHYS32 GCPhysVMMDevHeap;
192
193 /** Information reported by guest via VMMDevReportGuestInfo generic request.
194 * Until this information is reported the VMMDev refuses any other requests.
195 */
196 VBoxGuestInfo guestInfo;
197 /** Information report \#2, chewed a litte. */
198 struct
199 {
200 uint32_t uFullVersion; /**< non-zero if info is present. */
201 uint32_t uRevision;
202 uint32_t fFeatures;
203 char szName[128];
204 } guestInfo2;
205
206 /** Array of guest facility statuses. */
207 VMMDEVFACILITYSTATUSENTRY aFacilityStatuses[32];
208 /** The number of valid entries in the facility status array. */
209 uint32_t cFacilityStatuses;
210
211 /** Information reported by guest via VMMDevReportGuestCapabilities. */
212 uint32_t guestCaps;
213
214 /** "Additions are Ok" indicator, set to true after processing VMMDevReportGuestInfo,
215 * if additions version is compatible. This flag is here to avoid repeated comparing
216 * of the version in guestInfo.
217 */
218 uint32_t fu32AdditionsOk;
219
220 /** Video acceleration status set by guest. */
221 uint32_t u32VideoAccelEnabled;
222
223 DISPLAYCHANGEDATA displayChangeData;
224
225 /** Pointer to the credentials. */
226 R3PTRTYPE(VMMDEVCREDS *) pCredentials;
227
228 bool afAlignment4[HC_ARCH_BITS == 32 ? 3 : 7];
229
230 /* memory balloon change request */
231 uint32_t cMbMemoryBalloon;
232 /** The last balloon size queried by the guest additions. */
233 uint32_t cMbMemoryBalloonLast;
234
235 /* guest ram size */
236 uint64_t cbGuestRAM;
237
238 /* unique session id; the id will be different after each start, reset or restore of the VM. */
239 uint64_t idSession;
240
241 /* statistics interval change request */
242 uint32_t u32StatIntervalSize, u32LastStatIntervalSize;
243
244 /* seamless mode change request */
245 bool fLastSeamlessEnabled, fSeamlessEnabled;
246 bool afAlignment5[1];
247
248 bool fVRDPEnabled;
249 uint32_t uVRDPExperienceLevel;
250
251#ifdef VMMDEV_WITH_ALT_TIMESYNC
252 uint64_t hostTime;
253 bool fTimesyncBackdoorLo;
254 bool afAlignment6[3];
255#endif
256 /** Set if GetHostTime should fail.
257 * Loaded from the GetHostTimeDisabled configuration value. */
258 bool fGetHostTimeDisabled;
259
260 /** Set if backdoor logging should be disabled (output will be ignored then) */
261 bool fBackdoorLogDisabled;
262
263 /** Don't clear credentials */
264 bool fKeepCredentials;
265
266 /** Heap enabled. */
267 bool fHeapEnabled;
268
269 /** Guest Core Dumping enabled. */
270 bool fGuestCoreDumpEnabled;
271
272 /** Guest Core Dump location. */
273 char szGuestCoreDumpDir[RTPATH_MAX];
274
275 /** Number of additional cores to keep around. */
276 uint32_t cGuestCoreDumps;
277
278 bool afAlignment7[1];
279
280#ifdef VBOX_WITH_HGCM
281 /** List of pending HGCM requests, used for saving the HGCM state. */
282 R3PTRTYPE(PVBOXHGCMCMD) pHGCMCmdList;
283 /** Critical section to protect the list. */
284 RTCRITSECT critsectHGCMCmdList;
285 /** Whether the HGCM events are already automatically enabled. */
286 uint32_t u32HGCMEnabled;
287 /** Alignment padding. */
288 uint32_t u32Alignment7;
289#endif /* VBOX_WITH_HGCM */
290
291 /** Status LUN: Shared folders LED */
292 struct
293 {
294 /** The LED. */
295 PDMLED Led;
296 /** The LED ports. */
297 PDMILEDPORTS ILeds;
298 /** Partner of ILeds. */
299 R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector;
300 } SharedFolders;
301
302 /** FLag whether CPU hotplug events are monitored */
303 bool fCpuHotPlugEventsEnabled;
304 /** Alignment padding. */
305 bool afPadding8[3];
306 /** CPU hotplug event */
307 VMMDevCpuEventType enmCpuHotPlugEvent;
308 /** Core id of the CPU to change */
309 uint32_t idCpuCore;
310 /** Package id of the CPU to change */
311 uint32_t idCpuPackage;
312
313 uint32_t StatMemBalloonChunks;
314
315 /** Set if RC/R0 is enabled. */
316 bool fRZEnabled;
317 /** Set if testing is enabled. */
318 bool fTestingEnabled;
319 /** Set if testing the MMIO testing range is enabled. */
320 bool fTestingMMIO;
321 /** Alignment padding. */
322 bool afPadding9[HC_ARCH_BITS == 32 ? 1 : 5];
323#ifndef VBOX_WITHOUT_TESTING_FEATURES
324 /** The high timestamp value. */
325 uint32_t u32TestingHighTimestamp;
326 /** The current testing command (VMMDEV_TESTING_CMD_XXX). */
327 uint32_t u32TestingCmd;
328 /** The testing data offset (command specific). */
329 uint32_t offTestingData;
330 /** For buffering the what comes in over the testing data port. */
331 union
332 {
333 char padding[1024];
334
335 /** VMMDEV_TESTING_CMD_INIT, VMMDEV_TESTING_CMD_SUB_NEW,
336 * VMMDEV_TESTING_CMD_FAILED. */
337 struct
338 {
339 char sz[1024];
340 } String, Init, SubNew, Failed;
341
342 /** VMMDEV_TESTING_CMD_TERM, VMMDEV_TESTING_CMD_SUB_DONE. */
343 struct
344 {
345 uint32_t c;
346 } Error, Term, SubDone;
347
348 /** VMMDEV_TESTING_CMD_VALUE. */
349 struct
350 {
351 RTUINT64U u64Value;
352 uint32_t u32Unit;
353 char szName[1024 - 8 - 4];
354 } Value;
355 } TestingData;
356 /** The XML output file name (can be a named pipe, doesn't matter to us). */
357 R3PTRTYPE(char *) pszTestingXmlOutput;
358 /** Testing instance for dealing with the output. */
359 RTTEST hTestingTest;
360#endif /* !VBOX_WITHOUT_TESTING_FEATURES */
361} VMMDevState;
362typedef VMMDevState VMMDEV;
363/** Pointer to the VMM device state. */
364typedef VMMDEV *PVMMDEV;
365AssertCompileMemberAlignment(VMMDEV, CritSect, 8);
366AssertCompileMemberAlignment(VMMDEV, cbGuestRAM, 8);
367AssertCompileMemberAlignment(VMMDEV, enmCpuHotPlugEvent, 4);
368AssertCompileMemberAlignment(VMMDEV, aFacilityStatuses, 8);
369#ifndef VBOX_WITHOUT_TESTING_FEATURES
370AssertCompileMemberAlignment(VMMDEV, TestingData.Value.u64Value, 8);
371#endif
372
373
374void VMMDevNotifyGuest(VMMDEV *pVMMDevState, uint32_t u32EventMask);
375void VMMDevCtlSetGuestFilterMask(VMMDEV *pVMMDevState, uint32_t u32OrMask, uint32_t u32NotMask);
376
377#endif /* !___VMMDev_VMMDevState_h */
378
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