VirtualBox

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

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

Another attempt to initialize the balloon correct during startup

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