VirtualBox

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

Last change on this file since 34490 was 34490, checked in by vboxsync, 14 years ago

VBoxVideo: remove leading underscore from structure names and make VBoxVideoGuest.h C-friendly

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