VirtualBox

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

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

Automated rebranding to Oracle copyright/license strings via filemuncher

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