VirtualBox

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

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

Route input to PS/2 keyboard unless USB keyboard was explicitly activated.

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