VirtualBox

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

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

pdmifs, Devices/Input, Main, FE/BFE: add support for absolute-only pointing devices

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