VirtualBox

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

Last change on this file since 99396 was 98276, checked in by vboxsync, 23 months ago

Main/UsbCardReader.cpp: rc -> hrc/vrc. bugref:10223

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

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