VirtualBox

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

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

Backed out r57393

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