VirtualBox

source: vbox/trunk/include/VBox/vmm/pdmifs.h@ 97342

Last change on this file since 97342 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 99.8 KB
Line 
1/** @file
2 * PDM - Pluggable Device Manager, Interfaces.
3 */
4
5/*
6 * Copyright (C) 2006-2022 Oracle and/or its affiliates.
7 *
8 * This file is part of VirtualBox base platform packages, as
9 * available from https://www.virtualbox.org.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation, in version 3 of the
14 * License.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, see <https://www.gnu.org/licenses>.
23 *
24 * The contents of this file may alternatively be used under the terms
25 * of the Common Development and Distribution License Version 1.0
26 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
27 * in the VirtualBox distribution, in which case the provisions of the
28 * CDDL are applicable instead of those of the GPL.
29 *
30 * You may elect to license modified versions of this file under the
31 * terms and conditions of either the GPL or the CDDL or both.
32 *
33 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
34 */
35
36#ifndef VBOX_INCLUDED_vmm_pdmifs_h
37#define VBOX_INCLUDED_vmm_pdmifs_h
38#ifndef RT_WITHOUT_PRAGMA_ONCE
39# pragma once
40#endif
41
42#include <iprt/sg.h>
43#include <VBox/types.h>
44
45
46RT_C_DECLS_BEGIN
47
48/** @defgroup grp_pdm_interfaces The PDM Interface Definitions
49 * @ingroup grp_pdm
50 *
51 * For historical reasons (the PDMINTERFACE enum) a lot of interface was stuffed
52 * together in this group instead, dragging stuff into global space that didn't
53 * need to be there and making this file huge (>2500 lines). Since we're using
54 * UUIDs as interface identifiers (IIDs) now, no only generic PDM interface will
55 * be added to this file. Component specific interface should be defined in the
56 * header file of that component.
57 *
58 * Interfaces consists of a method table (typedef'ed struct) and an interface
59 * ID. The typename of the method table should have an 'I' in it, be all
60 * capitals and according to the rules, no underscores. The interface ID is a
61 * \#define constructed by appending '_IID' to the typename. The IID value is a
62 * UUID string on the form "a2299c0d-b709-4551-aa5a-73f59ffbed74". If you stick
63 * to these rules, you can make use of the PDMIBASE_QUERY_INTERFACE and
64 * PDMIBASE_RETURN_INTERFACE when querying interface and implementing
65 * PDMIBASE::pfnQueryInterface respectively.
66 *
67 * In most interface descriptions the orientation of the interface is given as
68 * 'down' or 'up'. This refers to a model with the device on the top and the
69 * drivers stacked below it. Sometimes there is mention of 'main' or 'external'
70 * which normally means the same, i.e. the Main or VBoxBFE API. Picture the
71 * orientation of 'main' as horizontal.
72 *
73 * @{
74 */
75
76
77/** @name PDMIBASE
78 * @{
79 */
80
81/**
82 * PDM Base Interface.
83 *
84 * Everyone implements this.
85 */
86typedef struct PDMIBASE
87{
88 /**
89 * Queries an interface to the driver.
90 *
91 * @returns Pointer to interface.
92 * @returns NULL if the interface was not supported by the driver.
93 * @param pInterface Pointer to this interface structure.
94 * @param pszIID The interface ID, a UUID string.
95 * @thread Any thread.
96 */
97 DECLR3CALLBACKMEMBER(void *, pfnQueryInterface,(struct PDMIBASE *pInterface, const char *pszIID));
98} PDMIBASE;
99/** PDMIBASE interface ID. */
100#define PDMIBASE_IID "a2299c0d-b709-4551-aa5a-73f59ffbed74"
101
102/**
103 * Helper macro for querying an interface from PDMIBASE.
104 *
105 * @returns Correctly typed PDMIBASE::pfnQueryInterface return value.
106 *
107 * @param pIBase Pointer to the base interface.
108 * @param InterfaceType The interface type name. The interface ID is
109 * derived from this by appending _IID.
110 */
111#define PDMIBASE_QUERY_INTERFACE(pIBase, InterfaceType) \
112 ( (InterfaceType *)(pIBase)->pfnQueryInterface(pIBase, InterfaceType##_IID ) )
113
114/**
115 * Helper macro for implementing PDMIBASE::pfnQueryInterface.
116 *
117 * Return @a pInterface if @a pszIID matches the @a InterfaceType. This will
118 * perform basic type checking.
119 *
120 * @param pszIID The ID of the interface that is being queried.
121 * @param InterfaceType The interface type name. The interface ID is
122 * derived from this by appending _IID.
123 * @param pInterface The interface address expression.
124 */
125#define PDMIBASE_RETURN_INTERFACE(pszIID, InterfaceType, pInterface) \
126 do { \
127 if (RTUuidCompare2Strs((pszIID), InterfaceType##_IID) == 0) \
128 { \
129 P##InterfaceType pReturnInterfaceTypeCheck = (pInterface); \
130 return pReturnInterfaceTypeCheck; \
131 } \
132 } while (0)
133
134/** @} */
135
136
137/** @name PDMIBASERC
138 * @{
139 */
140
141/**
142 * PDM Base Interface for querying ring-mode context interfaces in
143 * ring-3.
144 *
145 * This is mandatory for drivers present in raw-mode context.
146 */
147typedef struct PDMIBASERC
148{
149 /**
150 * Queries an ring-mode context interface to the driver.
151 *
152 * @returns Pointer to interface.
153 * @returns NULL if the interface was not supported by the driver.
154 * @param pInterface Pointer to this interface structure.
155 * @param pszIID The interface ID, a UUID string.
156 * @thread Any thread.
157 */
158 DECLR3CALLBACKMEMBER(RTRCPTR, pfnQueryInterface,(struct PDMIBASERC *pInterface, const char *pszIID));
159} PDMIBASERC;
160/** Pointer to a PDM Base Interface for query ring-mode context interfaces. */
161typedef PDMIBASERC *PPDMIBASERC;
162/** PDMIBASERC interface ID. */
163#define PDMIBASERC_IID "f6a6c649-6cb3-493f-9737-4653f221aeca"
164
165/**
166 * Helper macro for querying an interface from PDMIBASERC.
167 *
168 * @returns PDMIBASERC::pfnQueryInterface return value.
169 *
170 * @param pIBaseRC Pointer to the base raw-mode context interface. Can
171 * be NULL.
172 * @param InterfaceType The interface type base name, no trailing RC. The
173 * interface ID is derived from this by appending _IID.
174 *
175 * @remarks Unlike PDMIBASE_QUERY_INTERFACE, this macro is not able to do any
176 * implicit type checking for you.
177 */
178#define PDMIBASERC_QUERY_INTERFACE(pIBaseRC, InterfaceType) \
179 ( (P##InterfaceType##RC)((pIBaseRC) ? (pIBaseRC)->pfnQueryInterface(pIBaseRC, InterfaceType##_IID) : NIL_RTRCPTR) )
180
181/**
182 * Helper macro for implementing PDMIBASERC::pfnQueryInterface.
183 *
184 * Return @a pInterface if @a pszIID matches the @a InterfaceType. This will
185 * perform basic type checking.
186 *
187 * @param pIns Pointer to the instance data.
188 * @param pszIID The ID of the interface that is being queried.
189 * @param InterfaceType The interface type base name, no trailing RC. The
190 * interface ID is derived from this by appending _IID.
191 * @param pInterface The interface address expression. This must resolve
192 * to some address within the instance data.
193 * @remarks Don't use with PDMIBASE.
194 */
195#define PDMIBASERC_RETURN_INTERFACE(pIns, pszIID, InterfaceType, pInterface) \
196 do { \
197 Assert((uintptr_t)pInterface - PDMINS_2_DATA(pIns, uintptr_t) < _4M); \
198 if (RTUuidCompare2Strs((pszIID), InterfaceType##_IID) == 0) \
199 { \
200 InterfaceType##RC *pReturnInterfaceTypeCheck = (pInterface); \
201 return (uintptr_t)pReturnInterfaceTypeCheck \
202 - PDMINS_2_DATA(pIns, uintptr_t) \
203 + PDMINS_2_DATA_RCPTR(pIns); \
204 } \
205 } while (0)
206
207/** @} */
208
209
210/** @name PDMIBASER0
211 * @{
212 */
213
214/**
215 * PDM Base Interface for querying ring-0 interfaces in ring-3.
216 *
217 * This is mandatory for drivers present in ring-0 context.
218 */
219typedef struct PDMIBASER0
220{
221 /**
222 * Queries an ring-0 interface to the driver.
223 *
224 * @returns Pointer to interface.
225 * @returns NULL if the interface was not supported by the driver.
226 * @param pInterface Pointer to this interface structure.
227 * @param pszIID The interface ID, a UUID string.
228 * @thread Any thread.
229 */
230 DECLR3CALLBACKMEMBER(RTR0PTR, pfnQueryInterface,(struct PDMIBASER0 *pInterface, const char *pszIID));
231} PDMIBASER0;
232/** Pointer to a PDM Base Interface for query ring-0 context interfaces. */
233typedef PDMIBASER0 *PPDMIBASER0;
234/** PDMIBASER0 interface ID. */
235#define PDMIBASER0_IID "9c9b99b8-7f53-4f59-a3c2-5bc9659c7944"
236
237/**
238 * Helper macro for querying an interface from PDMIBASER0.
239 *
240 * @returns PDMIBASER0::pfnQueryInterface return value.
241 *
242 * @param pIBaseR0 Pointer to the base ring-0 interface. Can be NULL.
243 * @param InterfaceType The interface type base name, no trailing R0. The
244 * interface ID is derived from this by appending _IID.
245 *
246 * @remarks Unlike PDMIBASE_QUERY_INTERFACE, this macro is not able to do any
247 * implicit type checking for you.
248 */
249#define PDMIBASER0_QUERY_INTERFACE(pIBaseR0, InterfaceType) \
250 ( (P##InterfaceType##R0)((pIBaseR0) ? (pIBaseR0)->pfnQueryInterface(pIBaseR0, InterfaceType##_IID) : NIL_RTR0PTR) )
251
252/**
253 * Helper macro for implementing PDMIBASER0::pfnQueryInterface.
254 *
255 * Return @a pInterface if @a pszIID matches the @a InterfaceType. This will
256 * perform basic type checking.
257 *
258 * @param pIns Pointer to the instance data.
259 * @param pszIID The ID of the interface that is being queried.
260 * @param InterfaceType The interface type base name, no trailing R0. The
261 * interface ID is derived from this by appending _IID.
262 * @param pInterface The interface address expression. This must resolve
263 * to some address within the instance data.
264 * @remarks Don't use with PDMIBASE.
265 */
266#define PDMIBASER0_RETURN_INTERFACE(pIns, pszIID, InterfaceType, pInterface) \
267 do { \
268 Assert((uintptr_t)pInterface - PDMINS_2_DATA(pIns, uintptr_t) < _4M); \
269 if (RTUuidCompare2Strs((pszIID), InterfaceType##_IID) == 0) \
270 { \
271 InterfaceType##R0 *pReturnInterfaceTypeCheck = (pInterface); \
272 return (uintptr_t)pReturnInterfaceTypeCheck \
273 - PDMINS_2_DATA(pIns, uintptr_t) \
274 + PDMINS_2_DATA_R0PTR(pIns); \
275 } \
276 } while (0)
277
278/** @} */
279
280
281/**
282 * Dummy interface.
283 *
284 * This is used to typedef other dummy interfaces. The purpose of a dummy
285 * interface is to validate the logical function of a driver/device and
286 * full a natural interface pair.
287 */
288typedef struct PDMIDUMMY
289{
290 RTHCPTR pvDummy;
291} PDMIDUMMY;
292
293
294/** Pointer to a mouse port interface. */
295typedef struct PDMIMOUSEPORT *PPDMIMOUSEPORT;
296/**
297 * Mouse port interface (down).
298 * Pair with PDMIMOUSECONNECTOR.
299 */
300typedef struct PDMIMOUSEPORT
301{
302 /**
303 * Puts a mouse event.
304 *
305 * This is called by the source of mouse events. The event will be passed up
306 * until the topmost driver, which then calls the registered event handler.
307 *
308 * @returns VBox status code. Return VERR_TRY_AGAIN if you cannot process the
309 * event now and want it to be repeated at a later point.
310 *
311 * @param pInterface Pointer to this interface structure.
312 * @param dx The X delta.
313 * @param dy The Y delta.
314 * @param dz The Z delta.
315 * @param dw The W (horizontal scroll button) delta.
316 * @param fButtons The button states, see the PDMIMOUSEPORT_BUTTON_* \#defines.
317 */
318 DECLR3CALLBACKMEMBER(int, pfnPutEvent,(PPDMIMOUSEPORT pInterface,
319 int32_t dx, int32_t dy, int32_t dz,
320 int32_t dw, uint32_t fButtons));
321 /**
322 * Puts an absolute mouse event.
323 *
324 * This is called by the source of mouse events. The event will be passed up
325 * until the topmost driver, which then calls the registered event handler.
326 *
327 * @returns VBox status code. Return VERR_TRY_AGAIN if you cannot process the
328 * event now and want it to be repeated at a later point.
329 *
330 * @param pInterface Pointer to this interface structure.
331 * @param x The X value, in the range 0 to 0xffff.
332 * @param y The Y value, in the range 0 to 0xffff.
333 * @param dz The Z delta.
334 * @param dw The W (horizontal scroll button) delta.
335 * @param fButtons The button states, see the PDMIMOUSEPORT_BUTTON_* \#defines.
336 */
337 DECLR3CALLBACKMEMBER(int, pfnPutEventAbs,(PPDMIMOUSEPORT pInterface,
338 uint32_t x, uint32_t y,
339 int32_t dz, int32_t dw,
340 uint32_t fButtons));
341 /**
342 * Puts a multi-touch absolute (touchscreen) event.
343 *
344 * @returns VBox status code. Return VERR_TRY_AGAIN if you cannot process the
345 * event now and want it to be repeated at a later point.
346 *
347 * @param pInterface Pointer to this interface structure.
348 * @param cContacts How many touch contacts in this event.
349 * @param pau64Contacts Pointer to array of packed contact information.
350 * Each 64bit element contains:
351 * Bits 0..15: X coordinate in pixels (signed).
352 * Bits 16..31: Y coordinate in pixels (signed).
353 * Bits 32..39: contact identifier.
354 * Bit 40: "in contact" flag, which indicates that
355 * there is a contact with the touch surface.
356 * Bit 41: "in range" flag, the contact is close enough
357 * to the touch surface.
358 * All other bits are reserved for future use and must be set to 0.
359 * @param u32ScanTime Timestamp of this event in milliseconds. Only relative
360 * time between event is important.
361 */
362 DECLR3CALLBACKMEMBER(int, pfnPutEventTouchScreen,(PPDMIMOUSEPORT pInterface,
363 uint8_t cContacts,
364 const uint64_t *pau64Contacts,
365 uint32_t u32ScanTime));
366
367 /**
368 * Puts a multi-touch relative (touchpad) event.
369 *
370 * @returns VBox status code. Return VERR_TRY_AGAIN if you cannot process the
371 * event now and want it to be repeated at a later point.
372 *
373 * @param pInterface Pointer to this interface structure.
374 * @param cContacts How many touch contacts in this event.
375 * @param pau64Contacts Pointer to array of packed contact information.
376 * Each 64bit element contains:
377 * Bits 0..15: Normalized X coordinate (range: 0 - 0xffff).
378 * Bits 16..31: Normalized Y coordinate (range: 0 - 0xffff).
379 * Bits 32..39: contact identifier.
380 * Bit 40: "in contact" flag, which indicates that
381 * there is a contact with the touch surface.
382 * All other bits are reserved for future use and must be set to 0.
383 * @param u32ScanTime Timestamp of this event in milliseconds. Only relative
384 * time between event is important.
385 */
386
387 DECLR3CALLBACKMEMBER(int, pfnPutEventTouchPad,(PPDMIMOUSEPORT pInterface,
388 uint8_t cContacts,
389 const uint64_t *pau64Contacts,
390 uint32_t u32ScanTime));
391} PDMIMOUSEPORT;
392/** PDMIMOUSEPORT interface ID. */
393#define PDMIMOUSEPORT_IID "d2bb54b7-d877-441b-9d25-d2d3329465c2"
394
395/** Mouse button defines for PDMIMOUSEPORT::pfnPutEvent.
396 * @{ */
397#define PDMIMOUSEPORT_BUTTON_LEFT RT_BIT(0)
398#define PDMIMOUSEPORT_BUTTON_RIGHT RT_BIT(1)
399#define PDMIMOUSEPORT_BUTTON_MIDDLE RT_BIT(2)
400#define PDMIMOUSEPORT_BUTTON_X1 RT_BIT(3)
401#define PDMIMOUSEPORT_BUTTON_X2 RT_BIT(4)
402/** @} */
403
404
405/** Pointer to a mouse connector interface. */
406typedef struct PDMIMOUSECONNECTOR *PPDMIMOUSECONNECTOR;
407/**
408 * Mouse connector interface (up).
409 * Pair with PDMIMOUSEPORT.
410 */
411typedef struct PDMIMOUSECONNECTOR
412{
413 /**
414 * Notifies the the downstream driver of changes to the reporting modes
415 * supported by the driver
416 *
417 * @param pInterface Pointer to this interface structure.
418 * @param fRelative Whether relative mode is currently supported.
419 * @param fAbsolute Whether absolute mode is currently supported.
420 * @param fMTAbsolute Whether absolute multi-touch mode is currently supported.
421 * @param fMTRelative Whether relative multi-touch mode is currently supported.
422 */
423 DECLR3CALLBACKMEMBER(void, pfnReportModes,(PPDMIMOUSECONNECTOR pInterface, bool fRelative, bool fAbsolute, bool fMTAbsolute, bool fMTRelative));
424
425 /**
426 * Flushes the mouse queue if it contains pending events.
427 *
428 * @param pInterface Pointer to this interface structure.
429 */
430 DECLR3CALLBACKMEMBER(void, pfnFlushQueue,(PPDMIMOUSECONNECTOR pInterface));
431
432} PDMIMOUSECONNECTOR;
433/** PDMIMOUSECONNECTOR interface ID. */
434#define PDMIMOUSECONNECTOR_IID "ce64d7bd-fa8f-41d1-a6fb-d102a2d6bffe"
435
436
437/** Flags for PDMIKEYBOARDPORT::pfnPutEventHid.
438 * @{ */
439#define PDMIKBDPORT_KEY_UP RT_BIT(31) /** Key release event if set. */
440#define PDMIKBDPORT_RELEASE_KEYS RT_BIT(30) /** Force all keys to be released. */
441/** @} */
442
443/** USB HID usage pages understood by PDMIKEYBOARDPORT::pfnPutEventHid.
444 * @{ */
445#define USB_HID_DC_PAGE 1 /** USB HID Generic Desktop Control Usage Page. */
446#define USB_HID_KB_PAGE 7 /** USB HID Keyboard Usage Page. */
447#define USB_HID_CC_PAGE 12 /** USB HID Consumer Control Usage Page. */
448/** @} */
449
450
451/** Pointer to a keyboard port interface. */
452typedef struct PDMIKEYBOARDPORT *PPDMIKEYBOARDPORT;
453/**
454 * Keyboard port interface (down).
455 * Pair with PDMIKEYBOARDCONNECTOR.
456 */
457typedef struct PDMIKEYBOARDPORT
458{
459 /**
460 * Puts a scan code based keyboard event.
461 *
462 * This is called by the source of keyboard events. The event will be passed up
463 * until the topmost driver, which then calls the registered event handler.
464 *
465 * @returns VBox status code. Return VERR_TRY_AGAIN if you cannot process the
466 * event now and want it to be repeated at a later point.
467 *
468 * @param pInterface Pointer to this interface structure.
469 * @param u8ScanCode The scan code to queue.
470 */
471 DECLR3CALLBACKMEMBER(int, pfnPutEventScan,(PPDMIKEYBOARDPORT pInterface, uint8_t u8KeyCode));
472
473 /**
474 * Puts a USB HID usage ID based keyboard event.
475 *
476 * This is called by the source of keyboard events. The event will be passed up
477 * until the topmost driver, which then calls the registered event handler.
478 *
479 * @returns VBox status code. Return VERR_TRY_AGAIN if you cannot process the
480 * event now and want it to be repeated at a later point.
481 *
482 * @param pInterface Pointer to this interface structure.
483 * @param idUsage The HID usage code event to queue.
484 */
485 DECLR3CALLBACKMEMBER(int, pfnPutEventHid,(PPDMIKEYBOARDPORT pInterface, uint32_t idUsage));
486
487 /**
488 * Forcibly releases any pressed keys.
489 *
490 * This is called by the source of keyboard events in situations when a full
491 * release of all currently pressed keys must be forced, e.g. when activating
492 * a different keyboard, or when key-up events may have been lost.
493 *
494 * @returns VBox status code.
495 *
496 * @param pInterface Pointer to this interface structure.
497 */
498 DECLR3CALLBACKMEMBER(int, pfnReleaseKeys,(PPDMIKEYBOARDPORT pInterface));
499} PDMIKEYBOARDPORT;
500/** PDMIKEYBOARDPORT interface ID. */
501#define PDMIKEYBOARDPORT_IID "2a0844f0-410b-40ab-a6ed-6575f3aa3e29"
502
503
504/**
505 * Keyboard LEDs.
506 */
507typedef enum PDMKEYBLEDS
508{
509 /** No leds. */
510 PDMKEYBLEDS_NONE = 0x0000,
511 /** Num Lock */
512 PDMKEYBLEDS_NUMLOCK = 0x0001,
513 /** Caps Lock */
514 PDMKEYBLEDS_CAPSLOCK = 0x0002,
515 /** Scroll Lock */
516 PDMKEYBLEDS_SCROLLLOCK = 0x0004
517} PDMKEYBLEDS;
518
519/** Pointer to keyboard connector interface. */
520typedef struct PDMIKEYBOARDCONNECTOR *PPDMIKEYBOARDCONNECTOR;
521/**
522 * Keyboard connector interface (up).
523 * Pair with PDMIKEYBOARDPORT
524 */
525typedef struct PDMIKEYBOARDCONNECTOR
526{
527 /**
528 * Notifies the the downstream driver about an LED change initiated by the guest.
529 *
530 * @param pInterface Pointer to this interface structure.
531 * @param enmLeds The new led mask.
532 */
533 DECLR3CALLBACKMEMBER(void, pfnLedStatusChange,(PPDMIKEYBOARDCONNECTOR pInterface, PDMKEYBLEDS enmLeds));
534
535 /**
536 * Notifies the the downstream driver of changes in driver state.
537 *
538 * @param pInterface Pointer to this interface structure.
539 * @param fActive Whether interface wishes to get "focus".
540 */
541 DECLR3CALLBACKMEMBER(void, pfnSetActive,(PPDMIKEYBOARDCONNECTOR pInterface, bool fActive));
542
543 /**
544 * Flushes the keyboard queue if it contains pending events.
545 *
546 * @param pInterface Pointer to this interface structure.
547 */
548 DECLR3CALLBACKMEMBER(void, pfnFlushQueue,(PPDMIKEYBOARDCONNECTOR pInterface));
549
550} PDMIKEYBOARDCONNECTOR;
551/** PDMIKEYBOARDCONNECTOR interface ID. */
552#define PDMIKEYBOARDCONNECTOR_IID "db3f7bd5-953e-436f-9f8e-077905a92d82"
553
554
555
556/** Pointer to a display port interface. */
557typedef struct PDMIDISPLAYPORT *PPDMIDISPLAYPORT;
558/**
559 * Display port interface (down).
560 * Pair with PDMIDISPLAYCONNECTOR.
561 */
562typedef struct PDMIDISPLAYPORT
563{
564 /**
565 * Update the display with any changed regions.
566 *
567 * Flushes any display changes to the memory pointed to by the
568 * PDMIDISPLAYCONNECTOR interface and calles PDMIDISPLAYCONNECTOR::pfnUpdateRect()
569 * while doing so.
570 *
571 * @returns VBox status code.
572 * @param pInterface Pointer to this interface.
573 * @thread The emulation thread.
574 */
575 DECLR3CALLBACKMEMBER(int, pfnUpdateDisplay,(PPDMIDISPLAYPORT pInterface));
576
577 /**
578 * Update the entire display.
579 *
580 * Flushes the entire display content to the memory pointed to by the
581 * PDMIDISPLAYCONNECTOR interface and calles PDMIDISPLAYCONNECTOR::pfnUpdateRect().
582 *
583 * @returns VBox status code.
584 * @param pInterface Pointer to this interface.
585 * @param fFailOnResize Fail is a resize is pending.
586 * @thread The emulation thread - bird sees no need for EMT here!
587 */
588 DECLR3CALLBACKMEMBER(int, pfnUpdateDisplayAll,(PPDMIDISPLAYPORT pInterface, bool fFailOnResize));
589
590 /**
591 * Return the current guest resolution and color depth in bits per pixel (bpp).
592 *
593 * As the graphics card is able to provide display updates with the bpp
594 * requested by the host, this method can be used to query the actual
595 * guest color depth.
596 *
597 * @returns VBox status code.
598 * @param pInterface Pointer to this interface.
599 * @param pcBits Where to store the current guest color depth.
600 * @param pcx Where to store the horizontal resolution.
601 * @param pcy Where to store the vertical resolution.
602 * @thread Any thread.
603 */
604 DECLR3CALLBACKMEMBER(int, pfnQueryVideoMode,(PPDMIDISPLAYPORT pInterface, uint32_t *pcBits, uint32_t *pcx, uint32_t *pcy));
605
606 /**
607 * Sets the refresh rate and restart the timer.
608 * The rate is defined as the minimum interval between the return of
609 * one PDMIDISPLAYPORT::pfnRefresh() call to the next one.
610 *
611 * The interval timer will be restarted by this call. So at VM startup
612 * this function must be called to start the refresh cycle. The refresh
613 * rate is not saved, but have to be when resuming a loaded VM state.
614 *
615 * @returns VBox status code.
616 * @param pInterface Pointer to this interface.
617 * @param cMilliesInterval Number of millis between two refreshes.
618 * @thread Any thread.
619 */
620 DECLR3CALLBACKMEMBER(int, pfnSetRefreshRate,(PPDMIDISPLAYPORT pInterface, uint32_t cMilliesInterval));
621
622 /**
623 * Create a 32-bbp screenshot of the display.
624 *
625 * This will allocate and return a 32-bbp bitmap. Size of the bitmap scanline in bytes is 4*width.
626 *
627 * The allocated bitmap buffer must be freed with pfnFreeScreenshot.
628 *
629 * @param pInterface Pointer to this interface.
630 * @param ppbData Where to store the pointer to the allocated
631 * buffer.
632 * @param pcbData Where to store the actual size of the bitmap.
633 * @param pcx Where to store the width of the bitmap.
634 * @param pcy Where to store the height of the bitmap.
635 * @thread The emulation thread.
636 */
637 DECLR3CALLBACKMEMBER(int, pfnTakeScreenshot,(PPDMIDISPLAYPORT pInterface, uint8_t **ppbData, size_t *pcbData, uint32_t *pcx, uint32_t *pcy));
638
639 /**
640 * Free screenshot buffer.
641 *
642 * This will free the memory buffer allocated by pfnTakeScreenshot.
643 *
644 * @param pInterface Pointer to this interface.
645 * @param pbData Pointer to the buffer returned by
646 * pfnTakeScreenshot.
647 * @thread Any.
648 */
649 DECLR3CALLBACKMEMBER(void, pfnFreeScreenshot,(PPDMIDISPLAYPORT pInterface, uint8_t *pbData));
650
651 /**
652 * Copy bitmap to the display.
653 *
654 * This will convert and copy a 32-bbp bitmap (with dword aligned scanline length) to
655 * the memory pointed to by the PDMIDISPLAYCONNECTOR interface.
656 *
657 * @param pInterface Pointer to this interface.
658 * @param pvData Pointer to the bitmap bits.
659 * @param x The upper left corner x coordinate of the destination rectangle.
660 * @param y The upper left corner y coordinate of the destination rectangle.
661 * @param cx The width of the source and destination rectangles.
662 * @param cy The height of the source and destination rectangles.
663 * @thread The emulation thread.
664 * @remark This is just a convenience for using the bitmap conversions of the
665 * graphics device.
666 */
667 DECLR3CALLBACKMEMBER(int, pfnDisplayBlt,(PPDMIDISPLAYPORT pInterface, const void *pvData, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy));
668
669 /**
670 * Render a rectangle from guest VRAM to Framebuffer.
671 *
672 * @param pInterface Pointer to this interface.
673 * @param x The upper left corner x coordinate of the rectangle to be updated.
674 * @param y The upper left corner y coordinate of the rectangle to be updated.
675 * @param cx The width of the rectangle to be updated.
676 * @param cy The height of the rectangle to be updated.
677 * @thread The emulation thread.
678 */
679 DECLR3CALLBACKMEMBER(void, pfnUpdateDisplayRect,(PPDMIDISPLAYPORT pInterface, int32_t x, int32_t y, uint32_t cx, uint32_t cy));
680
681 /**
682 * Inform the VGA device whether the Display is directly using the guest VRAM and there is no need
683 * to render the VRAM to the framebuffer memory.
684 *
685 * @param pInterface Pointer to this interface.
686 * @param fRender Whether the VRAM content must be rendered to the framebuffer.
687 * @thread The emulation thread.
688 */
689 DECLR3CALLBACKMEMBER(void, pfnSetRenderVRAM,(PPDMIDISPLAYPORT pInterface, bool fRender));
690
691 /**
692 * Render a bitmap rectangle from source to target buffer.
693 *
694 * @param pInterface Pointer to this interface.
695 * @param cx The width of the rectangle to be copied.
696 * @param cy The height of the rectangle to be copied.
697 * @param pbSrc Source frame buffer 0,0.
698 * @param xSrc The upper left corner x coordinate of the source rectangle.
699 * @param ySrc The upper left corner y coordinate of the source rectangle.
700 * @param cxSrc The width of the source frame buffer.
701 * @param cySrc The height of the source frame buffer.
702 * @param cbSrcLine The line length of the source frame buffer.
703 * @param cSrcBitsPerPixel The pixel depth of the source.
704 * @param pbDst Destination frame buffer 0,0.
705 * @param xDst The upper left corner x coordinate of the destination rectangle.
706 * @param yDst The upper left corner y coordinate of the destination rectangle.
707 * @param cxDst The width of the destination frame buffer.
708 * @param cyDst The height of the destination frame buffer.
709 * @param cbDstLine The line length of the destination frame buffer.
710 * @param cDstBitsPerPixel The pixel depth of the destination.
711 * @thread The emulation thread - bird sees no need for EMT here!
712 */
713 DECLR3CALLBACKMEMBER(int, pfnCopyRect,(PPDMIDISPLAYPORT pInterface, uint32_t cx, uint32_t cy,
714 const uint8_t *pbSrc, int32_t xSrc, int32_t ySrc, uint32_t cxSrc, uint32_t cySrc, uint32_t cbSrcLine, uint32_t cSrcBitsPerPixel,
715 uint8_t *pbDst, int32_t xDst, int32_t yDst, uint32_t cxDst, uint32_t cyDst, uint32_t cbDstLine, uint32_t cDstBitsPerPixel));
716
717 /**
718 * Inform the VGA device of viewport changes (as a result of e.g. scrolling).
719 *
720 * @param pInterface Pointer to this interface.
721 * @param idScreen The screen updates are for.
722 * @param x The upper left corner x coordinate of the new viewport rectangle
723 * @param y The upper left corner y coordinate of the new viewport rectangle
724 * @param cx The width of the new viewport rectangle
725 * @param cy The height of the new viewport rectangle
726 * @thread GUI thread?
727 *
728 * @remarks Is allowed to be NULL.
729 */
730 DECLR3CALLBACKMEMBER(void, pfnSetViewport,(PPDMIDISPLAYPORT pInterface,
731 uint32_t idScreen, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy));
732
733 /**
734 * Send a video mode hint to the VGA device.
735 *
736 * @param pInterface Pointer to this interface.
737 * @param cx The X resolution.
738 * @param cy The Y resolution.
739 * @param cBPP The bit count.
740 * @param iDisplay The screen number.
741 * @param dx X offset into the virtual framebuffer or ~0.
742 * @param dy Y offset into the virtual framebuffer or ~0.
743 * @param fEnabled Is this screen currently enabled?
744 * @param fNotifyGuest Should the device send the guest an IRQ?
745 * Set for the last hint of a series.
746 * @thread Schedules on the emulation thread.
747 */
748 DECLR3CALLBACKMEMBER(int, pfnSendModeHint, (PPDMIDISPLAYPORT pInterface, uint32_t cx, uint32_t cy,
749 uint32_t cBPP, uint32_t iDisplay, uint32_t dx,
750 uint32_t dy, uint32_t fEnabled, uint32_t fNotifyGuest));
751
752 /**
753 * Send the guest a notification about host cursor capabilities changes.
754 *
755 * @param pInterface Pointer to this interface.
756 * @param fSupportsRenderCursor Whether the host can draw the guest cursor
757 * using the host one provided the location matches.
758 * @param fSupportsMoveCursor Whether the host can draw the guest cursor
759 * itself at any position. Implies RenderCursor.
760 * @thread Any.
761 */
762 DECLR3CALLBACKMEMBER(void, pfnReportHostCursorCapabilities, (PPDMIDISPLAYPORT pInterface, bool fSupportsRenderCursor, bool fSupportsMoveCursor));
763
764 /**
765 * Tell the graphics device about the host cursor position.
766 *
767 * @param pInterface Pointer to this interface.
768 * @param x X offset into the cursor range.
769 * @param y Y offset into the cursor range.
770 * @param fOutOfRange The host pointer is out of all guest windows, so
771 * X and Y do not currently have meaningful value.
772 * @thread Any.
773 */
774 DECLR3CALLBACKMEMBER(void, pfnReportHostCursorPosition, (PPDMIDISPLAYPORT pInterface, uint32_t x, uint32_t y, bool fOutOfRange));
775
776 /**
777 * Notify the graphics device about the monitor positions since the ones we get
778 * from vmwgfx FIFO are not correct.
779 *
780 * In an ideal universe this method should not be here.
781 *
782 * @param pInterface Pointer to this interface.
783 * @param cPositions Number of monitor positions.
784 * @param paPositions Monitor positions (offsets/origins) array.
785 * @thread Any (EMT).
786 * @sa PDMIVMMDEVCONNECTOR::pfnUpdateMonitorPositions
787 */
788 DECLR3CALLBACKMEMBER(void, pfnReportMonitorPositions, (PPDMIDISPLAYPORT pInterface, uint32_t cPositions,
789 PCRTPOINT paPositions));
790
791} PDMIDISPLAYPORT;
792/** PDMIDISPLAYPORT interface ID. */
793#define PDMIDISPLAYPORT_IID "471b0520-338c-11e9-bb84-6ff2c956da45"
794
795/** @name Flags for PDMIDISPLAYCONNECTOR::pfnVBVAReportCursorPosition.
796 * @{ */
797/** Is the data in the report valid? */
798#define VBVA_CURSOR_VALID_DATA RT_BIT(0)
799/** Is the cursor position reported relative to a particular guest screen? */
800#define VBVA_CURSOR_SCREEN_RELATIVE RT_BIT(1)
801/** @} */
802
803/** Pointer to a 3D graphics notification. */
804typedef struct VBOX3DNOTIFY VBOX3DNOTIFY;
805/** Pointer to a 2D graphics acceleration command. */
806typedef struct VBOXVHWACMD VBOXVHWACMD;
807/** Pointer to a VBVA command header. */
808typedef struct VBVACMDHDR *PVBVACMDHDR;
809/** Pointer to a const VBVA command header. */
810typedef const struct VBVACMDHDR *PCVBVACMDHDR;
811/** Pointer to a VBVA screen information. */
812typedef struct VBVAINFOSCREEN *PVBVAINFOSCREEN;
813/** Pointer to a const VBVA screen information. */
814typedef const struct VBVAINFOSCREEN *PCVBVAINFOSCREEN;
815/** Pointer to a VBVA guest VRAM area information. */
816typedef struct VBVAINFOVIEW *PVBVAINFOVIEW;
817/** Pointer to a const VBVA guest VRAM area information. */
818typedef const struct VBVAINFOVIEW *PCVBVAINFOVIEW;
819typedef struct VBVAHOSTFLAGS *PVBVAHOSTFLAGS;
820
821/** Pointer to a display connector interface. */
822typedef struct PDMIDISPLAYCONNECTOR *PPDMIDISPLAYCONNECTOR;
823
824/**
825 * Display connector interface (up).
826 * Pair with PDMIDISPLAYPORT.
827 */
828typedef struct PDMIDISPLAYCONNECTOR
829{
830 /**
831 * Resize the display.
832 * This is called when the resolution changes. This usually happens on
833 * request from the guest os, but may also happen as the result of a reset.
834 * If the callback returns VINF_VGA_RESIZE_IN_PROGRESS, the caller (VGA device)
835 * must not access the connector and return.
836 *
837 * @returns VINF_SUCCESS if the framebuffer resize was completed,
838 * VINF_VGA_RESIZE_IN_PROGRESS if resize takes time and not yet finished.
839 * @param pInterface Pointer to this interface.
840 * @param cBits Color depth (bits per pixel) of the new video mode.
841 * @param pvVRAM Address of the guest VRAM.
842 * @param cbLine Size in bytes of a single scan line.
843 * @param cx New display width.
844 * @param cy New display height.
845 * @thread The emulation thread.
846 */
847 DECLR3CALLBACKMEMBER(int, pfnResize,(PPDMIDISPLAYCONNECTOR pInterface, uint32_t cBits, void *pvVRAM, uint32_t cbLine,
848 uint32_t cx, uint32_t cy));
849
850 /**
851 * Update a rectangle of the display.
852 * PDMIDISPLAYPORT::pfnUpdateDisplay is the caller.
853 *
854 * @param pInterface Pointer to this interface.
855 * @param x The upper left corner x coordinate of the rectangle.
856 * @param y The upper left corner y coordinate of the rectangle.
857 * @param cx The width of the rectangle.
858 * @param cy The height of the rectangle.
859 * @thread The emulation thread.
860 */
861 DECLR3CALLBACKMEMBER(void, pfnUpdateRect,(PPDMIDISPLAYCONNECTOR pInterface, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy));
862
863 /**
864 * Refresh the display.
865 *
866 * The interval between these calls is set by
867 * PDMIDISPLAYPORT::pfnSetRefreshRate(). The driver should call
868 * PDMIDISPLAYPORT::pfnUpdateDisplay() if it wishes to refresh the
869 * display. PDMIDISPLAYPORT::pfnUpdateDisplay calls pfnUpdateRect with
870 * the changed rectangles.
871 *
872 * @param pInterface Pointer to this interface.
873 * @thread The emulation thread or timer queue thread.
874 */
875 DECLR3CALLBACKMEMBER(void, pfnRefresh,(PPDMIDISPLAYCONNECTOR pInterface));
876
877 /**
878 * Reset the display.
879 *
880 * Notification message when the graphics card has been reset.
881 *
882 * @param pInterface Pointer to this interface.
883 * @thread The emulation thread.
884 */
885 DECLR3CALLBACKMEMBER(void, pfnReset,(PPDMIDISPLAYCONNECTOR pInterface));
886
887 /**
888 * LFB video mode enter/exit.
889 *
890 * Notification message when LinearFrameBuffer video mode is enabled/disabled.
891 *
892 * @param pInterface Pointer to this interface.
893 * @param fEnabled false - LFB mode was disabled,
894 * true - an LFB mode was disabled
895 * @thread The emulation thread.
896 */
897 DECLR3CALLBACKMEMBER(void, pfnLFBModeChange,(PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled));
898
899 /**
900 * Process the guest graphics adapter information.
901 *
902 * Direct notification from guest to the display connector.
903 *
904 * @param pInterface Pointer to this interface.
905 * @param pvVRAM Address of the guest VRAM.
906 * @param u32VRAMSize Size of the guest VRAM.
907 * @thread The emulation thread.
908 */
909 DECLR3CALLBACKMEMBER(void, pfnProcessAdapterData,(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, uint32_t u32VRAMSize));
910
911 /**
912 * Process the guest display information.
913 *
914 * Direct notification from guest to the display connector.
915 *
916 * @param pInterface Pointer to this interface.
917 * @param pvVRAM Address of the guest VRAM.
918 * @param uScreenId The index of the guest display to be processed.
919 * @thread The emulation thread.
920 */
921 DECLR3CALLBACKMEMBER(void, pfnProcessDisplayData,(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, unsigned uScreenId));
922
923 /**
924 * Process the guest Video HW Acceleration command.
925 *
926 * @param pInterface Pointer to this interface.
927 * @param enmCmd The command type (don't re-read from pCmd).
928 * @param fGuestCmd Set if the command origins with the guest and
929 * pCmd must be considered volatile.
930 * @param pCmd Video HW Acceleration Command to be processed.
931 * @retval VINF_SUCCESS - command is completed,
932 * @retval VINF_CALLBACK_RETURN if command will by asynchronously completed via
933 * complete callback.
934 * @retval VERR_INVALID_STATE if the command could not be processed (most
935 * likely because the framebuffer was disconnected) - the post should
936 * be retried later.
937 * @thread EMT
938 */
939 DECLR3CALLBACKMEMBER(int, pfnVHWACommandProcess,(PPDMIDISPLAYCONNECTOR pInterface, int enmCmd, bool fGuestCmd,
940 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCmd));
941
942 /**
943 * The specified screen enters VBVA mode.
944 *
945 * @param pInterface Pointer to this interface.
946 * @param uScreenId The screen updates are for.
947 * @param pHostFlags Undocumented!
948 * @thread The emulation thread.
949 */
950 DECLR3CALLBACKMEMBER(int, pfnVBVAEnable,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId,
951 struct VBVAHOSTFLAGS RT_UNTRUSTED_VOLATILE_GUEST *pHostFlags));
952
953 /**
954 * The specified screen leaves VBVA mode.
955 *
956 * @param pInterface Pointer to this interface.
957 * @param uScreenId The screen updates are for.
958 * @thread if render thread mode is on (fRenderThreadMode that was passed to pfnVBVAEnable is TRUE) - the render thread pfnVBVAEnable was called in,
959 * otherwise - the emulation thread.
960 */
961 DECLR3CALLBACKMEMBER(void, pfnVBVADisable,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId));
962
963 /**
964 * A sequence of pfnVBVAUpdateProcess calls begins.
965 *
966 * @param pInterface Pointer to this interface.
967 * @param uScreenId The screen updates are for.
968 * @thread if render thread mode is on (fRenderThreadMode that was passed to pfnVBVAEnable is TRUE) - the render thread pfnVBVAEnable was called in,
969 * otherwise - the emulation thread.
970 */
971 DECLR3CALLBACKMEMBER(void, pfnVBVAUpdateBegin,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId));
972
973 /**
974 * Process the guest VBVA command.
975 *
976 * @param pInterface Pointer to this interface.
977 * @param uScreenId The screen updates are for.
978 * @param pCmd Video HW Acceleration Command to be processed.
979 * @param cbCmd Undocumented!
980 * @thread if render thread mode is on (fRenderThreadMode that was passed to pfnVBVAEnable is TRUE) - the render thread pfnVBVAEnable was called in,
981 * otherwise - the emulation thread.
982 */
983 DECLR3CALLBACKMEMBER(void, pfnVBVAUpdateProcess,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId,
984 struct VBVACMDHDR const RT_UNTRUSTED_VOLATILE_GUEST *pCmd, size_t cbCmd));
985
986 /**
987 * A sequence of pfnVBVAUpdateProcess calls ends.
988 *
989 * @param pInterface Pointer to this interface.
990 * @param uScreenId The screen updates are for.
991 * @param x The upper left corner x coordinate of the combined rectangle of all VBVA updates.
992 * @param y The upper left corner y coordinate of the rectangle.
993 * @param cx The width of the rectangle.
994 * @param cy The height of the rectangle.
995 * @thread if render thread mode is on (fRenderThreadMode that was passed to pfnVBVAEnable is TRUE) - the render thread pfnVBVAEnable was called in,
996 * otherwise - the emulation thread.
997 */
998 DECLR3CALLBACKMEMBER(void, pfnVBVAUpdateEnd,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, int32_t x, int32_t y,
999 uint32_t cx, uint32_t cy));
1000
1001 /**
1002 * Resize the display.
1003 * This is called when the resolution changes. This usually happens on
1004 * request from the guest os, but may also happen as the result of a reset.
1005 * If the callback returns VINF_VGA_RESIZE_IN_PROGRESS, the caller (VGA device)
1006 * must not access the connector and return.
1007 *
1008 * @todo Merge with pfnResize.
1009 *
1010 * @returns VINF_SUCCESS if the framebuffer resize was completed,
1011 * VINF_VGA_RESIZE_IN_PROGRESS if resize takes time and not yet finished.
1012 * @param pInterface Pointer to this interface.
1013 * @param pView The description of VRAM block for this screen.
1014 * @param pScreen The data of screen being resized.
1015 * @param pvVRAM Address of the guest VRAM.
1016 * @param fResetInputMapping Whether to reset the absolute pointing device to screen position co-ordinate
1017 * mapping. Needed for real resizes, as the caller on the guest may not know how
1018 * to set the mapping. Not wanted when we restore a saved state and are resetting
1019 * the mode.
1020 * @thread if render thread mode is on (fRenderThreadMode that was passed to pfnVBVAEnable is TRUE) - the render thread pfnVBVAEnable was called in,
1021 * otherwise - the emulation thread.
1022 */
1023 DECLR3CALLBACKMEMBER(int, pfnVBVAResize,(PPDMIDISPLAYCONNECTOR pInterface, PCVBVAINFOVIEW pView, PCVBVAINFOSCREEN pScreen,
1024 void *pvVRAM, bool fResetInputMapping));
1025
1026 /**
1027 * Update the pointer shape.
1028 * This is called when the mouse pointer shape changes. The new shape
1029 * is passed as a caller allocated buffer that will be freed after returning
1030 *
1031 * @param pInterface Pointer to this interface.
1032 * @param fVisible Visibility indicator (if false, the other parameters are undefined).
1033 * @param fAlpha Flag whether alpha channel is being passed.
1034 * @param xHot Pointer hot spot x coordinate.
1035 * @param yHot Pointer hot spot y coordinate.
1036 * @param cx Pointer width in pixels.
1037 * @param cy Pointer height in pixels.
1038 * @param pvShape New shape buffer.
1039 * @thread The emulation thread.
1040 */
1041 DECLR3CALLBACKMEMBER(int, pfnVBVAMousePointerShape,(PPDMIDISPLAYCONNECTOR pInterface, bool fVisible, bool fAlpha,
1042 uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy,
1043 const void *pvShape));
1044
1045 /**
1046 * The guest capabilities were updated.
1047 *
1048 * @param pInterface Pointer to this interface.
1049 * @param fCapabilities The new capability flag state.
1050 * @thread The emulation thread.
1051 */
1052 DECLR3CALLBACKMEMBER(void, pfnVBVAGuestCapabilityUpdate,(PPDMIDISPLAYCONNECTOR pInterface, uint32_t fCapabilities));
1053
1054 /** Read-only attributes.
1055 * For preformance reasons some readonly attributes are kept in the interface.
1056 * We trust the interface users to respect the readonlyness of these.
1057 * @{
1058 */
1059 /** Pointer to the display data buffer. */
1060 uint8_t *pbData;
1061 /** Size of a scanline in the data buffer. */
1062 uint32_t cbScanline;
1063 /** The color depth (in bits) the graphics card is supposed to provide. */
1064 uint32_t cBits;
1065 /** The display width. */
1066 uint32_t cx;
1067 /** The display height. */
1068 uint32_t cy;
1069 /** @} */
1070
1071 /**
1072 * The guest display input mapping rectangle was updated.
1073 *
1074 * @param pInterface Pointer to this interface.
1075 * @param xOrigin Upper left X co-ordinate relative to the first screen.
1076 * @param yOrigin Upper left Y co-ordinate relative to the first screen.
1077 * @param cx Rectangle width.
1078 * @param cy Rectangle height.
1079 * @thread The emulation thread.
1080 */
1081 DECLR3CALLBACKMEMBER(void, pfnVBVAInputMappingUpdate,(PPDMIDISPLAYCONNECTOR pInterface, int32_t xOrigin, int32_t yOrigin, uint32_t cx, uint32_t cy));
1082
1083 /**
1084 * The guest is reporting the requested location of the host pointer.
1085 *
1086 * @param pInterface Pointer to this interface.
1087 * @param fFlags VBVA_CURSOR_*
1088 * @param uScreenId The screen to which X and Y are relative if VBVA_CURSOR_SCREEN_RELATIVE is set.
1089 * @param x Cursor X offset.
1090 * @param y Cursor Y offset.
1091 * @thread The emulation thread.
1092 */
1093 DECLR3CALLBACKMEMBER(void, pfnVBVAReportCursorPosition,(PPDMIDISPLAYCONNECTOR pInterface, uint32_t fFlags, uint32_t uScreen, uint32_t x, uint32_t y));
1094
1095 /**
1096 * Process the graphics device HW Acceleration command.
1097 *
1098 * @param pInterface Pointer to this interface.
1099 * @param p3DNotify Acceleration Command to be processed.
1100 * @thread The graphics device thread: FIFO for the VMSVGA device.
1101 */
1102 DECLR3CALLBACKMEMBER(int, pfn3DNotifyProcess,(PPDMIDISPLAYCONNECTOR pInterface,
1103 VBOX3DNOTIFY *p3DNotify));
1104} PDMIDISPLAYCONNECTOR;
1105/** PDMIDISPLAYCONNECTOR interface ID. */
1106#define PDMIDISPLAYCONNECTOR_IID "cdd562e4-8030-11ea-8d40-bbc8e146c565"
1107
1108
1109/** Pointer to a secret key interface. */
1110typedef struct PDMISECKEY *PPDMISECKEY;
1111
1112/**
1113 * Secret key interface to retrieve secret keys.
1114 */
1115typedef struct PDMISECKEY
1116{
1117 /**
1118 * Retains a key identified by the ID. The caller will only hold a reference
1119 * to the key and must not modify the key buffer in any way.
1120 *
1121 * @returns VBox status code.
1122 * @param pInterface Pointer to this interface.
1123 * @param pszId The alias/id for the key to retrieve.
1124 * @param ppbKey Where to store the pointer to the key buffer on success.
1125 * @param pcbKey Where to store the size of the key in bytes on success.
1126 */
1127 DECLR3CALLBACKMEMBER(int, pfnKeyRetain, (PPDMISECKEY pInterface, const char *pszId,
1128 const uint8_t **pbKey, size_t *pcbKey));
1129
1130 /**
1131 * Releases one reference of the key identified by the given identifier.
1132 * The caller must not access the key buffer after calling this operation.
1133 *
1134 * @returns VBox status code.
1135 * @param pInterface Pointer to this interface.
1136 * @param pszId The alias/id for the key to release.
1137 *
1138 * @note: It is advised to release the key whenever it is not used anymore so the entity
1139 * storing the key can do anything to make retrieving the key from memory more
1140 * difficult like scrambling the memory buffer for instance.
1141 */
1142 DECLR3CALLBACKMEMBER(int, pfnKeyRelease, (PPDMISECKEY pInterface, const char *pszId));
1143
1144 /**
1145 * Retains a password identified by the ID. The caller will only hold a reference
1146 * to the password and must not modify the buffer in any way.
1147 *
1148 * @returns VBox status code.
1149 * @param pInterface Pointer to this interface.
1150 * @param pszId The alias/id for the password to retrieve.
1151 * @param ppszPassword Where to store the pointer to the password on success.
1152 */
1153 DECLR3CALLBACKMEMBER(int, pfnPasswordRetain, (PPDMISECKEY pInterface, const char *pszId,
1154 const char **ppszPassword));
1155
1156 /**
1157 * Releases one reference of the password identified by the given identifier.
1158 * The caller must not access the password after calling this operation.
1159 *
1160 * @returns VBox status code.
1161 * @param pInterface Pointer to this interface.
1162 * @param pszId The alias/id for the password to release.
1163 *
1164 * @note: It is advised to release the password whenever it is not used anymore so the entity
1165 * storing the password can do anything to make retrieving the password from memory more
1166 * difficult like scrambling the memory buffer for instance.
1167 */
1168 DECLR3CALLBACKMEMBER(int, pfnPasswordRelease, (PPDMISECKEY pInterface, const char *pszId));
1169} PDMISECKEY;
1170/** PDMISECKEY interface ID. */
1171#define PDMISECKEY_IID "3d698355-d995-453d-960f-31566a891df2"
1172
1173/** Pointer to a secret key helper interface. */
1174typedef struct PDMISECKEYHLP *PPDMISECKEYHLP;
1175
1176/**
1177 * Secret key helper interface for non critical functionality.
1178 */
1179typedef struct PDMISECKEYHLP
1180{
1181 /**
1182 * Notifies the interface provider that a key couldn't be retrieved from the key store.
1183 *
1184 * @returns VBox status code.
1185 * @param pInterface Pointer to this interface.
1186 */
1187 DECLR3CALLBACKMEMBER(int, pfnKeyMissingNotify, (PPDMISECKEYHLP pInterface));
1188
1189} PDMISECKEYHLP;
1190/** PDMISECKEY interface ID. */
1191#define PDMISECKEYHLP_IID "7be96168-4156-40ac-86d2-3073bf8b318e"
1192
1193
1194/** Pointer to a stream interface. */
1195typedef struct PDMISTREAM *PPDMISTREAM;
1196/**
1197 * Stream interface (up).
1198 * Makes up the foundation for PDMICHARCONNECTOR. No pair interface.
1199 */
1200typedef struct PDMISTREAM
1201{
1202 /**
1203 * Polls for the specified events.
1204 *
1205 * @returns VBox status code.
1206 * @retval VERR_INTERRUPTED if the poll was interrupted.
1207 * @retval VERR_TIMEOUT if the maximum waiting time was reached.
1208 * @param pInterface Pointer to the interface structure containing the called function pointer.
1209 * @param fEvts The events to poll for, see RTPOLL_EVT_XXX.
1210 * @param pfEvts Where to return details about the events that occurred.
1211 * @param cMillies Number of milliseconds to wait. Use
1212 * RT_INDEFINITE_WAIT to wait for ever.
1213 */
1214 DECLR3CALLBACKMEMBER(int, pfnPoll,(PPDMISTREAM pInterface, uint32_t fEvts, uint32_t *pfEvts, RTMSINTERVAL cMillies));
1215
1216 /**
1217 * Interrupts the current poll call.
1218 *
1219 * @returns VBox status code.
1220 * @param pInterface Pointer to the interface structure containing the called function pointer.
1221 */
1222 DECLR3CALLBACKMEMBER(int, pfnPollInterrupt,(PPDMISTREAM pInterface));
1223
1224 /**
1225 * Read bits.
1226 *
1227 * @returns VBox status code.
1228 * @param pInterface Pointer to the interface structure containing the called function pointer.
1229 * @param pvBuf Where to store the read bits.
1230 * @param pcbRead Number of bytes to read/bytes actually read.
1231 * @thread Any thread.
1232 *
1233 * @note: This is non blocking, use the poll callback to block when there is nothing to read.
1234 */
1235 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMISTREAM pInterface, void *pvBuf, size_t *pcbRead));
1236
1237 /**
1238 * Write bits.
1239 *
1240 * @returns VBox status code.
1241 * @param pInterface Pointer to the interface structure containing the called function pointer.
1242 * @param pvBuf Where to store the write bits.
1243 * @param pcbWrite Number of bytes to write/bytes actually written.
1244 * @thread Any thread.
1245 *
1246 * @note: This is non blocking, use the poll callback to block until there is room to write.
1247 */
1248 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMISTREAM pInterface, const void *pvBuf, size_t *pcbWrite));
1249} PDMISTREAM;
1250/** PDMISTREAM interface ID. */
1251#define PDMISTREAM_IID "f9bd1ba6-c134-44cc-8259-febe14393952"
1252
1253
1254/** Mode of the parallel port */
1255typedef enum PDMPARALLELPORTMODE
1256{
1257 /** First invalid mode. */
1258 PDM_PARALLEL_PORT_MODE_INVALID = 0,
1259 /** SPP (Compatibility mode). */
1260 PDM_PARALLEL_PORT_MODE_SPP,
1261 /** EPP Data mode. */
1262 PDM_PARALLEL_PORT_MODE_EPP_DATA,
1263 /** EPP Address mode. */
1264 PDM_PARALLEL_PORT_MODE_EPP_ADDR,
1265 /** ECP mode (not implemented yet). */
1266 PDM_PARALLEL_PORT_MODE_ECP,
1267 /** 32bit hack. */
1268 PDM_PARALLEL_PORT_MODE_32BIT_HACK = 0x7fffffff
1269} PDMPARALLELPORTMODE;
1270
1271/** Pointer to a host parallel port interface. */
1272typedef struct PDMIHOSTPARALLELPORT *PPDMIHOSTPARALLELPORT;
1273/**
1274 * Host parallel port interface (down).
1275 * Pair with PDMIHOSTPARALLELCONNECTOR.
1276 */
1277typedef struct PDMIHOSTPARALLELPORT
1278{
1279 /**
1280 * Notify device/driver that an interrupt has occurred.
1281 *
1282 * @returns VBox status code.
1283 * @param pInterface Pointer to the interface structure containing the called function pointer.
1284 * @thread Any thread.
1285 */
1286 DECLR3CALLBACKMEMBER(int, pfnNotifyInterrupt,(PPDMIHOSTPARALLELPORT pInterface));
1287} PDMIHOSTPARALLELPORT;
1288/** PDMIHOSTPARALLELPORT interface ID. */
1289#define PDMIHOSTPARALLELPORT_IID "f24b8668-e7f6-4eaa-a14c-4aa2a5f7048e"
1290
1291
1292
1293/** Pointer to a Host Parallel connector interface. */
1294typedef struct PDMIHOSTPARALLELCONNECTOR *PPDMIHOSTPARALLELCONNECTOR;
1295/**
1296 * Host parallel connector interface (up).
1297 * Pair with PDMIHOSTPARALLELPORT.
1298 */
1299typedef struct PDMIHOSTPARALLELCONNECTOR
1300{
1301 /**
1302 * Write bits.
1303 *
1304 * @returns VBox status code.
1305 * @param pInterface Pointer to the interface structure containing the called function pointer.
1306 * @param pvBuf Where to store the write bits.
1307 * @param cbWrite Number of bytes to write.
1308 * @param enmMode Mode to write the data.
1309 * @thread Any thread.
1310 * @todo r=klaus cbWrite only defines buffer length, method needs a way top return actually written amount of data.
1311 */
1312 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIHOSTPARALLELCONNECTOR pInterface, const void *pvBuf,
1313 size_t cbWrite, PDMPARALLELPORTMODE enmMode));
1314
1315 /**
1316 * Read bits.
1317 *
1318 * @returns VBox status code.
1319 * @param pInterface Pointer to the interface structure containing the called function pointer.
1320 * @param pvBuf Where to store the read bits.
1321 * @param cbRead Number of bytes to read.
1322 * @param enmMode Mode to read the data.
1323 * @thread Any thread.
1324 * @todo r=klaus cbRead only defines buffer length, method needs a way top return actually read amount of data.
1325 */
1326 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIHOSTPARALLELCONNECTOR pInterface, void *pvBuf,
1327 size_t cbRead, PDMPARALLELPORTMODE enmMode));
1328
1329 /**
1330 * Set data direction of the port (forward/reverse).
1331 *
1332 * @returns VBox status code.
1333 * @param pInterface Pointer to the interface structure containing the called function pointer.
1334 * @param fForward Flag whether to indicate whether the port is operated in forward or reverse mode.
1335 * @thread Any thread.
1336 */
1337 DECLR3CALLBACKMEMBER(int, pfnSetPortDirection,(PPDMIHOSTPARALLELCONNECTOR pInterface, bool fForward));
1338
1339 /**
1340 * Write control register bits.
1341 *
1342 * @returns VBox status code.
1343 * @param pInterface Pointer to the interface structure containing the called function pointer.
1344 * @param fReg The new control register value.
1345 * @thread Any thread.
1346 */
1347 DECLR3CALLBACKMEMBER(int, pfnWriteControl,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t fReg));
1348
1349 /**
1350 * Read control register bits.
1351 *
1352 * @returns VBox status code.
1353 * @param pInterface Pointer to the interface structure containing the called function pointer.
1354 * @param pfReg Where to store the control register bits.
1355 * @thread Any thread.
1356 */
1357 DECLR3CALLBACKMEMBER(int, pfnReadControl,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t *pfReg));
1358
1359 /**
1360 * Read status register bits.
1361 *
1362 * @returns VBox status code.
1363 * @param pInterface Pointer to the interface structure containing the called function pointer.
1364 * @param pfReg Where to store the status register bits.
1365 * @thread Any thread.
1366 */
1367 DECLR3CALLBACKMEMBER(int, pfnReadStatus,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t *pfReg));
1368
1369} PDMIHOSTPARALLELCONNECTOR;
1370/** PDMIHOSTPARALLELCONNECTOR interface ID. */
1371#define PDMIHOSTPARALLELCONNECTOR_IID "7c532602-7438-4fbc-9265-349d9f0415f9"
1372
1373
1374/** ACPI power source identifier */
1375typedef enum PDMACPIPOWERSOURCE
1376{
1377 PDM_ACPI_POWER_SOURCE_UNKNOWN = 0,
1378 PDM_ACPI_POWER_SOURCE_OUTLET,
1379 PDM_ACPI_POWER_SOURCE_BATTERY
1380} PDMACPIPOWERSOURCE;
1381/** Pointer to ACPI battery state. */
1382typedef PDMACPIPOWERSOURCE *PPDMACPIPOWERSOURCE;
1383
1384/** ACPI battey capacity */
1385typedef enum PDMACPIBATCAPACITY
1386{
1387 PDM_ACPI_BAT_CAPACITY_MIN = 0,
1388 PDM_ACPI_BAT_CAPACITY_MAX = 100,
1389 PDM_ACPI_BAT_CAPACITY_UNKNOWN = 255
1390} PDMACPIBATCAPACITY;
1391/** Pointer to ACPI battery capacity. */
1392typedef PDMACPIBATCAPACITY *PPDMACPIBATCAPACITY;
1393
1394/** ACPI battery state. See ACPI 3.0 spec '_BST (Battery Status)' */
1395typedef enum PDMACPIBATSTATE
1396{
1397 PDM_ACPI_BAT_STATE_CHARGED = 0x00,
1398 PDM_ACPI_BAT_STATE_DISCHARGING = 0x01,
1399 PDM_ACPI_BAT_STATE_CHARGING = 0x02,
1400 PDM_ACPI_BAT_STATE_CRITICAL = 0x04
1401} PDMACPIBATSTATE;
1402/** Pointer to ACPI battery state. */
1403typedef PDMACPIBATSTATE *PPDMACPIBATSTATE;
1404
1405/** Pointer to an ACPI port interface. */
1406typedef struct PDMIACPIPORT *PPDMIACPIPORT;
1407/**
1408 * ACPI port interface (down). Used by both the ACPI driver and (grumble) main.
1409 * Pair with PDMIACPICONNECTOR.
1410 */
1411typedef struct PDMIACPIPORT
1412{
1413 /**
1414 * Send an ACPI power off event.
1415 *
1416 * @returns VBox status code
1417 * @param pInterface Pointer to the interface structure containing the called function pointer.
1418 */
1419 DECLR3CALLBACKMEMBER(int, pfnPowerButtonPress,(PPDMIACPIPORT pInterface));
1420
1421 /**
1422 * Send an ACPI sleep button event.
1423 *
1424 * @returns VBox status code
1425 * @param pInterface Pointer to the interface structure containing the called function pointer.
1426 */
1427 DECLR3CALLBACKMEMBER(int, pfnSleepButtonPress,(PPDMIACPIPORT pInterface));
1428
1429 /**
1430 * Check if the last power button event was handled by the guest.
1431 *
1432 * @returns VBox status code
1433 * @param pInterface Pointer to the interface structure containing the called function pointer.
1434 * @param pfHandled Is set to true if the last power button event was handled, false otherwise.
1435 */
1436 DECLR3CALLBACKMEMBER(int, pfnGetPowerButtonHandled,(PPDMIACPIPORT pInterface, bool *pfHandled));
1437
1438 /**
1439 * Check if the guest entered the ACPI mode.
1440 *
1441 * @returns VBox status code
1442 * @param pInterface Pointer to the interface structure containing the called function pointer.
1443 * @param pfEntered Is set to true if the guest entered the ACPI mode, false otherwise.
1444 */
1445 DECLR3CALLBACKMEMBER(int, pfnGetGuestEnteredACPIMode,(PPDMIACPIPORT pInterface, bool *pfEntered));
1446
1447 /**
1448 * Check if the given CPU is still locked by the guest.
1449 *
1450 * @returns VBox status code
1451 * @param pInterface Pointer to the interface structure containing the called function pointer.
1452 * @param uCpu The CPU to check for.
1453 * @param pfLocked Is set to true if the CPU is still locked by the guest, false otherwise.
1454 */
1455 DECLR3CALLBACKMEMBER(int, pfnGetCpuStatus,(PPDMIACPIPORT pInterface, unsigned uCpu, bool *pfLocked));
1456
1457 /**
1458 * Send an ACPI monitor hot-plug event.
1459 *
1460 * @returns VBox status code
1461 * @param pInterface Pointer to the interface structure containing
1462 * the called function pointer.
1463 */
1464 DECLR3CALLBACKMEMBER(int, pfnMonitorHotPlugEvent,(PPDMIACPIPORT pInterface));
1465
1466 /**
1467 * Send a battery status change event.
1468 *
1469 * @returns VBox status code
1470 * @param pInterface Pointer to the interface structure containing
1471 * the called function pointer.
1472 */
1473 DECLR3CALLBACKMEMBER(int, pfnBatteryStatusChangeEvent,(PPDMIACPIPORT pInterface));
1474} PDMIACPIPORT;
1475/** PDMIACPIPORT interface ID. */
1476#define PDMIACPIPORT_IID "974cb8fb-7fda-408c-f9b4-7ff4e3b2a699"
1477
1478
1479/** Pointer to an ACPI connector interface. */
1480typedef struct PDMIACPICONNECTOR *PPDMIACPICONNECTOR;
1481/**
1482 * ACPI connector interface (up).
1483 * Pair with PDMIACPIPORT.
1484 */
1485typedef struct PDMIACPICONNECTOR
1486{
1487 /**
1488 * Get the current power source of the host system.
1489 *
1490 * @returns VBox status code
1491 * @param pInterface Pointer to the interface structure containing the called function pointer.
1492 * @param penmPowerSource Pointer to the power source result variable.
1493 */
1494 DECLR3CALLBACKMEMBER(int, pfnQueryPowerSource,(PPDMIACPICONNECTOR, PPDMACPIPOWERSOURCE penmPowerSource));
1495
1496 /**
1497 * Query the current battery status of the host system.
1498 *
1499 * @returns VBox status code?
1500 * @param pInterface Pointer to the interface structure containing the called function pointer.
1501 * @param pfPresent Is set to true if battery is present, false otherwise.
1502 * @param penmRemainingCapacity Pointer to the battery remaining capacity (0 - 100 or 255 for unknown).
1503 * @param penmBatteryState Pointer to the battery status.
1504 * @param pu32PresentRate Pointer to the present rate (0..1000 of the total capacity).
1505 */
1506 DECLR3CALLBACKMEMBER(int, pfnQueryBatteryStatus,(PPDMIACPICONNECTOR, bool *pfPresent, PPDMACPIBATCAPACITY penmRemainingCapacity,
1507 PPDMACPIBATSTATE penmBatteryState, uint32_t *pu32PresentRate));
1508} PDMIACPICONNECTOR;
1509/** PDMIACPICONNECTOR interface ID. */
1510#define PDMIACPICONNECTOR_IID "5f14bf8d-1edf-4e3a-a1e1-cca9fd08e359"
1511
1512struct VMMDevDisplayDef;
1513
1514/** Pointer to a VMMDevice port interface. */
1515typedef struct PDMIVMMDEVPORT *PPDMIVMMDEVPORT;
1516/**
1517 * VMMDevice port interface (down).
1518 * Pair with PDMIVMMDEVCONNECTOR.
1519 */
1520typedef struct PDMIVMMDEVPORT
1521{
1522 /**
1523 * Return the current absolute mouse position in pixels
1524 *
1525 * @returns VBox status code
1526 * @param pInterface Pointer to the interface structure containing the called function pointer.
1527 * @param pxAbs Pointer of result value, can be NULL
1528 * @param pyAbs Pointer of result value, can be NULL
1529 */
1530 DECLR3CALLBACKMEMBER(int, pfnQueryAbsoluteMouse,(PPDMIVMMDEVPORT pInterface, int32_t *pxAbs, int32_t *pyAbs));
1531
1532 /**
1533 * Set the new absolute mouse position in pixels
1534 *
1535 * @returns VBox status code
1536 * @param pInterface Pointer to the interface structure containing the called function pointer.
1537 * @param xAbs New absolute X position
1538 * @param yAbs New absolute Y position
1539 */
1540 DECLR3CALLBACKMEMBER(int, pfnSetAbsoluteMouse,(PPDMIVMMDEVPORT pInterface, int32_t xAbs, int32_t yAbs));
1541
1542 /**
1543 * Return the current mouse capability flags
1544 *
1545 * @returns VBox status code
1546 * @param pInterface Pointer to the interface structure containing the called function pointer.
1547 * @param pfCapabilities Pointer of result value
1548 */
1549 DECLR3CALLBACKMEMBER(int, pfnQueryMouseCapabilities,(PPDMIVMMDEVPORT pInterface, uint32_t *pfCapabilities));
1550
1551 /**
1552 * Set the current mouse capability flag (host side)
1553 *
1554 * @returns VBox status code
1555 * @param pInterface Pointer to the interface structure containing the called function pointer.
1556 * @param fCapsAdded Mask of capabilities to add to the flag
1557 * @param fCapsRemoved Mask of capabilities to remove from the flag
1558 */
1559 DECLR3CALLBACKMEMBER(int, pfnUpdateMouseCapabilities,(PPDMIVMMDEVPORT pInterface, uint32_t fCapsAdded, uint32_t fCapsRemoved));
1560
1561 /**
1562 * Issue a display resolution change request.
1563 *
1564 * Note that there can only one request in the queue and that in case the guest does
1565 * not process it, issuing another request will overwrite the previous.
1566 *
1567 * @returns VBox status code
1568 * @param pInterface Pointer to the interface structure containing the called function pointer.
1569 * @param cDisplays Number of displays. Can be either 1 or the number of VM virtual monitors.
1570 * @param paDisplays Definitions of guest screens to be applied. See VMMDev.h
1571 * @param fForce Whether to deliver the request to the guest even if the guest has
1572 * the requested resolution already.
1573 * @param fMayNotify Whether to send a hotplug notification to the guest if appropriate.
1574 */
1575 DECLR3CALLBACKMEMBER(int, pfnRequestDisplayChange,(PPDMIVMMDEVPORT pInterface, uint32_t cDisplays,
1576 struct VMMDevDisplayDef const *paDisplays, bool fForce, bool fMayNotify));
1577
1578 /**
1579 * Pass credentials to guest.
1580 *
1581 * Note that there can only be one set of credentials and the guest may or may not
1582 * query them and may do whatever it wants with them.
1583 *
1584 * @returns VBox status code.
1585 * @param pInterface Pointer to the interface structure containing the called function pointer.
1586 * @param pszUsername User name, may be empty (UTF-8).
1587 * @param pszPassword Password, may be empty (UTF-8).
1588 * @param pszDomain Domain name, may be empty (UTF-8).
1589 * @param fFlags VMMDEV_SETCREDENTIALS_*.
1590 */
1591 DECLR3CALLBACKMEMBER(int, pfnSetCredentials,(PPDMIVMMDEVPORT pInterface, const char *pszUsername,
1592 const char *pszPassword, const char *pszDomain,
1593 uint32_t fFlags));
1594
1595 /**
1596 * Notify the driver about a VBVA status change.
1597 *
1598 * @returns Nothing. Because it is informational callback.
1599 * @param pInterface Pointer to the interface structure containing the called function pointer.
1600 * @param fEnabled Current VBVA status.
1601 */
1602 DECLR3CALLBACKMEMBER(void, pfnVBVAChange, (PPDMIVMMDEVPORT pInterface, bool fEnabled));
1603
1604 /**
1605 * Issue a seamless mode change request.
1606 *
1607 * Note that there can only one request in the queue and that in case the guest does
1608 * not process it, issuing another request will overwrite the previous.
1609 *
1610 * @returns VBox status code
1611 * @param pInterface Pointer to the interface structure containing the called function pointer.
1612 * @param fEnabled Seamless mode enabled or not
1613 */
1614 DECLR3CALLBACKMEMBER(int, pfnRequestSeamlessChange,(PPDMIVMMDEVPORT pInterface, bool fEnabled));
1615
1616 /**
1617 * Issue a memory balloon change request.
1618 *
1619 * Note that there can only one request in the queue and that in case the guest does
1620 * not process it, issuing another request will overwrite the previous.
1621 *
1622 * @returns VBox status code
1623 * @param pInterface Pointer to the interface structure containing the called function pointer.
1624 * @param cMbBalloon Balloon size in megabytes
1625 */
1626 DECLR3CALLBACKMEMBER(int, pfnSetMemoryBalloon,(PPDMIVMMDEVPORT pInterface, uint32_t cMbBalloon));
1627
1628 /**
1629 * Issue a statistcs interval change request.
1630 *
1631 * Note that there can only one request in the queue and that in case the guest does
1632 * not process it, issuing another request will overwrite the previous.
1633 *
1634 * @returns VBox status code
1635 * @param pInterface Pointer to the interface structure containing the called function pointer.
1636 * @param cSecsStatInterval Statistics query interval in seconds
1637 * (0=disable).
1638 */
1639 DECLR3CALLBACKMEMBER(int, pfnSetStatisticsInterval,(PPDMIVMMDEVPORT pInterface, uint32_t cSecsStatInterval));
1640
1641 /**
1642 * Notify the guest about a VRDP status change.
1643 *
1644 * @returns VBox status code
1645 * @param pInterface Pointer to the interface structure containing the called function pointer.
1646 * @param fVRDPEnabled Current VRDP status.
1647 * @param uVRDPExperienceLevel Which visual effects to be disabled in
1648 * the guest.
1649 */
1650 DECLR3CALLBACKMEMBER(int, pfnVRDPChange, (PPDMIVMMDEVPORT pInterface, bool fVRDPEnabled, uint32_t uVRDPExperienceLevel));
1651
1652 /**
1653 * Notify the guest of CPU hot-unplug event.
1654 *
1655 * @returns VBox status code
1656 * @param pInterface Pointer to the interface structure containing the called function pointer.
1657 * @param idCpuCore The core id of the CPU to remove.
1658 * @param idCpuPackage The package id of the CPU to remove.
1659 */
1660 DECLR3CALLBACKMEMBER(int, pfnCpuHotUnplug, (PPDMIVMMDEVPORT pInterface, uint32_t idCpuCore, uint32_t idCpuPackage));
1661
1662 /**
1663 * Notify the guest of CPU hot-plug event.
1664 *
1665 * @returns VBox status code
1666 * @param pInterface Pointer to the interface structure containing the called function pointer.
1667 * @param idCpuCore The core id of the CPU to add.
1668 * @param idCpuPackage The package id of the CPU to add.
1669 */
1670 DECLR3CALLBACKMEMBER(int, pfnCpuHotPlug, (PPDMIVMMDEVPORT pInterface, uint32_t idCpuCore, uint32_t idCpuPackage));
1671
1672} PDMIVMMDEVPORT;
1673/** PDMIVMMDEVPORT interface ID. */
1674#define PDMIVMMDEVPORT_IID "9e004f1a-875d-11e9-a673-c77c30f53623"
1675
1676
1677/** Pointer to a HPET legacy notification interface. */
1678typedef struct PDMIHPETLEGACYNOTIFY *PPDMIHPETLEGACYNOTIFY;
1679/**
1680 * HPET legacy notification interface.
1681 */
1682typedef struct PDMIHPETLEGACYNOTIFY
1683{
1684 /**
1685 * Notify about change of HPET legacy mode.
1686 *
1687 * @param pInterface Pointer to the interface structure containing the
1688 * called function pointer.
1689 * @param fActivated If HPET legacy mode is activated (@c true) or
1690 * deactivated (@c false).
1691 */
1692 DECLR3CALLBACKMEMBER(void, pfnModeChanged,(PPDMIHPETLEGACYNOTIFY pInterface, bool fActivated));
1693} PDMIHPETLEGACYNOTIFY;
1694/** PDMIHPETLEGACYNOTIFY interface ID. */
1695#define PDMIHPETLEGACYNOTIFY_IID "c9ada595-4b65-4311-8b21-b10498997774"
1696
1697
1698/** @name Flags for PDMIVMMDEVPORT::pfnSetCredentials.
1699 * @{ */
1700/** The guest should perform a logon with the credentials. */
1701#define VMMDEV_SETCREDENTIALS_GUESTLOGON RT_BIT(0)
1702/** The guest should prevent local logons. */
1703#define VMMDEV_SETCREDENTIALS_NOLOCALLOGON RT_BIT(1)
1704/** The guest should verify the credentials. */
1705#define VMMDEV_SETCREDENTIALS_JUDGE RT_BIT(15)
1706/** @} */
1707
1708/** Forward declaration of the guest information structure. */
1709struct VBoxGuestInfo;
1710/** Forward declaration of the guest information-2 structure. */
1711struct VBoxGuestInfo2;
1712/** Forward declaration of the guest statistics structure */
1713struct VBoxGuestStatistics;
1714/** Forward declaration of the guest status structure */
1715struct VBoxGuestStatus;
1716
1717/** Forward declaration of the video accelerator command memory. */
1718struct VBVAMEMORY;
1719/** Pointer to video accelerator command memory. */
1720typedef struct VBVAMEMORY *PVBVAMEMORY;
1721
1722/** Pointer to a VMMDev connector interface. */
1723typedef struct PDMIVMMDEVCONNECTOR *PPDMIVMMDEVCONNECTOR;
1724/**
1725 * VMMDev connector interface (up).
1726 * Pair with PDMIVMMDEVPORT.
1727 */
1728typedef struct PDMIVMMDEVCONNECTOR
1729{
1730 /**
1731 * Update guest facility status.
1732 *
1733 * Called in response to VMMDevReq_ReportGuestStatus, reset or state restore.
1734 *
1735 * @param pInterface Pointer to this interface.
1736 * @param uFacility The facility.
1737 * @param uStatus The status.
1738 * @param fFlags Flags assoicated with the update. Currently
1739 * reserved and should be ignored.
1740 * @param pTimeSpecTS Pointer to the timestamp of this report.
1741 * @thread The emulation thread.
1742 */
1743 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestStatus,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t uFacility, uint16_t uStatus,
1744 uint32_t fFlags, PCRTTIMESPEC pTimeSpecTS));
1745
1746 /**
1747 * Updates a guest user state.
1748 *
1749 * Called in response to VMMDevReq_ReportGuestUserState.
1750 *
1751 * @param pInterface Pointer to this interface.
1752 * @param pszUser Guest user name to update status for.
1753 * @param pszDomain Domain the guest user is bound to. Optional.
1754 * @param uState New guest user state to notify host about.
1755 * @param pabDetails Pointer to optional state data.
1756 * @param cbDetails Size (in bytes) of optional state data.
1757 * @thread The emulation thread.
1758 */
1759 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestUserState,(PPDMIVMMDEVCONNECTOR pInterface, const char *pszUser,
1760 const char *pszDomain, uint32_t uState,
1761 const uint8_t *pabDetails, uint32_t cbDetails));
1762
1763 /**
1764 * Reports the guest API and OS version.
1765 * Called whenever the Additions issue a guest info report request.
1766 *
1767 * @param pInterface Pointer to this interface.
1768 * @param pGuestInfo Pointer to guest information structure
1769 * @thread The emulation thread.
1770 */
1771 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestInfo,(PPDMIVMMDEVCONNECTOR pInterface, const struct VBoxGuestInfo *pGuestInfo));
1772
1773 /**
1774 * Reports the detailed Guest Additions version.
1775 *
1776 * @param pInterface Pointer to this interface.
1777 * @param uFullVersion The guest additions version as a full version.
1778 * Use VBOX_FULL_VERSION_GET_MAJOR,
1779 * VBOX_FULL_VERSION_GET_MINOR and
1780 * VBOX_FULL_VERSION_GET_BUILD to access it.
1781 * (This will not be zero, so turn down the
1782 * paranoia level a notch.)
1783 * @param pszName Pointer to the sanitized version name. This can
1784 * be empty, but will not be NULL. If not empty,
1785 * it will contain a build type tag and/or a
1786 * publisher tag. If both, then they are separated
1787 * by an underscore (VBOX_VERSION_STRING fashion).
1788 * @param uRevision The SVN revision. Can be 0.
1789 * @param fFeatures Feature mask, currently none are defined.
1790 *
1791 * @thread The emulation thread.
1792 */
1793 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestInfo2,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t uFullVersion,
1794 const char *pszName, uint32_t uRevision, uint32_t fFeatures));
1795
1796 /**
1797 * Update the guest additions capabilities.
1798 * This is called when the guest additions capabilities change. The new capabilities
1799 * are given and the connector should update its internal state.
1800 *
1801 * @param pInterface Pointer to this interface.
1802 * @param newCapabilities New capabilities.
1803 * @thread The emulation thread.
1804 */
1805 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestCapabilities,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities));
1806
1807 /**
1808 * Update the mouse capabilities.
1809 * This is called when the mouse capabilities change. The new capabilities
1810 * are given and the connector should update its internal state.
1811 *
1812 * @param pInterface Pointer to this interface.
1813 * @param newCapabilities New capabilities.
1814 * @thread The emulation thread.
1815 */
1816 DECLR3CALLBACKMEMBER(void, pfnUpdateMouseCapabilities,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities));
1817
1818 /**
1819 * Update the pointer shape.
1820 * This is called when the mouse pointer shape changes. The new shape
1821 * is passed as a caller allocated buffer that will be freed after returning
1822 *
1823 * @param pInterface Pointer to this interface.
1824 * @param fVisible Visibility indicator (if false, the other parameters are undefined).
1825 * @param fAlpha Flag whether alpha channel is being passed.
1826 * @param xHot Pointer hot spot x coordinate.
1827 * @param yHot Pointer hot spot y coordinate.
1828 * @param x Pointer new x coordinate on screen.
1829 * @param y Pointer new y coordinate on screen.
1830 * @param cx Pointer width in pixels.
1831 * @param cy Pointer height in pixels.
1832 * @param cbScanline Size of one scanline in bytes.
1833 * @param pvShape New shape buffer.
1834 * @thread The emulation thread.
1835 */
1836 DECLR3CALLBACKMEMBER(void, pfnUpdatePointerShape,(PPDMIVMMDEVCONNECTOR pInterface, bool fVisible, bool fAlpha,
1837 uint32_t xHot, uint32_t yHot,
1838 uint32_t cx, uint32_t cy,
1839 void *pvShape));
1840
1841 /**
1842 * Enable or disable video acceleration on behalf of guest.
1843 *
1844 * @param pInterface Pointer to this interface.
1845 * @param fEnable Whether to enable acceleration.
1846 * @param pVbvaMemory Video accelerator memory.
1847
1848 * @return VBox rc. VINF_SUCCESS if VBVA was enabled.
1849 * @thread The emulation thread.
1850 */
1851 DECLR3CALLBACKMEMBER(int, pfnVideoAccelEnable,(PPDMIVMMDEVCONNECTOR pInterface, bool fEnable, PVBVAMEMORY pVbvaMemory));
1852
1853 /**
1854 * Force video queue processing.
1855 *
1856 * @param pInterface Pointer to this interface.
1857 * @thread The emulation thread.
1858 */
1859 DECLR3CALLBACKMEMBER(void, pfnVideoAccelFlush,(PPDMIVMMDEVCONNECTOR pInterface));
1860
1861 /**
1862 * Return whether the given video mode is supported/wanted by the host.
1863 *
1864 * @returns VBox status code
1865 * @param pInterface Pointer to this interface.
1866 * @param display The guest monitor, 0 for primary.
1867 * @param cy Video mode horizontal resolution in pixels.
1868 * @param cx Video mode vertical resolution in pixels.
1869 * @param cBits Video mode bits per pixel.
1870 * @param pfSupported Where to put the indicator for whether this mode is supported. (output)
1871 * @thread The emulation thread.
1872 */
1873 DECLR3CALLBACKMEMBER(int, pfnVideoModeSupported,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t display, uint32_t cx, uint32_t cy, uint32_t cBits, bool *pfSupported));
1874
1875 /**
1876 * Queries by how many pixels the height should be reduced when calculating video modes
1877 *
1878 * @returns VBox status code
1879 * @param pInterface Pointer to this interface.
1880 * @param pcyReduction Pointer to the result value.
1881 * @thread The emulation thread.
1882 */
1883 DECLR3CALLBACKMEMBER(int, pfnGetHeightReduction,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcyReduction));
1884
1885 /**
1886 * Informs about a credentials judgement result from the guest.
1887 *
1888 * @returns VBox status code
1889 * @param pInterface Pointer to this interface.
1890 * @param fFlags Judgement result flags.
1891 * @thread The emulation thread.
1892 */
1893 DECLR3CALLBACKMEMBER(int, pfnSetCredentialsJudgementResult,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t fFlags));
1894
1895 /**
1896 * Set the visible region of the display
1897 *
1898 * @returns VBox status code.
1899 * @param pInterface Pointer to this interface.
1900 * @param cRect Number of rectangles in pRect
1901 * @param pRect Rectangle array
1902 * @thread The emulation thread.
1903 */
1904 DECLR3CALLBACKMEMBER(int, pfnSetVisibleRegion,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t cRect, PRTRECT pRect));
1905
1906 /**
1907 * Update monitor positions (offsets).
1908 *
1909 * Passing monitor positions from the guest to host exclusively since vmwgfx
1910 * (linux driver) fails to do so thru the FIFO.
1911 *
1912 * @returns VBox status code.
1913 * @param pInterface Pointer to this interface.
1914 * @param cPositions Number of monitor positions
1915 * @param paPositions Positions array
1916 * @remarks Is allowed to be NULL.
1917 * @thread The emulation thread.
1918 * @sa PDMIDISPLAYPORT::pfnReportMonitorPositions
1919 */
1920 DECLR3CALLBACKMEMBER(int, pfnUpdateMonitorPositions,(PPDMIVMMDEVCONNECTOR pInterface,
1921 uint32_t cPositions, PCRTPOINT paPositions));
1922
1923 /**
1924 * Query the visible region of the display
1925 *
1926 * @returns VBox status code.
1927 * @param pInterface Pointer to this interface.
1928 * @param pcRects Where to return the number of rectangles in
1929 * paRects.
1930 * @param paRects Rectangle array (set to NULL to query the number
1931 * of rectangles)
1932 * @thread The emulation thread.
1933 */
1934 DECLR3CALLBACKMEMBER(int, pfnQueryVisibleRegion,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcRects, PRTRECT paRects));
1935
1936 /**
1937 * Request the statistics interval
1938 *
1939 * @returns VBox status code.
1940 * @param pInterface Pointer to this interface.
1941 * @param pulInterval Pointer to interval in seconds
1942 * @thread The emulation thread.
1943 */
1944 DECLR3CALLBACKMEMBER(int, pfnQueryStatisticsInterval,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pulInterval));
1945
1946 /**
1947 * Report new guest statistics
1948 *
1949 * @returns VBox status code.
1950 * @param pInterface Pointer to this interface.
1951 * @param pGuestStats Guest statistics
1952 * @thread The emulation thread.
1953 */
1954 DECLR3CALLBACKMEMBER(int, pfnReportStatistics,(PPDMIVMMDEVCONNECTOR pInterface, struct VBoxGuestStatistics *pGuestStats));
1955
1956 /**
1957 * Query the current balloon size
1958 *
1959 * @returns VBox status code.
1960 * @param pInterface Pointer to this interface.
1961 * @param pcbBalloon Balloon size
1962 * @thread The emulation thread.
1963 */
1964 DECLR3CALLBACKMEMBER(int, pfnQueryBalloonSize,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcbBalloon));
1965
1966 /**
1967 * Query the current page fusion setting
1968 *
1969 * @returns VBox status code.
1970 * @param pInterface Pointer to this interface.
1971 * @param pfPageFusionEnabled Pointer to boolean
1972 * @thread The emulation thread.
1973 */
1974 DECLR3CALLBACKMEMBER(int, pfnIsPageFusionEnabled,(PPDMIVMMDEVCONNECTOR pInterface, bool *pfPageFusionEnabled));
1975
1976} PDMIVMMDEVCONNECTOR;
1977/** PDMIVMMDEVCONNECTOR interface ID. */
1978#define PDMIVMMDEVCONNECTOR_IID "aff90240-a443-434e-9132-80c186ab97d4"
1979
1980
1981/**
1982 * Generic status LED core.
1983 * Note that a unit doesn't have to support all the indicators.
1984 */
1985typedef union PDMLEDCORE
1986{
1987 /** 32-bit view. */
1988 uint32_t volatile u32;
1989 /** Bit view. */
1990 struct
1991 {
1992 /** Reading/Receiving indicator. */
1993 uint32_t fReading : 1;
1994 /** Writing/Sending indicator. */
1995 uint32_t fWriting : 1;
1996 /** Busy indicator. */
1997 uint32_t fBusy : 1;
1998 /** Error indicator. */
1999 uint32_t fError : 1;
2000 } s;
2001} PDMLEDCORE;
2002
2003/** LED bit masks for the u32 view.
2004 * @{ */
2005/** Reading/Receiving indicator. */
2006#define PDMLED_READING RT_BIT(0)
2007/** Writing/Sending indicator. */
2008#define PDMLED_WRITING RT_BIT(1)
2009/** Busy indicator. */
2010#define PDMLED_BUSY RT_BIT(2)
2011/** Error indicator. */
2012#define PDMLED_ERROR RT_BIT(3)
2013/** @} */
2014
2015
2016/**
2017 * Generic status LED.
2018 * Note that a unit doesn't have to support all the indicators.
2019 */
2020typedef struct PDMLED
2021{
2022 /** Just a magic for sanity checking. */
2023 uint32_t u32Magic;
2024 uint32_t u32Alignment; /**< structure size alignment. */
2025 /** The actual LED status.
2026 * Only the device is allowed to change this. */
2027 PDMLEDCORE Actual;
2028 /** The asserted LED status which is cleared by the reader.
2029 * The device will assert the bits but never clear them.
2030 * The driver clears them as it sees fit. */
2031 PDMLEDCORE Asserted;
2032} PDMLED;
2033
2034/** Pointer to an LED. */
2035typedef PDMLED *PPDMLED;
2036/** Pointer to a const LED. */
2037typedef const PDMLED *PCPDMLED;
2038
2039/** Magic value for PDMLED::u32Magic. */
2040#define PDMLED_MAGIC UINT32_C(0x11335577)
2041
2042/** Pointer to an LED ports interface. */
2043typedef struct PDMILEDPORTS *PPDMILEDPORTS;
2044/**
2045 * Interface for exporting LEDs (down).
2046 * Pair with PDMILEDCONNECTORS.
2047 */
2048typedef struct PDMILEDPORTS
2049{
2050 /**
2051 * Gets the pointer to the status LED of a unit.
2052 *
2053 * @returns VBox status code.
2054 * @param pInterface Pointer to the interface structure containing the called function pointer.
2055 * @param iLUN The unit which status LED we desire.
2056 * @param ppLed Where to store the LED pointer.
2057 */
2058 DECLR3CALLBACKMEMBER(int, pfnQueryStatusLed,(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed));
2059
2060} PDMILEDPORTS;
2061/** PDMILEDPORTS interface ID. */
2062#define PDMILEDPORTS_IID "435e0cec-8549-4ca0-8c0d-98e52f1dc038"
2063
2064
2065/** Pointer to an LED connectors interface. */
2066typedef struct PDMILEDCONNECTORS *PPDMILEDCONNECTORS;
2067/**
2068 * Interface for reading LEDs (up).
2069 * Pair with PDMILEDPORTS.
2070 */
2071typedef struct PDMILEDCONNECTORS
2072{
2073 /**
2074 * Notification about a unit which have been changed.
2075 *
2076 * The driver must discard any pointers to data owned by
2077 * the unit and requery it.
2078 *
2079 * @param pInterface Pointer to the interface structure containing the called function pointer.
2080 * @param iLUN The unit number.
2081 */
2082 DECLR3CALLBACKMEMBER(void, pfnUnitChanged,(PPDMILEDCONNECTORS pInterface, unsigned iLUN));
2083} PDMILEDCONNECTORS;
2084/** PDMILEDCONNECTORS interface ID. */
2085#define PDMILEDCONNECTORS_IID "8ed63568-82a7-4193-b57b-db8085ac4495"
2086
2087
2088/** Pointer to a Media Notification interface. */
2089typedef struct PDMIMEDIANOTIFY *PPDMIMEDIANOTIFY;
2090/**
2091 * Interface for exporting Medium eject information (up). No interface pair.
2092 */
2093typedef struct PDMIMEDIANOTIFY
2094{
2095 /**
2096 * Signals that the medium was ejected.
2097 *
2098 * @returns VBox status code.
2099 * @param pInterface Pointer to the interface structure containing the called function pointer.
2100 * @param iLUN The unit which had the medium ejected.
2101 */
2102 DECLR3CALLBACKMEMBER(int, pfnEjected,(PPDMIMEDIANOTIFY pInterface, unsigned iLUN));
2103
2104} PDMIMEDIANOTIFY;
2105/** PDMIMEDIANOTIFY interface ID. */
2106#define PDMIMEDIANOTIFY_IID "fc22d53e-feb1-4a9c-b9fb-0a990a6ab288"
2107
2108
2109/** The special status unit number */
2110#define PDM_STATUS_LUN 999
2111
2112
2113#ifdef VBOX_WITH_HGCM
2114
2115/** Abstract HGCM command structure. Used only to define a typed pointer. */
2116struct VBOXHGCMCMD;
2117
2118/** Pointer to HGCM command structure. This pointer is unique and identifies
2119 * the command being processed. The pointer is passed to HGCM connector methods,
2120 * and must be passed back to HGCM port when command is completed.
2121 */
2122typedef struct VBOXHGCMCMD *PVBOXHGCMCMD;
2123
2124/** Pointer to a HGCM port interface. */
2125typedef struct PDMIHGCMPORT *PPDMIHGCMPORT;
2126/**
2127 * Host-Guest communication manager port interface (down). Normally implemented
2128 * by VMMDev.
2129 * Pair with PDMIHGCMCONNECTOR.
2130 */
2131typedef struct PDMIHGCMPORT
2132{
2133 /**
2134 * Notify the guest on a command completion.
2135 *
2136 * @returns VINF_SUCCESS or VERR_CANCELLED if the guest canceled the call.
2137 * @param pInterface Pointer to this interface.
2138 * @param rc The return code (VBox error code).
2139 * @param pCmd A pointer that identifies the completed command.
2140 */
2141 DECLR3CALLBACKMEMBER(int, pfnCompleted,(PPDMIHGCMPORT pInterface, int32_t rc, PVBOXHGCMCMD pCmd));
2142
2143 /**
2144 * Checks if @a pCmd was restored & resubmitted from saved state.
2145 *
2146 * @returns true if restored, false if not.
2147 * @param pInterface Pointer to this interface.
2148 * @param pCmd The command we're checking on.
2149 */
2150 DECLR3CALLBACKMEMBER(bool, pfnIsCmdRestored,(PPDMIHGCMPORT pInterface, PVBOXHGCMCMD pCmd));
2151
2152 /**
2153 * Checks if @a pCmd was cancelled.
2154 *
2155 * @returns true if cancelled, false if not.
2156 * @param pInterface Pointer to this interface.
2157 * @param pCmd The command we're checking on.
2158 */
2159 DECLR3CALLBACKMEMBER(bool, pfnIsCmdCancelled,(PPDMIHGCMPORT pInterface, PVBOXHGCMCMD pCmd));
2160
2161 /**
2162 * Gets the VMMDevRequestHeader::fRequestor value for @a pCmd.
2163 *
2164 * @returns The fRequestor value, VMMDEV_REQUESTOR_LEGACY if guest does not
2165 * support it, VMMDEV_REQUESTOR_LOWEST if invalid parameters.
2166 * @param pInterface Pointer to this interface.
2167 * @param pCmd The command we're in checking on.
2168 */
2169 DECLR3CALLBACKMEMBER(uint32_t, pfnGetRequestor,(PPDMIHGCMPORT pInterface, PVBOXHGCMCMD pCmd));
2170
2171 /**
2172 * Gets the VMMDevState::idSession value.
2173 *
2174 * @returns VMMDevState::idSession.
2175 * @param pInterface Pointer to this interface.
2176 */
2177 DECLR3CALLBACKMEMBER(uint64_t, pfnGetVMMDevSessionId,(PPDMIHGCMPORT pInterface));
2178
2179} PDMIHGCMPORT;
2180/** PDMIHGCMPORT interface ID. */
2181# define PDMIHGCMPORT_IID "28c0a201-68cd-4752-9404-bb42a0c09eb7"
2182
2183/* forward decl to hgvmsvc.h. */
2184struct VBOXHGCMSVCPARM;
2185/** Pointer to a HGCM service location structure. */
2186typedef struct HGCMSERVICELOCATION *PHGCMSERVICELOCATION;
2187/** Pointer to a HGCM connector interface. */
2188typedef struct PDMIHGCMCONNECTOR *PPDMIHGCMCONNECTOR;
2189/**
2190 * The Host-Guest communication manager connector interface (up). Normally
2191 * implemented by Main::VMMDevInterface.
2192 * Pair with PDMIHGCMPORT.
2193 */
2194typedef struct PDMIHGCMCONNECTOR
2195{
2196 /**
2197 * Locate a service and inform it about a client connection.
2198 *
2199 * @param pInterface Pointer to this interface.
2200 * @param pCmd A pointer that identifies the command.
2201 * @param pServiceLocation Pointer to the service location structure.
2202 * @param pu32ClientID Where to store the client id for the connection.
2203 * @return VBox status code.
2204 * @thread The emulation thread.
2205 */
2206 DECLR3CALLBACKMEMBER(int, pfnConnect,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, PHGCMSERVICELOCATION pServiceLocation, uint32_t *pu32ClientID));
2207
2208 /**
2209 * Disconnect from service.
2210 *
2211 * @param pInterface Pointer to this interface.
2212 * @param pCmd A pointer that identifies the command.
2213 * @param u32ClientID The client id returned by the pfnConnect call.
2214 * @return VBox status code.
2215 * @thread The emulation thread.
2216 */
2217 DECLR3CALLBACKMEMBER(int, pfnDisconnect,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID));
2218
2219 /**
2220 * Process a guest issued command.
2221 *
2222 * @param pInterface Pointer to this interface.
2223 * @param pCmd A pointer that identifies the command.
2224 * @param u32ClientID The client id returned by the pfnConnect call.
2225 * @param u32Function Function to be performed by the service.
2226 * @param cParms Number of parameters in the array pointed to by paParams.
2227 * @param paParms Pointer to an array of parameters.
2228 * @param tsArrival The STAM_GET_TS() value when the request arrived.
2229 * @return VBox status code.
2230 * @thread The emulation thread.
2231 */
2232 DECLR3CALLBACKMEMBER(int, pfnCall,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID, uint32_t u32Function,
2233 uint32_t cParms, struct VBOXHGCMSVCPARM *paParms, uint64_t tsArrival));
2234
2235 /**
2236 * Notification about the guest cancelling a pending request.
2237 * @param pInterface Pointer to this interface.
2238 * @param pCmd A pointer that identifies the command.
2239 * @param idclient The client id returned by the pfnConnect call.
2240 */
2241 DECLR3CALLBACKMEMBER(void, pfnCancelled,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t idClient));
2242
2243} PDMIHGCMCONNECTOR;
2244/** PDMIHGCMCONNECTOR interface ID. */
2245# define PDMIHGCMCONNECTOR_IID "33cb5c91-6a4a-4ad9-3fec-d1f7d413c4a5"
2246
2247#endif /* VBOX_WITH_HGCM */
2248
2249
2250/** Pointer to a display VBVA callbacks interface. */
2251typedef struct PDMIDISPLAYVBVACALLBACKS *PPDMIDISPLAYVBVACALLBACKS;
2252/**
2253 * Display VBVA callbacks interface (up).
2254 */
2255typedef struct PDMIDISPLAYVBVACALLBACKS
2256{
2257
2258 /**
2259 * Informs guest about completion of processing the given Video HW Acceleration
2260 * command, does not wait for the guest to process the command.
2261 *
2262 * @returns ???
2263 * @param pInterface Pointer to this interface.
2264 * @param pCmd The Video HW Acceleration Command that was
2265 * completed.
2266 */
2267 DECLR3CALLBACKMEMBER(int, pfnVHWACommandCompleteAsync,(PPDMIDISPLAYVBVACALLBACKS pInterface,
2268 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCmd));
2269} PDMIDISPLAYVBVACALLBACKS;
2270/** PDMIDISPLAYVBVACALLBACKS */
2271#define PDMIDISPLAYVBVACALLBACKS_IID "37f34c9c-0491-47dc-a0b3-81697c44a416"
2272
2273/** Pointer to a PCI raw connector interface. */
2274typedef struct PDMIPCIRAWCONNECTOR *PPDMIPCIRAWCONNECTOR;
2275/**
2276 * PCI raw connector interface (up).
2277 */
2278typedef struct PDMIPCIRAWCONNECTOR
2279{
2280
2281 /**
2282 *
2283 */
2284 DECLR3CALLBACKMEMBER(int, pfnDeviceConstructComplete, (PPDMIPCIRAWCONNECTOR pInterface, const char *pcszName,
2285 uint32_t uHostPciAddress, uint32_t uGuestPciAddress,
2286 int rc));
2287
2288} PDMIPCIRAWCONNECTOR;
2289/** PDMIPCIRAWCONNECTOR interface ID. */
2290#define PDMIPCIRAWCONNECTOR_IID "14aa9c6c-8869-4782-9dfc-910071a6aebf"
2291
2292
2293/** Pointer to a VFS connector interface. */
2294typedef struct PDMIVFSCONNECTOR *PPDMIVFSCONNECTOR;
2295/**
2296 * VFS connector interface (up).
2297 */
2298typedef struct PDMIVFSCONNECTOR
2299{
2300 /**
2301 * Queries the size of the given path.
2302 *
2303 * @returns VBox status code.
2304 * @retval VERR_NOT_FOUND if the path is not available.
2305 * @param pInterface Pointer to this interface.
2306 * @param pszNamespace The namespace for the path (usually driver/device name) or NULL for default namespace.
2307 * @param pszPath The path to query the size for.
2308 * @param pcb Where to store the size of the path in bytes on success.
2309 */
2310 DECLR3CALLBACKMEMBER(int, pfnQuerySize, (PPDMIVFSCONNECTOR pInterface, const char *pszNamespace, const char *pszPath,
2311 uint64_t *pcb));
2312
2313 /**
2314 * Reads everything from the given path and stores the data into the supplied buffer.
2315 *
2316 * @returns VBox status code.
2317 * @retval VERR_NOT_FOUND if the path is not available.
2318 * @retval VERR_BUFFER_OVERFLOW if the supplied buffer is too small to read everything.
2319 * @retval VINF_BUFFER_UNDERFLOW if the supplied buffer is too large.
2320 * @param pInterface Pointer to this interface.
2321 * @param pszNamespace The namespace for the path (usually driver/device name) or NULL for default namespace.
2322 * @param pszPath The path to read everything for.
2323 * @param pvBuf Where to store the data.
2324 * @param cbRead How much to read.
2325 */
2326 DECLR3CALLBACKMEMBER(int, pfnReadAll, (PPDMIVFSCONNECTOR pInterface, const char *pszNamespace, const char *pszPath,
2327 void *pvBuf, size_t cbRead));
2328
2329 /**
2330 * Writes the supplied data to the given path, overwriting any previously existing data.
2331 *
2332 * @returns VBox status code.
2333 * @param pInterface Pointer to this interface.
2334 * @param pszNamespace The namespace for the path (usually driver/device name) or NULL for default namespace.
2335 * @param pszPath The path to write everything to.
2336 * @param pvBuf The data to store.
2337 * @param cbWrite How many bytes to write.
2338 */
2339 DECLR3CALLBACKMEMBER(int, pfnWriteAll, (PPDMIVFSCONNECTOR pInterface, const char *pszNamespace, const char *pszPath,
2340 const void *pvBuf, size_t cbWrite));
2341
2342 /**
2343 * Deletes the given path.
2344 *
2345 * @returns VBox status code.
2346 * @retval VERR_NOT_FOUND if the path is not available.
2347 * @param pszNamespace The namespace for the path (usually driver/device name) or NULL for default namespace.
2348 * @param pszPath The path to delete.
2349 */
2350 DECLR3CALLBACKMEMBER(int, pfnDelete, (PPDMIVFSCONNECTOR pInterface, const char *pszNamespace, const char *pszPath));
2351
2352 /** @todo Add standard open/read/write/close callbacks when the need arises. */
2353
2354} PDMIVFSCONNECTOR;
2355/** PDMIVFSCONNECTOR interface ID. */
2356#define PDMIVFSCONNECTOR_IID "a1fc51e0-414a-4e78-8388-8053b9dc6521"
2357
2358/** @} */
2359
2360RT_C_DECLS_END
2361
2362#endif /* !VBOX_INCLUDED_vmm_pdmifs_h */
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