VirtualBox

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

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

pdmifs.h: doc update

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