VirtualBox

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

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

Devices, Main, pdmifs.h: initial support for PS/2 touchscreen emulation, based on the Lifebook touchscreen device

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