VirtualBox

source: vbox/trunk/include/VBox/pdmifs.h@ 28320

Last change on this file since 28320 was 28320, checked in by vboxsync, 15 years ago

Network/D*,VMM: Moving the TX threads, part 1.

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

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