VirtualBox

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

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

Main/Display, Devices/Graphics: added a generic guest VRAM->Framebuffer copy function (xTracker 4655).

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