VirtualBox

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

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

Storage/VBoxHDD+DrvBlock+DrvVD: implement core code for live snapshot merging.

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette