VirtualBox

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

Last change on this file since 108994 was 108641, checked in by vboxsync, 5 weeks ago

Removed 2D video acceleration (aka VHWA / VBOX_WITH_VIDEOHWACCEL). bugref:10756

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 100.9 KB
Line 
1/** @file
2 * PDM - Pluggable Device Manager, Interfaces.
3 */
4
5/*
6 * Copyright (C) 2006-2024 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 VBVA command header. */
806typedef struct VBVACMDHDR *PVBVACMDHDR;
807/** Pointer to a const VBVA command header. */
808typedef const struct VBVACMDHDR *PCVBVACMDHDR;
809/** Pointer to a VBVA screen information. */
810typedef struct VBVAINFOSCREEN *PVBVAINFOSCREEN;
811/** Pointer to a const VBVA screen information. */
812typedef const struct VBVAINFOSCREEN *PCVBVAINFOSCREEN;
813/** Pointer to a VBVA guest VRAM area information. */
814typedef struct VBVAINFOVIEW *PVBVAINFOVIEW;
815/** Pointer to a const VBVA guest VRAM area information. */
816typedef const struct VBVAINFOVIEW *PCVBVAINFOVIEW;
817typedef struct VBVAHOSTFLAGS *PVBVAHOSTFLAGS;
818
819/** Pointer to a display connector interface. */
820typedef struct PDMIDISPLAYCONNECTOR *PPDMIDISPLAYCONNECTOR;
821
822/**
823 * Display connector interface (up).
824 * Pair with PDMIDISPLAYPORT.
825 */
826typedef struct PDMIDISPLAYCONNECTOR
827{
828 /**
829 * Resize the display.
830 * This is called when the resolution changes. This usually happens on
831 * request from the guest os, but may also happen as the result of a reset.
832 * If the callback returns VINF_VGA_RESIZE_IN_PROGRESS, the caller (VGA device)
833 * must not access the connector and return.
834 *
835 * @returns VINF_SUCCESS if the framebuffer resize was completed,
836 * VINF_VGA_RESIZE_IN_PROGRESS if resize takes time and not yet finished.
837 * @param pInterface Pointer to this interface.
838 * @param cBits Color depth (bits per pixel) of the new video mode.
839 * @param pvVRAM Address of the guest VRAM.
840 * @param cbLine Size in bytes of a single scan line.
841 * @param cx New display width.
842 * @param cy New display height.
843 * @thread The emulation thread.
844 */
845 DECLR3CALLBACKMEMBER(int, pfnResize,(PPDMIDISPLAYCONNECTOR pInterface, uint32_t cBits, void *pvVRAM, uint32_t cbLine,
846 uint32_t cx, uint32_t cy));
847
848 /**
849 * Update a rectangle of the display.
850 * PDMIDISPLAYPORT::pfnUpdateDisplay is the caller.
851 *
852 * @param pInterface Pointer to this interface.
853 * @param x The upper left corner x coordinate of the rectangle.
854 * @param y The upper left corner y coordinate of the rectangle.
855 * @param cx The width of the rectangle.
856 * @param cy The height of the rectangle.
857 * @thread The emulation thread.
858 */
859 DECLR3CALLBACKMEMBER(void, pfnUpdateRect,(PPDMIDISPLAYCONNECTOR pInterface, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy));
860
861 /**
862 * Refresh the display.
863 *
864 * The interval between these calls is set by
865 * PDMIDISPLAYPORT::pfnSetRefreshRate(). The driver should call
866 * PDMIDISPLAYPORT::pfnUpdateDisplay() if it wishes to refresh the
867 * display. PDMIDISPLAYPORT::pfnUpdateDisplay calls pfnUpdateRect with
868 * the changed rectangles.
869 *
870 * @param pInterface Pointer to this interface.
871 * @thread The emulation thread or timer queue thread.
872 */
873 DECLR3CALLBACKMEMBER(void, pfnRefresh,(PPDMIDISPLAYCONNECTOR pInterface));
874
875 /**
876 * Reset the display.
877 *
878 * Notification message when the graphics card has been reset.
879 *
880 * @param pInterface Pointer to this interface.
881 * @thread The emulation thread.
882 */
883 DECLR3CALLBACKMEMBER(void, pfnReset,(PPDMIDISPLAYCONNECTOR pInterface));
884
885 /**
886 * LFB video mode enter/exit.
887 *
888 * Notification message when LinearFrameBuffer video mode is enabled/disabled.
889 *
890 * @param pInterface Pointer to this interface.
891 * @param fEnabled false - LFB mode was disabled,
892 * true - an LFB mode was disabled
893 * @thread The emulation thread.
894 */
895 DECLR3CALLBACKMEMBER(void, pfnLFBModeChange,(PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled));
896
897 /**
898 * Process the guest graphics adapter information.
899 *
900 * Direct notification from guest to the display connector.
901 *
902 * @param pInterface Pointer to this interface.
903 * @param pvVRAM Address of the guest VRAM.
904 * @param u32VRAMSize Size of the guest VRAM.
905 * @thread The emulation thread.
906 */
907 DECLR3CALLBACKMEMBER(void, pfnProcessAdapterData,(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, uint32_t u32VRAMSize));
908
909 /**
910 * Process the guest display information.
911 *
912 * Direct notification from guest to the display connector.
913 *
914 * @param pInterface Pointer to this interface.
915 * @param pvVRAM Address of the guest VRAM.
916 * @param uScreenId The index of the guest display to be processed.
917 * @thread The emulation thread.
918 */
919 DECLR3CALLBACKMEMBER(void, pfnProcessDisplayData,(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, unsigned uScreenId));
920
921 /**
922 * The specified screen enters VBVA mode.
923 *
924 * @param pInterface Pointer to this interface.
925 * @param uScreenId The screen updates are for.
926 * @param pHostFlags Undocumented!
927 * @thread The emulation thread.
928 */
929 DECLR3CALLBACKMEMBER(int, pfnVBVAEnable,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId,
930 struct VBVAHOSTFLAGS RT_UNTRUSTED_VOLATILE_GUEST *pHostFlags));
931
932 /**
933 * The specified screen leaves VBVA mode.
934 *
935 * @param pInterface Pointer to this interface.
936 * @param uScreenId The screen updates are for.
937 * @thread if render thread mode is on (fRenderThreadMode that was passed to pfnVBVAEnable is TRUE) - the render thread pfnVBVAEnable was called in,
938 * otherwise - the emulation thread.
939 */
940 DECLR3CALLBACKMEMBER(void, pfnVBVADisable,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId));
941
942 /**
943 * A sequence of pfnVBVAUpdateProcess calls begins.
944 *
945 * @param pInterface Pointer to this interface.
946 * @param uScreenId The screen updates are for.
947 * @thread if render thread mode is on (fRenderThreadMode that was passed to pfnVBVAEnable is TRUE) - the render thread pfnVBVAEnable was called in,
948 * otherwise - the emulation thread.
949 */
950 DECLR3CALLBACKMEMBER(void, pfnVBVAUpdateBegin,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId));
951
952 /**
953 * Process the guest VBVA command.
954 *
955 * @param pInterface Pointer to this interface.
956 * @param uScreenId The screen updates are for.
957 * @param pCmd Video HW Acceleration Command to be processed.
958 * @param cbCmd Undocumented!
959 * @thread if render thread mode is on (fRenderThreadMode that was passed to pfnVBVAEnable is TRUE) - the render thread pfnVBVAEnable was called in,
960 * otherwise - the emulation thread.
961 */
962 DECLR3CALLBACKMEMBER(void, pfnVBVAUpdateProcess,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId,
963 struct VBVACMDHDR const RT_UNTRUSTED_VOLATILE_GUEST *pCmd, size_t cbCmd));
964
965 /**
966 * A sequence of pfnVBVAUpdateProcess calls ends.
967 *
968 * @param pInterface Pointer to this interface.
969 * @param uScreenId The screen updates are for.
970 * @param x The upper left corner x coordinate of the combined rectangle of all VBVA updates.
971 * @param y The upper left corner y coordinate of the rectangle.
972 * @param cx The width of the rectangle.
973 * @param cy The height of the rectangle.
974 * @thread if render thread mode is on (fRenderThreadMode that was passed to pfnVBVAEnable is TRUE) - the render thread pfnVBVAEnable was called in,
975 * otherwise - the emulation thread.
976 */
977 DECLR3CALLBACKMEMBER(void, pfnVBVAUpdateEnd,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, int32_t x, int32_t y,
978 uint32_t cx, uint32_t cy));
979
980 /**
981 * Resize the display.
982 * This is called when the resolution changes. This usually happens on
983 * request from the guest os, but may also happen as the result of a reset.
984 * If the callback returns VINF_VGA_RESIZE_IN_PROGRESS, the caller (VGA device)
985 * must not access the connector and return.
986 *
987 * @todo Merge with pfnResize.
988 *
989 * @returns VINF_SUCCESS if the framebuffer resize was completed,
990 * VINF_VGA_RESIZE_IN_PROGRESS if resize takes time and not yet finished.
991 * @param pInterface Pointer to this interface.
992 * @param pView The description of VRAM block for this screen.
993 * @param pScreen The data of screen being resized.
994 * @param pvVRAM Address of the guest VRAM.
995 * @param fResetInputMapping Whether to reset the absolute pointing device to screen position co-ordinate
996 * mapping. Needed for real resizes, as the caller on the guest may not know how
997 * to set the mapping. Not wanted when we restore a saved state and are resetting
998 * the mode.
999 * @thread if render thread mode is on (fRenderThreadMode that was passed to pfnVBVAEnable is TRUE) - the render thread pfnVBVAEnable was called in,
1000 * otherwise - the emulation thread.
1001 */
1002 DECLR3CALLBACKMEMBER(int, pfnVBVAResize,(PPDMIDISPLAYCONNECTOR pInterface, PCVBVAINFOVIEW pView, PCVBVAINFOSCREEN pScreen,
1003 void *pvVRAM, bool fResetInputMapping));
1004
1005 /**
1006 * Update the pointer shape.
1007 * This is called when the mouse pointer shape changes. The new shape
1008 * is passed as a caller allocated buffer that will be freed after returning
1009 *
1010 * @param pInterface Pointer to this interface.
1011 * @param fVisible Visibility indicator (if false, the other parameters are undefined).
1012 * @param fAlpha Flag whether alpha channel is being passed.
1013 * @param xHot Pointer hot spot x coordinate.
1014 * @param yHot Pointer hot spot y coordinate.
1015 * @param cx Pointer width in pixels.
1016 * @param cy Pointer height in pixels.
1017 * @param pvShape New shape buffer.
1018 * @thread The emulation thread.
1019 */
1020 DECLR3CALLBACKMEMBER(int, pfnVBVAMousePointerShape,(PPDMIDISPLAYCONNECTOR pInterface, bool fVisible, bool fAlpha,
1021 uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy,
1022 const void *pvShape));
1023
1024 /**
1025 * The guest capabilities were updated.
1026 *
1027 * @param pInterface Pointer to this interface.
1028 * @param fCapabilities The new capability flag state.
1029 * @thread The emulation thread.
1030 */
1031 DECLR3CALLBACKMEMBER(void, pfnVBVAGuestCapabilityUpdate,(PPDMIDISPLAYCONNECTOR pInterface, uint32_t fCapabilities));
1032
1033 /** Read-only attributes.
1034 * For preformance reasons some readonly attributes are kept in the interface.
1035 * We trust the interface users to respect the readonlyness of these.
1036 * @{
1037 */
1038 /** Pointer to the display data buffer. */
1039 uint8_t *pbData;
1040 /** Size of a scanline in the data buffer. */
1041 uint32_t cbScanline;
1042 /** The color depth (in bits) the graphics card is supposed to provide. */
1043 uint32_t cBits;
1044 /** The display width. */
1045 uint32_t cx;
1046 /** The display height. */
1047 uint32_t cy;
1048 /** @} */
1049
1050 /**
1051 * The guest display input mapping rectangle was updated.
1052 *
1053 * @param pInterface Pointer to this interface.
1054 * @param xOrigin Upper left X co-ordinate relative to the first screen.
1055 * @param yOrigin Upper left Y co-ordinate relative to the first screen.
1056 * @param cx Rectangle width.
1057 * @param cy Rectangle height.
1058 * @thread The emulation thread.
1059 */
1060 DECLR3CALLBACKMEMBER(void, pfnVBVAInputMappingUpdate,(PPDMIDISPLAYCONNECTOR pInterface, int32_t xOrigin, int32_t yOrigin, uint32_t cx, uint32_t cy));
1061
1062 /**
1063 * The guest is reporting the requested location of the host pointer.
1064 *
1065 * @param pInterface Pointer to this interface.
1066 * @param fFlags VBVA_CURSOR_*
1067 * @param uScreenId The screen to which X and Y are relative if VBVA_CURSOR_SCREEN_RELATIVE is set.
1068 * @param x Cursor X offset.
1069 * @param y Cursor Y offset.
1070 * @thread The emulation thread.
1071 */
1072 DECLR3CALLBACKMEMBER(void, pfnVBVAReportCursorPosition,(PPDMIDISPLAYCONNECTOR pInterface, uint32_t fFlags, uint32_t uScreen, uint32_t x, uint32_t y));
1073
1074 /**
1075 * Process the graphics device HW Acceleration command.
1076 *
1077 * @param pInterface Pointer to this interface.
1078 * @param p3DNotify Acceleration Command to be processed.
1079 * @thread The graphics device thread: FIFO for the VMSVGA device.
1080 */
1081 DECLR3CALLBACKMEMBER(int, pfn3DNotifyProcess,(PPDMIDISPLAYCONNECTOR pInterface,
1082 VBOX3DNOTIFY *p3DNotify));
1083} PDMIDISPLAYCONNECTOR;
1084/** PDMIDISPLAYCONNECTOR interface ID. */
1085#define PDMIDISPLAYCONNECTOR_IID "cdd562e4-8030-11ea-8d40-bbc8e146c565"
1086
1087
1088/** Pointer to a secret key interface. */
1089typedef struct PDMISECKEY *PPDMISECKEY;
1090
1091/**
1092 * Secret key interface to retrieve secret keys.
1093 */
1094typedef struct PDMISECKEY
1095{
1096 /**
1097 * Retains a key identified by the ID. The caller will only hold a reference
1098 * to the key and must not modify the key buffer in any way.
1099 *
1100 * @returns VBox status code.
1101 * @param pInterface Pointer to this interface.
1102 * @param pszId The alias/id for the key to retrieve.
1103 * @param ppbKey Where to store the pointer to the key buffer on success.
1104 * @param pcbKey Where to store the size of the key in bytes on success.
1105 */
1106 DECLR3CALLBACKMEMBER(int, pfnKeyRetain, (PPDMISECKEY pInterface, const char *pszId,
1107 const uint8_t **pbKey, size_t *pcbKey));
1108
1109 /**
1110 * Releases one reference of the key identified by the given identifier.
1111 * The caller must not access the key buffer after calling this operation.
1112 *
1113 * @returns VBox status code.
1114 * @param pInterface Pointer to this interface.
1115 * @param pszId The alias/id for the key to release.
1116 *
1117 * @note: It is advised to release the key whenever it is not used anymore so the entity
1118 * storing the key can do anything to make retrieving the key from memory more
1119 * difficult like scrambling the memory buffer for instance.
1120 */
1121 DECLR3CALLBACKMEMBER(int, pfnKeyRelease, (PPDMISECKEY pInterface, const char *pszId));
1122
1123 /**
1124 * Retains a password identified by the ID. The caller will only hold a reference
1125 * to the password and must not modify the buffer in any way.
1126 *
1127 * @returns VBox status code.
1128 * @param pInterface Pointer to this interface.
1129 * @param pszId The alias/id for the password to retrieve.
1130 * @param ppszPassword Where to store the pointer to the password on success.
1131 */
1132 DECLR3CALLBACKMEMBER(int, pfnPasswordRetain, (PPDMISECKEY pInterface, const char *pszId,
1133 const char **ppszPassword));
1134
1135 /**
1136 * Releases one reference of the password identified by the given identifier.
1137 * The caller must not access the password after calling this operation.
1138 *
1139 * @returns VBox status code.
1140 * @param pInterface Pointer to this interface.
1141 * @param pszId The alias/id for the password to release.
1142 *
1143 * @note: It is advised to release the password whenever it is not used anymore so the entity
1144 * storing the password can do anything to make retrieving the password from memory more
1145 * difficult like scrambling the memory buffer for instance.
1146 */
1147 DECLR3CALLBACKMEMBER(int, pfnPasswordRelease, (PPDMISECKEY pInterface, const char *pszId));
1148} PDMISECKEY;
1149/** PDMISECKEY interface ID. */
1150#define PDMISECKEY_IID "3d698355-d995-453d-960f-31566a891df2"
1151
1152/** Pointer to a secret key helper interface. */
1153typedef struct PDMISECKEYHLP *PPDMISECKEYHLP;
1154
1155/**
1156 * Secret key helper interface for non critical functionality.
1157 */
1158typedef struct PDMISECKEYHLP
1159{
1160 /**
1161 * Notifies the interface provider that a key couldn't be retrieved from the key store.
1162 *
1163 * @returns VBox status code.
1164 * @param pInterface Pointer to this interface.
1165 */
1166 DECLR3CALLBACKMEMBER(int, pfnKeyMissingNotify, (PPDMISECKEYHLP pInterface));
1167
1168} PDMISECKEYHLP;
1169/** PDMISECKEY interface ID. */
1170#define PDMISECKEYHLP_IID "7be96168-4156-40ac-86d2-3073bf8b318e"
1171
1172
1173/** Pointer to a stream interface. */
1174typedef struct PDMISTREAM *PPDMISTREAM;
1175/**
1176 * Stream interface (up).
1177 * Makes up the foundation for PDMICHARCONNECTOR. No pair interface.
1178 */
1179typedef struct PDMISTREAM
1180{
1181 /**
1182 * Polls for the specified events.
1183 *
1184 * @returns VBox status code.
1185 * @retval VERR_INTERRUPTED if the poll was interrupted.
1186 * @retval VERR_TIMEOUT if the maximum waiting time was reached.
1187 * @param pInterface Pointer to the interface structure containing the called function pointer.
1188 * @param fEvts The events to poll for, see RTPOLL_EVT_XXX.
1189 * @param pfEvts Where to return details about the events that occurred.
1190 * @param cMillies Number of milliseconds to wait. Use
1191 * RT_INDEFINITE_WAIT to wait for ever.
1192 */
1193 DECLR3CALLBACKMEMBER(int, pfnPoll,(PPDMISTREAM pInterface, uint32_t fEvts, uint32_t *pfEvts, RTMSINTERVAL cMillies));
1194
1195 /**
1196 * Interrupts the current poll call.
1197 *
1198 * @returns VBox status code.
1199 * @param pInterface Pointer to the interface structure containing the called function pointer.
1200 */
1201 DECLR3CALLBACKMEMBER(int, pfnPollInterrupt,(PPDMISTREAM pInterface));
1202
1203 /**
1204 * Read bits.
1205 *
1206 * @returns VBox status code.
1207 * @param pInterface Pointer to the interface structure containing the called function pointer.
1208 * @param pvBuf Where to store the read bits.
1209 * @param pcbRead Number of bytes to read/bytes actually read.
1210 * @thread Any thread.
1211 *
1212 * @note: This is non blocking, use the poll callback to block when there is nothing to read.
1213 */
1214 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMISTREAM pInterface, void *pvBuf, size_t *pcbRead));
1215
1216 /**
1217 * Write bits.
1218 *
1219 * @returns VBox status code.
1220 * @param pInterface Pointer to the interface structure containing the called function pointer.
1221 * @param pvBuf Where to store the write bits.
1222 * @param pcbWrite Number of bytes to write/bytes actually written.
1223 * @thread Any thread.
1224 *
1225 * @note: This is non blocking, use the poll callback to block until there is room to write.
1226 */
1227 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMISTREAM pInterface, const void *pvBuf, size_t *pcbWrite));
1228} PDMISTREAM;
1229/** PDMISTREAM interface ID. */
1230#define PDMISTREAM_IID "f9bd1ba6-c134-44cc-8259-febe14393952"
1231
1232
1233/** Mode of the parallel port */
1234typedef enum PDMPARALLELPORTMODE
1235{
1236 /** First invalid mode. */
1237 PDM_PARALLEL_PORT_MODE_INVALID = 0,
1238 /** SPP (Compatibility mode). */
1239 PDM_PARALLEL_PORT_MODE_SPP,
1240 /** EPP Data mode. */
1241 PDM_PARALLEL_PORT_MODE_EPP_DATA,
1242 /** EPP Address mode. */
1243 PDM_PARALLEL_PORT_MODE_EPP_ADDR,
1244 /** ECP mode (not implemented yet). */
1245 PDM_PARALLEL_PORT_MODE_ECP,
1246 /** 32bit hack. */
1247 PDM_PARALLEL_PORT_MODE_32BIT_HACK = 0x7fffffff
1248} PDMPARALLELPORTMODE;
1249
1250/** Pointer to a host parallel port interface. */
1251typedef struct PDMIHOSTPARALLELPORT *PPDMIHOSTPARALLELPORT;
1252/**
1253 * Host parallel port interface (down).
1254 * Pair with PDMIHOSTPARALLELCONNECTOR.
1255 */
1256typedef struct PDMIHOSTPARALLELPORT
1257{
1258 /**
1259 * Notify device/driver that an interrupt has occurred.
1260 *
1261 * @returns VBox status code.
1262 * @param pInterface Pointer to the interface structure containing the called function pointer.
1263 * @thread Any thread.
1264 */
1265 DECLR3CALLBACKMEMBER(int, pfnNotifyInterrupt,(PPDMIHOSTPARALLELPORT pInterface));
1266} PDMIHOSTPARALLELPORT;
1267/** PDMIHOSTPARALLELPORT interface ID. */
1268#define PDMIHOSTPARALLELPORT_IID "f24b8668-e7f6-4eaa-a14c-4aa2a5f7048e"
1269
1270
1271
1272/** Pointer to a Host Parallel connector interface. */
1273typedef struct PDMIHOSTPARALLELCONNECTOR *PPDMIHOSTPARALLELCONNECTOR;
1274/**
1275 * Host parallel connector interface (up).
1276 * Pair with PDMIHOSTPARALLELPORT.
1277 */
1278typedef struct PDMIHOSTPARALLELCONNECTOR
1279{
1280 /**
1281 * Write bits.
1282 *
1283 * @returns VBox status code.
1284 * @param pInterface Pointer to the interface structure containing the called function pointer.
1285 * @param pvBuf Where to store the write bits.
1286 * @param cbWrite Number of bytes to write.
1287 * @param enmMode Mode to write the data.
1288 * @thread Any thread.
1289 * @todo r=klaus cbWrite only defines buffer length, method needs a way top return actually written amount of data.
1290 */
1291 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIHOSTPARALLELCONNECTOR pInterface, const void *pvBuf,
1292 size_t cbWrite, PDMPARALLELPORTMODE enmMode));
1293
1294 /**
1295 * Read bits.
1296 *
1297 * @returns VBox status code.
1298 * @param pInterface Pointer to the interface structure containing the called function pointer.
1299 * @param pvBuf Where to store the read bits.
1300 * @param cbRead Number of bytes to read.
1301 * @param enmMode Mode to read the data.
1302 * @thread Any thread.
1303 * @todo r=klaus cbRead only defines buffer length, method needs a way top return actually read amount of data.
1304 */
1305 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIHOSTPARALLELCONNECTOR pInterface, void *pvBuf,
1306 size_t cbRead, PDMPARALLELPORTMODE enmMode));
1307
1308 /**
1309 * Set data direction of the port (forward/reverse).
1310 *
1311 * @returns VBox status code.
1312 * @param pInterface Pointer to the interface structure containing the called function pointer.
1313 * @param fForward Flag whether to indicate whether the port is operated in forward or reverse mode.
1314 * @thread Any thread.
1315 */
1316 DECLR3CALLBACKMEMBER(int, pfnSetPortDirection,(PPDMIHOSTPARALLELCONNECTOR pInterface, bool fForward));
1317
1318 /**
1319 * Write control register bits.
1320 *
1321 * @returns VBox status code.
1322 * @param pInterface Pointer to the interface structure containing the called function pointer.
1323 * @param fReg The new control register value.
1324 * @thread Any thread.
1325 */
1326 DECLR3CALLBACKMEMBER(int, pfnWriteControl,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t fReg));
1327
1328 /**
1329 * Read control register bits.
1330 *
1331 * @returns VBox status code.
1332 * @param pInterface Pointer to the interface structure containing the called function pointer.
1333 * @param pfReg Where to store the control register bits.
1334 * @thread Any thread.
1335 */
1336 DECLR3CALLBACKMEMBER(int, pfnReadControl,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t *pfReg));
1337
1338 /**
1339 * Read status register bits.
1340 *
1341 * @returns VBox status code.
1342 * @param pInterface Pointer to the interface structure containing the called function pointer.
1343 * @param pfReg Where to store the status register bits.
1344 * @thread Any thread.
1345 */
1346 DECLR3CALLBACKMEMBER(int, pfnReadStatus,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t *pfReg));
1347
1348} PDMIHOSTPARALLELCONNECTOR;
1349/** PDMIHOSTPARALLELCONNECTOR interface ID. */
1350#define PDMIHOSTPARALLELCONNECTOR_IID "7c532602-7438-4fbc-9265-349d9f0415f9"
1351
1352
1353/** ACPI power source identifier */
1354typedef enum PDMACPIPOWERSOURCE
1355{
1356 PDM_ACPI_POWER_SOURCE_UNKNOWN = 0,
1357 PDM_ACPI_POWER_SOURCE_OUTLET,
1358 PDM_ACPI_POWER_SOURCE_BATTERY
1359} PDMACPIPOWERSOURCE;
1360/** Pointer to ACPI battery state. */
1361typedef PDMACPIPOWERSOURCE *PPDMACPIPOWERSOURCE;
1362
1363/** ACPI battey capacity */
1364typedef enum PDMACPIBATCAPACITY
1365{
1366 PDM_ACPI_BAT_CAPACITY_MIN = 0,
1367 PDM_ACPI_BAT_CAPACITY_MAX = 100,
1368 PDM_ACPI_BAT_CAPACITY_UNKNOWN = 255
1369} PDMACPIBATCAPACITY;
1370/** Pointer to ACPI battery capacity. */
1371typedef PDMACPIBATCAPACITY *PPDMACPIBATCAPACITY;
1372
1373/** ACPI battery state. See ACPI 3.0 spec '_BST (Battery Status)' */
1374typedef enum PDMACPIBATSTATE
1375{
1376 PDM_ACPI_BAT_STATE_CHARGED = 0x00,
1377 PDM_ACPI_BAT_STATE_DISCHARGING = 0x01,
1378 PDM_ACPI_BAT_STATE_CHARGING = 0x02,
1379 PDM_ACPI_BAT_STATE_CRITICAL = 0x04
1380} PDMACPIBATSTATE;
1381/** Pointer to ACPI battery state. */
1382typedef PDMACPIBATSTATE *PPDMACPIBATSTATE;
1383
1384/** Pointer to an ACPI port interface. */
1385typedef struct PDMIACPIPORT *PPDMIACPIPORT;
1386/**
1387 * ACPI port interface (down). Used by both the ACPI driver and (grumble) main.
1388 * Pair with PDMIACPICONNECTOR.
1389 */
1390typedef struct PDMIACPIPORT
1391{
1392 /**
1393 * Check if the guest entered the ACPI mode.
1394 *
1395 * @returns VBox status code
1396 * @param pInterface Pointer to the interface structure containing the called function pointer.
1397 * @param pfEntered Is set to true if the guest entered the ACPI mode, false otherwise.
1398 */
1399 DECLR3CALLBACKMEMBER(int, pfnGetGuestEnteredACPIMode,(PPDMIACPIPORT pInterface, bool *pfEntered));
1400
1401 /**
1402 * Check if the given CPU is still locked by the guest.
1403 *
1404 * @returns VBox status code
1405 * @param pInterface Pointer to the interface structure containing the called function pointer.
1406 * @param uCpu The CPU to check for.
1407 * @param pfLocked Is set to true if the CPU is still locked by the guest, false otherwise.
1408 */
1409 DECLR3CALLBACKMEMBER(int, pfnGetCpuStatus,(PPDMIACPIPORT pInterface, unsigned uCpu, bool *pfLocked));
1410
1411 /**
1412 * Send an ACPI monitor hot-plug event.
1413 *
1414 * @returns VBox status code
1415 * @param pInterface Pointer to the interface structure containing
1416 * the called function pointer.
1417 */
1418 DECLR3CALLBACKMEMBER(int, pfnMonitorHotPlugEvent,(PPDMIACPIPORT pInterface));
1419
1420 /**
1421 * Send a battery status change event.
1422 *
1423 * @returns VBox status code
1424 * @param pInterface Pointer to the interface structure containing
1425 * the called function pointer.
1426 */
1427 DECLR3CALLBACKMEMBER(int, pfnBatteryStatusChangeEvent,(PPDMIACPIPORT pInterface));
1428} PDMIACPIPORT;
1429/** PDMIACPIPORT interface ID. */
1430#define PDMIACPIPORT_IID "974cb8fb-7fda-408c-f9b4-7ff4e3b2a699"
1431
1432
1433/** Pointer to an ACPI connector interface. */
1434typedef struct PDMIACPICONNECTOR *PPDMIACPICONNECTOR;
1435/**
1436 * ACPI connector interface (up).
1437 * Pair with PDMIACPIPORT.
1438 */
1439typedef struct PDMIACPICONNECTOR
1440{
1441 /**
1442 * Get the current power source of the host system.
1443 *
1444 * @returns VBox status code
1445 * @param pInterface Pointer to the interface structure containing the called function pointer.
1446 * @param penmPowerSource Pointer to the power source result variable.
1447 */
1448 DECLR3CALLBACKMEMBER(int, pfnQueryPowerSource,(PPDMIACPICONNECTOR, PPDMACPIPOWERSOURCE penmPowerSource));
1449
1450 /**
1451 * Query the current battery status of the host system.
1452 *
1453 * @returns VBox status code?
1454 * @param pInterface Pointer to the interface structure containing the called function pointer.
1455 * @param pfPresent Is set to true if battery is present, false otherwise.
1456 * @param penmRemainingCapacity Pointer to the battery remaining capacity (0 - 100 or 255 for unknown).
1457 * @param penmBatteryState Pointer to the battery status.
1458 * @param pu32PresentRate Pointer to the present rate (0..1000 of the total capacity).
1459 */
1460 DECLR3CALLBACKMEMBER(int, pfnQueryBatteryStatus,(PPDMIACPICONNECTOR, bool *pfPresent, PPDMACPIBATCAPACITY penmRemainingCapacity,
1461 PPDMACPIBATSTATE penmBatteryState, uint32_t *pu32PresentRate));
1462} PDMIACPICONNECTOR;
1463/** PDMIACPICONNECTOR interface ID. */
1464#define PDMIACPICONNECTOR_IID "5f14bf8d-1edf-4e3a-a1e1-cca9fd08e359"
1465
1466
1467/** Pointer to an event button port interface. */
1468typedef struct PDMIEVENTBUTTONPORT *PPDMIEVENTBUTTONPORT;
1469/**
1470 * Event button port interface (down). Used by both the ACPI/GPIO driver and (grumble) main.
1471 * Pair with PDMIEVENTBUTTONCONNECTOR.
1472 */
1473typedef struct PDMIEVENTBUTTONPORT
1474{
1475 /**
1476 * Check if the guest is able to handle button events.
1477 *
1478 * @returns VBox status code
1479 * @param pInterface Pointer to the interface structure containing the called function pointer.
1480 * @param pfCanHandleButtonEvents Is set to true if the guest is able to handle button events, false otherwise.
1481 */
1482 DECLR3CALLBACKMEMBER(int, pfnQueryGuestCanHandleButtonEvents,(PPDMIEVENTBUTTONPORT pInterface, bool *pfCanHandleButtonEvents));
1483
1484 /**
1485 * Send an power off button event.
1486 *
1487 * @returns VBox status code
1488 * @param pInterface Pointer to the interface structure containing the called function pointer.
1489 */
1490 DECLR3CALLBACKMEMBER(int, pfnPowerButtonPress,(PPDMIEVENTBUTTONPORT pInterface));
1491
1492 /**
1493 * Send an sleep button event.
1494 *
1495 * @returns VBox status code
1496 * @param pInterface Pointer to the interface structure containing the called function pointer.
1497 */
1498 DECLR3CALLBACKMEMBER(int, pfnSleepButtonPress,(PPDMIEVENTBUTTONPORT pInterface));
1499
1500 /**
1501 * Check if the last power button event was handled by the guest.
1502 *
1503 * @returns VBox status code
1504 * @param pInterface Pointer to the interface structure containing the called function pointer.
1505 * @param pfHandled Is set to true if the last power button event was handled, false otherwise.
1506 */
1507 DECLR3CALLBACKMEMBER(int, pfnQueryPowerButtonHandled,(PPDMIEVENTBUTTONPORT pInterface, bool *pfHandled));
1508
1509} PDMIEVENTBUTTONPORT;
1510/** PDMIEVENTBUTTONPORT interface ID. */
1511#define PDMIEVENTBUTTONPORT_IID "7aa5ada2-35c7-45be-a757-0398427af7aa"
1512
1513
1514/** Pointer to an event button connector interface. */
1515typedef struct PDMIEVENTBUTTONCONNECTOR *PPDMIEVENTBUTTONCONNECTOR;
1516/**
1517 * Event button connector interface (up).
1518 * Pair with PDMIEVENTBUTTONPORT.
1519 */
1520typedef struct PDMIEVENTBUTTONCONNECTOR
1521{
1522 /** Currently empty, so just a dummy value. */
1523 uint32_t uDummy;
1524
1525} PDMIEVENTBUTTONCONNECTOR;
1526/** PDMIACPICONNECTOR interface ID. */
1527#define PDMIEVENTBUTTONCONNECTOR_IID "46774d25-a55e-4e63-b70b-8946bcedd4a7"
1528
1529
1530struct VMMDevDisplayDef;
1531
1532/** Pointer to a VMMDevice port interface. */
1533typedef struct PDMIVMMDEVPORT *PPDMIVMMDEVPORT;
1534/**
1535 * VMMDevice port interface (down).
1536 * Pair with PDMIVMMDEVCONNECTOR.
1537 */
1538typedef struct PDMIVMMDEVPORT
1539{
1540 /**
1541 * Return the current absolute mouse position in pixels
1542 *
1543 * @returns VBox status code
1544 * @param pInterface Pointer to the interface structure containing the called function pointer.
1545 * @param pxAbs Pointer of result value, can be NULL
1546 * @param pyAbs Pointer of result value, can be NULL
1547 */
1548 DECLR3CALLBACKMEMBER(int, pfnQueryAbsoluteMouse,(PPDMIVMMDEVPORT pInterface, int32_t *pxAbs, int32_t *pyAbs));
1549
1550 /**
1551 * Set the new absolute mouse position in pixels
1552 *
1553 * @returns VBox status code
1554 * @param pInterface Pointer to the interface structure containing the called function pointer.
1555 * @param xAbs New absolute X position
1556 * @param yAbs New absolute Y position
1557 * @param dz New mouse wheel vertical movement offset
1558 * @param dw New mouse wheel horizontal movement offset
1559 * @param fButtons New buttons state
1560 */
1561 DECLR3CALLBACKMEMBER(int, pfnSetAbsoluteMouse,(PPDMIVMMDEVPORT pInterface, int32_t xAbs, int32_t yAbs,
1562 int32_t dz, int32_t dw, uint32_t fButtons));
1563
1564 /**
1565 * Return the current mouse capability flags
1566 *
1567 * @returns VBox status code
1568 * @param pInterface Pointer to the interface structure containing the called function pointer.
1569 * @param pfCapabilities Pointer of result value
1570 */
1571 DECLR3CALLBACKMEMBER(int, pfnQueryMouseCapabilities,(PPDMIVMMDEVPORT pInterface, uint32_t *pfCapabilities));
1572
1573 /**
1574 * Set the current mouse capability flag (host side)
1575 *
1576 * @returns VBox status code
1577 * @param pInterface Pointer to the interface structure containing the called function pointer.
1578 * @param fCapsAdded Mask of capabilities to add to the flag
1579 * @param fCapsRemoved Mask of capabilities to remove from the flag
1580 */
1581 DECLR3CALLBACKMEMBER(int, pfnUpdateMouseCapabilities,(PPDMIVMMDEVPORT pInterface, uint32_t fCapsAdded, uint32_t fCapsRemoved));
1582
1583 /**
1584 * Issue a display resolution change request.
1585 *
1586 * Note that there can only one request in the queue and that in case the guest does
1587 * not process it, issuing another request will overwrite the previous.
1588 *
1589 * @returns VBox status code
1590 * @param pInterface Pointer to the interface structure containing the called function pointer.
1591 * @param cDisplays Number of displays. Can be either 1 or the number of VM virtual monitors.
1592 * @param paDisplays Definitions of guest screens to be applied. See VMMDev.h
1593 * @param fForce Whether to deliver the request to the guest even if the guest has
1594 * the requested resolution already.
1595 * @param fMayNotify Whether to send a hotplug notification to the guest if appropriate.
1596 */
1597 DECLR3CALLBACKMEMBER(int, pfnRequestDisplayChange,(PPDMIVMMDEVPORT pInterface, uint32_t cDisplays,
1598 struct VMMDevDisplayDef const *paDisplays, bool fForce, bool fMayNotify));
1599
1600 /**
1601 * Pass credentials to guest.
1602 *
1603 * Note that there can only be one set of credentials and the guest may or may not
1604 * query them and may do whatever it wants with them.
1605 *
1606 * @returns VBox status code.
1607 * @param pInterface Pointer to the interface structure containing the called function pointer.
1608 * @param pszUsername User name, may be empty (UTF-8).
1609 * @param pszPassword Password, may be empty (UTF-8).
1610 * @param pszDomain Domain name, may be empty (UTF-8).
1611 * @param fFlags VMMDEV_SETCREDENTIALS_*.
1612 */
1613 DECLR3CALLBACKMEMBER(int, pfnSetCredentials,(PPDMIVMMDEVPORT pInterface, const char *pszUsername,
1614 const char *pszPassword, const char *pszDomain,
1615 uint32_t fFlags));
1616
1617 /**
1618 * Notify the driver about a VBVA status change.
1619 *
1620 * @param pInterface Pointer to the interface structure containing the called function pointer.
1621 * @param fEnabled Current VBVA status.
1622 */
1623 DECLR3CALLBACKMEMBER(void, pfnVBVAChange, (PPDMIVMMDEVPORT pInterface, bool fEnabled));
1624
1625 /**
1626 * Issue a seamless mode change request.
1627 *
1628 * Note that there can only one request in the queue and that in case the guest does
1629 * not process it, issuing another request will overwrite the previous.
1630 *
1631 * @returns VBox status code
1632 * @param pInterface Pointer to the interface structure containing the called function pointer.
1633 * @param fEnabled Seamless mode enabled or not
1634 */
1635 DECLR3CALLBACKMEMBER(int, pfnRequestSeamlessChange,(PPDMIVMMDEVPORT pInterface, bool fEnabled));
1636
1637 /**
1638 * Issue a memory balloon change request.
1639 *
1640 * Note that there can only one request in the queue and that in case the guest does
1641 * not process it, issuing another request will overwrite the previous.
1642 *
1643 * @returns VBox status code
1644 * @param pInterface Pointer to the interface structure containing the called function pointer.
1645 * @param cMbBalloon Balloon size in megabytes
1646 */
1647 DECLR3CALLBACKMEMBER(int, pfnSetMemoryBalloon,(PPDMIVMMDEVPORT pInterface, uint32_t cMbBalloon));
1648
1649 /**
1650 * Issue a statistcs interval change request.
1651 *
1652 * Note that there can only one request in the queue and that in case the guest does
1653 * not process it, issuing another request will overwrite the previous.
1654 *
1655 * @returns VBox status code
1656 * @param pInterface Pointer to the interface structure containing the called function pointer.
1657 * @param cSecsStatInterval Statistics query interval in seconds
1658 * (0=disable).
1659 */
1660 DECLR3CALLBACKMEMBER(int, pfnSetStatisticsInterval,(PPDMIVMMDEVPORT pInterface, uint32_t cSecsStatInterval));
1661
1662 /**
1663 * Notify the guest about a VRDP status change.
1664 *
1665 * @returns VBox status code
1666 * @param pInterface Pointer to the interface structure containing the called function pointer.
1667 * @param fVRDPEnabled Current VRDP status.
1668 * @param uVRDPExperienceLevel Which visual effects to be disabled in
1669 * the guest.
1670 */
1671 DECLR3CALLBACKMEMBER(int, pfnVRDPChange, (PPDMIVMMDEVPORT pInterface, bool fVRDPEnabled, uint32_t uVRDPExperienceLevel));
1672
1673 /**
1674 * Notify the guest of CPU hot-unplug event.
1675 *
1676 * @returns VBox status code
1677 * @param pInterface Pointer to the interface structure containing the called function pointer.
1678 * @param idCpuCore The core id of the CPU to remove.
1679 * @param idCpuPackage The package id of the CPU to remove.
1680 */
1681 DECLR3CALLBACKMEMBER(int, pfnCpuHotUnplug, (PPDMIVMMDEVPORT pInterface, uint32_t idCpuCore, uint32_t idCpuPackage));
1682
1683 /**
1684 * Notify the guest of CPU hot-plug event.
1685 *
1686 * @returns VBox status code
1687 * @param pInterface Pointer to the interface structure containing the called function pointer.
1688 * @param idCpuCore The core id of the CPU to add.
1689 * @param idCpuPackage The package id of the CPU to add.
1690 */
1691 DECLR3CALLBACKMEMBER(int, pfnCpuHotPlug, (PPDMIVMMDEVPORT pInterface, uint32_t idCpuCore, uint32_t idCpuPackage));
1692
1693} PDMIVMMDEVPORT;
1694/** PDMIVMMDEVPORT interface ID. */
1695#define PDMIVMMDEVPORT_IID "9e004f1a-875d-11e9-a673-c77c30f53623"
1696
1697
1698/** Pointer to a HPET legacy notification interface. */
1699typedef struct PDMIHPETLEGACYNOTIFY *PPDMIHPETLEGACYNOTIFY;
1700/**
1701 * HPET legacy notification interface.
1702 */
1703typedef struct PDMIHPETLEGACYNOTIFY
1704{
1705 /**
1706 * Notify about change of HPET legacy mode.
1707 *
1708 * @param pInterface Pointer to the interface structure containing the
1709 * called function pointer.
1710 * @param fActivated If HPET legacy mode is activated (@c true) or
1711 * deactivated (@c false).
1712 */
1713 DECLR3CALLBACKMEMBER(void, pfnModeChanged,(PPDMIHPETLEGACYNOTIFY pInterface, bool fActivated));
1714} PDMIHPETLEGACYNOTIFY;
1715/** PDMIHPETLEGACYNOTIFY interface ID. */
1716#define PDMIHPETLEGACYNOTIFY_IID "c9ada595-4b65-4311-8b21-b10498997774"
1717
1718
1719/** @name Flags for PDMIVMMDEVPORT::pfnSetCredentials.
1720 * @{ */
1721/** The guest should perform a logon with the credentials. */
1722#define VMMDEV_SETCREDENTIALS_GUESTLOGON RT_BIT(0)
1723/** The guest should prevent local logons. */
1724#define VMMDEV_SETCREDENTIALS_NOLOCALLOGON RT_BIT(1)
1725/** The guest should verify the credentials. */
1726#define VMMDEV_SETCREDENTIALS_JUDGE RT_BIT(15)
1727/** @} */
1728
1729/** Forward declaration of the guest information structure. */
1730struct VBoxGuestInfo;
1731/** Forward declaration of the guest information-2 structure. */
1732struct VBoxGuestInfo2;
1733/** Forward declaration of the guest statistics structure */
1734struct VBoxGuestStatistics;
1735/** Forward declaration of the guest status structure */
1736struct VBoxGuestStatus;
1737
1738/** Forward declaration of the video accelerator command memory. */
1739struct VBVAMEMORY;
1740/** Pointer to video accelerator command memory. */
1741typedef struct VBVAMEMORY *PVBVAMEMORY;
1742
1743/** Pointer to a VMMDev connector interface. */
1744typedef struct PDMIVMMDEVCONNECTOR *PPDMIVMMDEVCONNECTOR;
1745/**
1746 * VMMDev connector interface (up).
1747 * Pair with PDMIVMMDEVPORT.
1748 */
1749typedef struct PDMIVMMDEVCONNECTOR
1750{
1751 /**
1752 * Update guest facility status.
1753 *
1754 * Called in response to VMMDevReq_ReportGuestStatus, reset or state restore.
1755 *
1756 * @param pInterface Pointer to this interface.
1757 * @param uFacility The facility.
1758 * @param uStatus The status.
1759 * @param fFlags Flags assoicated with the update. Currently
1760 * reserved and should be ignored.
1761 * @param pTimeSpecTS Pointer to the timestamp of this report.
1762 * @thread The emulation thread.
1763 */
1764 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestStatus,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t uFacility, uint16_t uStatus,
1765 uint32_t fFlags, PCRTTIMESPEC pTimeSpecTS));
1766
1767 /**
1768 * Updates a guest user state.
1769 *
1770 * Called in response to VMMDevReq_ReportGuestUserState.
1771 *
1772 * @param pInterface Pointer to this interface.
1773 * @param pszUser Guest user name to update status for.
1774 * @param pszDomain Domain the guest user is bound to. Optional.
1775 * @param uState New guest user state to notify host about.
1776 * @param pabDetails Pointer to optional state data.
1777 * @param cbDetails Size (in bytes) of optional state data.
1778 * @thread The emulation thread.
1779 */
1780 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestUserState,(PPDMIVMMDEVCONNECTOR pInterface, const char *pszUser,
1781 const char *pszDomain, uint32_t uState,
1782 const uint8_t *pabDetails, uint32_t cbDetails));
1783
1784 /**
1785 * Reports the guest API and OS version.
1786 * Called whenever the Additions issue a guest info report request.
1787 *
1788 * @param pInterface Pointer to this interface.
1789 * @param pGuestInfo Pointer to guest information structure
1790 * @thread The emulation thread.
1791 */
1792 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestInfo,(PPDMIVMMDEVCONNECTOR pInterface, const struct VBoxGuestInfo *pGuestInfo));
1793
1794 /**
1795 * Reports the detailed Guest Additions version.
1796 *
1797 * @param pInterface Pointer to this interface.
1798 * @param uFullVersion The guest additions version as a full version.
1799 * Use VBOX_FULL_VERSION_GET_MAJOR,
1800 * VBOX_FULL_VERSION_GET_MINOR and
1801 * VBOX_FULL_VERSION_GET_BUILD to access it.
1802 * (This will not be zero, so turn down the
1803 * paranoia level a notch.)
1804 * @param pszName Pointer to the sanitized version name. This can
1805 * be empty, but will not be NULL. If not empty,
1806 * it will contain a build type tag and/or a
1807 * publisher tag. If both, then they are separated
1808 * by an underscore (VBOX_VERSION_STRING fashion).
1809 * @param uRevision The SVN revision. Can be 0.
1810 * @param fFeatures Feature mask, currently none are defined.
1811 *
1812 * @thread The emulation thread.
1813 */
1814 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestInfo2,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t uFullVersion,
1815 const char *pszName, uint32_t uRevision, uint32_t fFeatures));
1816
1817 /**
1818 * Update the guest additions capabilities.
1819 * This is called when the guest additions capabilities change. The new capabilities
1820 * are given and the connector should update its internal state.
1821 *
1822 * @param pInterface Pointer to this interface.
1823 * @param newCapabilities New capabilities.
1824 * @thread The emulation thread.
1825 */
1826 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestCapabilities,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities));
1827
1828 /**
1829 * Update the mouse capabilities.
1830 * This is called when the mouse capabilities change. The new capabilities
1831 * are given and the connector should update its internal state.
1832 *
1833 * @param pInterface Pointer to this interface.
1834 * @param newCapabilities New capabilities.
1835 * @thread The emulation thread.
1836 */
1837 DECLR3CALLBACKMEMBER(void, pfnUpdateMouseCapabilities,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities));
1838
1839 /**
1840 * Update the pointer shape.
1841 * This is called when the mouse pointer shape changes. The new shape
1842 * is passed as a caller allocated buffer that will be freed after returning
1843 *
1844 * @param pInterface Pointer to this interface.
1845 * @param fVisible Visibility indicator (if false, the other parameters are undefined).
1846 * @param fAlpha Flag whether alpha channel is being passed.
1847 * @param xHot Pointer hot spot x coordinate.
1848 * @param yHot Pointer hot spot y coordinate.
1849 * @param x Pointer new x coordinate on screen.
1850 * @param y Pointer new y coordinate on screen.
1851 * @param cx Pointer width in pixels.
1852 * @param cy Pointer height in pixels.
1853 * @param cbScanline Size of one scanline in bytes.
1854 * @param pvShape New shape buffer.
1855 * @thread The emulation thread.
1856 */
1857 DECLR3CALLBACKMEMBER(void, pfnUpdatePointerShape,(PPDMIVMMDEVCONNECTOR pInterface, bool fVisible, bool fAlpha,
1858 uint32_t xHot, uint32_t yHot,
1859 uint32_t cx, uint32_t cy,
1860 void *pvShape));
1861
1862 /**
1863 * Enable or disable video acceleration on behalf of guest.
1864 *
1865 * @param pInterface Pointer to this interface.
1866 * @param fEnable Whether to enable acceleration.
1867 * @param pVbvaMemory Video accelerator memory.
1868
1869 * @return VBox rc. VINF_SUCCESS if VBVA was enabled.
1870 * @thread The emulation thread.
1871 */
1872 DECLR3CALLBACKMEMBER(int, pfnVideoAccelEnable,(PPDMIVMMDEVCONNECTOR pInterface, bool fEnable, PVBVAMEMORY pVbvaMemory));
1873
1874 /**
1875 * Force video queue processing.
1876 *
1877 * @param pInterface Pointer to this interface.
1878 * @thread The emulation thread.
1879 */
1880 DECLR3CALLBACKMEMBER(void, pfnVideoAccelFlush,(PPDMIVMMDEVCONNECTOR pInterface));
1881
1882 /**
1883 * Return whether the given video mode is supported/wanted by the host.
1884 *
1885 * @returns VBox status code
1886 * @param pInterface Pointer to this interface.
1887 * @param display The guest monitor, 0 for primary.
1888 * @param cy Video mode horizontal resolution in pixels.
1889 * @param cx Video mode vertical resolution in pixels.
1890 * @param cBits Video mode bits per pixel.
1891 * @param pfSupported Where to put the indicator for whether this mode is supported. (output)
1892 * @thread The emulation thread.
1893 */
1894 DECLR3CALLBACKMEMBER(int, pfnVideoModeSupported,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t display, uint32_t cx, uint32_t cy, uint32_t cBits, bool *pfSupported));
1895
1896 /**
1897 * Queries by how many pixels the height should be reduced when calculating video modes
1898 *
1899 * @returns VBox status code
1900 * @param pInterface Pointer to this interface.
1901 * @param pcyReduction Pointer to the result value.
1902 * @thread The emulation thread.
1903 */
1904 DECLR3CALLBACKMEMBER(int, pfnGetHeightReduction,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcyReduction));
1905
1906 /**
1907 * Informs about a credentials judgement result from the guest.
1908 *
1909 * @returns VBox status code
1910 * @param pInterface Pointer to this interface.
1911 * @param fFlags Judgement result flags.
1912 * @thread The emulation thread.
1913 */
1914 DECLR3CALLBACKMEMBER(int, pfnSetCredentialsJudgementResult,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t fFlags));
1915
1916 /**
1917 * Set the visible region of the display
1918 *
1919 * @returns VBox status code.
1920 * @param pInterface Pointer to this interface.
1921 * @param cRect Number of rectangles in pRect
1922 * @param pRect Rectangle array
1923 * @thread The emulation thread.
1924 */
1925 DECLR3CALLBACKMEMBER(int, pfnSetVisibleRegion,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t cRect, PRTRECT pRect));
1926
1927 /**
1928 * Update monitor positions (offsets).
1929 *
1930 * Passing monitor positions from the guest to host exclusively since vmwgfx
1931 * (linux driver) fails to do so thru the FIFO.
1932 *
1933 * @returns VBox status code.
1934 * @param pInterface Pointer to this interface.
1935 * @param cPositions Number of monitor positions
1936 * @param paPositions Positions array
1937 * @remarks Is allowed to be NULL.
1938 * @thread The emulation thread.
1939 * @sa PDMIDISPLAYPORT::pfnReportMonitorPositions
1940 */
1941 DECLR3CALLBACKMEMBER(int, pfnUpdateMonitorPositions,(PPDMIVMMDEVCONNECTOR pInterface,
1942 uint32_t cPositions, PCRTPOINT paPositions));
1943
1944 /**
1945 * Query the visible region of the display
1946 *
1947 * @returns VBox status code.
1948 * @param pInterface Pointer to this interface.
1949 * @param pcRects Where to return the number of rectangles in
1950 * paRects.
1951 * @param paRects Rectangle array (set to NULL to query the number
1952 * of rectangles)
1953 * @thread The emulation thread.
1954 */
1955 DECLR3CALLBACKMEMBER(int, pfnQueryVisibleRegion,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcRects, PRTRECT paRects));
1956
1957 /**
1958 * Request the statistics interval
1959 *
1960 * @returns VBox status code.
1961 * @param pInterface Pointer to this interface.
1962 * @param pulInterval Pointer to interval in seconds
1963 * @thread The emulation thread.
1964 */
1965 DECLR3CALLBACKMEMBER(int, pfnQueryStatisticsInterval,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pulInterval));
1966
1967 /**
1968 * Report new guest statistics
1969 *
1970 * @returns VBox status code.
1971 * @param pInterface Pointer to this interface.
1972 * @param pGuestStats Guest statistics
1973 * @thread The emulation thread.
1974 */
1975 DECLR3CALLBACKMEMBER(int, pfnReportStatistics,(PPDMIVMMDEVCONNECTOR pInterface, struct VBoxGuestStatistics *pGuestStats));
1976
1977 /**
1978 * Query the current balloon size
1979 *
1980 * @returns VBox status code.
1981 * @param pInterface Pointer to this interface.
1982 * @param pcbBalloon Balloon size
1983 * @thread The emulation thread.
1984 */
1985 DECLR3CALLBACKMEMBER(int, pfnQueryBalloonSize,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcbBalloon));
1986
1987 /**
1988 * Query the current page fusion setting
1989 *
1990 * @returns VBox status code.
1991 * @param pInterface Pointer to this interface.
1992 * @param pfPageFusionEnabled Pointer to boolean
1993 * @thread The emulation thread.
1994 */
1995 DECLR3CALLBACKMEMBER(int, pfnIsPageFusionEnabled,(PPDMIVMMDEVCONNECTOR pInterface, bool *pfPageFusionEnabled));
1996
1997} PDMIVMMDEVCONNECTOR;
1998/** PDMIVMMDEVCONNECTOR interface ID. */
1999#define PDMIVMMDEVCONNECTOR_IID "aff90240-a443-434e-9132-80c186ab97d4"
2000
2001
2002/**
2003 * Generic status LED core.
2004 * Note that a unit doesn't have to support all the indicators.
2005 */
2006typedef union PDMLEDCORE
2007{
2008 /** 32-bit view. */
2009 uint32_t volatile u32;
2010 /** Bit view. */
2011 struct
2012 {
2013 /** Reading/Receiving indicator. */
2014 uint32_t fReading : 1;
2015 /** Writing/Sending indicator. */
2016 uint32_t fWriting : 1;
2017 /** Busy indicator. */
2018 uint32_t fBusy : 1;
2019 /** Error indicator. */
2020 uint32_t fError : 1;
2021 } s;
2022} PDMLEDCORE;
2023
2024/** LED bit masks for the u32 view.
2025 * @{ */
2026/** Reading/Receiving indicator. */
2027#define PDMLED_READING RT_BIT(0)
2028/** Writing/Sending indicator. */
2029#define PDMLED_WRITING RT_BIT(1)
2030/** Busy indicator. */
2031#define PDMLED_BUSY RT_BIT(2)
2032/** Error indicator. */
2033#define PDMLED_ERROR RT_BIT(3)
2034/** @} */
2035
2036
2037/**
2038 * Generic status LED.
2039 * Note that a unit doesn't have to support all the indicators.
2040 */
2041typedef struct PDMLED
2042{
2043 /** Just a magic for sanity checking. */
2044 uint32_t u32Magic;
2045 uint32_t u32Alignment; /**< structure size alignment. */
2046 /** The actual LED status.
2047 * Only the device is allowed to change this. */
2048 PDMLEDCORE Actual;
2049 /** The asserted LED status which is cleared by the reader.
2050 * The device will assert the bits but never clear them.
2051 * The driver clears them as it sees fit. */
2052 PDMLEDCORE Asserted;
2053} PDMLED;
2054
2055/** Pointer to an LED. */
2056typedef PDMLED *PPDMLED;
2057/** Pointer to a const LED. */
2058typedef const PDMLED *PCPDMLED;
2059
2060/** Magic value for PDMLED::u32Magic. */
2061#define PDMLED_MAGIC UINT32_C(0x11335577)
2062
2063/** Pointer to an LED ports interface. */
2064typedef struct PDMILEDPORTS *PPDMILEDPORTS;
2065/**
2066 * Interface for exporting LEDs (down).
2067 * Pair with PDMILEDCONNECTORS.
2068 */
2069typedef struct PDMILEDPORTS
2070{
2071 /**
2072 * Gets the pointer to the status LED of a unit.
2073 *
2074 * @returns VBox status code.
2075 * @param pInterface Pointer to the interface structure containing the called function pointer.
2076 * @param iLUN The unit which status LED we desire.
2077 * @param ppLed Where to store the LED pointer.
2078 */
2079 DECLR3CALLBACKMEMBER(int, pfnQueryStatusLed,(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed));
2080
2081} PDMILEDPORTS;
2082/** PDMILEDPORTS interface ID. */
2083#define PDMILEDPORTS_IID "435e0cec-8549-4ca0-8c0d-98e52f1dc038"
2084
2085
2086/** Pointer to an LED connectors interface. */
2087typedef struct PDMILEDCONNECTORS *PPDMILEDCONNECTORS;
2088/**
2089 * Interface for reading LEDs (up).
2090 * Pair with PDMILEDPORTS.
2091 */
2092typedef struct PDMILEDCONNECTORS
2093{
2094 /**
2095 * Notification about a unit which have been changed.
2096 *
2097 * The driver must discard any pointers to data owned by
2098 * the unit and requery it.
2099 *
2100 * @param pInterface Pointer to the interface structure containing the called function pointer.
2101 * @param iLUN The unit number.
2102 */
2103 DECLR3CALLBACKMEMBER(void, pfnUnitChanged,(PPDMILEDCONNECTORS pInterface, unsigned iLUN));
2104} PDMILEDCONNECTORS;
2105/** PDMILEDCONNECTORS interface ID. */
2106#define PDMILEDCONNECTORS_IID "8ed63568-82a7-4193-b57b-db8085ac4495"
2107
2108
2109/** Pointer to a Media Notification interface. */
2110typedef struct PDMIMEDIANOTIFY *PPDMIMEDIANOTIFY;
2111/**
2112 * Interface for exporting Medium eject information (up). No interface pair.
2113 */
2114typedef struct PDMIMEDIANOTIFY
2115{
2116 /**
2117 * Signals that the medium was ejected.
2118 *
2119 * @returns VBox status code.
2120 * @param pInterface Pointer to the interface structure containing the called function pointer.
2121 * @param iLUN The unit which had the medium ejected.
2122 */
2123 DECLR3CALLBACKMEMBER(int, pfnEjected,(PPDMIMEDIANOTIFY pInterface, unsigned iLUN));
2124
2125} PDMIMEDIANOTIFY;
2126/** PDMIMEDIANOTIFY interface ID. */
2127#define PDMIMEDIANOTIFY_IID "fc22d53e-feb1-4a9c-b9fb-0a990a6ab288"
2128
2129
2130/** The special status unit number */
2131#define PDM_STATUS_LUN 999
2132
2133
2134#ifdef VBOX_WITH_HGCM
2135
2136/** Abstract HGCM command structure. Used only to define a typed pointer. */
2137struct VBOXHGCMCMD;
2138
2139/** Pointer to HGCM command structure. This pointer is unique and identifies
2140 * the command being processed. The pointer is passed to HGCM connector methods,
2141 * and must be passed back to HGCM port when command is completed.
2142 */
2143typedef struct VBOXHGCMCMD *PVBOXHGCMCMD;
2144
2145/** Pointer to a HGCM port interface. */
2146typedef struct PDMIHGCMPORT *PPDMIHGCMPORT;
2147/**
2148 * Host-Guest communication manager port interface (down). Normally implemented
2149 * by VMMDev.
2150 * Pair with PDMIHGCMCONNECTOR.
2151 */
2152typedef struct PDMIHGCMPORT
2153{
2154 /**
2155 * Notify the guest on a command completion.
2156 *
2157 * @returns VINF_SUCCESS or VERR_CANCELLED if the guest canceled the call.
2158 * @param pInterface Pointer to this interface.
2159 * @param rc The return code (VBox error code).
2160 * @param pCmd A pointer that identifies the completed command.
2161 */
2162 DECLR3CALLBACKMEMBER(int, pfnCompleted,(PPDMIHGCMPORT pInterface, int32_t rc, PVBOXHGCMCMD pCmd));
2163
2164 /**
2165 * Checks if @a pCmd was restored & resubmitted from saved state.
2166 *
2167 * @returns true if restored, false if not.
2168 * @param pInterface Pointer to this interface.
2169 * @param pCmd The command we're checking on.
2170 */
2171 DECLR3CALLBACKMEMBER(bool, pfnIsCmdRestored,(PPDMIHGCMPORT pInterface, PVBOXHGCMCMD pCmd));
2172
2173 /**
2174 * Checks if @a pCmd was cancelled.
2175 *
2176 * @returns true if cancelled, false if not.
2177 * @param pInterface Pointer to this interface.
2178 * @param pCmd The command we're checking on.
2179 */
2180 DECLR3CALLBACKMEMBER(bool, pfnIsCmdCancelled,(PPDMIHGCMPORT pInterface, PVBOXHGCMCMD pCmd));
2181
2182 /**
2183 * Gets the VMMDevRequestHeader::fRequestor value for @a pCmd.
2184 *
2185 * @returns The fRequestor value, VMMDEV_REQUESTOR_LEGACY if guest does not
2186 * support it, VMMDEV_REQUESTOR_LOWEST if invalid parameters.
2187 * @param pInterface Pointer to this interface.
2188 * @param pCmd The command we're in checking on.
2189 */
2190 DECLR3CALLBACKMEMBER(uint32_t, pfnGetRequestor,(PPDMIHGCMPORT pInterface, PVBOXHGCMCMD pCmd));
2191
2192 /**
2193 * Gets the VMMDevState::idSession value.
2194 *
2195 * @returns VMMDevState::idSession.
2196 * @param pInterface Pointer to this interface.
2197 */
2198 DECLR3CALLBACKMEMBER(uint64_t, pfnGetVMMDevSessionId,(PPDMIHGCMPORT pInterface));
2199
2200} PDMIHGCMPORT;
2201/** PDMIHGCMPORT interface ID. */
2202# define PDMIHGCMPORT_IID "28c0a201-68cd-4752-9404-bb42a0c09eb7"
2203
2204/* forward decl to hgvmsvc.h. */
2205struct VBOXHGCMSVCPARM;
2206/** Pointer to a HGCM service location structure. */
2207typedef struct HGCMSERVICELOCATION *PHGCMSERVICELOCATION;
2208/** Pointer to a HGCM connector interface. */
2209typedef struct PDMIHGCMCONNECTOR *PPDMIHGCMCONNECTOR;
2210/**
2211 * The Host-Guest communication manager connector interface (up). Normally
2212 * implemented by Main::VMMDevInterface.
2213 * Pair with PDMIHGCMPORT.
2214 */
2215typedef struct PDMIHGCMCONNECTOR
2216{
2217 /**
2218 * Locate a service and inform it about a client connection.
2219 *
2220 * @param pInterface Pointer to this interface.
2221 * @param pCmd A pointer that identifies the command.
2222 * @param pServiceLocation Pointer to the service location structure.
2223 * @param pu32ClientID Where to store the client id for the connection.
2224 * @return VBox status code.
2225 * @thread The emulation thread.
2226 */
2227 DECLR3CALLBACKMEMBER(int, pfnConnect,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, PHGCMSERVICELOCATION pServiceLocation, uint32_t *pu32ClientID));
2228
2229 /**
2230 * Disconnect from service.
2231 *
2232 * @param pInterface Pointer to this interface.
2233 * @param pCmd A pointer that identifies the command.
2234 * @param u32ClientID The client id returned by the pfnConnect call.
2235 * @return VBox status code.
2236 * @thread The emulation thread.
2237 */
2238 DECLR3CALLBACKMEMBER(int, pfnDisconnect,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID));
2239
2240 /**
2241 * Process a guest issued command.
2242 *
2243 * @param pInterface Pointer to this interface.
2244 * @param pCmd A pointer that identifies the command.
2245 * @param u32ClientID The client id returned by the pfnConnect call.
2246 * @param u32Function Function to be performed by the service.
2247 * @param cParms Number of parameters in the array pointed to by paParams.
2248 * @param paParms Pointer to an array of parameters.
2249 * @param tsArrival The STAM_GET_TS() value when the request arrived.
2250 * @return VBox status code.
2251 * @thread The emulation thread.
2252 */
2253 DECLR3CALLBACKMEMBER(int, pfnCall,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID, uint32_t u32Function,
2254 uint32_t cParms, struct VBOXHGCMSVCPARM *paParms, uint64_t tsArrival));
2255
2256 /**
2257 * Notification about the guest cancelling a pending request.
2258 * @param pInterface Pointer to this interface.
2259 * @param pCmd A pointer that identifies the command.
2260 * @param idclient The client id returned by the pfnConnect call.
2261 */
2262 DECLR3CALLBACKMEMBER(void, pfnCancelled,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t idClient));
2263
2264} PDMIHGCMCONNECTOR;
2265/** PDMIHGCMCONNECTOR interface ID. */
2266# define PDMIHGCMCONNECTOR_IID "33cb5c91-6a4a-4ad9-3fec-d1f7d413c4a5"
2267
2268#endif /* VBOX_WITH_HGCM */
2269
2270/** Pointer to a PCI raw connector interface. */
2271typedef struct PDMIPCIRAWCONNECTOR *PPDMIPCIRAWCONNECTOR;
2272/**
2273 * PCI raw connector interface (up).
2274 */
2275typedef struct PDMIPCIRAWCONNECTOR
2276{
2277
2278 /**
2279 *
2280 */
2281 DECLR3CALLBACKMEMBER(int, pfnDeviceConstructComplete, (PPDMIPCIRAWCONNECTOR pInterface, const char *pcszName,
2282 uint32_t uHostPciAddress, uint32_t uGuestPciAddress,
2283 int vrc));
2284
2285} PDMIPCIRAWCONNECTOR;
2286/** PDMIPCIRAWCONNECTOR interface ID. */
2287#define PDMIPCIRAWCONNECTOR_IID "14aa9c6c-8869-4782-9dfc-910071a6aebf"
2288
2289
2290/** Pointer to a VFS connector interface. */
2291typedef struct PDMIVFSCONNECTOR *PPDMIVFSCONNECTOR;
2292/**
2293 * VFS connector interface (up).
2294 */
2295typedef struct PDMIVFSCONNECTOR
2296{
2297 /**
2298 * Queries the size of the given path.
2299 *
2300 * @returns VBox status code.
2301 * @retval VERR_NOT_FOUND if the path is not available.
2302 * @param pInterface Pointer to this interface.
2303 * @param pszNamespace The namespace for the path (usually driver/device name) or NULL for default namespace.
2304 * @param pszPath The path to query the size for.
2305 * @param pcb Where to store the size of the path in bytes on success.
2306 */
2307 DECLR3CALLBACKMEMBER(int, pfnQuerySize, (PPDMIVFSCONNECTOR pInterface, const char *pszNamespace, const char *pszPath,
2308 uint64_t *pcb));
2309
2310 /**
2311 * Reads everything from the given path and stores the data into the supplied buffer.
2312 *
2313 * @returns VBox status code.
2314 * @retval VERR_NOT_FOUND if the path is not available.
2315 * @retval VERR_BUFFER_OVERFLOW if the supplied buffer is too small to read everything.
2316 * @retval VINF_BUFFER_UNDERFLOW if the supplied buffer is too large.
2317 * @param pInterface Pointer to this interface.
2318 * @param pszNamespace The namespace for the path (usually driver/device name) or NULL for default namespace.
2319 * @param pszPath The path to read everything for.
2320 * @param pvBuf Where to store the data.
2321 * @param cbRead How much to read.
2322 */
2323 DECLR3CALLBACKMEMBER(int, pfnReadAll, (PPDMIVFSCONNECTOR pInterface, const char *pszNamespace, const char *pszPath,
2324 void *pvBuf, size_t cbRead));
2325
2326 /**
2327 * Writes the supplied data to the given path, overwriting any previously existing data.
2328 *
2329 * @returns VBox status code.
2330 * @param pInterface Pointer to this interface.
2331 * @param pszNamespace The namespace for the path (usually driver/device name) or NULL for default namespace.
2332 * @param pszPath The path to write everything to.
2333 * @param pvBuf The data to store.
2334 * @param cbWrite How many bytes to write.
2335 */
2336 DECLR3CALLBACKMEMBER(int, pfnWriteAll, (PPDMIVFSCONNECTOR pInterface, const char *pszNamespace, const char *pszPath,
2337 const void *pvBuf, size_t cbWrite));
2338
2339 /**
2340 * Deletes the given path.
2341 *
2342 * @returns VBox status code.
2343 * @retval VERR_NOT_FOUND if the path is not available.
2344 * @param pszNamespace The namespace for the path (usually driver/device name) or NULL for default namespace.
2345 * @param pszPath The path to delete.
2346 */
2347 DECLR3CALLBACKMEMBER(int, pfnDelete, (PPDMIVFSCONNECTOR pInterface, const char *pszNamespace, const char *pszPath));
2348
2349 /** @todo Add standard open/read/write/close callbacks when the need arises. */
2350
2351} PDMIVFSCONNECTOR;
2352/** PDMIVFSCONNECTOR interface ID. */
2353#define PDMIVFSCONNECTOR_IID "a1fc51e0-414a-4e78-8388-8053b9dc6521"
2354
2355
2356/** Pointer to an GPIO port interface. */
2357typedef struct PDMIGPIOPORT *PPDMIGPIOPORT;
2358/**
2359 * Interface for GPIO ports (down).
2360 * Pair with PDMIGPIOCONNECTORS.
2361 */
2362typedef struct PDMIGPIOPORT
2363{
2364
2365 /**
2366 * Changes the state of the indicated GPIO line to the given value.
2367 *
2368 * @returns VBox status code.
2369 * @param pInterface Pointer to this interface.
2370 * @param idGpio The GPIO line ID to change.
2371 * @param fVal The value to change the GPIO line to.
2372 */
2373 DECLR3CALLBACKMEMBER(int, pfnGpioLineChange, (PPDMIGPIOPORT pInterface, uint32_t idGpio, bool fVal));
2374
2375 /**
2376 * Returns whether the given GPIO line is configured as an input.
2377 *
2378 * @returns true if the line is configured as an input, false if output.
2379 * @param pInterface Pointer to this interface.
2380 * @param idGpio The GPIO line ID to check.
2381 */
2382 DECLR3CALLBACKMEMBER(bool, pfnGpioLineIsInput, (PPDMIGPIOPORT pInterface, uint32_t idGpio));
2383
2384} PDMIGPIOPORT;
2385/** PDMIGPIOPORT interface ID. */
2386#define PDMIGPIOPORT_IID "75e0017c-4cda-47a4-8160-f4cc436025c4"
2387
2388
2389/** Pointer to an GPIO connectors interface. */
2390typedef struct PDMIGPIOCONNECTOR *PPDMIGPIOCONNECTOR;
2391/**
2392 * GPIO connector interface (up).
2393 * Pair with PDMIGPIOPORT.
2394 */
2395typedef struct PDMIGPIOCONNECTOR
2396{
2397 uint32_t uDummy;
2398} PDMIGPIOCONNECTOR;
2399/** PDMIGPIOCONNECTOR interface ID. */
2400#define PDMIGPIOCONNECTOR_IID "504bff7e-489f-4829-8cc3-f9b080d39133"
2401
2402/** @} */
2403
2404RT_C_DECLS_END
2405
2406#endif /* !VBOX_INCLUDED_vmm_pdmifs_h */
Note: See TracBrowser for help on using the repository browser.

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