VirtualBox

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

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

Shared paging interface updates

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 104.8 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 /**
2038 * Enable or disable page sharing
2039 *
2040 * @returns VBox status code
2041 * @param fEnabled New setting
2042 */
2043 DECLR3CALLBACKMEMBER(int, pfnEnablePageSharing, (PPDMIVMMDEVPORT pInterface, bool fEnabled));
2044
2045} PDMIVMMDEVPORT;
2046/** PDMIVMMDEVPORT interface ID. */
2047#define PDMIVMMDEVPORT_IID "d7e52035-3b6c-422e-9215-2a75646a945d"
2048
2049
2050/** Pointer to a HPET legacy notifcation interface. */
2051typedef struct PDMIHPETLEGACYNOTIFY *PPDMIHPETLEGACYNOTIFY;
2052/**
2053 * HPET legacy notifcation interface.
2054 */
2055typedef struct PDMIHPETLEGACYNOTIFY
2056{
2057 /**
2058 * Notify about change of HPET legacy mode.
2059 *
2060 * @param pInterface Pointer to the interface structure containing the
2061 * called function pointer.
2062 * @param fActivated If HPET legacy mode is activated (@c true) or
2063 * deactivated (@c false).
2064 */
2065 DECLR3CALLBACKMEMBER(void, pfnModeChanged,(PPDMIHPETLEGACYNOTIFY pInterface, bool fActivated));
2066} PDMIHPETLEGACYNOTIFY;
2067/** PDMIHPETLEGACYNOTIFY interface ID. */
2068#define PDMIHPETLEGACYNOTIFY_IID "c9ada595-4b65-4311-8b21-b10498997774"
2069
2070
2071/** @name Flags for PDMIVMMDEVPORT::pfnSetCredentials.
2072 * @{ */
2073/** The guest should perform a logon with the credentials. */
2074#define VMMDEV_SETCREDENTIALS_GUESTLOGON RT_BIT(0)
2075/** The guest should prevent local logons. */
2076#define VMMDEV_SETCREDENTIALS_NOLOCALLOGON RT_BIT(1)
2077/** The guest should verify the credentials. */
2078#define VMMDEV_SETCREDENTIALS_JUDGE RT_BIT(15)
2079/** @} */
2080
2081
2082/** Forward declaration of the video accelerator command memory. */
2083struct VBVAMEMORY;
2084/** Forward declaration of the guest information structure. */
2085struct VBoxGuestInfo;
2086/** Forward declaration of the guest statistics structure */
2087struct VBoxGuestStatistics;
2088/** Pointer to video accelerator command memory. */
2089typedef struct VBVAMEMORY *PVBVAMEMORY;
2090
2091/** Pointer to a VMMDev connector interface. */
2092typedef struct PDMIVMMDEVCONNECTOR *PPDMIVMMDEVCONNECTOR;
2093/**
2094 * VMMDev connector interface (up).
2095 * Pair with PDMIVMMDEVPORT.
2096 */
2097typedef struct PDMIVMMDEVCONNECTOR
2098{
2099 /**
2100 * Report guest OS version.
2101 * Called whenever the Additions issue a guest version report request.
2102 *
2103 * @param pInterface Pointer to this interface.
2104 * @param pGuestInfo Pointer to guest information structure
2105 * @thread The emulation thread.
2106 */
2107 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestVersion,(PPDMIVMMDEVCONNECTOR pInterface, struct VBoxGuestInfo *pGuestInfo));
2108
2109 /**
2110 * Update the guest additions capabilities.
2111 * This is called when the guest additions capabilities change. The new capabilities
2112 * are given and the connector should update its internal state.
2113 *
2114 * @param pInterface Pointer to this interface.
2115 * @param newCapabilities New capabilities.
2116 * @thread The emulation thread.
2117 */
2118 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestCapabilities,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities));
2119
2120 /**
2121 * Update the mouse capabilities.
2122 * This is called when the mouse capabilities change. The new capabilities
2123 * are given and the connector should update its internal state.
2124 *
2125 * @param pInterface Pointer to this interface.
2126 * @param newCapabilities New capabilities.
2127 * @thread The emulation thread.
2128 */
2129 DECLR3CALLBACKMEMBER(void, pfnUpdateMouseCapabilities,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities));
2130
2131 /**
2132 * Update the pointer shape.
2133 * This is called when the mouse pointer shape changes. The new shape
2134 * is passed as a caller allocated buffer that will be freed after returning
2135 *
2136 * @param pInterface Pointer to this interface.
2137 * @param fVisible Visibility indicator (if false, the other parameters are undefined).
2138 * @param fAlpha Flag whether alpha channel is being passed.
2139 * @param xHot Pointer hot spot x coordinate.
2140 * @param yHot Pointer hot spot y coordinate.
2141 * @param x Pointer new x coordinate on screen.
2142 * @param y Pointer new y coordinate on screen.
2143 * @param cx Pointer width in pixels.
2144 * @param cy Pointer height in pixels.
2145 * @param cbScanline Size of one scanline in bytes.
2146 * @param pvShape New shape buffer.
2147 * @thread The emulation thread.
2148 */
2149 DECLR3CALLBACKMEMBER(void, pfnUpdatePointerShape,(PPDMIVMMDEVCONNECTOR pInterface, bool fVisible, bool fAlpha,
2150 uint32_t xHot, uint32_t yHot,
2151 uint32_t cx, uint32_t cy,
2152 void *pvShape));
2153
2154 /**
2155 * Enable or disable video acceleration on behalf of guest.
2156 *
2157 * @param pInterface Pointer to this interface.
2158 * @param fEnable Whether to enable acceleration.
2159 * @param pVbvaMemory Video accelerator memory.
2160
2161 * @return VBox rc. VINF_SUCCESS if VBVA was enabled.
2162 * @thread The emulation thread.
2163 */
2164 DECLR3CALLBACKMEMBER(int, pfnVideoAccelEnable,(PPDMIVMMDEVCONNECTOR pInterface, bool fEnable, PVBVAMEMORY pVbvaMemory));
2165
2166 /**
2167 * Force video queue processing.
2168 *
2169 * @param pInterface Pointer to this interface.
2170 * @thread The emulation thread.
2171 */
2172 DECLR3CALLBACKMEMBER(void, pfnVideoAccelFlush,(PPDMIVMMDEVCONNECTOR pInterface));
2173
2174 /**
2175 * Return whether the given video mode is supported/wanted by the host.
2176 *
2177 * @returns VBox status code
2178 * @param pInterface Pointer to this interface.
2179 * @param display The guest monitor, 0 for primary.
2180 * @param cy Video mode horizontal resolution in pixels.
2181 * @param cx Video mode vertical resolution in pixels.
2182 * @param cBits Video mode bits per pixel.
2183 * @param pfSupported Where to put the indicator for whether this mode is supported. (output)
2184 * @thread The emulation thread.
2185 */
2186 DECLR3CALLBACKMEMBER(int, pfnVideoModeSupported,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t display, uint32_t cx, uint32_t cy, uint32_t cBits, bool *pfSupported));
2187
2188 /**
2189 * Queries by how many pixels the height should be reduced when calculating video modes
2190 *
2191 * @returns VBox status code
2192 * @param pInterface Pointer to this interface.
2193 * @param pcyReduction Pointer to the result value.
2194 * @thread The emulation thread.
2195 */
2196 DECLR3CALLBACKMEMBER(int, pfnGetHeightReduction,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcyReduction));
2197
2198 /**
2199 * Informs about a credentials judgement result from the guest.
2200 *
2201 * @returns VBox status code
2202 * @param pInterface Pointer to this interface.
2203 * @param fFlags Judgement result flags.
2204 * @thread The emulation thread.
2205 */
2206 DECLR3CALLBACKMEMBER(int, pfnSetCredentialsJudgementResult,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t fFlags));
2207
2208 /**
2209 * Set the visible region of the display
2210 *
2211 * @returns VBox status code.
2212 * @param pInterface Pointer to this interface.
2213 * @param cRect Number of rectangles in pRect
2214 * @param pRect Rectangle array
2215 * @thread The emulation thread.
2216 */
2217 DECLR3CALLBACKMEMBER(int, pfnSetVisibleRegion,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t cRect, PRTRECT pRect));
2218
2219 /**
2220 * Query the visible region of the display
2221 *
2222 * @returns VBox status code.
2223 * @param pInterface Pointer to this interface.
2224 * @param pcRect Number of rectangles in pRect
2225 * @param pRect Rectangle array (set to NULL to query the number of rectangles)
2226 * @thread The emulation thread.
2227 */
2228 DECLR3CALLBACKMEMBER(int, pfnQueryVisibleRegion,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcRect, PRTRECT pRect));
2229
2230 /**
2231 * Request the statistics interval
2232 *
2233 * @returns VBox status code.
2234 * @param pInterface Pointer to this interface.
2235 * @param pulInterval Pointer to interval in seconds
2236 * @thread The emulation thread.
2237 */
2238 DECLR3CALLBACKMEMBER(int, pfnQueryStatisticsInterval,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pulInterval));
2239
2240 /**
2241 * Report new guest statistics
2242 *
2243 * @returns VBox status code.
2244 * @param pInterface Pointer to this interface.
2245 * @param pGuestStats Guest statistics
2246 * @thread The emulation thread.
2247 */
2248 DECLR3CALLBACKMEMBER(int, pfnReportStatistics,(PPDMIVMMDEVCONNECTOR pInterface, struct VBoxGuestStatistics *pGuestStats));
2249
2250 /**
2251 * Query the current balloon size
2252 *
2253 * @returns VBox status code.
2254 * @param pInterface Pointer to this interface.
2255 * @param pcbBalloon Balloon size
2256 * @thread The emulation thread.
2257 */
2258 DECLR3CALLBACKMEMBER(int, pfnQueryBalloonSize,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcbBalloon));
2259
2260} PDMIVMMDEVCONNECTOR;
2261/** PDMIVMMDEVCONNECTOR interface ID. */
2262#define PDMIVMMDEVCONNECTOR_IID "1c300d1b-5938-42bb-8acb-46ecfe483db7"
2263
2264
2265/** Pointer to a network connector interface */
2266typedef struct PDMIAUDIOCONNECTOR *PPDMIAUDIOCONNECTOR;
2267/**
2268 * Audio connector interface (up).
2269 * No interface pair yet.
2270 */
2271typedef struct PDMIAUDIOCONNECTOR
2272{
2273 DECLR3CALLBACKMEMBER(void, pfnRun,(PPDMIAUDIOCONNECTOR pInterface));
2274
2275/* DECLR3CALLBACKMEMBER(int, pfnSetRecordSource,(PPDMIAUDIOINCONNECTOR pInterface, AUDIORECSOURCE)); */
2276
2277} PDMIAUDIOCONNECTOR;
2278/** PDMIAUDIOCONNECTOR interface ID. */
2279#define PDMIAUDIOCONNECTOR_IID "85d52af5-b3aa-4b3e-b176-4b5ebfc52f47"
2280
2281
2282/** @todo r=bird: the two following interfaces are hacks to work around the missing audio driver
2283 * interface. This should be addressed rather than making more temporary hacks. */
2284
2285/** Pointer to a Audio Sniffer Device port interface. */
2286typedef struct PDMIAUDIOSNIFFERPORT *PPDMIAUDIOSNIFFERPORT;
2287/**
2288 * Audio Sniffer port interface (down).
2289 * Pair with PDMIAUDIOSNIFFERCONNECTOR.
2290 */
2291typedef struct PDMIAUDIOSNIFFERPORT
2292{
2293 /**
2294 * Enables or disables sniffing.
2295 *
2296 * If sniffing is being enabled also sets a flag whether the audio must be also
2297 * left on the host.
2298 *
2299 * @returns VBox status code
2300 * @param pInterface Pointer to this interface.
2301 * @param fEnable 'true' for enable sniffing, 'false' to disable.
2302 * @param fKeepHostAudio Indicates whether host audio should also present
2303 * 'true' means that sound should not be played
2304 * by the audio device.
2305 */
2306 DECLR3CALLBACKMEMBER(int, pfnSetup,(PPDMIAUDIOSNIFFERPORT pInterface, bool fEnable, bool fKeepHostAudio));
2307
2308} PDMIAUDIOSNIFFERPORT;
2309/** PDMIAUDIOSNIFFERPORT interface ID. */
2310#define PDMIAUDIOSNIFFERPORT_IID "83b95e02-68cb-470d-9dfc-25a0f8efe197"
2311
2312
2313/** Pointer to a Audio Sniffer connector interface. */
2314typedef struct PDMIAUDIOSNIFFERCONNECTOR *PPDMIAUDIOSNIFFERCONNECTOR;
2315
2316/**
2317 * Audio Sniffer connector interface (up).
2318 * Pair with PDMIAUDIOSNIFFERPORT.
2319 */
2320typedef struct PDMIAUDIOSNIFFERCONNECTOR
2321{
2322 /**
2323 * AudioSniffer device calls this method when audio samples
2324 * are about to be played and sniffing is enabled.
2325 *
2326 * @param pInterface Pointer to this interface.
2327 * @param pvSamples Audio samples buffer.
2328 * @param cSamples How many complete samples are in the buffer.
2329 * @param iSampleHz The sample frequency in Hz.
2330 * @param cChannels Number of channels. 1 for mono, 2 for stereo.
2331 * @param cBits How many bits a sample for a single channel has. Normally 8 or 16.
2332 * @param fUnsigned Whether samples are unsigned values.
2333 * @thread The emulation thread.
2334 */
2335 DECLR3CALLBACKMEMBER(void, pfnAudioSamplesOut,(PPDMIAUDIOSNIFFERCONNECTOR pInterface, void *pvSamples, uint32_t cSamples,
2336 int iSampleHz, int cChannels, int cBits, bool fUnsigned));
2337
2338 /**
2339 * AudioSniffer device calls this method when output volume is changed.
2340 *
2341 * @param pInterface Pointer to this interface.
2342 * @param u16LeftVolume 0..0xFFFF volume level for left channel.
2343 * @param u16RightVolume 0..0xFFFF volume level for right channel.
2344 * @thread The emulation thread.
2345 */
2346 DECLR3CALLBACKMEMBER(void, pfnAudioVolumeOut,(PPDMIAUDIOSNIFFERCONNECTOR pInterface, uint16_t u16LeftVolume, uint16_t u16RightVolume));
2347
2348} PDMIAUDIOSNIFFERCONNECTOR;
2349/** PDMIAUDIOSNIFFERCONNECTOR - The Audio Sniffer Driver connector interface. */
2350#define PDMIAUDIOSNIFFERCONNECTOR_IID "433b64ab-e603-4933-bc97-8fe79b2bd0e0"
2351
2352
2353/**
2354 * Generic status LED core.
2355 * Note that a unit doesn't have to support all the indicators.
2356 */
2357typedef union PDMLEDCORE
2358{
2359 /** 32-bit view. */
2360 uint32_t volatile u32;
2361 /** Bit view. */
2362 struct
2363 {
2364 /** Reading/Receiving indicator. */
2365 uint32_t fReading : 1;
2366 /** Writing/Sending indicator. */
2367 uint32_t fWriting : 1;
2368 /** Busy indicator. */
2369 uint32_t fBusy : 1;
2370 /** Error indicator. */
2371 uint32_t fError : 1;
2372 } s;
2373} PDMLEDCORE;
2374
2375/** LED bit masks for the u32 view.
2376 * @{ */
2377/** Reading/Receiving indicator. */
2378#define PDMLED_READING RT_BIT(0)
2379/** Writing/Sending indicator. */
2380#define PDMLED_WRITING RT_BIT(1)
2381/** Busy indicator. */
2382#define PDMLED_BUSY RT_BIT(2)
2383/** Error indicator. */
2384#define PDMLED_ERROR RT_BIT(3)
2385/** @} */
2386
2387
2388/**
2389 * Generic status LED.
2390 * Note that a unit doesn't have to support all the indicators.
2391 */
2392typedef struct PDMLED
2393{
2394 /** Just a magic for sanity checking. */
2395 uint32_t u32Magic;
2396 uint32_t u32Alignment; /**< structure size alignment. */
2397 /** The actual LED status.
2398 * Only the device is allowed to change this. */
2399 PDMLEDCORE Actual;
2400 /** The asserted LED status which is cleared by the reader.
2401 * The device will assert the bits but never clear them.
2402 * The driver clears them as it sees fit. */
2403 PDMLEDCORE Asserted;
2404} PDMLED;
2405
2406/** Pointer to an LED. */
2407typedef PDMLED *PPDMLED;
2408/** Pointer to a const LED. */
2409typedef const PDMLED *PCPDMLED;
2410
2411/** Magic value for PDMLED::u32Magic. */
2412#define PDMLED_MAGIC UINT32_C(0x11335577)
2413
2414/** Pointer to an LED ports interface. */
2415typedef struct PDMILEDPORTS *PPDMILEDPORTS;
2416/**
2417 * Interface for exporting LEDs (down).
2418 * Pair with PDMILEDCONNECTORS.
2419 */
2420typedef struct PDMILEDPORTS
2421{
2422 /**
2423 * Gets the pointer to the status LED of a unit.
2424 *
2425 * @returns VBox status code.
2426 * @param pInterface Pointer to the interface structure containing the called function pointer.
2427 * @param iLUN The unit which status LED we desire.
2428 * @param ppLed Where to store the LED pointer.
2429 */
2430 DECLR3CALLBACKMEMBER(int, pfnQueryStatusLed,(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed));
2431
2432} PDMILEDPORTS;
2433/** PDMILEDPORTS interface ID. */
2434#define PDMILEDPORTS_IID "435e0cec-8549-4ca0-8c0d-98e52f1dc038"
2435
2436
2437/** Pointer to an LED connectors interface. */
2438typedef struct PDMILEDCONNECTORS *PPDMILEDCONNECTORS;
2439/**
2440 * Interface for reading LEDs (up).
2441 * Pair with PDMILEDPORTS.
2442 */
2443typedef struct PDMILEDCONNECTORS
2444{
2445 /**
2446 * Notification about a unit which have been changed.
2447 *
2448 * The driver must discard any pointers to data owned by
2449 * the unit and requery it.
2450 *
2451 * @param pInterface Pointer to the interface structure containing the called function pointer.
2452 * @param iLUN The unit number.
2453 */
2454 DECLR3CALLBACKMEMBER(void, pfnUnitChanged,(PPDMILEDCONNECTORS pInterface, unsigned iLUN));
2455} PDMILEDCONNECTORS;
2456/** PDMILEDCONNECTORS interface ID. */
2457#define PDMILEDCONNECTORS_IID "8ed63568-82a7-4193-b57b-db8085ac4495"
2458
2459
2460/** The special status unit number */
2461#define PDM_STATUS_LUN 999
2462
2463
2464#ifdef VBOX_WITH_HGCM
2465
2466/** Abstract HGCM command structure. Used only to define a typed pointer. */
2467struct VBOXHGCMCMD;
2468
2469/** Pointer to HGCM command structure. This pointer is unique and identifies
2470 * the command being processed. The pointer is passed to HGCM connector methods,
2471 * and must be passed back to HGCM port when command is completed.
2472 */
2473typedef struct VBOXHGCMCMD *PVBOXHGCMCMD;
2474
2475/** Pointer to a HGCM port interface. */
2476typedef struct PDMIHGCMPORT *PPDMIHGCMPORT;
2477/**
2478 * Host-Guest communication manager port interface (down). Normally implemented
2479 * by VMMDev.
2480 * Pair with PDMIHGCMCONNECTOR.
2481 */
2482typedef struct PDMIHGCMPORT
2483{
2484 /**
2485 * Notify the guest on a command completion.
2486 *
2487 * @param pInterface Pointer to this interface.
2488 * @param rc The return code (VBox error code).
2489 * @param pCmd A pointer that identifies the completed command.
2490 *
2491 * @returns VBox status code
2492 */
2493 DECLR3CALLBACKMEMBER(void, pfnCompleted,(PPDMIHGCMPORT pInterface, int32_t rc, PVBOXHGCMCMD pCmd));
2494
2495} PDMIHGCMPORT;
2496/** PDMIHGCMPORT interface ID. */
2497# define PDMIHGCMPORT_IID "e00a0cbf-b75a-45c3-87f4-41cddbc5ae0b"
2498
2499
2500/** Pointer to a HGCM service location structure. */
2501typedef struct HGCMSERVICELOCATION *PHGCMSERVICELOCATION;
2502
2503/** Pointer to a HGCM connector interface. */
2504typedef struct PDMIHGCMCONNECTOR *PPDMIHGCMCONNECTOR;
2505/**
2506 * The Host-Guest communication manager connector interface (up). Normally
2507 * implemented by Main::VMMDevInterface.
2508 * Pair with PDMIHGCMPORT.
2509 */
2510typedef struct PDMIHGCMCONNECTOR
2511{
2512 /**
2513 * Locate a service and inform it about a client connection.
2514 *
2515 * @param pInterface Pointer to this interface.
2516 * @param pCmd A pointer that identifies the command.
2517 * @param pServiceLocation Pointer to the service location structure.
2518 * @param pu32ClientID Where to store the client id for the connection.
2519 * @return VBox status code.
2520 * @thread The emulation thread.
2521 */
2522 DECLR3CALLBACKMEMBER(int, pfnConnect,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, PHGCMSERVICELOCATION pServiceLocation, uint32_t *pu32ClientID));
2523
2524 /**
2525 * Disconnect from service.
2526 *
2527 * @param pInterface Pointer to this interface.
2528 * @param pCmd A pointer that identifies the command.
2529 * @param u32ClientID The client id returned by the pfnConnect call.
2530 * @return VBox status code.
2531 * @thread The emulation thread.
2532 */
2533 DECLR3CALLBACKMEMBER(int, pfnDisconnect,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID));
2534
2535 /**
2536 * Process a guest issued command.
2537 *
2538 * @param pInterface Pointer to this interface.
2539 * @param pCmd A pointer that identifies the command.
2540 * @param u32ClientID The client id returned by the pfnConnect call.
2541 * @param u32Function Function to be performed by the service.
2542 * @param cParms Number of parameters in the array pointed to by paParams.
2543 * @param paParms Pointer to an array of parameters.
2544 * @return VBox status code.
2545 * @thread The emulation thread.
2546 */
2547 DECLR3CALLBACKMEMBER(int, pfnCall,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID, uint32_t u32Function,
2548 uint32_t cParms, PVBOXHGCMSVCPARM paParms));
2549
2550} PDMIHGCMCONNECTOR;
2551/** PDMIHGCMCONNECTOR interface ID. */
2552# define PDMIHGCMCONNECTOR_IID "a1104758-c888-4437-8f2a-7bac17865b5c"
2553
2554#endif /* VBOX_WITH_HGCM */
2555
2556/**
2557 * Data direction.
2558 */
2559typedef enum PDMSCSIREQUESTTXDIR
2560{
2561 PDMSCSIREQUESTTXDIR_UNKNOWN = 0x00,
2562 PDMSCSIREQUESTTXDIR_FROM_DEVICE = 0x01,
2563 PDMSCSIREQUESTTXDIR_TO_DEVICE = 0x02,
2564 PDMSCSIREQUESTTXDIR_NONE = 0x03,
2565 PDMSCSIREQUESTTXDIR_32BIT_HACK = 0x7fffffff
2566} PDMSCSIREQUESTTXDIR;
2567
2568/**
2569 * SCSI request structure.
2570 */
2571typedef struct PDMSCSIREQUEST
2572{
2573 /** The logical unit. */
2574 uint32_t uLogicalUnit;
2575 /** Direction of the data flow. */
2576 PDMSCSIREQUESTTXDIR uDataDirection;
2577 /** Size of the SCSI CDB. */
2578 uint32_t cbCDB;
2579 /** Pointer to the SCSI CDB. */
2580 uint8_t *pbCDB;
2581 /** Overall size of all scatter gather list elements
2582 * for data transfer if any. */
2583 uint32_t cbScatterGather;
2584 /** Number of elements in the scatter gather list. */
2585 uint32_t cScatterGatherEntries;
2586 /** Pointer to the head of the scatter gather list. */
2587 PRTSGSEG paScatterGatherHead;
2588 /** Size of the sense buffer. */
2589 uint32_t cbSenseBuffer;
2590 /** Pointer to the sense buffer. *
2591 * Current assumption that the sense buffer is not scattered. */
2592 uint8_t *pbSenseBuffer;
2593 /** Opaque user data for use by the device. Left untouched by everything else! */
2594 void *pvUser;
2595} PDMSCSIREQUEST, *PPDMSCSIREQUEST;
2596/** Pointer to a const SCSI request structure. */
2597typedef const PDMSCSIREQUEST *PCSCSIREQUEST;
2598
2599/** Pointer to a SCSI port interface. */
2600typedef struct PDMISCSIPORT *PPDMISCSIPORT;
2601/**
2602 * SCSI command execution port interface (down).
2603 * Pair with PDMISCSICONNECTOR.
2604 */
2605typedef struct PDMISCSIPORT
2606{
2607
2608 /**
2609 * Notify the device on request completion.
2610 *
2611 * @returns VBox status code.
2612 * @param pInterface Pointer to this interface.
2613 * @param pSCSIRequest Pointer to the finished SCSI request.
2614 * @param rcCompletion SCSI_STATUS_* code for the completed request.
2615 */
2616 DECLR3CALLBACKMEMBER(int, pfnSCSIRequestCompleted, (PPDMISCSIPORT pInterface, PPDMSCSIREQUEST pSCSIRequest, int rcCompletion));
2617
2618} PDMISCSIPORT;
2619/** PDMISCSIPORT interface ID. */
2620#define PDMISCSIPORT_IID "0f894add-714d-4a77-818e-a32fe3586ba4"
2621
2622
2623/** Pointer to a SCSI connector interface. */
2624typedef struct PDMISCSICONNECTOR *PPDMISCSICONNECTOR;
2625/**
2626 * SCSI command execution connector interface (up).
2627 * Pair with PDMISCSIPORT.
2628 */
2629typedef struct PDMISCSICONNECTOR
2630{
2631
2632 /**
2633 * Submits a SCSI request for execution.
2634 *
2635 * @returns VBox status code.
2636 * @param pInterface Pointer to this interface.
2637 * @param pSCSIRequest Pointer to the SCSI request to execute.
2638 */
2639 DECLR3CALLBACKMEMBER(int, pfnSCSIRequestSend, (PPDMISCSICONNECTOR pInterface, PPDMSCSIREQUEST pSCSIRequest));
2640
2641} PDMISCSICONNECTOR;
2642/** PDMISCSICONNECTOR interface ID. */
2643#define PDMISCSICONNECTOR_IID "94465fbd-a2f2-447e-88c9-7366421bfbfe"
2644
2645
2646/** Pointer to a display VBVA callbacks interface. */
2647typedef struct PDMIDISPLAYVBVACALLBACKS *PPDMIDISPLAYVBVACALLBACKS;
2648/**
2649 * Display VBVA callbacks interface (up).
2650 */
2651typedef struct PDMIDISPLAYVBVACALLBACKS
2652{
2653
2654 /**
2655 * Informs guest about completion of processing the given Video HW Acceleration
2656 * command, does not wait for the guest to process the command.
2657 *
2658 * @returns ???
2659 * @param pInterface Pointer to this interface.
2660 * @param pCmd The Video HW Acceleration Command that was
2661 * completed.
2662 * @todo r=bird: if asynch means asyncronous; then
2663 * s/pfnVHWACommandCompleteAsynch/pfnVHWACommandCompleteAsync/;
2664 * fi
2665 */
2666 DECLR3CALLBACKMEMBER(int, pfnVHWACommandCompleteAsynch, (PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVHWACMD pCmd));
2667
2668} PDMIDISPLAYVBVACALLBACKS;
2669/** PDMIDISPLAYVBVACALLBACKS */
2670#define PDMIDISPLAYVBVACALLBACKS_IID "b78b81d2-c821-4e66-96ff-dbafa76343a5"
2671
2672/** @} */
2673
2674RT_C_DECLS_END
2675
2676#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