VirtualBox

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

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

pdmifs.h: cleaned out the remaining references to PDMINTERFACE. (assertion texts mostly)

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

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