VirtualBox

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

Last change on this file since 47764 was 47571, checked in by vboxsync, 12 years ago

include,Devices,Main,VirtualBox: multi-touch input.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 124.8 KB
Line 
1/** @file
2 * PDM - Pluggable Device Manager, Interfaces.
3 */
4
5/*
6 * Copyright (C) 2006-2012 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef ___VBox_vmm_pdmifs_h
27#define ___VBox_vmm_pdmifs_h
28
29#include <iprt/sg.h>
30#include <VBox/types.h>
31#include <VBox/hgcmsvc.h>
32
33
34RT_C_DECLS_BEGIN
35
36/** @defgroup grp_pdm_interfaces The PDM Interface Definitions
37 * @ingroup grp_pdm
38 *
39 * For historical reasons (the PDMINTERFACE enum) a lot of interface was stuffed
40 * together in this group instead, dragging stuff into global space that didn't
41 * need to be there and making this file huge (>2500 lines). Since we're using
42 * UUIDs as interface identifiers (IIDs) now, no only generic PDM interface will
43 * be added to this file. Component specific interface should be defined in the
44 * header file of that component.
45 *
46 * Interfaces consists of a method table (typedef'ed struct) and an interface
47 * ID. The typename of the method table should have an 'I' in it, be all
48 * capitals and according to the rules, no underscores. The interface ID is a
49 * \#define constructed by appending '_IID' to the typename. The IID value is a
50 * UUID string on the form "a2299c0d-b709-4551-aa5a-73f59ffbed74". If you stick
51 * to these rules, you can make use of the PDMIBASE_QUERY_INTERFACE and
52 * PDMIBASE_RETURN_INTERFACE when querying interface and implementing
53 * PDMIBASE::pfnQueryInterface respectively.
54 *
55 * In most interface descriptions the orientation of the interface is given as
56 * 'down' or 'up'. This refers to a model with the device on the top and the
57 * drivers stacked below it. Sometimes there is mention of 'main' or 'external'
58 * which normally means the same, i.e. the Main or VBoxBFE API. Picture the
59 * orientation of 'main' as horizontal.
60 *
61 * @{
62 */
63
64
65/** @name PDMIBASE
66 * @{
67 */
68
69/**
70 * PDM Base Interface.
71 *
72 * Everyone implements this.
73 */
74typedef struct PDMIBASE
75{
76 /**
77 * Queries an interface to the driver.
78 *
79 * @returns Pointer to interface.
80 * @returns NULL if the interface was not supported by the driver.
81 * @param pInterface Pointer to this interface structure.
82 * @param pszIID The interface ID, a UUID string.
83 * @thread Any thread.
84 */
85 DECLR3CALLBACKMEMBER(void *, pfnQueryInterface,(struct PDMIBASE *pInterface, const char *pszIID));
86} PDMIBASE;
87/** PDMIBASE interface ID. */
88#define PDMIBASE_IID "a2299c0d-b709-4551-aa5a-73f59ffbed74"
89
90/**
91 * Helper macro for querying an interface from PDMIBASE.
92 *
93 * @returns Correctly typed PDMIBASE::pfnQueryInterface return value.
94 *
95 * @param pIBase Pointer to the base interface.
96 * @param InterfaceType The interface type name. The interface ID is
97 * derived from this by appending _IID.
98 */
99#define PDMIBASE_QUERY_INTERFACE(pIBase, InterfaceType) \
100 ( (InterfaceType *)(pIBase)->pfnQueryInterface(pIBase, InterfaceType##_IID ) )
101
102/**
103 * Helper macro for implementing PDMIBASE::pfnQueryInterface.
104 *
105 * Return @a pInterface if @a pszIID matches the @a InterfaceType. This will
106 * perform basic type checking.
107 *
108 * @param pszIID The ID of the interface that is being queried.
109 * @param InterfaceType The interface type name. The interface ID is
110 * derived from this by appending _IID.
111 * @param pInterface The interface address expression.
112 */
113#define PDMIBASE_RETURN_INTERFACE(pszIID, InterfaceType, pInterface) \
114 do { \
115 if (RTUuidCompare2Strs((pszIID), InterfaceType##_IID) == 0) \
116 { \
117 P##InterfaceType pReturnInterfaceTypeCheck = (pInterface); \
118 return pReturnInterfaceTypeCheck; \
119 } \
120 } while (0)
121
122/** @} */
123
124
125/** @name PDMIBASERC
126 * @{
127 */
128
129/**
130 * PDM Base Interface for querying ring-mode context interfaces in
131 * ring-3.
132 *
133 * This is mandatory for drivers present in raw-mode context.
134 */
135typedef struct PDMIBASERC
136{
137 /**
138 * Queries an ring-mode context interface to the driver.
139 *
140 * @returns Pointer to interface.
141 * @returns NULL if the interface was not supported by the driver.
142 * @param pInterface Pointer to this interface structure.
143 * @param pszIID The interface ID, a UUID string.
144 * @thread Any thread.
145 */
146 DECLR3CALLBACKMEMBER(RTRCPTR, pfnQueryInterface,(struct PDMIBASERC *pInterface, const char *pszIID));
147} PDMIBASERC;
148/** Pointer to a PDM Base Interface for query ring-mode context interfaces. */
149typedef PDMIBASERC *PPDMIBASERC;
150/** PDMIBASERC interface ID. */
151#define PDMIBASERC_IID "f6a6c649-6cb3-493f-9737-4653f221aeca"
152
153/**
154 * Helper macro for querying an interface from PDMIBASERC.
155 *
156 * @returns PDMIBASERC::pfnQueryInterface return value.
157 *
158 * @param pIBaseRC Pointer to the base raw-mode context interface. Can
159 * be NULL.
160 * @param InterfaceType The interface type base name, no trailing RC. The
161 * interface ID is derived from this by appending _IID.
162 *
163 * @remarks Unlike PDMIBASE_QUERY_INTERFACE, this macro is not able to do any
164 * implicit type checking for you.
165 */
166#define PDMIBASERC_QUERY_INTERFACE(pIBaseRC, InterfaceType) \
167 ( (P##InterfaceType##RC)((pIBaseRC) ? (pIBaseRC)->pfnQueryInterface(pIBaseRC, InterfaceType##_IID) : NIL_RTRCPTR) )
168
169/**
170 * Helper macro for implementing PDMIBASERC::pfnQueryInterface.
171 *
172 * Return @a pInterface if @a pszIID matches the @a InterfaceType. This will
173 * perform basic type checking.
174 *
175 * @param pIns Pointer to the instance data.
176 * @param pszIID The ID of the interface that is being queried.
177 * @param InterfaceType The interface type base name, no trailing RC. The
178 * interface ID is derived from this by appending _IID.
179 * @param pInterface The interface address expression. This must resolve
180 * to some address within the instance data.
181 * @remarks Don't use with PDMIBASE.
182 */
183#define PDMIBASERC_RETURN_INTERFACE(pIns, pszIID, InterfaceType, pInterface) \
184 do { \
185 Assert((uintptr_t)pInterface - PDMINS_2_DATA(pIns, uintptr_t) < _4M); \
186 if (RTUuidCompare2Strs((pszIID), InterfaceType##_IID) == 0) \
187 { \
188 InterfaceType##RC *pReturnInterfaceTypeCheck = (pInterface); \
189 return (uintptr_t)pReturnInterfaceTypeCheck \
190 - PDMINS_2_DATA(pIns, uintptr_t) \
191 + PDMINS_2_DATA_RCPTR(pIns); \
192 } \
193 } while (0)
194
195/** @} */
196
197
198/** @name PDMIBASER0
199 * @{
200 */
201
202/**
203 * PDM Base Interface for querying ring-0 interfaces in ring-3.
204 *
205 * This is mandatory for drivers present in ring-0 context.
206 */
207typedef struct PDMIBASER0
208{
209 /**
210 * Queries an ring-0 interface to the driver.
211 *
212 * @returns Pointer to interface.
213 * @returns NULL if the interface was not supported by the driver.
214 * @param pInterface Pointer to this interface structure.
215 * @param pszIID The interface ID, a UUID string.
216 * @thread Any thread.
217 */
218 DECLR3CALLBACKMEMBER(RTR0PTR, pfnQueryInterface,(struct PDMIBASER0 *pInterface, const char *pszIID));
219} PDMIBASER0;
220/** Pointer to a PDM Base Interface for query ring-0 context interfaces. */
221typedef PDMIBASER0 *PPDMIBASER0;
222/** PDMIBASER0 interface ID. */
223#define PDMIBASER0_IID "9c9b99b8-7f53-4f59-a3c2-5bc9659c7944"
224
225/**
226 * Helper macro for querying an interface from PDMIBASER0.
227 *
228 * @returns PDMIBASER0::pfnQueryInterface return value.
229 *
230 * @param pIBaseR0 Pointer to the base ring-0 interface. Can be NULL.
231 * @param InterfaceType The interface type base name, no trailing R0. The
232 * interface ID is derived from this by appending _IID.
233 *
234 * @remarks Unlike PDMIBASE_QUERY_INTERFACE, this macro is not able to do any
235 * implicit type checking for you.
236 */
237#define PDMIBASER0_QUERY_INTERFACE(pIBaseR0, InterfaceType) \
238 ( (P##InterfaceType##R0)((pIBaseR0) ? (pIBaseR0)->pfnQueryInterface(pIBaseR0, InterfaceType##_IID) : NIL_RTR0PTR) )
239
240/**
241 * Helper macro for implementing PDMIBASER0::pfnQueryInterface.
242 *
243 * Return @a pInterface if @a pszIID matches the @a InterfaceType. This will
244 * perform basic type checking.
245 *
246 * @param pIns Pointer to the instance data.
247 * @param pszIID The ID of the interface that is being queried.
248 * @param InterfaceType The interface type base name, no trailing R0. The
249 * interface ID is derived from this by appending _IID.
250 * @param pInterface The interface address expression. This must resolve
251 * to some address within the instance data.
252 * @remarks Don't use with PDMIBASE.
253 */
254#define PDMIBASER0_RETURN_INTERFACE(pIns, pszIID, InterfaceType, pInterface) \
255 do { \
256 Assert((uintptr_t)pInterface - PDMINS_2_DATA(pIns, uintptr_t) < _4M); \
257 if (RTUuidCompare2Strs((pszIID), InterfaceType##_IID) == 0) \
258 { \
259 InterfaceType##R0 *pReturnInterfaceTypeCheck = (pInterface); \
260 return (uintptr_t)pReturnInterfaceTypeCheck \
261 - PDMINS_2_DATA(pIns, uintptr_t) \
262 + PDMINS_2_DATA_R0PTR(pIns); \
263 } \
264 } while (0)
265
266/** @} */
267
268
269/**
270 * Dummy interface.
271 *
272 * This is used to typedef other dummy interfaces. The purpose of a dummy
273 * interface is to validate the logical function of a driver/device and
274 * full a natural interface pair.
275 */
276typedef struct PDMIDUMMY
277{
278 RTHCPTR pvDummy;
279} PDMIDUMMY;
280
281
282/** Pointer to a mouse port interface. */
283typedef struct PDMIMOUSEPORT *PPDMIMOUSEPORT;
284/**
285 * Mouse port interface (down).
286 * Pair with PDMIMOUSECONNECTOR.
287 */
288typedef struct PDMIMOUSEPORT
289{
290 /**
291 * Puts a mouse event.
292 *
293 * This is called by the source of mouse events. The event will be passed up
294 * until the topmost driver, which then calls the registered event handler.
295 *
296 * @returns VBox status code. Return VERR_TRY_AGAIN if you cannot process the
297 * event now and want it to be repeated at a later point.
298 *
299 * @param pInterface Pointer to this interface structure.
300 * @param dx The X delta.
301 * @param dy The Y delta.
302 * @param dz The Z delta.
303 * @param dw The W (horizontal scroll button) delta.
304 * @param fButtons The button states, see the PDMIMOUSEPORT_BUTTON_* \#defines.
305 */
306 DECLR3CALLBACKMEMBER(int, pfnPutEvent,(PPDMIMOUSEPORT pInterface,
307 int32_t dx, int32_t dy, int32_t dz,
308 int32_t dw, uint32_t fButtons));
309 /**
310 * Puts an absolute mouse event.
311 *
312 * This is called by the source of mouse events. The event will be passed up
313 * until the topmost driver, which then calls the registered event handler.
314 *
315 * @returns VBox status code. Return VERR_TRY_AGAIN if you cannot process the
316 * event now and want it to be repeated at a later point.
317 *
318 * @param pInterface Pointer to this interface structure.
319 * @param x The X value, in the range 0 to 0xffff.
320 * @param z The Y value, in the range 0 to 0xffff.
321 * @param dz The Z delta.
322 * @param dw The W (horizontal scroll button) delta.
323 * @param fButtons The button states, see the PDMIMOUSEPORT_BUTTON_* \#defines.
324 */
325 DECLR3CALLBACKMEMBER(int, pfnPutEventAbs,(PPDMIMOUSEPORT pInterface,
326 uint32_t x, uint32_t z,
327 int32_t dz, int32_t dw,
328 uint32_t fButtons));
329 /**
330 * Puts a multi-touch event.
331 *
332 * @returns VBox status code. Return VERR_TRY_AGAIN if you cannot process the
333 * event now and want it to be repeated at a later point.
334 *
335 * @param pInterface Pointer to this interface structure.
336 * @param cContacts How many touch contacts in this event.
337 * @param pau64Contacts Pointer to array of packed contact information.
338 * Each 64bit element contains:
339 * Bits 0..15: X coordinate in pixels (signed).
340 * Bits 16..31: Y coordinate in pixels (signed).
341 * Bits 32..39: contact identifier.
342 * Bit 40: "in contact" flag, which indicates that
343 * there is a contact with the touch surface.
344 * Bit 41: "in range" flag, the contact is close enough
345 * to the touch surface.
346 * All other bits are reserved for future use and must be set to 0.
347 * @param u32ScanTime Timestamp of this event in milliseconds. Only relative
348 * time between event is important.
349 */
350 DECLR3CALLBACKMEMBER(int, pfnPutEventMultiTouch,(PPDMIMOUSEPORT pInterface,
351 uint8_t cContacts,
352 const uint64_t *pau64Contacts,
353 uint32_t u32ScanTime));
354} PDMIMOUSEPORT;
355/** PDMIMOUSEPORT interface ID. */
356#define PDMIMOUSEPORT_IID "359364f0-9fa3-4490-a6b4-7ed771901c93"
357
358/** Mouse button defines for PDMIMOUSEPORT::pfnPutEvent.
359 * @{ */
360#define PDMIMOUSEPORT_BUTTON_LEFT RT_BIT(0)
361#define PDMIMOUSEPORT_BUTTON_RIGHT RT_BIT(1)
362#define PDMIMOUSEPORT_BUTTON_MIDDLE RT_BIT(2)
363#define PDMIMOUSEPORT_BUTTON_X1 RT_BIT(3)
364#define PDMIMOUSEPORT_BUTTON_X2 RT_BIT(4)
365/** @} */
366
367
368/** Pointer to a mouse connector interface. */
369typedef struct PDMIMOUSECONNECTOR *PPDMIMOUSECONNECTOR;
370/**
371 * Mouse connector interface (up).
372 * Pair with PDMIMOUSEPORT.
373 */
374typedef struct PDMIMOUSECONNECTOR
375{
376 /**
377 * Notifies the the downstream driver of changes to the reporting modes
378 * supported by the driver
379 *
380 * @param pInterface Pointer to the this interface.
381 * @param fRelative Whether relative mode is currently supported.
382 * @param fAbsolute Whether absolute mode is currently supported.
383 * @param fAbsolute Whether multi-touch mode is currently supported.
384 */
385 DECLR3CALLBACKMEMBER(void, pfnReportModes,(PPDMIMOUSECONNECTOR pInterface, bool fRelative, bool fAbsolute, bool fMultiTouch));
386
387} PDMIMOUSECONNECTOR;
388/** PDMIMOUSECONNECTOR interface ID. */
389#define PDMIMOUSECONNECTOR_IID "ce64d7bd-fa8f-41d1-a6fb-d102a2d6bffe"
390
391
392/** Pointer to a keyboard port interface. */
393typedef struct PDMIKEYBOARDPORT *PPDMIKEYBOARDPORT;
394/**
395 * Keyboard port interface (down).
396 * Pair with PDMIKEYBOARDCONNECTOR.
397 */
398typedef struct PDMIKEYBOARDPORT
399{
400 /**
401 * Puts a keyboard event.
402 *
403 * This is called by the source of keyboard events. The event will be passed up
404 * until the topmost driver, which then calls the registered event handler.
405 *
406 * @returns VBox status code. Return VERR_TRY_AGAIN if you cannot process the
407 * event now and want it to be repeated at a later point.
408 *
409 * @param pInterface Pointer to this interface structure.
410 * @param u8KeyCode The keycode to queue.
411 */
412 DECLR3CALLBACKMEMBER(int, pfnPutEvent,(PPDMIKEYBOARDPORT pInterface, uint8_t u8KeyCode));
413} PDMIKEYBOARDPORT;
414/** PDMIKEYBOARDPORT interface ID. */
415#define PDMIKEYBOARDPORT_IID "2a0844f0-410b-40ab-a6ed-6575f3aa3e29"
416
417
418/**
419 * Keyboard LEDs.
420 */
421typedef enum PDMKEYBLEDS
422{
423 /** No leds. */
424 PDMKEYBLEDS_NONE = 0x0000,
425 /** Num Lock */
426 PDMKEYBLEDS_NUMLOCK = 0x0001,
427 /** Caps Lock */
428 PDMKEYBLEDS_CAPSLOCK = 0x0002,
429 /** Scroll Lock */
430 PDMKEYBLEDS_SCROLLLOCK = 0x0004
431} PDMKEYBLEDS;
432
433/** Pointer to keyboard connector interface. */
434typedef struct PDMIKEYBOARDCONNECTOR *PPDMIKEYBOARDCONNECTOR;
435/**
436 * Keyboard connector interface (up).
437 * Pair with PDMIKEYBOARDPORT
438 */
439typedef struct PDMIKEYBOARDCONNECTOR
440{
441 /**
442 * Notifies the the downstream driver about an LED change initiated by the guest.
443 *
444 * @param pInterface Pointer to the this interface.
445 * @param enmLeds The new led mask.
446 */
447 DECLR3CALLBACKMEMBER(void, pfnLedStatusChange,(PPDMIKEYBOARDCONNECTOR pInterface, PDMKEYBLEDS enmLeds));
448
449 /**
450 * Notifies the the downstream driver of changes in driver state.
451 *
452 * @param pInterface Pointer to the this interface.
453 * @param fActive Whether interface wishes to get "focus".
454 */
455 DECLR3CALLBACKMEMBER(void, pfnSetActive,(PPDMIKEYBOARDCONNECTOR pInterface, bool fActive));
456
457} PDMIKEYBOARDCONNECTOR;
458/** PDMIKEYBOARDCONNECTOR interface ID. */
459#define PDMIKEYBOARDCONNECTOR_IID "db3f7bd5-953e-436f-9f8e-077905a92d82"
460
461
462
463/** Pointer to a display port interface. */
464typedef struct PDMIDISPLAYPORT *PPDMIDISPLAYPORT;
465/**
466 * Display port interface (down).
467 * Pair with PDMIDISPLAYCONNECTOR.
468 */
469typedef struct PDMIDISPLAYPORT
470{
471 /**
472 * Update the display with any changed regions.
473 *
474 * Flushes any display changes to the memory pointed to by the
475 * PDMIDISPLAYCONNECTOR interface and calles PDMIDISPLAYCONNECTOR::pfnUpdateRect()
476 * while doing so.
477 *
478 * @returns VBox status code.
479 * @param pInterface Pointer to this interface.
480 * @thread The emulation thread.
481 */
482 DECLR3CALLBACKMEMBER(int, pfnUpdateDisplay,(PPDMIDISPLAYPORT pInterface));
483
484 /**
485 * Update the entire display.
486 *
487 * Flushes the entire display content to the memory pointed to by the
488 * PDMIDISPLAYCONNECTOR interface and calles PDMIDISPLAYCONNECTOR::pfnUpdateRect().
489 *
490 * @returns VBox status code.
491 * @param pInterface Pointer to this interface.
492 * @thread The emulation thread.
493 */
494 DECLR3CALLBACKMEMBER(int, pfnUpdateDisplayAll,(PPDMIDISPLAYPORT pInterface));
495
496 /**
497 * Return the current guest color depth in bits per pixel (bpp).
498 *
499 * As the graphics card is able to provide display updates with the bpp
500 * requested by the host, this method can be used to query the actual
501 * guest color depth.
502 *
503 * @returns VBox status code.
504 * @param pInterface Pointer to this interface.
505 * @param pcBits Where to store the current guest color depth.
506 * @thread Any thread.
507 */
508 DECLR3CALLBACKMEMBER(int, pfnQueryColorDepth,(PPDMIDISPLAYPORT pInterface, uint32_t *pcBits));
509
510 /**
511 * Sets the refresh rate and restart the timer.
512 * The rate is defined as the minimum interval between the return of
513 * one PDMIDISPLAYPORT::pfnRefresh() call to the next one.
514 *
515 * The interval timer will be restarted by this call. So at VM startup
516 * this function must be called to start the refresh cycle. The refresh
517 * rate is not saved, but have to be when resuming a loaded VM state.
518 *
519 * @returns VBox status code.
520 * @param pInterface Pointer to this interface.
521 * @param cMilliesInterval Number of millis between two refreshes.
522 * @thread Any thread.
523 */
524 DECLR3CALLBACKMEMBER(int, pfnSetRefreshRate,(PPDMIDISPLAYPORT pInterface, uint32_t cMilliesInterval));
525
526 /**
527 * Create a 32-bbp screenshot of the display.
528 *
529 * This will allocate and return a 32-bbp bitmap. Size of the bitmap scanline in bytes is 4*width.
530 *
531 * The allocated bitmap buffer must be freed with pfnFreeScreenshot.
532 *
533 * @param pInterface Pointer to this interface.
534 * @param ppu8Data Where to store the pointer to the allocated buffer.
535 * @param pcbData Where to store the actual size of the bitmap.
536 * @param pcx Where to store the width of the bitmap.
537 * @param pcy Where to store the height of the bitmap.
538 * @thread The emulation thread.
539 */
540 DECLR3CALLBACKMEMBER(int, pfnTakeScreenshot,(PPDMIDISPLAYPORT pInterface, uint8_t **ppu8Data, size_t *pcbData, uint32_t *pcx, uint32_t *pcy));
541
542 /**
543 * Free screenshot buffer.
544 *
545 * This will free the memory buffer allocated by pfnTakeScreenshot.
546 *
547 * @param pInterface Pointer to this interface.
548 * @param ppu8Data Pointer to the buffer returned by pfnTakeScreenshot.
549 * @thread Any.
550 */
551 DECLR3CALLBACKMEMBER(void, pfnFreeScreenshot,(PPDMIDISPLAYPORT pInterface, uint8_t *pu8Data));
552
553 /**
554 * Copy bitmap to the display.
555 *
556 * This will convert and copy a 32-bbp bitmap (with dword aligned scanline length) to
557 * the memory pointed to by the PDMIDISPLAYCONNECTOR interface.
558 *
559 * @param pInterface Pointer to this interface.
560 * @param pvData Pointer to the bitmap bits.
561 * @param x The upper left corner x coordinate of the destination rectangle.
562 * @param y The upper left corner y coordinate of the destination rectangle.
563 * @param cx The width of the source and destination rectangles.
564 * @param cy The height of the source and destination rectangles.
565 * @thread The emulation thread.
566 * @remark This is just a convenience for using the bitmap conversions of the
567 * graphics device.
568 */
569 DECLR3CALLBACKMEMBER(int, pfnDisplayBlt,(PPDMIDISPLAYPORT pInterface, const void *pvData, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy));
570
571 /**
572 * Render a rectangle from guest VRAM to Framebuffer.
573 *
574 * @param pInterface Pointer to this interface.
575 * @param x The upper left corner x coordinate of the rectangle to be updated.
576 * @param y The upper left corner y coordinate of the rectangle to be updated.
577 * @param cx The width of the rectangle to be updated.
578 * @param cy The height of the rectangle to be updated.
579 * @thread The emulation thread.
580 */
581 DECLR3CALLBACKMEMBER(void, pfnUpdateDisplayRect,(PPDMIDISPLAYPORT pInterface, int32_t x, int32_t y, uint32_t cx, uint32_t cy));
582
583 /**
584 * Inform the VGA device whether the Display is directly using the guest VRAM and there is no need
585 * to render the VRAM to the framebuffer memory.
586 *
587 * @param pInterface Pointer to this interface.
588 * @param fRender Whether the VRAM content must be rendered to the framebuffer.
589 * @thread The emulation thread.
590 */
591 DECLR3CALLBACKMEMBER(void, pfnSetRenderVRAM,(PPDMIDISPLAYPORT pInterface, bool fRender));
592
593 /**
594 * Render a bitmap rectangle from source to target buffer.
595 *
596 * @param pInterface Pointer to this interface.
597 * @param cx The width of the rectangle to be copied.
598 * @param cy The height of the rectangle to be copied.
599 * @param pbSrc Source frame buffer 0,0.
600 * @param xSrc The upper left corner x coordinate of the source rectangle.
601 * @param ySrc The upper left corner y coordinate of the source rectangle.
602 * @param cxSrc The width of the source frame buffer.
603 * @param cySrc The height of the source frame buffer.
604 * @param cbSrcLine The line length of the source frame buffer.
605 * @param cSrcBitsPerPixel The pixel depth of the source.
606 * @param pbDst Destination frame buffer 0,0.
607 * @param xDst The upper left corner x coordinate of the destination rectangle.
608 * @param yDst The upper left corner y coordinate of the destination rectangle.
609 * @param cxDst The width of the destination frame buffer.
610 * @param cyDst The height of the destination frame buffer.
611 * @param cbDstLine The line length of the destination frame buffer.
612 * @param cDstBitsPerPixel The pixel depth of the destination.
613 * @thread The emulation thread.
614 */
615 DECLR3CALLBACKMEMBER(int, pfnCopyRect,(PPDMIDISPLAYPORT pInterface, uint32_t cx, uint32_t cy,
616 const uint8_t *pbSrc, int32_t xSrc, int32_t ySrc, uint32_t cxSrc, uint32_t cySrc, uint32_t cbSrcLine, uint32_t cSrcBitsPerPixel,
617 uint8_t *pbDst, int32_t xDst, int32_t yDst, uint32_t cxDst, uint32_t cyDst, uint32_t cbDstLine, uint32_t cDstBitsPerPixel));
618
619} PDMIDISPLAYPORT;
620/** PDMIDISPLAYPORT interface ID. */
621#define PDMIDISPLAYPORT_IID "22d3d93d-3407-487a-8308-85367eae00bb"
622
623
624typedef struct VBOXVHWACMD *PVBOXVHWACMD; /**< @todo r=bird: A line what it is to make doxygen happy. */
625typedef struct VBVACMDHDR *PVBVACMDHDR;
626typedef struct VBVAINFOSCREEN *PVBVAINFOSCREEN;
627typedef struct VBVAINFOVIEW *PVBVAINFOVIEW;
628typedef struct VBVAHOSTFLAGS *PVBVAHOSTFLAGS;
629typedef struct VBOXVDMACMD_CHROMIUM_CMD *PVBOXVDMACMD_CHROMIUM_CMD; /* <- chromium [hgsmi] command */
630typedef struct VBOXVDMACMD_CHROMIUM_CTL *PVBOXVDMACMD_CHROMIUM_CTL; /* <- chromium [hgsmi] command */
631
632/** Pointer to a display connector interface. */
633typedef struct PDMIDISPLAYCONNECTOR *PPDMIDISPLAYCONNECTOR;
634/**
635 * Display connector interface (up).
636 * Pair with PDMIDISPLAYPORT.
637 */
638typedef struct PDMIDISPLAYCONNECTOR
639{
640 /**
641 * Resize the display.
642 * This is called when the resolution changes. This usually happens on
643 * request from the guest os, but may also happen as the result of a reset.
644 * If the callback returns VINF_VGA_RESIZE_IN_PROGRESS, the caller (VGA device)
645 * must not access the connector and return.
646 *
647 * @returns VINF_SUCCESS if the framebuffer resize was completed,
648 * VINF_VGA_RESIZE_IN_PROGRESS if resize takes time and not yet finished.
649 * @param pInterface Pointer to this interface.
650 * @param cBits Color depth (bits per pixel) of the new video mode.
651 * @param pvVRAM Address of the guest VRAM.
652 * @param cbLine Size in bytes of a single scan line.
653 * @param cx New display width.
654 * @param cy New display height.
655 * @thread The emulation thread.
656 */
657 DECLR3CALLBACKMEMBER(int, pfnResize,(PPDMIDISPLAYCONNECTOR pInterface, uint32_t cBits, void *pvVRAM, uint32_t cbLine, uint32_t cx, uint32_t cy));
658
659 /**
660 * Update a rectangle of the display.
661 * PDMIDISPLAYPORT::pfnUpdateDisplay is the caller.
662 *
663 * @param pInterface Pointer to this interface.
664 * @param x The upper left corner x coordinate of the rectangle.
665 * @param y The upper left corner y coordinate of the rectangle.
666 * @param cx The width of the rectangle.
667 * @param cy The height of the rectangle.
668 * @thread The emulation thread.
669 */
670 DECLR3CALLBACKMEMBER(void, pfnUpdateRect,(PPDMIDISPLAYCONNECTOR pInterface, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy));
671
672 /**
673 * Refresh the display.
674 *
675 * The interval between these calls is set by
676 * PDMIDISPLAYPORT::pfnSetRefreshRate(). The driver should call
677 * PDMIDISPLAYPORT::pfnUpdateDisplay() if it wishes to refresh the
678 * display. PDMIDISPLAYPORT::pfnUpdateDisplay calls pfnUpdateRect with
679 * the changed rectangles.
680 *
681 * @param pInterface Pointer to this interface.
682 * @thread The emulation thread.
683 */
684 DECLR3CALLBACKMEMBER(void, pfnRefresh,(PPDMIDISPLAYCONNECTOR pInterface));
685
686 /**
687 * Reset the display.
688 *
689 * Notification message when the graphics card has been reset.
690 *
691 * @param pInterface Pointer to this interface.
692 * @thread The emulation thread.
693 */
694 DECLR3CALLBACKMEMBER(void, pfnReset,(PPDMIDISPLAYCONNECTOR pInterface));
695
696 /**
697 * LFB video mode enter/exit.
698 *
699 * Notification message when LinearFrameBuffer video mode is enabled/disabled.
700 *
701 * @param pInterface Pointer to this interface.
702 * @param fEnabled false - LFB mode was disabled,
703 * true - an LFB mode was disabled
704 * @thread The emulation thread.
705 */
706 DECLR3CALLBACKMEMBER(void, pfnLFBModeChange, (PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled));
707
708 /**
709 * Process the guest graphics adapter information.
710 *
711 * Direct notification from guest to the display connector.
712 *
713 * @param pInterface Pointer to this interface.
714 * @param pvVRAM Address of the guest VRAM.
715 * @param u32VRAMSize Size of the guest VRAM.
716 * @thread The emulation thread.
717 */
718 DECLR3CALLBACKMEMBER(void, pfnProcessAdapterData, (PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, uint32_t u32VRAMSize));
719
720 /**
721 * Process the guest display information.
722 *
723 * Direct notification from guest to the display connector.
724 *
725 * @param pInterface Pointer to this interface.
726 * @param pvVRAM Address of the guest VRAM.
727 * @param uScreenId The index of the guest display to be processed.
728 * @thread The emulation thread.
729 */
730 DECLR3CALLBACKMEMBER(void, pfnProcessDisplayData, (PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, unsigned uScreenId));
731
732 /**
733 * Process the guest Video HW Acceleration command.
734 *
735 * @param pInterface Pointer to this interface.
736 * @param pCmd Video HW Acceleration Command to be processed.
737 * @thread The emulation thread.
738 */
739 DECLR3CALLBACKMEMBER(void, pfnVHWACommandProcess, (PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCmd));
740
741 /**
742 * Process the guest chromium command.
743 *
744 * @param pInterface Pointer to this interface.
745 * @param pCmd Video HW Acceleration Command to be processed.
746 * @thread The emulation thread.
747 */
748 DECLR3CALLBACKMEMBER(void, pfnCrHgsmiCommandProcess, (PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd));
749
750 /**
751 * Process the guest chromium control command.
752 *
753 * @param pInterface Pointer to this interface.
754 * @param pCmd Video HW Acceleration Command to be processed.
755 * @thread The emulation thread.
756 */
757 DECLR3CALLBACKMEMBER(void, pfnCrHgsmiControlProcess, (PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32_t cbCtl));
758
759
760 /**
761 * The specified screen enters VBVA mode.
762 *
763 * @param pInterface Pointer to this interface.
764 * @param uScreenId The screen updates are for.
765 * @thread The emulation thread.
766 */
767 DECLR3CALLBACKMEMBER(int, pfnVBVAEnable,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, PVBVAHOSTFLAGS pHostFlags));
768
769 /**
770 * The specified screen leaves VBVA mode.
771 *
772 * @param pInterface Pointer to this interface.
773 * @param uScreenId The screen updates are for.
774 * @thread The emulation thread.
775 */
776 DECLR3CALLBACKMEMBER(void, pfnVBVADisable,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId));
777
778 /**
779 * A sequence of pfnVBVAUpdateProcess calls begins.
780 *
781 * @param pInterface Pointer to this interface.
782 * @param uScreenId The screen updates are for.
783 * @thread The emulation thread.
784 */
785 DECLR3CALLBACKMEMBER(void, pfnVBVAUpdateBegin,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId));
786
787 /**
788 * Process the guest VBVA command.
789 *
790 * @param pInterface Pointer to this interface.
791 * @param pCmd Video HW Acceleration Command to be processed.
792 * @thread The emulation thread.
793 */
794 DECLR3CALLBACKMEMBER(void, pfnVBVAUpdateProcess,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, const PVBVACMDHDR pCmd, size_t cbCmd));
795
796 /**
797 * A sequence of pfnVBVAUpdateProcess calls ends.
798 *
799 * @param pInterface Pointer to this interface.
800 * @param uScreenId The screen updates are for.
801 * @param x The upper left corner x coordinate of the combined rectangle of all VBVA updates.
802 * @param y The upper left corner y coordinate of the rectangle.
803 * @param cx The width of the rectangle.
804 * @param cy The height of the rectangle.
805 * @thread The emulation thread.
806 */
807 DECLR3CALLBACKMEMBER(void, pfnVBVAUpdateEnd,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, int32_t x, int32_t y, uint32_t cx, uint32_t cy));
808
809 /**
810 * Resize the display.
811 * This is called when the resolution changes. This usually happens on
812 * request from the guest os, but may also happen as the result of a reset.
813 * If the callback returns VINF_VGA_RESIZE_IN_PROGRESS, the caller (VGA device)
814 * must not access the connector and return.
815 *
816 * @todo Merge with pfnResize.
817 *
818 * @returns VINF_SUCCESS if the framebuffer resize was completed,
819 * VINF_VGA_RESIZE_IN_PROGRESS if resize takes time and not yet finished.
820 * @param pInterface Pointer to this interface.
821 * @param pView The description of VRAM block for this screen.
822 * @param pScreen The data of screen being resized.
823 * @param pvVRAM Address of the guest VRAM.
824 * @thread The emulation thread.
825 */
826 DECLR3CALLBACKMEMBER(int, pfnVBVAResize,(PPDMIDISPLAYCONNECTOR pInterface, const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN pScreen, void *pvVRAM));
827
828 /**
829 * Update the pointer shape.
830 * This is called when the mouse pointer shape changes. The new shape
831 * is passed as a caller allocated buffer that will be freed after returning
832 *
833 * @param pInterface Pointer to this interface.
834 * @param fVisible Visibility indicator (if false, the other parameters are undefined).
835 * @param fAlpha Flag whether alpha channel is being passed.
836 * @param xHot Pointer hot spot x coordinate.
837 * @param yHot Pointer hot spot y coordinate.
838 * @param x Pointer new x coordinate on screen.
839 * @param y Pointer new y coordinate on screen.
840 * @param cx Pointer width in pixels.
841 * @param cy Pointer height in pixels.
842 * @param cbScanline Size of one scanline in bytes.
843 * @param pvShape New shape buffer.
844 * @thread The emulation thread.
845 */
846 DECLR3CALLBACKMEMBER(int, pfnVBVAMousePointerShape,(PPDMIDISPLAYCONNECTOR pInterface, bool fVisible, bool fAlpha,
847 uint32_t xHot, uint32_t yHot,
848 uint32_t cx, uint32_t cy,
849 const void *pvShape));
850
851 /** Read-only attributes.
852 * For preformance reasons some readonly attributes are kept in the interface.
853 * We trust the interface users to respect the readonlyness of these.
854 * @{
855 */
856 /** Pointer to the display data buffer. */
857 uint8_t *pu8Data;
858 /** Size of a scanline in the data buffer. */
859 uint32_t cbScanline;
860 /** The color depth (in bits) the graphics card is supposed to provide. */
861 uint32_t cBits;
862 /** The display width. */
863 uint32_t cx;
864 /** The display height. */
865 uint32_t cy;
866 /** @} */
867} PDMIDISPLAYCONNECTOR;
868/** PDMIDISPLAYCONNECTOR interface ID. */
869#define PDMIDISPLAYCONNECTOR_IID "c7a1b36d-8dfc-421d-b71f-3a0eeaf733e6"
870
871
872/** Pointer to a block port interface. */
873typedef struct PDMIBLOCKPORT *PPDMIBLOCKPORT;
874/**
875 * Block notify interface (down).
876 * Pair with PDMIBLOCK.
877 */
878typedef struct PDMIBLOCKPORT
879{
880 /**
881 * Returns the storage controller name, instance and LUN of the attached medium.
882 *
883 * @returns VBox status.
884 * @param pInterface Pointer to this interface.
885 * @param ppcszController Where to store the name of the storage controller.
886 * @param piInstance Where to store the instance number of the controller.
887 * @param piLUN Where to store the LUN of the attached device.
888 */
889 DECLR3CALLBACKMEMBER(int, pfnQueryDeviceLocation, (PPDMIBLOCKPORT pInterface, const char **ppcszController,
890 uint32_t *piInstance, uint32_t *piLUN));
891
892} PDMIBLOCKPORT;
893/** PDMIBLOCKPORT interface ID. */
894#define PDMIBLOCKPORT_IID "bbbed4cf-0862-4ffd-b60c-f7a65ef8e8ff"
895
896
897/**
898 * Callback which provides progress information.
899 *
900 * @return VBox status code.
901 * @param pvUser Opaque user data.
902 * @param uPercent Completion percentage.
903 */
904typedef DECLCALLBACK(int) FNSIMPLEPROGRESS(void *pvUser, unsigned uPercentage);
905/** Pointer to FNSIMPLEPROGRESS() */
906typedef FNSIMPLEPROGRESS *PFNSIMPLEPROGRESS;
907
908
909/**
910 * Block drive type.
911 */
912typedef enum PDMBLOCKTYPE
913{
914 /** Error (for the query function). */
915 PDMBLOCKTYPE_ERROR = 1,
916 /** 360KB 5 1/4" floppy drive. */
917 PDMBLOCKTYPE_FLOPPY_360,
918 /** 720KB 3 1/2" floppy drive. */
919 PDMBLOCKTYPE_FLOPPY_720,
920 /** 1.2MB 5 1/4" floppy drive. */
921 PDMBLOCKTYPE_FLOPPY_1_20,
922 /** 1.44MB 3 1/2" floppy drive. */
923 PDMBLOCKTYPE_FLOPPY_1_44,
924 /** 2.88MB 3 1/2" floppy drive. */
925 PDMBLOCKTYPE_FLOPPY_2_88,
926 /** Fake drive that can take up to 15.6 MB images.
927 * C=255, H=2, S=63. */
928 PDMBLOCKTYPE_FLOPPY_FAKE_15_6,
929 /** Fake drive that can take up to 63.5 MB images.
930 * C=255, H=2, S=255. */
931 PDMBLOCKTYPE_FLOPPY_FAKE_63_5,
932 /** CDROM drive. */
933 PDMBLOCKTYPE_CDROM,
934 /** DVD drive. */
935 PDMBLOCKTYPE_DVD,
936 /** Hard disk drive. */
937 PDMBLOCKTYPE_HARD_DISK
938} PDMBLOCKTYPE;
939
940/** Check if the given block type is a floppy. */
941#define PDMBLOCKTYPE_IS_FLOPPY(a_enmType) ( (a_enmType) >= PDMBLOCKTYPE_FLOPPY_360 && (a_enmType) <= PDMBLOCKTYPE_FLOPPY_2_88 )
942
943/**
944 * Block raw command data transfer direction.
945 */
946typedef enum PDMBLOCKTXDIR
947{
948 PDMBLOCKTXDIR_NONE = 0,
949 PDMBLOCKTXDIR_FROM_DEVICE,
950 PDMBLOCKTXDIR_TO_DEVICE
951} PDMBLOCKTXDIR;
952
953
954/** Pointer to a block interface. */
955typedef struct PDMIBLOCK *PPDMIBLOCK;
956/**
957 * Block interface (up).
958 * Pair with PDMIBLOCKPORT.
959 */
960typedef struct PDMIBLOCK
961{
962 /**
963 * Read bits.
964 *
965 * @returns VBox status code.
966 * @param pInterface Pointer to the interface structure containing the called function pointer.
967 * @param off Offset to start reading from. The offset must be aligned to a sector boundary.
968 * @param pvBuf Where to store the read bits.
969 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary.
970 * @thread Any thread.
971 */
972 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIBLOCK pInterface, uint64_t off, void *pvBuf, size_t cbRead));
973
974 /**
975 * Write bits.
976 *
977 * @returns VBox status code.
978 * @param pInterface Pointer to the interface structure containing the called function pointer.
979 * @param off Offset to start writing at. The offset must be aligned to a sector boundary.
980 * @param pvBuf Where to store the write bits.
981 * @param cbWrite Number of bytes to write. Must be aligned to a sector boundary.
982 * @thread Any thread.
983 */
984 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIBLOCK pInterface, uint64_t off, const void *pvBuf, size_t cbWrite));
985
986 /**
987 * Make sure that the bits written are actually on the storage medium.
988 *
989 * @returns VBox status code.
990 * @param pInterface Pointer to the interface structure containing the called function pointer.
991 * @thread Any thread.
992 */
993 DECLR3CALLBACKMEMBER(int, pfnFlush,(PPDMIBLOCK pInterface));
994
995 /**
996 * Send a raw command to the underlying device (CDROM).
997 * This method is optional (i.e. the function pointer may be NULL).
998 *
999 * @returns VBox status code.
1000 * @param pInterface Pointer to the interface structure containing the called function pointer.
1001 * @param pbCmd Offset to start reading from.
1002 * @param enmTxDir Direction of transfer.
1003 * @param pvBuf Pointer tp the transfer buffer.
1004 * @param cbBuf Size of the transfer buffer.
1005 * @param pbSenseKey Status of the command (when return value is VERR_DEV_IO_ERROR).
1006 * @param cTimeoutMillies Command timeout in milliseconds.
1007 * @thread Any thread.
1008 */
1009 DECLR3CALLBACKMEMBER(int, pfnSendCmd,(PPDMIBLOCK pInterface, const uint8_t *pbCmd, PDMBLOCKTXDIR enmTxDir, void *pvBuf, uint32_t *pcbBuf, uint8_t *pabSense, size_t cbSense, uint32_t cTimeoutMillies));
1010
1011 /**
1012 * Merge medium contents during a live snapshot deletion.
1013 *
1014 * @returns VBox status code.
1015 * @param pInterface Pointer to the interface structure containing the called function pointer.
1016 * @param pfnProgress Function pointer for progress notification.
1017 * @param pvUser Opaque user data for progress notification.
1018 * @thread Any thread.
1019 */
1020 DECLR3CALLBACKMEMBER(int, pfnMerge,(PPDMIBLOCK pInterface, PFNSIMPLEPROGRESS pfnProgress, void *pvUser));
1021
1022 /**
1023 * Check if the media is readonly or not.
1024 *
1025 * @returns true if readonly.
1026 * @returns false if read/write.
1027 * @param pInterface Pointer to the interface structure containing the called function pointer.
1028 * @thread Any thread.
1029 */
1030 DECLR3CALLBACKMEMBER(bool, pfnIsReadOnly,(PPDMIBLOCK pInterface));
1031
1032 /**
1033 * Gets the media size in bytes.
1034 *
1035 * @returns Media size in bytes.
1036 * @param pInterface Pointer to the interface structure containing the called function pointer.
1037 * @thread Any thread.
1038 */
1039 DECLR3CALLBACKMEMBER(uint64_t, pfnGetSize,(PPDMIBLOCK pInterface));
1040
1041 /**
1042 * Gets the block drive type.
1043 *
1044 * @returns block drive type.
1045 * @param pInterface Pointer to the interface structure containing the called function pointer.
1046 * @thread Any thread.
1047 */
1048 DECLR3CALLBACKMEMBER(PDMBLOCKTYPE, pfnGetType,(PPDMIBLOCK pInterface));
1049
1050 /**
1051 * Gets the UUID of the block drive.
1052 * Don't return the media UUID if it's removable.
1053 *
1054 * @returns VBox status code.
1055 * @param pInterface Pointer to the interface structure containing the called function pointer.
1056 * @param pUuid Where to store the UUID on success.
1057 * @thread Any thread.
1058 */
1059 DECLR3CALLBACKMEMBER(int, pfnGetUuid,(PPDMIBLOCK pInterface, PRTUUID pUuid));
1060
1061 /**
1062 * Discards the given range.
1063 *
1064 * @returns VBox status code.
1065 * @param pInterface Pointer to the interface structure containing the called function pointer.
1066 * @param paRanges Array of ranges to discard.
1067 * @param cRanges Number of entries in the array.
1068 * @thread Any thread.
1069 */
1070 DECLR3CALLBACKMEMBER(int, pfnDiscard,(PPDMIBLOCK pInterface, PCRTRANGE paRanges, unsigned cRanges));
1071} PDMIBLOCK;
1072/** PDMIBLOCK interface ID. */
1073#define PDMIBLOCK_IID "5e7123dd-8cdf-4a6e-97a5-ab0c68d7e850"
1074
1075
1076/** Pointer to a mount interface. */
1077typedef struct PDMIMOUNTNOTIFY *PPDMIMOUNTNOTIFY;
1078/**
1079 * Block interface (up).
1080 * Pair with PDMIMOUNT.
1081 */
1082typedef struct PDMIMOUNTNOTIFY
1083{
1084 /**
1085 * Called when a media is mounted.
1086 *
1087 * @param pInterface Pointer to the interface structure containing the called function pointer.
1088 * @thread The emulation thread.
1089 */
1090 DECLR3CALLBACKMEMBER(void, pfnMountNotify,(PPDMIMOUNTNOTIFY pInterface));
1091
1092 /**
1093 * Called when a media is unmounted
1094 * @param pInterface Pointer to the interface structure containing the called function pointer.
1095 * @thread The emulation thread.
1096 */
1097 DECLR3CALLBACKMEMBER(void, pfnUnmountNotify,(PPDMIMOUNTNOTIFY pInterface));
1098} PDMIMOUNTNOTIFY;
1099/** PDMIMOUNTNOTIFY interface ID. */
1100#define PDMIMOUNTNOTIFY_IID "fa143ac9-9fc6-498e-997f-945380a558f9"
1101
1102
1103/** Pointer to mount interface. */
1104typedef struct PDMIMOUNT *PPDMIMOUNT;
1105/**
1106 * Mount interface (down).
1107 * Pair with PDMIMOUNTNOTIFY.
1108 */
1109typedef struct PDMIMOUNT
1110{
1111 /**
1112 * Mount a media.
1113 *
1114 * This will not unmount any currently mounted media!
1115 *
1116 * @returns VBox status code.
1117 * @param pInterface Pointer to the interface structure containing the called function pointer.
1118 * @param pszFilename Pointer to filename. If this is NULL it assumed that the caller have
1119 * constructed a configuration which can be attached to the bottom driver.
1120 * @param pszCoreDriver Core driver name. NULL will cause autodetection. Ignored if pszFilanem is NULL.
1121 * @thread The emulation thread.
1122 */
1123 DECLR3CALLBACKMEMBER(int, pfnMount,(PPDMIMOUNT pInterface, const char *pszFilename, const char *pszCoreDriver));
1124
1125 /**
1126 * Unmount the media.
1127 *
1128 * The driver will validate and pass it on. On the rebounce it will decide whether or not to detach it self.
1129 *
1130 * @returns VBox status code.
1131 * @param pInterface Pointer to the interface structure containing the called function pointer.
1132 * @thread The emulation thread.
1133 * @param fForce Force the unmount, even for locked media.
1134 * @param fEject Eject the medium. Only relevant for host drives.
1135 * @thread The emulation thread.
1136 */
1137 DECLR3CALLBACKMEMBER(int, pfnUnmount,(PPDMIMOUNT pInterface, bool fForce, bool fEject));
1138
1139 /**
1140 * Checks if a media is mounted.
1141 *
1142 * @returns true if mounted.
1143 * @returns false if not mounted.
1144 * @param pInterface Pointer to the interface structure containing the called function pointer.
1145 * @thread Any thread.
1146 */
1147 DECLR3CALLBACKMEMBER(bool, pfnIsMounted,(PPDMIMOUNT pInterface));
1148
1149 /**
1150 * Locks the media, preventing any unmounting of it.
1151 *
1152 * @returns VBox status code.
1153 * @param pInterface Pointer to the interface structure containing the called function pointer.
1154 * @thread The emulation thread.
1155 */
1156 DECLR3CALLBACKMEMBER(int, pfnLock,(PPDMIMOUNT pInterface));
1157
1158 /**
1159 * Unlocks the media, canceling previous calls to pfnLock().
1160 *
1161 * @returns VBox status code.
1162 * @param pInterface Pointer to the interface structure containing the called function pointer.
1163 * @thread The emulation thread.
1164 */
1165 DECLR3CALLBACKMEMBER(int, pfnUnlock,(PPDMIMOUNT pInterface));
1166
1167 /**
1168 * Checks if a media is locked.
1169 *
1170 * @returns true if locked.
1171 * @returns false if not locked.
1172 * @param pInterface Pointer to the interface structure containing the called function pointer.
1173 * @thread Any thread.
1174 */
1175 DECLR3CALLBACKMEMBER(bool, pfnIsLocked,(PPDMIMOUNT pInterface));
1176} PDMIMOUNT;
1177/** PDMIMOUNT interface ID. */
1178#define PDMIMOUNT_IID "34fc7a4c-623a-4806-a6bf-5be1be33c99f"
1179
1180
1181/**
1182 * Media geometry structure.
1183 */
1184typedef struct PDMMEDIAGEOMETRY
1185{
1186 /** Number of cylinders. */
1187 uint32_t cCylinders;
1188 /** Number of heads. */
1189 uint32_t cHeads;
1190 /** Number of sectors. */
1191 uint32_t cSectors;
1192} PDMMEDIAGEOMETRY;
1193
1194/** Pointer to media geometry structure. */
1195typedef PDMMEDIAGEOMETRY *PPDMMEDIAGEOMETRY;
1196/** Pointer to constant media geometry structure. */
1197typedef const PDMMEDIAGEOMETRY *PCPDMMEDIAGEOMETRY;
1198
1199/** Pointer to a media port interface. */
1200typedef struct PDMIMEDIAPORT *PPDMIMEDIAPORT;
1201/**
1202 * Media port interface (down).
1203 */
1204typedef struct PDMIMEDIAPORT
1205{
1206 /**
1207 * Returns the storage controller name, instance and LUN of the attached medium.
1208 *
1209 * @returns VBox status.
1210 * @param pInterface Pointer to this interface.
1211 * @param ppcszController Where to store the name of the storage controller.
1212 * @param piInstance Where to store the instance number of the controller.
1213 * @param piLUN Where to store the LUN of the attached device.
1214 */
1215 DECLR3CALLBACKMEMBER(int, pfnQueryDeviceLocation, (PPDMIMEDIAPORT pInterface, const char **ppcszController,
1216 uint32_t *piInstance, uint32_t *piLUN));
1217
1218} PDMIMEDIAPORT;
1219/** PDMIMEDIAPORT interface ID. */
1220#define PDMIMEDIAPORT_IID "9f7e8c9e-6d35-4453-bbef-1f78033174d6"
1221
1222/** Pointer to a media interface. */
1223typedef struct PDMIMEDIA *PPDMIMEDIA;
1224/**
1225 * Media interface (up).
1226 * Makes up the foundation for PDMIBLOCK and PDMIBLOCKBIOS.
1227 * Pairs with PDMIMEDIAPORT.
1228 */
1229typedef struct PDMIMEDIA
1230{
1231 /**
1232 * Read bits.
1233 *
1234 * @returns VBox status code.
1235 * @param pInterface Pointer to the interface structure containing the called function pointer.
1236 * @param off Offset to start reading from. The offset must be aligned to a sector boundary.
1237 * @param pvBuf Where to store the read bits.
1238 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary.
1239 * @thread Any thread.
1240 */
1241 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIMEDIA pInterface, uint64_t off, void *pvBuf, size_t cbRead));
1242
1243 /**
1244 * Write bits.
1245 *
1246 * @returns VBox status code.
1247 * @param pInterface Pointer to the interface structure containing the called function pointer.
1248 * @param off Offset to start writing at. The offset must be aligned to a sector boundary.
1249 * @param pvBuf Where to store the write bits.
1250 * @param cbWrite Number of bytes to write. Must be aligned to a sector boundary.
1251 * @thread Any thread.
1252 */
1253 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIMEDIA pInterface, uint64_t off, const void *pvBuf, size_t cbWrite));
1254
1255 /**
1256 * Make sure that the bits written are actually on the storage medium.
1257 *
1258 * @returns VBox status code.
1259 * @param pInterface Pointer to the interface structure containing the called function pointer.
1260 * @thread Any thread.
1261 */
1262 DECLR3CALLBACKMEMBER(int, pfnFlush,(PPDMIMEDIA pInterface));
1263
1264 /**
1265 * Merge medium contents during a live snapshot deletion. All details
1266 * must have been configured through CFGM or this will fail.
1267 * This method is optional (i.e. the function pointer may be NULL).
1268 *
1269 * @returns VBox status code.
1270 * @param pInterface Pointer to the interface structure containing the called function pointer.
1271 * @param pfnProgress Function pointer for progress notification.
1272 * @param pvUser Opaque user data for progress notification.
1273 * @thread Any thread.
1274 */
1275 DECLR3CALLBACKMEMBER(int, pfnMerge,(PPDMIMEDIA pInterface, PFNSIMPLEPROGRESS pfnProgress, void *pvUser));
1276
1277 /**
1278 * Get the media size in bytes.
1279 *
1280 * @returns Media size in bytes.
1281 * @param pInterface Pointer to the interface structure containing the called function pointer.
1282 * @thread Any thread.
1283 */
1284 DECLR3CALLBACKMEMBER(uint64_t, pfnGetSize,(PPDMIMEDIA pInterface));
1285
1286 /**
1287 * Check if the media is readonly or not.
1288 *
1289 * @returns true if readonly.
1290 * @returns false if read/write.
1291 * @param pInterface Pointer to the interface structure containing the called function pointer.
1292 * @thread Any thread.
1293 */
1294 DECLR3CALLBACKMEMBER(bool, pfnIsReadOnly,(PPDMIMEDIA pInterface));
1295
1296 /**
1297 * Get stored media geometry (physical CHS, PCHS) - BIOS property.
1298 * This is an optional feature of a media.
1299 *
1300 * @returns VBox status code.
1301 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1302 * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnBiosSetPCHSGeometry() yet.
1303 * @param pInterface Pointer to the interface structure containing the called function pointer.
1304 * @param pPCHSGeometry Pointer to PCHS geometry (cylinders/heads/sectors).
1305 * @remark This has no influence on the read/write operations.
1306 * @thread Any thread.
1307 */
1308 DECLR3CALLBACKMEMBER(int, pfnBiosGetPCHSGeometry,(PPDMIMEDIA pInterface, PPDMMEDIAGEOMETRY pPCHSGeometry));
1309
1310 /**
1311 * Store the media geometry (physical CHS, PCHS) - BIOS property.
1312 * This is an optional feature of a media.
1313 *
1314 * @returns VBox status code.
1315 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1316 * @param pInterface Pointer to the interface structure containing the called function pointer.
1317 * @param pPCHSGeometry Pointer to PCHS geometry (cylinders/heads/sectors).
1318 * @remark This has no influence on the read/write operations.
1319 * @thread The emulation thread.
1320 */
1321 DECLR3CALLBACKMEMBER(int, pfnBiosSetPCHSGeometry,(PPDMIMEDIA pInterface, PCPDMMEDIAGEOMETRY pPCHSGeometry));
1322
1323 /**
1324 * Get stored media geometry (logical CHS, LCHS) - BIOS property.
1325 * This is an optional feature of a media.
1326 *
1327 * @returns VBox status code.
1328 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1329 * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnBiosSetLCHSGeometry() yet.
1330 * @param pInterface Pointer to the interface structure containing the called function pointer.
1331 * @param pLCHSGeometry Pointer to LCHS geometry (cylinders/heads/sectors).
1332 * @remark This has no influence on the read/write operations.
1333 * @thread Any thread.
1334 */
1335 DECLR3CALLBACKMEMBER(int, pfnBiosGetLCHSGeometry,(PPDMIMEDIA pInterface, PPDMMEDIAGEOMETRY pLCHSGeometry));
1336
1337 /**
1338 * Store the media geometry (logical CHS, LCHS) - BIOS property.
1339 * This is an optional feature of a media.
1340 *
1341 * @returns VBox status code.
1342 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1343 * @param pInterface Pointer to the interface structure containing the called function pointer.
1344 * @param pLCHSGeometry Pointer to LCHS geometry (cylinders/heads/sectors).
1345 * @remark This has no influence on the read/write operations.
1346 * @thread The emulation thread.
1347 */
1348 DECLR3CALLBACKMEMBER(int, pfnBiosSetLCHSGeometry,(PPDMIMEDIA pInterface, PCPDMMEDIAGEOMETRY pLCHSGeometry));
1349
1350 /**
1351 * Gets the UUID of the media drive.
1352 *
1353 * @returns VBox status code.
1354 * @param pInterface Pointer to the interface structure containing the called function pointer.
1355 * @param pUuid Where to store the UUID on success.
1356 * @thread Any thread.
1357 */
1358 DECLR3CALLBACKMEMBER(int, pfnGetUuid,(PPDMIMEDIA pInterface, PRTUUID pUuid));
1359
1360 /**
1361 * Discards the given range.
1362 *
1363 * @returns VBox status code.
1364 * @param pInterface Pointer to the interface structure containing the called function pointer.
1365 * @param paRanges Array of ranges to discard.
1366 * @param cRanges Number of entries in the array.
1367 * @thread Any thread.
1368 */
1369 DECLR3CALLBACKMEMBER(int, pfnDiscard,(PPDMIMEDIA pInterface, PCRTRANGE paRanges, unsigned cRanges));
1370
1371} PDMIMEDIA;
1372/** PDMIMEDIA interface ID. */
1373#define PDMIMEDIA_IID "ec385d21-7aa9-42ca-8cfb-e1388297fa52"
1374
1375
1376/** Pointer to a block BIOS interface. */
1377typedef struct PDMIBLOCKBIOS *PPDMIBLOCKBIOS;
1378/**
1379 * Media BIOS interface (Up / External).
1380 * The interface the getting and setting properties which the BIOS/CMOS care about.
1381 */
1382typedef struct PDMIBLOCKBIOS
1383{
1384 /**
1385 * Get stored media geometry (physical CHS, PCHS) - BIOS property.
1386 * This is an optional feature of a media.
1387 *
1388 * @returns VBox status code.
1389 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1390 * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnSetPCHSGeometry() yet.
1391 * @param pInterface Pointer to the interface structure containing the called function pointer.
1392 * @param pPCHSGeometry Pointer to PCHS geometry (cylinders/heads/sectors).
1393 * @remark This has no influence on the read/write operations.
1394 * @thread Any thread.
1395 */
1396 DECLR3CALLBACKMEMBER(int, pfnGetPCHSGeometry,(PPDMIBLOCKBIOS pInterface, PPDMMEDIAGEOMETRY pPCHSGeometry));
1397
1398 /**
1399 * Store the media geometry (physical CHS, PCHS) - BIOS property.
1400 * This is an optional feature of a media.
1401 *
1402 * @returns VBox status code.
1403 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1404 * @param pInterface Pointer to the interface structure containing the called function pointer.
1405 * @param pPCHSGeometry Pointer to PCHS geometry (cylinders/heads/sectors).
1406 * @remark This has no influence on the read/write operations.
1407 * @thread The emulation thread.
1408 */
1409 DECLR3CALLBACKMEMBER(int, pfnSetPCHSGeometry,(PPDMIBLOCKBIOS pInterface, PCPDMMEDIAGEOMETRY pPCHSGeometry));
1410
1411 /**
1412 * Get stored media geometry (logical CHS, LCHS) - BIOS property.
1413 * This is an optional feature of a media.
1414 *
1415 * @returns VBox status code.
1416 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1417 * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnSetLCHSGeometry() yet.
1418 * @param pInterface Pointer to the interface structure containing the called function pointer.
1419 * @param pLCHSGeometry Pointer to LCHS geometry (cylinders/heads/sectors).
1420 * @remark This has no influence on the read/write operations.
1421 * @thread Any thread.
1422 */
1423 DECLR3CALLBACKMEMBER(int, pfnGetLCHSGeometry,(PPDMIBLOCKBIOS pInterface, PPDMMEDIAGEOMETRY pLCHSGeometry));
1424
1425 /**
1426 * Store the media geometry (logical CHS, LCHS) - BIOS property.
1427 * This is an optional feature of a media.
1428 *
1429 * @returns VBox status code.
1430 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1431 * @param pInterface Pointer to the interface structure containing the called function pointer.
1432 * @param pLCHSGeometry Pointer to LCHS geometry (cylinders/heads/sectors).
1433 * @remark This has no influence on the read/write operations.
1434 * @thread The emulation thread.
1435 */
1436 DECLR3CALLBACKMEMBER(int, pfnSetLCHSGeometry,(PPDMIBLOCKBIOS pInterface, PCPDMMEDIAGEOMETRY pLCHSGeometry));
1437
1438 /**
1439 * Checks if the device should be visible to the BIOS or not.
1440 *
1441 * @returns true if the device is visible to the BIOS.
1442 * @returns false if the device is not visible to the BIOS.
1443 * @param pInterface Pointer to the interface structure containing the called function pointer.
1444 * @thread Any thread.
1445 */
1446 DECLR3CALLBACKMEMBER(bool, pfnIsVisible,(PPDMIBLOCKBIOS pInterface));
1447
1448 /**
1449 * Gets the block drive type.
1450 *
1451 * @returns block drive type.
1452 * @param pInterface Pointer to the interface structure containing the called function pointer.
1453 * @thread Any thread.
1454 */
1455 DECLR3CALLBACKMEMBER(PDMBLOCKTYPE, pfnGetType,(PPDMIBLOCKBIOS pInterface));
1456
1457} PDMIBLOCKBIOS;
1458/** PDMIBLOCKBIOS interface ID. */
1459#define PDMIBLOCKBIOS_IID "477c3eee-a48d-48a9-82fd-2a54de16b2e9"
1460
1461
1462/** Pointer to a static block core driver interface. */
1463typedef struct PDMIMEDIASTATIC *PPDMIMEDIASTATIC;
1464/**
1465 * Static block core driver interface.
1466 */
1467typedef struct PDMIMEDIASTATIC
1468{
1469 /**
1470 * Check if the specified file is a format which the core driver can handle.
1471 *
1472 * @returns true / false accordingly.
1473 * @param pInterface Pointer to the interface structure containing the called function pointer.
1474 * @param pszFilename Name of the file to probe.
1475 */
1476 DECLR3CALLBACKMEMBER(bool, pfnCanHandle,(PPDMIMEDIASTATIC pInterface, const char *pszFilename));
1477} PDMIMEDIASTATIC;
1478
1479
1480
1481
1482
1483/** Pointer to an asynchronous block notify interface. */
1484typedef struct PDMIBLOCKASYNCPORT *PPDMIBLOCKASYNCPORT;
1485/**
1486 * Asynchronous block notify interface (up).
1487 * Pair with PDMIBLOCKASYNC.
1488 */
1489typedef struct PDMIBLOCKASYNCPORT
1490{
1491 /**
1492 * Notify completion of an asynchronous transfer.
1493 *
1494 * @returns VBox status code.
1495 * @param pInterface Pointer to the interface structure containing the called function pointer.
1496 * @param pvUser The user argument given in pfnStartWrite/Read.
1497 * @param rcReq IPRT Status code of the completed request.
1498 * @thread Any thread.
1499 */
1500 DECLR3CALLBACKMEMBER(int, pfnTransferCompleteNotify, (PPDMIBLOCKASYNCPORT pInterface, void *pvUser, int rcReq));
1501} PDMIBLOCKASYNCPORT;
1502/** PDMIBLOCKASYNCPORT interface ID. */
1503#define PDMIBLOCKASYNCPORT_IID "e3bdc0cb-9d99-41dd-8eec-0dc8cf5b2a92"
1504
1505
1506
1507/** Pointer to an asynchronous block interface. */
1508typedef struct PDMIBLOCKASYNC *PPDMIBLOCKASYNC;
1509/**
1510 * Asynchronous block interface (down).
1511 * Pair with PDMIBLOCKASYNCPORT.
1512 */
1513typedef struct PDMIBLOCKASYNC
1514{
1515 /**
1516 * Start reading task.
1517 *
1518 * @returns VBox status code.
1519 * @param pInterface Pointer to the interface structure containing the called function pointer.
1520 * @param off Offset to start reading from.c
1521 * @param paSegs Pointer to the S/G segment array.
1522 * @param cSegs Number of entries in the array.
1523 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary.
1524 * @param pvUser User argument which is returned in completion callback.
1525 * @thread Any thread.
1526 */
1527 DECLR3CALLBACKMEMBER(int, pfnStartRead,(PPDMIBLOCKASYNC pInterface, uint64_t off, PCRTSGSEG paSegs, unsigned cSegs, size_t cbRead, void *pvUser));
1528
1529 /**
1530 * Write bits.
1531 *
1532 * @returns VBox status code.
1533 * @param pInterface Pointer to the interface structure containing the called function pointer.
1534 * @param off Offset to start writing at. The offset must be aligned to a sector boundary.
1535 * @param paSegs Pointer to the S/G segment array.
1536 * @param cSegs Number of entries in the array.
1537 * @param cbWrite Number of bytes to write. Must be aligned to a sector boundary.
1538 * @param pvUser User argument which is returned in completion callback.
1539 * @thread Any thread.
1540 */
1541 DECLR3CALLBACKMEMBER(int, pfnStartWrite,(PPDMIBLOCKASYNC pInterface, uint64_t off, PCRTSGSEG paSegs, unsigned cSegs, size_t cbWrite, void *pvUser));
1542
1543 /**
1544 * Flush everything to disk.
1545 *
1546 * @returns VBox status code.
1547 * @param pInterface Pointer to the interface structure containing the called function pointer.
1548 * @param pvUser User argument which is returned in completion callback.
1549 * @thread Any thread.
1550 */
1551 DECLR3CALLBACKMEMBER(int, pfnStartFlush,(PPDMIBLOCKASYNC pInterface, void *pvUser));
1552
1553 /**
1554 * Discards the given range.
1555 *
1556 * @returns VBox status code.
1557 * @param pInterface Pointer to the interface structure containing the called function pointer.
1558 * @param paRanges Array of ranges to discard.
1559 * @param cRanges Number of entries in the array.
1560 * @param pvUser User argument which is returned in completion callback.
1561 * @thread Any thread.
1562 */
1563 DECLR3CALLBACKMEMBER(int, pfnStartDiscard,(PPDMIBLOCKASYNC pInterface, PCRTRANGE paRanges, unsigned cRanges, void *pvUser));
1564
1565} PDMIBLOCKASYNC;
1566/** PDMIBLOCKASYNC interface ID. */
1567#define PDMIBLOCKASYNC_IID "a921dd96-1748-4ecd-941e-d5f3cd4c8fe4"
1568
1569
1570/** Pointer to an asynchronous notification interface. */
1571typedef struct PDMIMEDIAASYNCPORT *PPDMIMEDIAASYNCPORT;
1572/**
1573 * Asynchronous version of the media interface (up).
1574 * Pair with PDMIMEDIAASYNC.
1575 */
1576typedef struct PDMIMEDIAASYNCPORT
1577{
1578 /**
1579 * Notify completion of a task.
1580 *
1581 * @returns VBox status code.
1582 * @param pInterface Pointer to the interface structure containing the called function pointer.
1583 * @param pvUser The user argument given in pfnStartWrite.
1584 * @param rcReq IPRT Status code of the completed request.
1585 * @thread Any thread.
1586 */
1587 DECLR3CALLBACKMEMBER(int, pfnTransferCompleteNotify, (PPDMIMEDIAASYNCPORT pInterface, void *pvUser, int rcReq));
1588} PDMIMEDIAASYNCPORT;
1589/** PDMIMEDIAASYNCPORT interface ID. */
1590#define PDMIMEDIAASYNCPORT_IID "22d38853-901f-4a71-9670-4d9da6e82317"
1591
1592
1593/** Pointer to an asynchronous media interface. */
1594typedef struct PDMIMEDIAASYNC *PPDMIMEDIAASYNC;
1595/**
1596 * Asynchronous version of PDMIMEDIA (down).
1597 * Pair with PDMIMEDIAASYNCPORT.
1598 */
1599typedef struct PDMIMEDIAASYNC
1600{
1601 /**
1602 * Start reading task.
1603 *
1604 * @returns VBox status code.
1605 * @param pInterface Pointer to the interface structure containing the called function pointer.
1606 * @param off Offset to start reading from. Must be aligned to a sector boundary.
1607 * @param paSegs Pointer to the S/G segment array.
1608 * @param cSegs Number of entries in the array.
1609 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary.
1610 * @param pvUser User data.
1611 * @thread Any thread.
1612 */
1613 DECLR3CALLBACKMEMBER(int, pfnStartRead,(PPDMIMEDIAASYNC pInterface, uint64_t off, PCRTSGSEG paSegs, unsigned cSegs, size_t cbRead, void *pvUser));
1614
1615 /**
1616 * Start writing task.
1617 *
1618 * @returns VBox status code.
1619 * @param pInterface Pointer to the interface structure containing the called function pointer.
1620 * @param off Offset to start writing at. Must be aligned to a sector boundary.
1621 * @param paSegs Pointer to the S/G segment array.
1622 * @param cSegs Number of entries in the array.
1623 * @param cbWrite Number of bytes to write. Must be aligned to a sector boundary.
1624 * @param pvUser User data.
1625 * @thread Any thread.
1626 */
1627 DECLR3CALLBACKMEMBER(int, pfnStartWrite,(PPDMIMEDIAASYNC pInterface, uint64_t off, PCRTSGSEG paSegs, unsigned cSegs, size_t cbWrite, void *pvUser));
1628
1629 /**
1630 * Flush everything to disk.
1631 *
1632 * @returns VBox status code.
1633 * @param pInterface Pointer to the interface structure containing the called function pointer.
1634 * @param pvUser User argument which is returned in completion callback.
1635 * @thread Any thread.
1636 */
1637 DECLR3CALLBACKMEMBER(int, pfnStartFlush,(PPDMIMEDIAASYNC pInterface, void *pvUser));
1638
1639 /**
1640 * Discards the given range.
1641 *
1642 * @returns VBox status code.
1643 * @param pInterface Pointer to the interface structure containing the called function pointer.
1644 * @param paRanges Array of ranges to discard.
1645 * @param cRanges Number of entries in the array.
1646 * @param pvUser User argument which is returned in completion callback.
1647 * @thread Any thread.
1648 */
1649 DECLR3CALLBACKMEMBER(int, pfnStartDiscard,(PPDMIMEDIAASYNC pInterface, PCRTRANGE paRanges, unsigned cRanges, void *pvUser));
1650
1651} PDMIMEDIAASYNC;
1652/** PDMIMEDIAASYNC interface ID. */
1653#define PDMIMEDIAASYNC_IID "4be209d3-ccb5-4297-82fe-7d8018bc6ab4"
1654
1655
1656/** Pointer to a char port interface. */
1657typedef struct PDMICHARPORT *PPDMICHARPORT;
1658/**
1659 * Char port interface (down).
1660 * Pair with PDMICHARCONNECTOR.
1661 */
1662typedef struct PDMICHARPORT
1663{
1664 /**
1665 * Deliver data read to the device/driver.
1666 *
1667 * @returns VBox status code.
1668 * @param pInterface Pointer to the interface structure containing the called function pointer.
1669 * @param pvBuf Where the read bits are stored.
1670 * @param pcbRead Number of bytes available for reading/having been read.
1671 * @thread Any thread.
1672 */
1673 DECLR3CALLBACKMEMBER(int, pfnNotifyRead,(PPDMICHARPORT pInterface, const void *pvBuf, size_t *pcbRead));
1674
1675 /**
1676 * Notify the device/driver when the status lines changed.
1677 *
1678 * @returns VBox status code.
1679 * @param pInterface Pointer to the interface structure containing the called function pointer.
1680 * @param fNewStatusLine New state of the status line pins.
1681 * @thread Any thread.
1682 */
1683 DECLR3CALLBACKMEMBER(int, pfnNotifyStatusLinesChanged,(PPDMICHARPORT pInterface, uint32_t fNewStatusLines));
1684
1685 /**
1686 * Notify the device when the driver buffer is full.
1687 *
1688 * @returns VBox status code.
1689 * @param pInterface Pointer to the interface structure containing the called function pointer.
1690 * @param fFull Buffer full.
1691 * @thread Any thread.
1692 */
1693 DECLR3CALLBACKMEMBER(int, pfnNotifyBufferFull,(PPDMICHARPORT pInterface, bool fFull));
1694
1695 /**
1696 * Notify the device/driver that a break occurred.
1697 *
1698 * @returns VBox statsus code.
1699 * @param pInterface Pointer to the interface structure containing the called function pointer.
1700 * @thread Any thread.
1701 */
1702 DECLR3CALLBACKMEMBER(int, pfnNotifyBreak,(PPDMICHARPORT pInterface));
1703} PDMICHARPORT;
1704/** PDMICHARPORT interface ID. */
1705#define PDMICHARPORT_IID "22769834-ea8b-4a6d-ade1-213dcdbd1228"
1706
1707/** @name Bit mask definitions for status line type.
1708 * @{ */
1709#define PDMICHARPORT_STATUS_LINES_DCD RT_BIT(0)
1710#define PDMICHARPORT_STATUS_LINES_RI RT_BIT(1)
1711#define PDMICHARPORT_STATUS_LINES_DSR RT_BIT(2)
1712#define PDMICHARPORT_STATUS_LINES_CTS RT_BIT(3)
1713/** @} */
1714
1715
1716/** Pointer to a char interface. */
1717typedef struct PDMICHARCONNECTOR *PPDMICHARCONNECTOR;
1718/**
1719 * Char connector interface (up).
1720 * Pair with PDMICHARPORT.
1721 */
1722typedef struct PDMICHARCONNECTOR
1723{
1724 /**
1725 * Write bits.
1726 *
1727 * @returns VBox status code.
1728 * @param pInterface Pointer to the interface structure containing the called function pointer.
1729 * @param pvBuf Where to store the write bits.
1730 * @param cbWrite Number of bytes to write.
1731 * @thread Any thread.
1732 */
1733 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMICHARCONNECTOR pInterface, const void *pvBuf, size_t cbWrite));
1734
1735 /**
1736 * Set device parameters.
1737 *
1738 * @returns VBox status code.
1739 * @param pInterface Pointer to the interface structure containing the called function pointer.
1740 * @param Bps Speed of the serial connection. (bits per second)
1741 * @param chParity Parity method: 'E' - even, 'O' - odd, 'N' - none.
1742 * @param cDataBits Number of data bits.
1743 * @param cStopBits Number of stop bits.
1744 * @thread Any thread.
1745 */
1746 DECLR3CALLBACKMEMBER(int, pfnSetParameters,(PPDMICHARCONNECTOR pInterface, unsigned Bps, char chParity, unsigned cDataBits, unsigned cStopBits));
1747
1748 /**
1749 * Set the state of the modem lines.
1750 *
1751 * @returns VBox status code.
1752 * @param pInterface Pointer to the interface structure containing the called function pointer.
1753 * @param fRequestToSend Set to true to make the Request to Send line active otherwise to 0.
1754 * @param fDataTerminalReady Set to true to make the Data Terminal Ready line active otherwise 0.
1755 * @thread Any thread.
1756 */
1757 DECLR3CALLBACKMEMBER(int, pfnSetModemLines,(PPDMICHARCONNECTOR pInterface, bool fRequestToSend, bool fDataTerminalReady));
1758
1759 /**
1760 * Sets the TD line into break condition.
1761 *
1762 * @returns VBox status code.
1763 * @param pInterface Pointer to the interface structure containing the called function pointer.
1764 * @param fBreak Set to true to let the device send a break false to put into normal operation.
1765 * @thread Any thread.
1766 */
1767 DECLR3CALLBACKMEMBER(int, pfnSetBreak,(PPDMICHARCONNECTOR pInterface, bool fBreak));
1768} PDMICHARCONNECTOR;
1769/** PDMICHARCONNECTOR interface ID. */
1770#define PDMICHARCONNECTOR_IID "4ad5c190-b408-4cef-926f-fbffce0dc5cc"
1771
1772
1773/** Pointer to a stream interface. */
1774typedef struct PDMISTREAM *PPDMISTREAM;
1775/**
1776 * Stream interface (up).
1777 * Makes up the foundation for PDMICHARCONNECTOR. No pair interface.
1778 */
1779typedef struct PDMISTREAM
1780{
1781 /**
1782 * Read bits.
1783 *
1784 * @returns VBox status code.
1785 * @param pInterface Pointer to the interface structure containing the called function pointer.
1786 * @param pvBuf Where to store the read bits.
1787 * @param cbRead Number of bytes to read/bytes actually read.
1788 * @thread Any thread.
1789 */
1790 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMISTREAM pInterface, void *pvBuf, size_t *cbRead));
1791
1792 /**
1793 * Write bits.
1794 *
1795 * @returns VBox status code.
1796 * @param pInterface Pointer to the interface structure containing the called function pointer.
1797 * @param pvBuf Where to store the write bits.
1798 * @param cbWrite Number of bytes to write/bytes actually written.
1799 * @thread Any thread.
1800 */
1801 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMISTREAM pInterface, const void *pvBuf, size_t *cbWrite));
1802} PDMISTREAM;
1803/** PDMISTREAM interface ID. */
1804#define PDMISTREAM_IID "d1a5bf5e-3d2c-449a-bde9-addd7920b71f"
1805
1806
1807/** Mode of the parallel port */
1808typedef enum PDMPARALLELPORTMODE
1809{
1810 /** First invalid mode. */
1811 PDM_PARALLEL_PORT_MODE_INVALID = 0,
1812 /** SPP (Compatibility mode). */
1813 PDM_PARALLEL_PORT_MODE_SPP,
1814 /** EPP Data mode. */
1815 PDM_PARALLEL_PORT_MODE_EPP_DATA,
1816 /** EPP Address mode. */
1817 PDM_PARALLEL_PORT_MODE_EPP_ADDR,
1818 /** ECP mode (not implemented yet). */
1819 PDM_PARALLEL_PORT_MODE_ECP,
1820 /** 32bit hack. */
1821 PDM_PARALLEL_PORT_MODE_32BIT_HACK = 0x7fffffff
1822} PDMPARALLELPORTMODE;
1823
1824/** Pointer to a host parallel port interface. */
1825typedef struct PDMIHOSTPARALLELPORT *PPDMIHOSTPARALLELPORT;
1826/**
1827 * Host parallel port interface (down).
1828 * Pair with PDMIHOSTPARALLELCONNECTOR.
1829 */
1830typedef struct PDMIHOSTPARALLELPORT
1831{
1832 /**
1833 * Notify device/driver that an interrupt has occurred.
1834 *
1835 * @returns VBox status code.
1836 * @param pInterface Pointer to the interface structure containing the called function pointer.
1837 * @thread Any thread.
1838 */
1839 DECLR3CALLBACKMEMBER(int, pfnNotifyInterrupt,(PPDMIHOSTPARALLELPORT pInterface));
1840} PDMIHOSTPARALLELPORT;
1841/** PDMIHOSTPARALLELPORT interface ID. */
1842#define PDMIHOSTPARALLELPORT_IID "f24b8668-e7f6-4eaa-a14c-4aa2a5f7048e"
1843
1844
1845
1846/** Pointer to a Host Parallel connector interface. */
1847typedef struct PDMIHOSTPARALLELCONNECTOR *PPDMIHOSTPARALLELCONNECTOR;
1848/**
1849 * Host parallel connector interface (up).
1850 * Pair with PDMIHOSTPARALLELPORT.
1851 */
1852typedef struct PDMIHOSTPARALLELCONNECTOR
1853{
1854 /**
1855 * Write bits.
1856 *
1857 * @returns VBox status code.
1858 * @param pInterface Pointer to the interface structure containing the called function pointer.
1859 * @param pvBuf Where to store the write bits.
1860 * @param cbWrite Number of bytes to write.
1861 * @param enmMode Mode to write the data.
1862 * @thread Any thread.
1863 * @todo r=klaus cbWrite only defines buffer length, method needs a way top return actually written amount of data.
1864 */
1865 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIHOSTPARALLELCONNECTOR pInterface, const void *pvBuf,
1866 size_t cbWrite, PDMPARALLELPORTMODE enmMode));
1867
1868 /**
1869 * Read bits.
1870 *
1871 * @returns VBox status code.
1872 * @param pInterface Pointer to the interface structure containing the called function pointer.
1873 * @param pvBuf Where to store the read bits.
1874 * @param cbRead Number of bytes to read.
1875 * @param enmMode Mode to read the data.
1876 * @thread Any thread.
1877 * @todo r=klaus cbRead only defines buffer length, method needs a way top return actually read amount of data.
1878 */
1879 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIHOSTPARALLELCONNECTOR pInterface, void *pvBuf,
1880 size_t cbRead, PDMPARALLELPORTMODE enmMode));
1881
1882 /**
1883 * Set data direction of the port (forward/reverse).
1884 *
1885 * @returns VBox status code.
1886 * @param pInterface Pointer to the interface structure containing the called function pointer.
1887 * @param fForward Flag whether to indicate whether the port is operated in forward or reverse mode.
1888 * @thread Any thread.
1889 */
1890 DECLR3CALLBACKMEMBER(int, pfnSetPortDirection,(PPDMIHOSTPARALLELCONNECTOR pInterface, bool fForward));
1891
1892 /**
1893 * Write control register bits.
1894 *
1895 * @returns VBox status code.
1896 * @param pInterface Pointer to the interface structure containing the called function pointer.
1897 * @param fReg The new control register value.
1898 * @thread Any thread.
1899 */
1900 DECLR3CALLBACKMEMBER(int, pfnWriteControl,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t fReg));
1901
1902 /**
1903 * Read control register bits.
1904 *
1905 * @returns VBox status code.
1906 * @param pInterface Pointer to the interface structure containing the called function pointer.
1907 * @param pfReg Where to store the control register bits.
1908 * @thread Any thread.
1909 */
1910 DECLR3CALLBACKMEMBER(int, pfnReadControl,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t *pfReg));
1911
1912 /**
1913 * Read status register bits.
1914 *
1915 * @returns VBox status code.
1916 * @param pInterface Pointer to the interface structure containing the called function pointer.
1917 * @param pfReg Where to store the status register bits.
1918 * @thread Any thread.
1919 */
1920 DECLR3CALLBACKMEMBER(int, pfnReadStatus,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t *pfReg));
1921
1922} PDMIHOSTPARALLELCONNECTOR;
1923/** PDMIHOSTPARALLELCONNECTOR interface ID. */
1924#define PDMIHOSTPARALLELCONNECTOR_IID "7c532602-7438-4fbc-9265-349d9f0415f9"
1925
1926
1927/** ACPI power source identifier */
1928typedef enum PDMACPIPOWERSOURCE
1929{
1930 PDM_ACPI_POWER_SOURCE_UNKNOWN = 0,
1931 PDM_ACPI_POWER_SOURCE_OUTLET,
1932 PDM_ACPI_POWER_SOURCE_BATTERY
1933} PDMACPIPOWERSOURCE;
1934/** Pointer to ACPI battery state. */
1935typedef PDMACPIPOWERSOURCE *PPDMACPIPOWERSOURCE;
1936
1937/** ACPI battey capacity */
1938typedef enum PDMACPIBATCAPACITY
1939{
1940 PDM_ACPI_BAT_CAPACITY_MIN = 0,
1941 PDM_ACPI_BAT_CAPACITY_MAX = 100,
1942 PDM_ACPI_BAT_CAPACITY_UNKNOWN = 255
1943} PDMACPIBATCAPACITY;
1944/** Pointer to ACPI battery capacity. */
1945typedef PDMACPIBATCAPACITY *PPDMACPIBATCAPACITY;
1946
1947/** ACPI battery state. See ACPI 3.0 spec '_BST (Battery Status)' */
1948typedef enum PDMACPIBATSTATE
1949{
1950 PDM_ACPI_BAT_STATE_CHARGED = 0x00,
1951 PDM_ACPI_BAT_STATE_DISCHARGING = 0x01,
1952 PDM_ACPI_BAT_STATE_CHARGING = 0x02,
1953 PDM_ACPI_BAT_STATE_CRITICAL = 0x04
1954} PDMACPIBATSTATE;
1955/** Pointer to ACPI battery state. */
1956typedef PDMACPIBATSTATE *PPDMACPIBATSTATE;
1957
1958/** Pointer to an ACPI port interface. */
1959typedef struct PDMIACPIPORT *PPDMIACPIPORT;
1960/**
1961 * ACPI port interface (down). Used by both the ACPI driver and (grumble) main.
1962 * Pair with PDMIACPICONNECTOR.
1963 */
1964typedef struct PDMIACPIPORT
1965{
1966 /**
1967 * Send an ACPI power off event.
1968 *
1969 * @returns VBox status code
1970 * @param pInterface Pointer to the interface structure containing the called function pointer.
1971 */
1972 DECLR3CALLBACKMEMBER(int, pfnPowerButtonPress,(PPDMIACPIPORT pInterface));
1973
1974 /**
1975 * Send an ACPI sleep button event.
1976 *
1977 * @returns VBox status code
1978 * @param pInterface Pointer to the interface structure containing the called function pointer.
1979 */
1980 DECLR3CALLBACKMEMBER(int, pfnSleepButtonPress,(PPDMIACPIPORT pInterface));
1981
1982 /**
1983 * Check if the last power button event was handled by the guest.
1984 *
1985 * @returns VBox status code
1986 * @param pInterface Pointer to the interface structure containing the called function pointer.
1987 * @param pfHandled Is set to true if the last power button event was handled, false otherwise.
1988 */
1989 DECLR3CALLBACKMEMBER(int, pfnGetPowerButtonHandled,(PPDMIACPIPORT pInterface, bool *pfHandled));
1990
1991 /**
1992 * Check if the guest entered the ACPI mode.
1993 *
1994 * @returns VBox status code
1995 * @param pInterface Pointer to the interface structure containing the called function pointer.
1996 * @param pfEnabled Is set to true if the guest entered the ACPI mode, false otherwise.
1997 */
1998 DECLR3CALLBACKMEMBER(int, pfnGetGuestEnteredACPIMode,(PPDMIACPIPORT pInterface, bool *pfEntered));
1999
2000 /**
2001 * Check if the given CPU is still locked by the guest.
2002 *
2003 * @returns VBox status code
2004 * @param pInterface Pointer to the interface structure containing the called function pointer.
2005 * @param uCpu The CPU to check for.
2006 * @param pfLocked Is set to true if the CPU is still locked by the guest, false otherwise.
2007 */
2008 DECLR3CALLBACKMEMBER(int, pfnGetCpuStatus,(PPDMIACPIPORT pInterface, unsigned uCpu, bool *pfLocked));
2009} PDMIACPIPORT;
2010/** PDMIACPIPORT interface ID. */
2011#define PDMIACPIPORT_IID "30d3dc4c-6a73-40c8-80e9-34309deacbb3"
2012
2013
2014/** Pointer to an ACPI connector interface. */
2015typedef struct PDMIACPICONNECTOR *PPDMIACPICONNECTOR;
2016/**
2017 * ACPI connector interface (up).
2018 * Pair with PDMIACPIPORT.
2019 */
2020typedef struct PDMIACPICONNECTOR
2021{
2022 /**
2023 * Get the current power source of the host system.
2024 *
2025 * @returns VBox status code
2026 * @param pInterface Pointer to the interface structure containing the called function pointer.
2027 * @param penmPowerSource Pointer to the power source result variable.
2028 */
2029 DECLR3CALLBACKMEMBER(int, pfnQueryPowerSource,(PPDMIACPICONNECTOR, PPDMACPIPOWERSOURCE penmPowerSource));
2030
2031 /**
2032 * Query the current battery status of the host system.
2033 *
2034 * @returns VBox status code?
2035 * @param pInterface Pointer to the interface structure containing the called function pointer.
2036 * @param pfPresent Is set to true if battery is present, false otherwise.
2037 * @param penmRemainingCapacity Pointer to the battery remaining capacity (0 - 100 or 255 for unknown).
2038 * @param penmBatteryState Pointer to the battery status.
2039 * @param pu32PresentRate Pointer to the present rate (0..1000 of the total capacity).
2040 */
2041 DECLR3CALLBACKMEMBER(int, pfnQueryBatteryStatus,(PPDMIACPICONNECTOR, bool *pfPresent, PPDMACPIBATCAPACITY penmRemainingCapacity,
2042 PPDMACPIBATSTATE penmBatteryState, uint32_t *pu32PresentRate));
2043} PDMIACPICONNECTOR;
2044/** PDMIACPICONNECTOR interface ID. */
2045#define PDMIACPICONNECTOR_IID "5f14bf8d-1edf-4e3a-a1e1-cca9fd08e359"
2046
2047
2048/** Pointer to a VMMDevice port interface. */
2049typedef struct PDMIVMMDEVPORT *PPDMIVMMDEVPORT;
2050/**
2051 * VMMDevice port interface (down).
2052 * Pair with PDMIVMMDEVCONNECTOR.
2053 */
2054typedef struct PDMIVMMDEVPORT
2055{
2056 /**
2057 * Return the current absolute mouse position in pixels
2058 *
2059 * @returns VBox status code
2060 * @param pInterface Pointer to the interface structure containing the called function pointer.
2061 * @param pxAbs Pointer of result value, can be NULL
2062 * @param pyAbs Pointer of result value, can be NULL
2063 */
2064 DECLR3CALLBACKMEMBER(int, pfnQueryAbsoluteMouse,(PPDMIVMMDEVPORT pInterface, int32_t *pxAbs, int32_t *pyAbs));
2065
2066 /**
2067 * Set the new absolute mouse position in pixels
2068 *
2069 * @returns VBox status code
2070 * @param pInterface Pointer to the interface structure containing the called function pointer.
2071 * @param xabs New absolute X position
2072 * @param yAbs New absolute Y position
2073 */
2074 DECLR3CALLBACKMEMBER(int, pfnSetAbsoluteMouse,(PPDMIVMMDEVPORT pInterface, int32_t xAbs, int32_t yAbs));
2075
2076 /**
2077 * Return the current mouse capability flags
2078 *
2079 * @returns VBox status code
2080 * @param pInterface Pointer to the interface structure containing the called function pointer.
2081 * @param pfCapabilities Pointer of result value
2082 */
2083 DECLR3CALLBACKMEMBER(int, pfnQueryMouseCapabilities,(PPDMIVMMDEVPORT pInterface, uint32_t *pfCapabilities));
2084
2085 /**
2086 * Set the current mouse capability flag (host side)
2087 *
2088 * @returns VBox status code
2089 * @param pInterface Pointer to the interface structure containing the called function pointer.
2090 * @param fCapsAdded Mask of capabilities to add to the flag
2091 * @param fCapsRemoved Mask of capabilities to remove from the flag
2092 */
2093 DECLR3CALLBACKMEMBER(int, pfnUpdateMouseCapabilities,(PPDMIVMMDEVPORT pInterface, uint32_t fCapsAdded, uint32_t fCapsRemoved));
2094
2095 /**
2096 * Issue a display resolution change request.
2097 *
2098 * Note that there can only one request in the queue and that in case the guest does
2099 * not process it, issuing another request will overwrite the previous.
2100 *
2101 * @returns VBox status code
2102 * @param pInterface Pointer to the interface structure containing the called function pointer.
2103 * @param cx Horizontal pixel resolution (0 = do not change).
2104 * @param cy Vertical pixel resolution (0 = do not change).
2105 * @param cBits Bits per pixel (0 = do not change).
2106 * @param idxDisplay The display index.
2107 * @param xOrigin The X coordinate of the lower left
2108 * corner of the secondary display with
2109 * ID = idxDisplay
2110 * @param yOrigin The Y coordinate of the lower left
2111 * corner of the secondary display with
2112 * ID = idxDisplay
2113 * @param fEnabled Whether the display is enabled or not. (Guessing
2114 * again.)
2115 * @param fChangeOrigin Whether the display origin point changed. (Guess)
2116 */
2117 DECLR3CALLBACKMEMBER(int, pfnRequestDisplayChange,(PPDMIVMMDEVPORT pInterface, uint32_t cx,
2118 uint32_t cy, uint32_t cBits, uint32_t idxDisplay,
2119 int32_t xOrigin, int32_t yOrigin, bool fEnabled, bool fChangeOrigin));
2120
2121 /**
2122 * Pass credentials to guest.
2123 *
2124 * Note that there can only be one set of credentials and the guest may or may not
2125 * query them and may do whatever it wants with them.
2126 *
2127 * @returns VBox status code.
2128 * @param pInterface Pointer to the interface structure containing the called function pointer.
2129 * @param pszUsername User name, may be empty (UTF-8).
2130 * @param pszPassword Password, may be empty (UTF-8).
2131 * @param pszDomain Domain name, may be empty (UTF-8).
2132 * @param fFlags VMMDEV_SETCREDENTIALS_*.
2133 */
2134 DECLR3CALLBACKMEMBER(int, pfnSetCredentials,(PPDMIVMMDEVPORT pInterface, const char *pszUsername,
2135 const char *pszPassword, const char *pszDomain,
2136 uint32_t fFlags));
2137
2138 /**
2139 * Notify the driver about a VBVA status change.
2140 *
2141 * @returns Nothing. Because it is informational callback.
2142 * @param pInterface Pointer to the interface structure containing the called function pointer.
2143 * @param fEnabled Current VBVA status.
2144 */
2145 DECLR3CALLBACKMEMBER(void, pfnVBVAChange, (PPDMIVMMDEVPORT pInterface, bool fEnabled));
2146
2147 /**
2148 * Issue a seamless mode change request.
2149 *
2150 * Note that there can only one request in the queue and that in case the guest does
2151 * not process it, issuing another request will overwrite the previous.
2152 *
2153 * @returns VBox status code
2154 * @param pInterface Pointer to the interface structure containing the called function pointer.
2155 * @param fEnabled Seamless mode enabled or not
2156 */
2157 DECLR3CALLBACKMEMBER(int, pfnRequestSeamlessChange,(PPDMIVMMDEVPORT pInterface, bool fEnabled));
2158
2159 /**
2160 * Issue a memory balloon change request.
2161 *
2162 * Note that there can only one request in the queue and that in case the guest does
2163 * not process it, issuing another request will overwrite the previous.
2164 *
2165 * @returns VBox status code
2166 * @param pInterface Pointer to the interface structure containing the called function pointer.
2167 * @param cMbBalloon Balloon size in megabytes
2168 */
2169 DECLR3CALLBACKMEMBER(int, pfnSetMemoryBalloon,(PPDMIVMMDEVPORT pInterface, uint32_t cMbBalloon));
2170
2171 /**
2172 * Issue a statistcs interval change request.
2173 *
2174 * Note that there can only one request in the queue and that in case the guest does
2175 * not process it, issuing another request will overwrite the previous.
2176 *
2177 * @returns VBox status code
2178 * @param pInterface Pointer to the interface structure containing the called function pointer.
2179 * @param cSecsStatInterval Statistics query interval in seconds
2180 * (0=disable).
2181 */
2182 DECLR3CALLBACKMEMBER(int, pfnSetStatisticsInterval,(PPDMIVMMDEVPORT pInterface, uint32_t cSecsStatInterval));
2183
2184 /**
2185 * Notify the guest about a VRDP status change.
2186 *
2187 * @returns VBox status code
2188 * @param pInterface Pointer to the interface structure containing the called function pointer.
2189 * @param fVRDPEnabled Current VRDP status.
2190 * @param uVRDPExperienceLevel Which visual effects to be disabled in
2191 * the guest.
2192 */
2193 DECLR3CALLBACKMEMBER(int, pfnVRDPChange, (PPDMIVMMDEVPORT pInterface, bool fVRDPEnabled, uint32_t uVRDPExperienceLevel));
2194
2195 /**
2196 * Notify the guest of CPU hot-unplug event.
2197 *
2198 * @returns VBox status code
2199 * @param pInterface Pointer to the interface structure containing the called function pointer.
2200 * @param idCpuCore The core id of the CPU to remove.
2201 * @param idCpuPackage The package id of the CPU to remove.
2202 */
2203 DECLR3CALLBACKMEMBER(int, pfnCpuHotUnplug, (PPDMIVMMDEVPORT pInterface, uint32_t idCpuCore, uint32_t idCpuPackage));
2204
2205 /**
2206 * Notify the guest of CPU hot-plug event.
2207 *
2208 * @returns VBox status code
2209 * @param pInterface Pointer to the interface structure containing the called function pointer.
2210 * @param idCpuCore The core id of the CPU to add.
2211 * @param idCpuPackage The package id of the CPU to add.
2212 */
2213 DECLR3CALLBACKMEMBER(int, pfnCpuHotPlug, (PPDMIVMMDEVPORT pInterface, uint32_t idCpuCore, uint32_t idCpuPackage));
2214
2215} PDMIVMMDEVPORT;
2216/** PDMIVMMDEVPORT interface ID. */
2217#define PDMIVMMDEVPORT_IID "d7e52035-3b6c-422e-9215-2a75646a945d"
2218
2219
2220/** Pointer to a HPET legacy notification interface. */
2221typedef struct PDMIHPETLEGACYNOTIFY *PPDMIHPETLEGACYNOTIFY;
2222/**
2223 * HPET legacy notification interface.
2224 */
2225typedef struct PDMIHPETLEGACYNOTIFY
2226{
2227 /**
2228 * Notify about change of HPET legacy mode.
2229 *
2230 * @param pInterface Pointer to the interface structure containing the
2231 * called function pointer.
2232 * @param fActivated If HPET legacy mode is activated (@c true) or
2233 * deactivated (@c false).
2234 */
2235 DECLR3CALLBACKMEMBER(void, pfnModeChanged,(PPDMIHPETLEGACYNOTIFY pInterface, bool fActivated));
2236} PDMIHPETLEGACYNOTIFY;
2237/** PDMIHPETLEGACYNOTIFY interface ID. */
2238#define PDMIHPETLEGACYNOTIFY_IID "c9ada595-4b65-4311-8b21-b10498997774"
2239
2240
2241/** @name Flags for PDMIVMMDEVPORT::pfnSetCredentials.
2242 * @{ */
2243/** The guest should perform a logon with the credentials. */
2244#define VMMDEV_SETCREDENTIALS_GUESTLOGON RT_BIT(0)
2245/** The guest should prevent local logons. */
2246#define VMMDEV_SETCREDENTIALS_NOLOCALLOGON RT_BIT(1)
2247/** The guest should verify the credentials. */
2248#define VMMDEV_SETCREDENTIALS_JUDGE RT_BIT(15)
2249/** @} */
2250
2251/** Forward declaration of the guest information structure. */
2252struct VBoxGuestInfo;
2253/** Forward declaration of the guest information-2 structure. */
2254struct VBoxGuestInfo2;
2255/** Forward declaration of the guest statistics structure */
2256struct VBoxGuestStatistics;
2257/** Forward declaration of the guest status structure */
2258struct VBoxGuestStatus;
2259
2260/** Forward declaration of the video accelerator command memory. */
2261struct VBVAMEMORY;
2262/** Pointer to video accelerator command memory. */
2263typedef struct VBVAMEMORY *PVBVAMEMORY;
2264
2265/** Pointer to a VMMDev connector interface. */
2266typedef struct PDMIVMMDEVCONNECTOR *PPDMIVMMDEVCONNECTOR;
2267/**
2268 * VMMDev connector interface (up).
2269 * Pair with PDMIVMMDEVPORT.
2270 */
2271typedef struct PDMIVMMDEVCONNECTOR
2272{
2273 /**
2274 * Update guest facility status.
2275 *
2276 * Called in response to VMMDevReq_ReportGuestStatus, reset or state restore.
2277 *
2278 * @param pInterface Pointer to this interface.
2279 * @param uFacility The facility.
2280 * @param uStatus The status.
2281 * @param fFlags Flags assoicated with the update. Currently
2282 * reserved and should be ignored.
2283 * @param pTimeSpecTS Pointer to the timestamp of this report.
2284 * @thread The emulation thread.
2285 */
2286 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestStatus,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t uFacility, uint16_t uStatus,
2287 uint32_t fFlags, PCRTTIMESPEC pTimeSpecTS));
2288
2289 /**
2290 * Updates a guest user state.
2291 *
2292 * Called in response to VMMDevReq_ReportGuestUserState.
2293 *
2294 * @param pInterface Pointer to this interface.
2295 * @param pszUser Guest user name to update status for.
2296 * @param pszDomain Domain the guest user is bound to. Optional.
2297 * @param uState New guest user state to notify host about.
2298 * @param puDetails Pointer to optional state data.
2299 * @param cbDetails Size (in bytes) of optional state data.
2300 * @thread The emulation thread.
2301 */
2302 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestUserState,(PPDMIVMMDEVCONNECTOR pInterface, const char *pszUser, const char *pszDomain,
2303 uint32_t uState,
2304 const uint8_t *puDetails, uint32_t cbDetails));
2305
2306 /**
2307 * Reports the guest API and OS version.
2308 * Called whenever the Additions issue a guest info report request.
2309 *
2310 * @param pInterface Pointer to this interface.
2311 * @param pGuestInfo Pointer to guest information structure
2312 * @thread The emulation thread.
2313 */
2314 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestInfo,(PPDMIVMMDEVCONNECTOR pInterface, const struct VBoxGuestInfo *pGuestInfo));
2315
2316 /**
2317 * Reports the detailed Guest Additions version.
2318 *
2319 * @param pInterface Pointer to this interface.
2320 * @param uFullVersion The guest additions version as a full version.
2321 * Use VBOX_FULL_VERSION_GET_MAJOR,
2322 * VBOX_FULL_VERSION_GET_MINOR and
2323 * VBOX_FULL_VERSION_GET_BUILD to access it.
2324 * (This will not be zero, so turn down the
2325 * paranoia level a notch.)
2326 * @param pszName Pointer to the sanitized version name. This can
2327 * be empty, but will not be NULL. If not empty,
2328 * it will contain a build type tag and/or a
2329 * publisher tag. If both, then they are separated
2330 * by an underscore (VBOX_VERSION_STRING fashion).
2331 * @param uRevision The SVN revision. Can be 0.
2332 * @param fFeatures Feature mask, currently none are defined.
2333 *
2334 * @thread The emulation thread.
2335 */
2336 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestInfo2,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t uFullVersion,
2337 const char *pszName, uint32_t uRevision, uint32_t fFeatures));
2338
2339 /**
2340 * Update the guest additions capabilities.
2341 * This is called when the guest additions capabilities change. The new capabilities
2342 * are given and the connector should update its internal state.
2343 *
2344 * @param pInterface Pointer to this interface.
2345 * @param newCapabilities New capabilities.
2346 * @thread The emulation thread.
2347 */
2348 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestCapabilities,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities));
2349
2350 /**
2351 * Update the mouse capabilities.
2352 * This is called when the mouse capabilities change. The new capabilities
2353 * are given and the connector should update its internal state.
2354 *
2355 * @param pInterface Pointer to this interface.
2356 * @param newCapabilities New capabilities.
2357 * @thread The emulation thread.
2358 */
2359 DECLR3CALLBACKMEMBER(void, pfnUpdateMouseCapabilities,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities));
2360
2361 /**
2362 * Update the pointer shape.
2363 * This is called when the mouse pointer shape changes. The new shape
2364 * is passed as a caller allocated buffer that will be freed after returning
2365 *
2366 * @param pInterface Pointer to this interface.
2367 * @param fVisible Visibility indicator (if false, the other parameters are undefined).
2368 * @param fAlpha Flag whether alpha channel is being passed.
2369 * @param xHot Pointer hot spot x coordinate.
2370 * @param yHot Pointer hot spot y coordinate.
2371 * @param x Pointer new x coordinate on screen.
2372 * @param y Pointer new y coordinate on screen.
2373 * @param cx Pointer width in pixels.
2374 * @param cy Pointer height in pixels.
2375 * @param cbScanline Size of one scanline in bytes.
2376 * @param pvShape New shape buffer.
2377 * @thread The emulation thread.
2378 */
2379 DECLR3CALLBACKMEMBER(void, pfnUpdatePointerShape,(PPDMIVMMDEVCONNECTOR pInterface, bool fVisible, bool fAlpha,
2380 uint32_t xHot, uint32_t yHot,
2381 uint32_t cx, uint32_t cy,
2382 void *pvShape));
2383
2384 /**
2385 * Enable or disable video acceleration on behalf of guest.
2386 *
2387 * @param pInterface Pointer to this interface.
2388 * @param fEnable Whether to enable acceleration.
2389 * @param pVbvaMemory Video accelerator memory.
2390
2391 * @return VBox rc. VINF_SUCCESS if VBVA was enabled.
2392 * @thread The emulation thread.
2393 */
2394 DECLR3CALLBACKMEMBER(int, pfnVideoAccelEnable,(PPDMIVMMDEVCONNECTOR pInterface, bool fEnable, PVBVAMEMORY pVbvaMemory));
2395
2396 /**
2397 * Force video queue processing.
2398 *
2399 * @param pInterface Pointer to this interface.
2400 * @thread The emulation thread.
2401 */
2402 DECLR3CALLBACKMEMBER(void, pfnVideoAccelFlush,(PPDMIVMMDEVCONNECTOR pInterface));
2403
2404 /**
2405 * Return whether the given video mode is supported/wanted by the host.
2406 *
2407 * @returns VBox status code
2408 * @param pInterface Pointer to this interface.
2409 * @param display The guest monitor, 0 for primary.
2410 * @param cy Video mode horizontal resolution in pixels.
2411 * @param cx Video mode vertical resolution in pixels.
2412 * @param cBits Video mode bits per pixel.
2413 * @param pfSupported Where to put the indicator for whether this mode is supported. (output)
2414 * @thread The emulation thread.
2415 */
2416 DECLR3CALLBACKMEMBER(int, pfnVideoModeSupported,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t display, uint32_t cx, uint32_t cy, uint32_t cBits, bool *pfSupported));
2417
2418 /**
2419 * Queries by how many pixels the height should be reduced when calculating video modes
2420 *
2421 * @returns VBox status code
2422 * @param pInterface Pointer to this interface.
2423 * @param pcyReduction Pointer to the result value.
2424 * @thread The emulation thread.
2425 */
2426 DECLR3CALLBACKMEMBER(int, pfnGetHeightReduction,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcyReduction));
2427
2428 /**
2429 * Informs about a credentials judgement result from the guest.
2430 *
2431 * @returns VBox status code
2432 * @param pInterface Pointer to this interface.
2433 * @param fFlags Judgement result flags.
2434 * @thread The emulation thread.
2435 */
2436 DECLR3CALLBACKMEMBER(int, pfnSetCredentialsJudgementResult,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t fFlags));
2437
2438 /**
2439 * Set the visible region of the display
2440 *
2441 * @returns VBox status code.
2442 * @param pInterface Pointer to this interface.
2443 * @param cRect Number of rectangles in pRect
2444 * @param pRect Rectangle array
2445 * @thread The emulation thread.
2446 */
2447 DECLR3CALLBACKMEMBER(int, pfnSetVisibleRegion,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t cRect, PRTRECT pRect));
2448
2449 /**
2450 * Query the visible region of the display
2451 *
2452 * @returns VBox status code.
2453 * @param pInterface Pointer to this interface.
2454 * @param pcRect Number of rectangles in pRect
2455 * @param pRect Rectangle array (set to NULL to query the number of rectangles)
2456 * @thread The emulation thread.
2457 */
2458 DECLR3CALLBACKMEMBER(int, pfnQueryVisibleRegion,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcRect, PRTRECT pRect));
2459
2460 /**
2461 * Request the statistics interval
2462 *
2463 * @returns VBox status code.
2464 * @param pInterface Pointer to this interface.
2465 * @param pulInterval Pointer to interval in seconds
2466 * @thread The emulation thread.
2467 */
2468 DECLR3CALLBACKMEMBER(int, pfnQueryStatisticsInterval,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pulInterval));
2469
2470 /**
2471 * Report new guest statistics
2472 *
2473 * @returns VBox status code.
2474 * @param pInterface Pointer to this interface.
2475 * @param pGuestStats Guest statistics
2476 * @thread The emulation thread.
2477 */
2478 DECLR3CALLBACKMEMBER(int, pfnReportStatistics,(PPDMIVMMDEVCONNECTOR pInterface, struct VBoxGuestStatistics *pGuestStats));
2479
2480 /**
2481 * Query the current balloon size
2482 *
2483 * @returns VBox status code.
2484 * @param pInterface Pointer to this interface.
2485 * @param pcbBalloon Balloon size
2486 * @thread The emulation thread.
2487 */
2488 DECLR3CALLBACKMEMBER(int, pfnQueryBalloonSize,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcbBalloon));
2489
2490 /**
2491 * Query the current page fusion setting
2492 *
2493 * @returns VBox status code.
2494 * @param pInterface Pointer to this interface.
2495 * @param pfPageFusionEnabled Pointer to boolean
2496 * @thread The emulation thread.
2497 */
2498 DECLR3CALLBACKMEMBER(int, pfnIsPageFusionEnabled,(PPDMIVMMDEVCONNECTOR pInterface, bool *pfPageFusionEnabled));
2499
2500} PDMIVMMDEVCONNECTOR;
2501/** PDMIVMMDEVCONNECTOR interface ID. */
2502#define PDMIVMMDEVCONNECTOR_IID "aff90240-a443-434e-9132-80c186ab97d4"
2503
2504
2505/** Pointer to a network connector interface */
2506typedef struct PDMIAUDIOCONNECTOR *PPDMIAUDIOCONNECTOR;
2507/**
2508 * Audio connector interface (up).
2509 * No interface pair yet.
2510 */
2511typedef struct PDMIAUDIOCONNECTOR
2512{
2513 DECLR3CALLBACKMEMBER(void, pfnRun,(PPDMIAUDIOCONNECTOR pInterface));
2514
2515/* DECLR3CALLBACKMEMBER(int, pfnSetRecordSource,(PPDMIAUDIOINCONNECTOR pInterface, AUDIORECSOURCE)); */
2516
2517} PDMIAUDIOCONNECTOR;
2518/** PDMIAUDIOCONNECTOR interface ID. */
2519#define PDMIAUDIOCONNECTOR_IID "85d52af5-b3aa-4b3e-b176-4b5ebfc52f47"
2520
2521
2522/** @todo r=bird: the two following interfaces are hacks to work around the missing audio driver
2523 * interface. This should be addressed rather than making more temporary hacks. */
2524
2525/** Pointer to a Audio Sniffer Device port interface. */
2526typedef struct PDMIAUDIOSNIFFERPORT *PPDMIAUDIOSNIFFERPORT;
2527/**
2528 * Audio Sniffer port interface (down).
2529 * Pair with PDMIAUDIOSNIFFERCONNECTOR.
2530 */
2531typedef struct PDMIAUDIOSNIFFERPORT
2532{
2533 /**
2534 * Enables or disables sniffing.
2535 *
2536 * If sniffing is being enabled also sets a flag whether the audio must be also
2537 * left on the host.
2538 *
2539 * @returns VBox status code
2540 * @param pInterface Pointer to this interface.
2541 * @param fEnable 'true' for enable sniffing, 'false' to disable.
2542 * @param fKeepHostAudio Indicates whether host audio should also present
2543 * 'true' means that sound should not be played
2544 * by the audio device.
2545 */
2546 DECLR3CALLBACKMEMBER(int, pfnSetup,(PPDMIAUDIOSNIFFERPORT pInterface, bool fEnable, bool fKeepHostAudio));
2547
2548 /**
2549 * Enables or disables audio input.
2550 *
2551 * @returns VBox status code
2552 * @param pInterface Pointer to this interface.
2553 * @param fIntercept 'true' for interception of audio input,
2554 * 'false' to let the host audio backend do audio input.
2555 */
2556 DECLR3CALLBACKMEMBER(int, pfnAudioInputIntercept,(PPDMIAUDIOSNIFFERPORT pInterface, bool fIntercept));
2557
2558 /**
2559 * Audio input is about to start.
2560 *
2561 * @returns VBox status code.
2562 * @param pvContext The callback context, supplied in the
2563 * PDMIAUDIOSNIFFERCONNECTOR::pfnAudioInputBegin as pvContext.
2564 * @param iSampleHz The sample frequency in Hz.
2565 * @param cChannels Number of channels. 1 for mono, 2 for stereo.
2566 * @param cBits How many bits a sample for a single channel has. Normally 8 or 16.
2567 * @param fUnsigned Whether samples are unsigned values.
2568 */
2569 DECLR3CALLBACKMEMBER(int, pfnAudioInputEventBegin,(PPDMIAUDIOSNIFFERPORT pInterface,
2570 void *pvContext,
2571 int iSampleHz,
2572 int cChannels,
2573 int cBits,
2574 bool fUnsigned));
2575
2576 /**
2577 * Callback which delivers audio data to the audio device.
2578 *
2579 * @returns VBox status code.
2580 * @param pvContext The callback context, supplied in the
2581 * PDMIAUDIOSNIFFERCONNECTOR::pfnAudioInputBegin as pvContext.
2582 * @param pvData Event specific data.
2583 * @param cbData Size of the buffer pointed by pvData.
2584 */
2585 DECLR3CALLBACKMEMBER(int, pfnAudioInputEventData,(PPDMIAUDIOSNIFFERPORT pInterface,
2586 void *pvContext,
2587 const void *pvData,
2588 uint32_t cbData));
2589
2590 /**
2591 * Audio input ends.
2592 *
2593 * @param pvContext The callback context, supplied in the
2594 * PDMIAUDIOSNIFFERCONNECTOR::pfnAudioInputBegin as pvContext.
2595 */
2596 DECLR3CALLBACKMEMBER(void, pfnAudioInputEventEnd,(PPDMIAUDIOSNIFFERPORT pInterface,
2597 void *pvContext));
2598} PDMIAUDIOSNIFFERPORT;
2599/** PDMIAUDIOSNIFFERPORT interface ID. */
2600#define PDMIAUDIOSNIFFERPORT_IID "8ad25d78-46e9-479b-a363-bb0bc0fe022f"
2601
2602
2603/** Pointer to a Audio Sniffer connector interface. */
2604typedef struct PDMIAUDIOSNIFFERCONNECTOR *PPDMIAUDIOSNIFFERCONNECTOR;
2605
2606/**
2607 * Audio Sniffer connector interface (up).
2608 * Pair with PDMIAUDIOSNIFFERPORT.
2609 */
2610typedef struct PDMIAUDIOSNIFFERCONNECTOR
2611{
2612 /**
2613 * AudioSniffer device calls this method when audio samples
2614 * are about to be played and sniffing is enabled.
2615 *
2616 * @param pInterface Pointer to this interface.
2617 * @param pvSamples Audio samples buffer.
2618 * @param cSamples How many complete samples are in the buffer.
2619 * @param iSampleHz The sample frequency in Hz.
2620 * @param cChannels Number of channels. 1 for mono, 2 for stereo.
2621 * @param cBits How many bits a sample for a single channel has. Normally 8 or 16.
2622 * @param fUnsigned Whether samples are unsigned values.
2623 * @thread The emulation thread.
2624 */
2625 DECLR3CALLBACKMEMBER(void, pfnAudioSamplesOut,(PPDMIAUDIOSNIFFERCONNECTOR pInterface, void *pvSamples, uint32_t cSamples,
2626 int iSampleHz, int cChannels, int cBits, bool fUnsigned));
2627
2628 /**
2629 * AudioSniffer device calls this method when output volume is changed.
2630 *
2631 * @param pInterface Pointer to this interface.
2632 * @param u16LeftVolume 0..0xFFFF volume level for left channel.
2633 * @param u16RightVolume 0..0xFFFF volume level for right channel.
2634 * @thread The emulation thread.
2635 */
2636 DECLR3CALLBACKMEMBER(void, pfnAudioVolumeOut,(PPDMIAUDIOSNIFFERCONNECTOR pInterface, uint16_t u16LeftVolume, uint16_t u16RightVolume));
2637
2638 /**
2639 * Audio input has been requested by the virtual audio device.
2640 *
2641 * @param pInterface Pointer to this interface.
2642 * @param ppvUserCtx The interface context for this audio input stream,
2643 * it will be used in the pfnAudioInputEnd call.
2644 * @param pvContext The context pointer to be used in PDMIAUDIOSNIFFERPORT::pfnAudioInputEvent.
2645 * @param cSamples How many samples in a block is preferred in
2646 * PDMIAUDIOSNIFFERPORT::pfnAudioInputEvent.
2647 * @param iSampleHz The sample frequency in Hz.
2648 * @param cChannels Number of channels. 1 for mono, 2 for stereo.
2649 * @param cBits How many bits a sample for a single channel has. Normally 8 or 16.
2650 * @thread The emulation thread.
2651 */
2652 DECLR3CALLBACKMEMBER(int, pfnAudioInputBegin,(PPDMIAUDIOSNIFFERCONNECTOR pInterface,
2653 void **ppvUserCtx,
2654 void *pvContext,
2655 uint32_t cSamples,
2656 uint32_t iSampleHz,
2657 uint32_t cChannels,
2658 uint32_t cBits));
2659
2660 /**
2661 * Audio input has been requested by the virtual audio device.
2662 *
2663 * @param pInterface Pointer to this interface.
2664 * @param pvUserCtx The interface context for this audio input stream,
2665 * which was returned by pfnAudioInputBegin call.
2666 * @thread The emulation thread.
2667 */
2668 DECLR3CALLBACKMEMBER(void, pfnAudioInputEnd,(PPDMIAUDIOSNIFFERCONNECTOR pInterface,
2669 void *pvUserCtx));
2670} PDMIAUDIOSNIFFERCONNECTOR;
2671/** PDMIAUDIOSNIFFERCONNECTOR - The Audio Sniffer Driver connector interface. */
2672#define PDMIAUDIOSNIFFERCONNECTOR_IID "9d37f543-27af-45f8-8002-8ef7abac71e4"
2673
2674
2675/**
2676 * Generic status LED core.
2677 * Note that a unit doesn't have to support all the indicators.
2678 */
2679typedef union PDMLEDCORE
2680{
2681 /** 32-bit view. */
2682 uint32_t volatile u32;
2683 /** Bit view. */
2684 struct
2685 {
2686 /** Reading/Receiving indicator. */
2687 uint32_t fReading : 1;
2688 /** Writing/Sending indicator. */
2689 uint32_t fWriting : 1;
2690 /** Busy indicator. */
2691 uint32_t fBusy : 1;
2692 /** Error indicator. */
2693 uint32_t fError : 1;
2694 } s;
2695} PDMLEDCORE;
2696
2697/** LED bit masks for the u32 view.
2698 * @{ */
2699/** Reading/Receiving indicator. */
2700#define PDMLED_READING RT_BIT(0)
2701/** Writing/Sending indicator. */
2702#define PDMLED_WRITING RT_BIT(1)
2703/** Busy indicator. */
2704#define PDMLED_BUSY RT_BIT(2)
2705/** Error indicator. */
2706#define PDMLED_ERROR RT_BIT(3)
2707/** @} */
2708
2709
2710/**
2711 * Generic status LED.
2712 * Note that a unit doesn't have to support all the indicators.
2713 */
2714typedef struct PDMLED
2715{
2716 /** Just a magic for sanity checking. */
2717 uint32_t u32Magic;
2718 uint32_t u32Alignment; /**< structure size alignment. */
2719 /** The actual LED status.
2720 * Only the device is allowed to change this. */
2721 PDMLEDCORE Actual;
2722 /** The asserted LED status which is cleared by the reader.
2723 * The device will assert the bits but never clear them.
2724 * The driver clears them as it sees fit. */
2725 PDMLEDCORE Asserted;
2726} PDMLED;
2727
2728/** Pointer to an LED. */
2729typedef PDMLED *PPDMLED;
2730/** Pointer to a const LED. */
2731typedef const PDMLED *PCPDMLED;
2732
2733/** Magic value for PDMLED::u32Magic. */
2734#define PDMLED_MAGIC UINT32_C(0x11335577)
2735
2736/** Pointer to an LED ports interface. */
2737typedef struct PDMILEDPORTS *PPDMILEDPORTS;
2738/**
2739 * Interface for exporting LEDs (down).
2740 * Pair with PDMILEDCONNECTORS.
2741 */
2742typedef struct PDMILEDPORTS
2743{
2744 /**
2745 * Gets the pointer to the status LED of a unit.
2746 *
2747 * @returns VBox status code.
2748 * @param pInterface Pointer to the interface structure containing the called function pointer.
2749 * @param iLUN The unit which status LED we desire.
2750 * @param ppLed Where to store the LED pointer.
2751 */
2752 DECLR3CALLBACKMEMBER(int, pfnQueryStatusLed,(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed));
2753
2754} PDMILEDPORTS;
2755/** PDMILEDPORTS interface ID. */
2756#define PDMILEDPORTS_IID "435e0cec-8549-4ca0-8c0d-98e52f1dc038"
2757
2758
2759/** Pointer to an LED connectors interface. */
2760typedef struct PDMILEDCONNECTORS *PPDMILEDCONNECTORS;
2761/**
2762 * Interface for reading LEDs (up).
2763 * Pair with PDMILEDPORTS.
2764 */
2765typedef struct PDMILEDCONNECTORS
2766{
2767 /**
2768 * Notification about a unit which have been changed.
2769 *
2770 * The driver must discard any pointers to data owned by
2771 * the unit and requery it.
2772 *
2773 * @param pInterface Pointer to the interface structure containing the called function pointer.
2774 * @param iLUN The unit number.
2775 */
2776 DECLR3CALLBACKMEMBER(void, pfnUnitChanged,(PPDMILEDCONNECTORS pInterface, unsigned iLUN));
2777} PDMILEDCONNECTORS;
2778/** PDMILEDCONNECTORS interface ID. */
2779#define PDMILEDCONNECTORS_IID "8ed63568-82a7-4193-b57b-db8085ac4495"
2780
2781
2782/** Pointer to a Media Notification interface. */
2783typedef struct PDMIMEDIANOTIFY *PPDMIMEDIANOTIFY;
2784/**
2785 * Interface for exporting Medium eject information (up). No interface pair.
2786 */
2787typedef struct PDMIMEDIANOTIFY
2788{
2789 /**
2790 * Signals that the medium was ejected.
2791 *
2792 * @returns VBox status code.
2793 * @param pInterface Pointer to the interface structure containing the called function pointer.
2794 * @param iLUN The unit which had the medium ejected.
2795 */
2796 DECLR3CALLBACKMEMBER(int, pfnEjected,(PPDMIMEDIANOTIFY pInterface, unsigned iLUN));
2797
2798} PDMIMEDIANOTIFY;
2799/** PDMIMEDIANOTIFY interface ID. */
2800#define PDMIMEDIANOTIFY_IID "fc22d53e-feb1-4a9c-b9fb-0a990a6ab288"
2801
2802
2803/** The special status unit number */
2804#define PDM_STATUS_LUN 999
2805
2806
2807#ifdef VBOX_WITH_HGCM
2808
2809/** Abstract HGCM command structure. Used only to define a typed pointer. */
2810struct VBOXHGCMCMD;
2811
2812/** Pointer to HGCM command structure. This pointer is unique and identifies
2813 * the command being processed. The pointer is passed to HGCM connector methods,
2814 * and must be passed back to HGCM port when command is completed.
2815 */
2816typedef struct VBOXHGCMCMD *PVBOXHGCMCMD;
2817
2818/** Pointer to a HGCM port interface. */
2819typedef struct PDMIHGCMPORT *PPDMIHGCMPORT;
2820/**
2821 * Host-Guest communication manager port interface (down). Normally implemented
2822 * by VMMDev.
2823 * Pair with PDMIHGCMCONNECTOR.
2824 */
2825typedef struct PDMIHGCMPORT
2826{
2827 /**
2828 * Notify the guest on a command completion.
2829 *
2830 * @param pInterface Pointer to this interface.
2831 * @param rc The return code (VBox error code).
2832 * @param pCmd A pointer that identifies the completed command.
2833 *
2834 * @returns VBox status code
2835 */
2836 DECLR3CALLBACKMEMBER(void, pfnCompleted,(PPDMIHGCMPORT pInterface, int32_t rc, PVBOXHGCMCMD pCmd));
2837
2838} PDMIHGCMPORT;
2839/** PDMIHGCMPORT interface ID. */
2840# define PDMIHGCMPORT_IID "e00a0cbf-b75a-45c3-87f4-41cddbc5ae0b"
2841
2842
2843/** Pointer to a HGCM service location structure. */
2844typedef struct HGCMSERVICELOCATION *PHGCMSERVICELOCATION;
2845
2846/** Pointer to a HGCM connector interface. */
2847typedef struct PDMIHGCMCONNECTOR *PPDMIHGCMCONNECTOR;
2848/**
2849 * The Host-Guest communication manager connector interface (up). Normally
2850 * implemented by Main::VMMDevInterface.
2851 * Pair with PDMIHGCMPORT.
2852 */
2853typedef struct PDMIHGCMCONNECTOR
2854{
2855 /**
2856 * Locate a service and inform it about a client connection.
2857 *
2858 * @param pInterface Pointer to this interface.
2859 * @param pCmd A pointer that identifies the command.
2860 * @param pServiceLocation Pointer to the service location structure.
2861 * @param pu32ClientID Where to store the client id for the connection.
2862 * @return VBox status code.
2863 * @thread The emulation thread.
2864 */
2865 DECLR3CALLBACKMEMBER(int, pfnConnect,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, PHGCMSERVICELOCATION pServiceLocation, uint32_t *pu32ClientID));
2866
2867 /**
2868 * Disconnect from service.
2869 *
2870 * @param pInterface Pointer to this interface.
2871 * @param pCmd A pointer that identifies the command.
2872 * @param u32ClientID The client id returned by the pfnConnect call.
2873 * @return VBox status code.
2874 * @thread The emulation thread.
2875 */
2876 DECLR3CALLBACKMEMBER(int, pfnDisconnect,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID));
2877
2878 /**
2879 * Process a guest issued command.
2880 *
2881 * @param pInterface Pointer to this interface.
2882 * @param pCmd A pointer that identifies the command.
2883 * @param u32ClientID The client id returned by the pfnConnect call.
2884 * @param u32Function Function to be performed by the service.
2885 * @param cParms Number of parameters in the array pointed to by paParams.
2886 * @param paParms Pointer to an array of parameters.
2887 * @return VBox status code.
2888 * @thread The emulation thread.
2889 */
2890 DECLR3CALLBACKMEMBER(int, pfnCall,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID, uint32_t u32Function,
2891 uint32_t cParms, PVBOXHGCMSVCPARM paParms));
2892
2893} PDMIHGCMCONNECTOR;
2894/** PDMIHGCMCONNECTOR interface ID. */
2895# define PDMIHGCMCONNECTOR_IID "a1104758-c888-4437-8f2a-7bac17865b5c"
2896
2897#endif /* VBOX_WITH_HGCM */
2898
2899/**
2900 * Data direction.
2901 */
2902typedef enum PDMSCSIREQUESTTXDIR
2903{
2904 PDMSCSIREQUESTTXDIR_UNKNOWN = 0x00,
2905 PDMSCSIREQUESTTXDIR_FROM_DEVICE = 0x01,
2906 PDMSCSIREQUESTTXDIR_TO_DEVICE = 0x02,
2907 PDMSCSIREQUESTTXDIR_NONE = 0x03,
2908 PDMSCSIREQUESTTXDIR_32BIT_HACK = 0x7fffffff
2909} PDMSCSIREQUESTTXDIR;
2910
2911/**
2912 * SCSI request structure.
2913 */
2914typedef struct PDMSCSIREQUEST
2915{
2916 /** The logical unit. */
2917 uint32_t uLogicalUnit;
2918 /** Direction of the data flow. */
2919 PDMSCSIREQUESTTXDIR uDataDirection;
2920 /** Size of the SCSI CDB. */
2921 uint32_t cbCDB;
2922 /** Pointer to the SCSI CDB. */
2923 uint8_t *pbCDB;
2924 /** Overall size of all scatter gather list elements
2925 * for data transfer if any. */
2926 uint32_t cbScatterGather;
2927 /** Number of elements in the scatter gather list. */
2928 uint32_t cScatterGatherEntries;
2929 /** Pointer to the head of the scatter gather list. */
2930 PRTSGSEG paScatterGatherHead;
2931 /** Size of the sense buffer. */
2932 uint32_t cbSenseBuffer;
2933 /** Pointer to the sense buffer. *
2934 * Current assumption that the sense buffer is not scattered. */
2935 uint8_t *pbSenseBuffer;
2936 /** Opaque user data for use by the device. Left untouched by everything else! */
2937 void *pvUser;
2938} PDMSCSIREQUEST, *PPDMSCSIREQUEST;
2939/** Pointer to a const SCSI request structure. */
2940typedef const PDMSCSIREQUEST *PCSCSIREQUEST;
2941
2942/** Pointer to a SCSI port interface. */
2943typedef struct PDMISCSIPORT *PPDMISCSIPORT;
2944/**
2945 * SCSI command execution port interface (down).
2946 * Pair with PDMISCSICONNECTOR.
2947 */
2948typedef struct PDMISCSIPORT
2949{
2950
2951 /**
2952 * Notify the device on request completion.
2953 *
2954 * @returns VBox status code.
2955 * @param pInterface Pointer to this interface.
2956 * @param pSCSIRequest Pointer to the finished SCSI request.
2957 * @param rcCompletion SCSI_STATUS_* code for the completed request.
2958 * @param fRedo Flag whether the request can to be redone
2959 * when it failed.
2960 * @param rcReq The status code the request completed with (VERR_*)
2961 * Should be only used to choose the correct error message
2962 * displayed to the user if the error can be fixed by him
2963 * (fRedo is true).
2964 */
2965 DECLR3CALLBACKMEMBER(int, pfnSCSIRequestCompleted, (PPDMISCSIPORT pInterface, PPDMSCSIREQUEST pSCSIRequest,
2966 int rcCompletion, bool fRedo, int rcReq));
2967
2968 /**
2969 * Returns the storage controller name, instance and LUN of the attached medium.
2970 *
2971 * @returns VBox status.
2972 * @param pInterface Pointer to this interface.
2973 * @param ppcszController Where to store the name of the storage controller.
2974 * @param piInstance Where to store the instance number of the controller.
2975 * @param piLUN Where to store the LUN of the attached device.
2976 */
2977 DECLR3CALLBACKMEMBER(int, pfnQueryDeviceLocation, (PPDMISCSIPORT pInterface, const char **ppcszController,
2978 uint32_t *piInstance, uint32_t *piLUN));
2979
2980} PDMISCSIPORT;
2981/** PDMISCSIPORT interface ID. */
2982#define PDMISCSIPORT_IID "05d9fc3b-e38c-4b30-8344-a323feebcfe5"
2983
2984
2985/** Pointer to a SCSI connector interface. */
2986typedef struct PDMISCSICONNECTOR *PPDMISCSICONNECTOR;
2987/**
2988 * SCSI command execution connector interface (up).
2989 * Pair with PDMISCSIPORT.
2990 */
2991typedef struct PDMISCSICONNECTOR
2992{
2993
2994 /**
2995 * Submits a SCSI request for execution.
2996 *
2997 * @returns VBox status code.
2998 * @param pInterface Pointer to this interface.
2999 * @param pSCSIRequest Pointer to the SCSI request to execute.
3000 */
3001 DECLR3CALLBACKMEMBER(int, pfnSCSIRequestSend, (PPDMISCSICONNECTOR pInterface, PPDMSCSIREQUEST pSCSIRequest));
3002
3003} PDMISCSICONNECTOR;
3004/** PDMISCSICONNECTOR interface ID. */
3005#define PDMISCSICONNECTOR_IID "94465fbd-a2f2-447e-88c9-7366421bfbfe"
3006
3007
3008/** Pointer to a display VBVA callbacks interface. */
3009typedef struct PDMIDISPLAYVBVACALLBACKS *PPDMIDISPLAYVBVACALLBACKS;
3010/**
3011 * Display VBVA callbacks interface (up).
3012 */
3013typedef struct PDMIDISPLAYVBVACALLBACKS
3014{
3015
3016 /**
3017 * Informs guest about completion of processing the given Video HW Acceleration
3018 * command, does not wait for the guest to process the command.
3019 *
3020 * @returns ???
3021 * @param pInterface Pointer to this interface.
3022 * @param pCmd The Video HW Acceleration Command that was
3023 * completed.
3024 * @todo r=bird: if async means asynchronous; then
3025 * s/pfnVHWACommandCompleteAsynch/pfnVHWACommandCompleteAsync/;
3026 * fi
3027 */
3028 DECLR3CALLBACKMEMBER(int, pfnVHWACommandCompleteAsynch, (PPDMIDISPLAYVBVACALLBACKS pInterface,
3029 PVBOXVHWACMD pCmd));
3030
3031 DECLR3CALLBACKMEMBER(int, pfnCrHgsmiCommandCompleteAsync, (PPDMIDISPLAYVBVACALLBACKS pInterface,
3032 PVBOXVDMACMD_CHROMIUM_CMD pCmd, int rc));
3033
3034 DECLR3CALLBACKMEMBER(int, pfnCrHgsmiControlCompleteAsync, (PPDMIDISPLAYVBVACALLBACKS pInterface,
3035 PVBOXVDMACMD_CHROMIUM_CTL pCmd, int rc));
3036} PDMIDISPLAYVBVACALLBACKS;
3037/** PDMIDISPLAYVBVACALLBACKS */
3038#define PDMIDISPLAYVBVACALLBACKS_IID "b78b81d2-c821-4e66-96ff-dbafa76343a5"
3039
3040/** Pointer to a PCI raw connector interface. */
3041typedef struct PDMIPCIRAWCONNECTOR *PPDMIPCIRAWCONNECTOR;
3042/**
3043 * PCI raw connector interface (up).
3044 */
3045typedef struct PDMIPCIRAWCONNECTOR
3046{
3047
3048 /**
3049 *
3050 */
3051 DECLR3CALLBACKMEMBER(int, pfnDeviceConstructComplete, (PPDMIPCIRAWCONNECTOR pInterface, const char *pcszName,
3052 uint32_t uHostPciAddress, uint32_t uGuestPciAddress,
3053 int rc));
3054
3055} PDMIPCIRAWCONNECTOR;
3056/** PDMIPCIRAWCONNECTOR interface ID. */
3057#define PDMIPCIRAWCONNECTOR_IID "14aa9c6c-8869-4782-9dfc-910071a6aebf"
3058
3059/** @} */
3060
3061RT_C_DECLS_END
3062
3063#endif
Note: See TracBrowser for help on using the repository browser.

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