VirtualBox

source: vbox/trunk/include/VBox/vmm/pdmifs.h@ 57088

Last change on this file since 57088 was 57088, checked in by vboxsync, 9 years ago

DisplayImpl.cpp: Free the screen shot data in the correct way. pu8Data -> pbData and other cleanups.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 135.1 KB
Line 
1/** @file
2 * PDM - Pluggable Device Manager, Interfaces.
3 */
4
5/*
6 * Copyright (C) 2006-2015 Oracle Corporation
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
26#ifndef ___VBox_vmm_pdmifs_h
27#define ___VBox_vmm_pdmifs_h
28
29#include <iprt/sg.h>
30#include <VBox/types.h>
31#include <VBox/hgcmsvc.h>
32
33
34RT_C_DECLS_BEGIN
35
36/** @defgroup grp_pdm_interfaces The PDM Interface Definitions
37 * @ingroup grp_pdm
38 *
39 * For historical reasons (the PDMINTERFACE enum) a lot of interface was stuffed
40 * together in this group instead, dragging stuff into global space that didn't
41 * need to be there and making this file huge (>2500 lines). Since we're using
42 * UUIDs as interface identifiers (IIDs) now, no only generic PDM interface will
43 * be added to this file. Component specific interface should be defined in the
44 * header file of that component.
45 *
46 * Interfaces consists of a method table (typedef'ed struct) and an interface
47 * ID. The typename of the method table should have an 'I' in it, be all
48 * capitals and according to the rules, no underscores. The interface ID is a
49 * \#define constructed by appending '_IID' to the typename. The IID value is a
50 * UUID string on the form "a2299c0d-b709-4551-aa5a-73f59ffbed74". If you stick
51 * to these rules, you can make use of the PDMIBASE_QUERY_INTERFACE and
52 * PDMIBASE_RETURN_INTERFACE when querying interface and implementing
53 * PDMIBASE::pfnQueryInterface respectively.
54 *
55 * In most interface descriptions the orientation of the interface is given as
56 * 'down' or 'up'. This refers to a model with the device on the top and the
57 * drivers stacked below it. Sometimes there is mention of 'main' or 'external'
58 * which normally means the same, i.e. the Main or VBoxBFE API. Picture the
59 * orientation of 'main' as horizontal.
60 *
61 * @{
62 */
63
64
65/** @name PDMIBASE
66 * @{
67 */
68
69/**
70 * PDM Base Interface.
71 *
72 * Everyone implements this.
73 */
74typedef struct PDMIBASE
75{
76 /**
77 * Queries an interface to the driver.
78 *
79 * @returns Pointer to interface.
80 * @returns NULL if the interface was not supported by the driver.
81 * @param pInterface Pointer to this interface structure.
82 * @param pszIID The interface ID, a UUID string.
83 * @thread Any thread.
84 */
85 DECLR3CALLBACKMEMBER(void *, pfnQueryInterface,(struct PDMIBASE *pInterface, const char *pszIID));
86} PDMIBASE;
87/** PDMIBASE interface ID. */
88#define PDMIBASE_IID "a2299c0d-b709-4551-aa5a-73f59ffbed74"
89
90/**
91 * Helper macro for querying an interface from PDMIBASE.
92 *
93 * @returns Correctly typed PDMIBASE::pfnQueryInterface return value.
94 *
95 * @param pIBase Pointer to the base interface.
96 * @param InterfaceType The interface type name. The interface ID is
97 * derived from this by appending _IID.
98 */
99#define PDMIBASE_QUERY_INTERFACE(pIBase, InterfaceType) \
100 ( (InterfaceType *)(pIBase)->pfnQueryInterface(pIBase, InterfaceType##_IID ) )
101
102/**
103 * Helper macro for implementing PDMIBASE::pfnQueryInterface.
104 *
105 * Return @a pInterface if @a pszIID matches the @a InterfaceType. This will
106 * perform basic type checking.
107 *
108 * @param pszIID The ID of the interface that is being queried.
109 * @param InterfaceType The interface type name. The interface ID is
110 * derived from this by appending _IID.
111 * @param pInterface The interface address expression.
112 */
113#define PDMIBASE_RETURN_INTERFACE(pszIID, InterfaceType, pInterface) \
114 do { \
115 if (RTUuidCompare2Strs((pszIID), InterfaceType##_IID) == 0) \
116 { \
117 P##InterfaceType pReturnInterfaceTypeCheck = (pInterface); \
118 return pReturnInterfaceTypeCheck; \
119 } \
120 } while (0)
121
122/** @} */
123
124
125/** @name PDMIBASERC
126 * @{
127 */
128
129/**
130 * PDM Base Interface for querying ring-mode context interfaces in
131 * ring-3.
132 *
133 * This is mandatory for drivers present in raw-mode context.
134 */
135typedef struct PDMIBASERC
136{
137 /**
138 * Queries an ring-mode context interface to the driver.
139 *
140 * @returns Pointer to interface.
141 * @returns NULL if the interface was not supported by the driver.
142 * @param pInterface Pointer to this interface structure.
143 * @param pszIID The interface ID, a UUID string.
144 * @thread Any thread.
145 */
146 DECLR3CALLBACKMEMBER(RTRCPTR, pfnQueryInterface,(struct PDMIBASERC *pInterface, const char *pszIID));
147} PDMIBASERC;
148/** Pointer to a PDM Base Interface for query ring-mode context interfaces. */
149typedef PDMIBASERC *PPDMIBASERC;
150/** PDMIBASERC interface ID. */
151#define PDMIBASERC_IID "f6a6c649-6cb3-493f-9737-4653f221aeca"
152
153/**
154 * Helper macro for querying an interface from PDMIBASERC.
155 *
156 * @returns PDMIBASERC::pfnQueryInterface return value.
157 *
158 * @param pIBaseRC Pointer to the base raw-mode context interface. Can
159 * be NULL.
160 * @param InterfaceType The interface type base name, no trailing RC. The
161 * interface ID is derived from this by appending _IID.
162 *
163 * @remarks Unlike PDMIBASE_QUERY_INTERFACE, this macro is not able to do any
164 * implicit type checking for you.
165 */
166#define PDMIBASERC_QUERY_INTERFACE(pIBaseRC, InterfaceType) \
167 ( (P##InterfaceType##RC)((pIBaseRC) ? (pIBaseRC)->pfnQueryInterface(pIBaseRC, InterfaceType##_IID) : NIL_RTRCPTR) )
168
169/**
170 * Helper macro for implementing PDMIBASERC::pfnQueryInterface.
171 *
172 * Return @a pInterface if @a pszIID matches the @a InterfaceType. This will
173 * perform basic type checking.
174 *
175 * @param pIns Pointer to the instance data.
176 * @param pszIID The ID of the interface that is being queried.
177 * @param InterfaceType The interface type base name, no trailing RC. The
178 * interface ID is derived from this by appending _IID.
179 * @param pInterface The interface address expression. This must resolve
180 * to some address within the instance data.
181 * @remarks Don't use with PDMIBASE.
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##RC *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 querying an interface from PDMIBASER0.
227 *
228 * @returns PDMIBASER0::pfnQueryInterface return value.
229 *
230 * @param pIBaseR0 Pointer to the base ring-0 interface. Can be NULL.
231 * @param InterfaceType The interface type base name, no trailing R0. The
232 * interface ID is 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 ( (P##InterfaceType##R0)((pIBaseR0) ? (pIBaseR0)->pfnQueryInterface(pIBaseR0, InterfaceType##_IID) : NIL_RTR0PTR) )
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 base name, no trailing R0. The
249 * interface ID is 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 * @remarks Don't use with PDMIBASE.
253 */
254#define PDMIBASER0_RETURN_INTERFACE(pIns, pszIID, InterfaceType, pInterface) \
255 do { \
256 Assert((uintptr_t)pInterface - PDMINS_2_DATA(pIns, uintptr_t) < _4M); \
257 if (RTUuidCompare2Strs((pszIID), InterfaceType##_IID) == 0) \
258 { \
259 InterfaceType##R0 *pReturnInterfaceTypeCheck = (pInterface); \
260 return (uintptr_t)pReturnInterfaceTypeCheck \
261 - PDMINS_2_DATA(pIns, uintptr_t) \
262 + PDMINS_2_DATA_R0PTR(pIns); \
263 } \
264 } while (0)
265
266/** @} */
267
268
269/**
270 * Dummy interface.
271 *
272 * This is used to typedef other dummy interfaces. The purpose of a dummy
273 * interface is to validate the logical function of a driver/device and
274 * full a natural interface pair.
275 */
276typedef struct PDMIDUMMY
277{
278 RTHCPTR pvDummy;
279} PDMIDUMMY;
280
281
282/** Pointer to a mouse port interface. */
283typedef struct PDMIMOUSEPORT *PPDMIMOUSEPORT;
284/**
285 * Mouse port interface (down).
286 * Pair with PDMIMOUSECONNECTOR.
287 */
288typedef struct PDMIMOUSEPORT
289{
290 /**
291 * Puts a mouse event.
292 *
293 * This is called by the source of mouse events. The event will be passed up
294 * until the topmost driver, which then calls the registered event handler.
295 *
296 * @returns VBox status code. Return VERR_TRY_AGAIN if you cannot process the
297 * event now and want it to be repeated at a later point.
298 *
299 * @param pInterface Pointer to this interface structure.
300 * @param dx The X delta.
301 * @param dy The Y delta.
302 * @param dz The Z delta.
303 * @param dw The W (horizontal scroll button) delta.
304 * @param fButtons The button states, see the PDMIMOUSEPORT_BUTTON_* \#defines.
305 */
306 DECLR3CALLBACKMEMBER(int, pfnPutEvent,(PPDMIMOUSEPORT pInterface,
307 int32_t dx, int32_t dy, int32_t dz,
308 int32_t dw, uint32_t fButtons));
309 /**
310 * Puts an absolute mouse event.
311 *
312 * This is called by the source of mouse events. The event will be passed up
313 * until the topmost driver, which then calls the registered event handler.
314 *
315 * @returns VBox status code. Return VERR_TRY_AGAIN if you cannot process the
316 * event now and want it to be repeated at a later point.
317 *
318 * @param pInterface Pointer to this interface structure.
319 * @param x The X value, in the range 0 to 0xffff.
320 * @param z The Y value, in the range 0 to 0xffff.
321 * @param dz The Z delta.
322 * @param dw The W (horizontal scroll button) delta.
323 * @param fButtons The button states, see the PDMIMOUSEPORT_BUTTON_* \#defines.
324 */
325 DECLR3CALLBACKMEMBER(int, pfnPutEventAbs,(PPDMIMOUSEPORT pInterface,
326 uint32_t x, uint32_t z,
327 int32_t dz, int32_t dw,
328 uint32_t fButtons));
329 /**
330 * Puts a multi-touch event.
331 *
332 * @returns VBox status code. Return VERR_TRY_AGAIN if you cannot process the
333 * event now and want it to be repeated at a later point.
334 *
335 * @param pInterface Pointer to this interface structure.
336 * @param cContacts How many touch contacts in this event.
337 * @param pau64Contacts Pointer to array of packed contact information.
338 * Each 64bit element contains:
339 * Bits 0..15: X coordinate in pixels (signed).
340 * Bits 16..31: Y coordinate in pixels (signed).
341 * Bits 32..39: contact identifier.
342 * Bit 40: "in contact" flag, which indicates that
343 * there is a contact with the touch surface.
344 * Bit 41: "in range" flag, the contact is close enough
345 * to the touch surface.
346 * All other bits are reserved for future use and must be set to 0.
347 * @param u32ScanTime Timestamp of this event in milliseconds. Only relative
348 * time between event is important.
349 */
350 DECLR3CALLBACKMEMBER(int, pfnPutEventMultiTouch,(PPDMIMOUSEPORT pInterface,
351 uint8_t cContacts,
352 const uint64_t *pau64Contacts,
353 uint32_t u32ScanTime));
354} PDMIMOUSEPORT;
355/** PDMIMOUSEPORT interface ID. */
356#define PDMIMOUSEPORT_IID "359364f0-9fa3-4490-a6b4-7ed771901c93"
357
358/** Mouse button defines for PDMIMOUSEPORT::pfnPutEvent.
359 * @{ */
360#define PDMIMOUSEPORT_BUTTON_LEFT RT_BIT(0)
361#define PDMIMOUSEPORT_BUTTON_RIGHT RT_BIT(1)
362#define PDMIMOUSEPORT_BUTTON_MIDDLE RT_BIT(2)
363#define PDMIMOUSEPORT_BUTTON_X1 RT_BIT(3)
364#define PDMIMOUSEPORT_BUTTON_X2 RT_BIT(4)
365/** @} */
366
367
368/** Pointer to a mouse connector interface. */
369typedef struct PDMIMOUSECONNECTOR *PPDMIMOUSECONNECTOR;
370/**
371 * Mouse connector interface (up).
372 * Pair with PDMIMOUSEPORT.
373 */
374typedef struct PDMIMOUSECONNECTOR
375{
376 /**
377 * Notifies the the downstream driver of changes to the reporting modes
378 * supported by the driver
379 *
380 * @param pInterface Pointer to this interface structure.
381 * @param fRelative Whether relative mode is currently supported.
382 * @param fAbsolute Whether absolute mode is currently supported.
383 * @param fAbsolute Whether multi-touch mode is currently supported.
384 */
385 DECLR3CALLBACKMEMBER(void, pfnReportModes,(PPDMIMOUSECONNECTOR pInterface, bool fRelative, bool fAbsolute, bool fMultiTouch));
386
387 /**
388 * Flushes the mouse queue if it contains pending events.
389 *
390 * @param pInterface Pointer to this interface structure.
391 */
392 DECLR3CALLBACKMEMBER(void, pfnFlushQueue,(PPDMIMOUSECONNECTOR pInterface));
393
394} PDMIMOUSECONNECTOR;
395/** PDMIMOUSECONNECTOR interface ID. */
396#define PDMIMOUSECONNECTOR_IID "ce64d7bd-fa8f-41d1-a6fb-d102a2d6bffe"
397
398
399/** Pointer to a keyboard port interface. */
400typedef struct PDMIKEYBOARDPORT *PPDMIKEYBOARDPORT;
401/**
402 * Keyboard port interface (down).
403 * Pair with PDMIKEYBOARDCONNECTOR.
404 */
405typedef struct PDMIKEYBOARDPORT
406{
407 /**
408 * Puts a scan code based keyboard event.
409 *
410 * This is called by the source of keyboard events. The event will be passed up
411 * until the topmost driver, which then calls the registered event handler.
412 *
413 * @returns VBox status code. Return VERR_TRY_AGAIN if you cannot process the
414 * event now and want it to be repeated at a later point.
415 *
416 * @param pInterface Pointer to this interface structure.
417 * @param u8ScanCode The scan code to queue.
418 */
419 DECLR3CALLBACKMEMBER(int, pfnPutEventScan,(PPDMIKEYBOARDPORT pInterface, uint8_t u8KeyCode));
420
421 /**
422 * Puts a USB HID usage ID based keyboard event.
423 *
424 * This is called by the source of keyboard events. The event will be passed up
425 * until the topmost driver, which then calls the registered event handler.
426 *
427 * @returns VBox status code. Return VERR_TRY_AGAIN if you cannot process the
428 * event now and want it to be repeated at a later point.
429 *
430 * @param pInterface Pointer to this interface structure.
431 * @param u32UsageID The HID usage code event to queue.
432 */
433 DECLR3CALLBACKMEMBER(int, pfnPutEventHid,(PPDMIKEYBOARDPORT pInterface, uint32_t u32UsageID));
434} PDMIKEYBOARDPORT;
435/** PDMIKEYBOARDPORT interface ID. */
436#define PDMIKEYBOARDPORT_IID "2a0844f0-410b-40ab-a6ed-6575f3aa3e29"
437
438
439/**
440 * Keyboard LEDs.
441 */
442typedef enum PDMKEYBLEDS
443{
444 /** No leds. */
445 PDMKEYBLEDS_NONE = 0x0000,
446 /** Num Lock */
447 PDMKEYBLEDS_NUMLOCK = 0x0001,
448 /** Caps Lock */
449 PDMKEYBLEDS_CAPSLOCK = 0x0002,
450 /** Scroll Lock */
451 PDMKEYBLEDS_SCROLLLOCK = 0x0004
452} PDMKEYBLEDS;
453
454/** Pointer to keyboard connector interface. */
455typedef struct PDMIKEYBOARDCONNECTOR *PPDMIKEYBOARDCONNECTOR;
456/**
457 * Keyboard connector interface (up).
458 * Pair with PDMIKEYBOARDPORT
459 */
460typedef struct PDMIKEYBOARDCONNECTOR
461{
462 /**
463 * Notifies the the downstream driver about an LED change initiated by the guest.
464 *
465 * @param pInterface Pointer to this interface structure.
466 * @param enmLeds The new led mask.
467 */
468 DECLR3CALLBACKMEMBER(void, pfnLedStatusChange,(PPDMIKEYBOARDCONNECTOR pInterface, PDMKEYBLEDS enmLeds));
469
470 /**
471 * Notifies the the downstream driver of changes in driver state.
472 *
473 * @param pInterface Pointer to this interface structure.
474 * @param fActive Whether interface wishes to get "focus".
475 */
476 DECLR3CALLBACKMEMBER(void, pfnSetActive,(PPDMIKEYBOARDCONNECTOR pInterface, bool fActive));
477
478 /**
479 * Flushes the keyboard queue if it contains pending events.
480 *
481 * @param pInterface Pointer to this interface structure.
482 */
483 DECLR3CALLBACKMEMBER(void, pfnFlushQueue,(PPDMIKEYBOARDCONNECTOR pInterface));
484
485} PDMIKEYBOARDCONNECTOR;
486/** PDMIKEYBOARDCONNECTOR interface ID. */
487#define PDMIKEYBOARDCONNECTOR_IID "db3f7bd5-953e-436f-9f8e-077905a92d82"
488
489
490
491/** Pointer to a display port interface. */
492typedef struct PDMIDISPLAYPORT *PPDMIDISPLAYPORT;
493/**
494 * Display port interface (down).
495 * Pair with PDMIDISPLAYCONNECTOR.
496 */
497typedef struct PDMIDISPLAYPORT
498{
499 /**
500 * Update the display with any changed regions.
501 *
502 * Flushes any display changes to the memory pointed to by the
503 * PDMIDISPLAYCONNECTOR interface and calles PDMIDISPLAYCONNECTOR::pfnUpdateRect()
504 * while doing so.
505 *
506 * @returns VBox status code.
507 * @param pInterface Pointer to this interface.
508 * @thread The emulation thread.
509 */
510 DECLR3CALLBACKMEMBER(int, pfnUpdateDisplay,(PPDMIDISPLAYPORT pInterface));
511
512 /**
513 * Update the entire display.
514 *
515 * Flushes the entire display content to the memory pointed to by the
516 * PDMIDISPLAYCONNECTOR interface and calles PDMIDISPLAYCONNECTOR::pfnUpdateRect().
517 *
518 * @returns VBox status code.
519 * @param pInterface Pointer to this interface.
520 * @param fFailOnResize Fail is a resize is pending.
521 * @thread The emulation thread.
522 */
523 DECLR3CALLBACKMEMBER(int, pfnUpdateDisplayAll,(PPDMIDISPLAYPORT pInterface, bool fFailOnResize));
524
525 /**
526 * Return the current guest resolution and color depth in bits per pixel (bpp).
527 *
528 * As the graphics card is able to provide display updates with the bpp
529 * requested by the host, this method can be used to query the actual
530 * guest color depth.
531 *
532 * @returns VBox status code.
533 * @param pInterface Pointer to this interface.
534 * @param pcBits Where to store the current guest color depth.
535 * @param pcx Where to store the horizontal resolution.
536 * @param pcy Where to store the vertical resolution.
537 * @thread Any thread.
538 */
539 DECLR3CALLBACKMEMBER(int, pfnQueryVideoMode,(PPDMIDISPLAYPORT pInterface, uint32_t *pcBits, uint32_t *pcx, uint32_t *pcy));
540
541 /**
542 * Sets the refresh rate and restart the timer.
543 * The rate is defined as the minimum interval between the return of
544 * one PDMIDISPLAYPORT::pfnRefresh() call to the next one.
545 *
546 * The interval timer will be restarted by this call. So at VM startup
547 * this function must be called to start the refresh cycle. The refresh
548 * rate is not saved, but have to be when resuming a loaded VM state.
549 *
550 * @returns VBox status code.
551 * @param pInterface Pointer to this interface.
552 * @param cMilliesInterval Number of millis between two refreshes.
553 * @thread Any thread.
554 */
555 DECLR3CALLBACKMEMBER(int, pfnSetRefreshRate,(PPDMIDISPLAYPORT pInterface, uint32_t cMilliesInterval));
556
557 /**
558 * Create a 32-bbp screenshot of the display.
559 *
560 * This will allocate and return a 32-bbp bitmap. Size of the bitmap scanline in bytes is 4*width.
561 *
562 * The allocated bitmap buffer must be freed with pfnFreeScreenshot.
563 *
564 * @param pInterface Pointer to this interface.
565 * @param ppbData Where to store the pointer to the allocated
566 * buffer.
567 * @param pcbData Where to store the actual size of the bitmap.
568 * @param pcx Where to store the width of the bitmap.
569 * @param pcy Where to store the height of the bitmap.
570 * @thread The emulation thread.
571 */
572 DECLR3CALLBACKMEMBER(int, pfnTakeScreenshot,(PPDMIDISPLAYPORT pInterface, uint8_t **ppbData, size_t *pcbData, uint32_t *pcx, uint32_t *pcy));
573
574 /**
575 * Free screenshot buffer.
576 *
577 * This will free the memory buffer allocated by pfnTakeScreenshot.
578 *
579 * @param pInterface Pointer to this interface.
580 * @param pbData Pointer to the buffer returned by
581 * pfnTakeScreenshot.
582 * @thread Any.
583 */
584 DECLR3CALLBACKMEMBER(void, pfnFreeScreenshot,(PPDMIDISPLAYPORT pInterface, uint8_t *pbData));
585
586 /**
587 * Copy bitmap to the display.
588 *
589 * This will convert and copy a 32-bbp bitmap (with dword aligned scanline length) to
590 * the memory pointed to by the PDMIDISPLAYCONNECTOR interface.
591 *
592 * @param pInterface Pointer to this interface.
593 * @param pvData Pointer to the bitmap bits.
594 * @param x The upper left corner x coordinate of the destination rectangle.
595 * @param y The upper left corner y coordinate of the destination rectangle.
596 * @param cx The width of the source and destination rectangles.
597 * @param cy The height of the source and destination rectangles.
598 * @thread The emulation thread.
599 * @remark This is just a convenience for using the bitmap conversions of the
600 * graphics device.
601 */
602 DECLR3CALLBACKMEMBER(int, pfnDisplayBlt,(PPDMIDISPLAYPORT pInterface, const void *pvData, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy));
603
604 /**
605 * Render a rectangle from guest VRAM to Framebuffer.
606 *
607 * @param pInterface Pointer to this interface.
608 * @param x The upper left corner x coordinate of the rectangle to be updated.
609 * @param y The upper left corner y coordinate of the rectangle to be updated.
610 * @param cx The width of the rectangle to be updated.
611 * @param cy The height of the rectangle to be updated.
612 * @thread The emulation thread.
613 */
614 DECLR3CALLBACKMEMBER(void, pfnUpdateDisplayRect,(PPDMIDISPLAYPORT pInterface, int32_t x, int32_t y, uint32_t cx, uint32_t cy));
615
616 /**
617 * Inform the VGA device whether the Display is directly using the guest VRAM and there is no need
618 * to render the VRAM to the framebuffer memory.
619 *
620 * @param pInterface Pointer to this interface.
621 * @param fRender Whether the VRAM content must be rendered to the framebuffer.
622 * @thread The emulation thread.
623 */
624 DECLR3CALLBACKMEMBER(void, pfnSetRenderVRAM,(PPDMIDISPLAYPORT pInterface, bool fRender));
625
626 /**
627 * Render a bitmap rectangle from source to target buffer.
628 *
629 * @param pInterface Pointer to this interface.
630 * @param cx The width of the rectangle to be copied.
631 * @param cy The height of the rectangle to be copied.
632 * @param pbSrc Source frame buffer 0,0.
633 * @param xSrc The upper left corner x coordinate of the source rectangle.
634 * @param ySrc The upper left corner y coordinate of the source rectangle.
635 * @param cxSrc The width of the source frame buffer.
636 * @param cySrc The height of the source frame buffer.
637 * @param cbSrcLine The line length of the source frame buffer.
638 * @param cSrcBitsPerPixel The pixel depth of the source.
639 * @param pbDst Destination frame buffer 0,0.
640 * @param xDst The upper left corner x coordinate of the destination rectangle.
641 * @param yDst The upper left corner y coordinate of the destination rectangle.
642 * @param cxDst The width of the destination frame buffer.
643 * @param cyDst The height of the destination frame buffer.
644 * @param cbDstLine The line length of the destination frame buffer.
645 * @param cDstBitsPerPixel The pixel depth of the destination.
646 * @thread The emulation thread.
647 */
648 DECLR3CALLBACKMEMBER(int, pfnCopyRect,(PPDMIDISPLAYPORT pInterface, uint32_t cx, uint32_t cy,
649 const uint8_t *pbSrc, int32_t xSrc, int32_t ySrc, uint32_t cxSrc, uint32_t cySrc, uint32_t cbSrcLine, uint32_t cSrcBitsPerPixel,
650 uint8_t *pbDst, int32_t xDst, int32_t yDst, uint32_t cxDst, uint32_t cyDst, uint32_t cbDstLine, uint32_t cDstBitsPerPixel));
651
652#ifdef VBOX_WITH_VMSVGA
653 /**
654 * Inform the VGA device of viewport changes (as a result of e.g. scrolling)
655 *
656 * @param pInterface Pointer to this interface.
657 * @param uScreenId The screen updates are for.
658 * @param x The upper left corner x coordinate of the new viewport rectangle
659 * @param y The upper left corner y coordinate of the new viewport rectangle
660 * @param cx The width of the new viewport rectangle
661 * @param cy The height of the new viewport rectangle
662 * @thread The emulation thread.
663 */
664 DECLR3CALLBACKMEMBER(void, pfnSetViewPort,(PPDMIDISPLAYPORT pInterface, uint32_t uScreenId, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy));
665#endif
666
667 /**
668 * Send a video mode hint to the VGA device.
669 *
670 * @param pInterface Pointer to this interface.
671 * @param cx The X resolution.
672 * @param cy The Y resolution.
673 * @param cBPP The bit count.
674 * @param iDisplay The screen number.
675 * @param dx X offset into the virtual framebuffer or ~0.
676 * @param dy Y offset into the virtual framebuffer or ~0.
677 * @param fEnabled Is this screen currently enabled?
678 * @param fNotifyGuest Should the device send the guest an IRQ?
679 * Set for the last hint of a series.
680 * @thread Schedules on the emulation thread.
681 */
682 DECLR3CALLBACKMEMBER(int, pfnSendModeHint, (PPDMIDISPLAYPORT pInterface, uint32_t cx, uint32_t cy,
683 uint32_t cBPP, uint32_t iDisplay, uint32_t dx,
684 uint32_t dy, uint32_t fEnabled, uint32_t fNotifyGuest));
685
686 /**
687 * Send the guest a notification about host cursor capabilities changes.
688 *
689 * @param pInterface Pointer to this interface.
690 * @param fCapabilitiesAdded New supported capabilities.
691 * @param fCapabilitiesRemoved No longer supported capabilities.
692 * @thread Any.
693 */
694 DECLR3CALLBACKMEMBER(void, pfnReportHostCursorCapabilities, (PPDMIDISPLAYPORT pInterface, uint32_t fCapabilitiesAdded,
695 uint32_t fCapabilitiesRemoved));
696
697 /**
698 * Tell the graphics device about the host cursor position.
699 *
700 * @param pInterface Pointer to this interface.
701 * @param x X offset into the cursor range.
702 * @param y Y offset into the cursor range.
703 * @thread Any.
704 */
705 DECLR3CALLBACKMEMBER(void, pfnReportHostCursorPosition, (PPDMIDISPLAYPORT pInterface, uint32_t x, uint32_t y));
706} PDMIDISPLAYPORT;
707/** PDMIDISPLAYPORT interface ID. */
708#ifdef VBOX_WITH_VMSVGA
709#define PDMIDISPLAYPORT_IID "9672e2b0-1aef-4c4d-9108-864cdb28333f"
710#else
711#define PDMIDISPLAYPORT_IID "323f3412-8903-4564-b04c-cbfe0d2d1596"
712#endif
713
714
715typedef struct VBOXVHWACMD *PVBOXVHWACMD; /**< @todo r=bird: A line what it is to make doxygen happy. */
716typedef struct VBVACMDHDR *PVBVACMDHDR;
717typedef struct VBVAINFOSCREEN *PVBVAINFOSCREEN;
718typedef struct VBVAINFOVIEW *PVBVAINFOVIEW;
719typedef struct VBVAHOSTFLAGS *PVBVAHOSTFLAGS;
720struct VBOXVDMACMD_CHROMIUM_CMD; /* <- chromium [hgsmi] command */
721struct VBOXVDMACMD_CHROMIUM_CTL; /* <- chromium [hgsmi] command */
722
723
724/** Pointer to a display connector interface. */
725typedef struct PDMIDISPLAYCONNECTOR *PPDMIDISPLAYCONNECTOR;
726struct VBOXCRCMDCTL;
727typedef DECLCALLBACKPTR(void, PFNCRCTLCOMPLETION)(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, int rc, void *pvCompletion);
728/**
729 * Display connector interface (up).
730 * Pair with PDMIDISPLAYPORT.
731 */
732typedef struct PDMIDISPLAYCONNECTOR
733{
734 /**
735 * Resize the display.
736 * This is called when the resolution changes. This usually happens on
737 * request from the guest os, but may also happen as the result of a reset.
738 * If the callback returns VINF_VGA_RESIZE_IN_PROGRESS, the caller (VGA device)
739 * must not access the connector and return.
740 *
741 * @returns VINF_SUCCESS if the framebuffer resize was completed,
742 * VINF_VGA_RESIZE_IN_PROGRESS if resize takes time and not yet finished.
743 * @param pInterface Pointer to this interface.
744 * @param cBits Color depth (bits per pixel) of the new video mode.
745 * @param pvVRAM Address of the guest VRAM.
746 * @param cbLine Size in bytes of a single scan line.
747 * @param cx New display width.
748 * @param cy New display height.
749 * @thread The emulation thread.
750 */
751 DECLR3CALLBACKMEMBER(int, pfnResize,(PPDMIDISPLAYCONNECTOR pInterface, uint32_t cBits, void *pvVRAM, uint32_t cbLine,
752 uint32_t cx, uint32_t cy));
753
754 /**
755 * Update a rectangle of the display.
756 * PDMIDISPLAYPORT::pfnUpdateDisplay is the caller.
757 *
758 * @param pInterface Pointer to this interface.
759 * @param x The upper left corner x coordinate of the rectangle.
760 * @param y The upper left corner y coordinate of the rectangle.
761 * @param cx The width of the rectangle.
762 * @param cy The height of the rectangle.
763 * @thread The emulation thread.
764 */
765 DECLR3CALLBACKMEMBER(void, pfnUpdateRect,(PPDMIDISPLAYCONNECTOR pInterface, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy));
766
767 /**
768 * Refresh the display.
769 *
770 * The interval between these calls is set by
771 * PDMIDISPLAYPORT::pfnSetRefreshRate(). The driver should call
772 * PDMIDISPLAYPORT::pfnUpdateDisplay() if it wishes to refresh the
773 * display. PDMIDISPLAYPORT::pfnUpdateDisplay calls pfnUpdateRect with
774 * the changed rectangles.
775 *
776 * @param pInterface Pointer to this interface.
777 * @thread The emulation thread.
778 */
779 DECLR3CALLBACKMEMBER(void, pfnRefresh,(PPDMIDISPLAYCONNECTOR pInterface));
780
781 /**
782 * Reset the display.
783 *
784 * Notification message when the graphics card has been reset.
785 *
786 * @param pInterface Pointer to this interface.
787 * @thread The emulation thread.
788 */
789 DECLR3CALLBACKMEMBER(void, pfnReset,(PPDMIDISPLAYCONNECTOR pInterface));
790
791 /**
792 * LFB video mode enter/exit.
793 *
794 * Notification message when LinearFrameBuffer video mode is enabled/disabled.
795 *
796 * @param pInterface Pointer to this interface.
797 * @param fEnabled false - LFB mode was disabled,
798 * true - an LFB mode was disabled
799 * @thread The emulation thread.
800 */
801 DECLR3CALLBACKMEMBER(void, pfnLFBModeChange,(PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled));
802
803 /**
804 * Process the guest graphics adapter information.
805 *
806 * Direct notification from guest to the display connector.
807 *
808 * @param pInterface Pointer to this interface.
809 * @param pvVRAM Address of the guest VRAM.
810 * @param u32VRAMSize Size of the guest VRAM.
811 * @thread The emulation thread.
812 */
813 DECLR3CALLBACKMEMBER(void, pfnProcessAdapterData,(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, uint32_t u32VRAMSize));
814
815 /**
816 * Process the guest display information.
817 *
818 * Direct notification from guest to the display connector.
819 *
820 * @param pInterface Pointer to this interface.
821 * @param pvVRAM Address of the guest VRAM.
822 * @param uScreenId The index of the guest display to be processed.
823 * @thread The emulation thread.
824 */
825 DECLR3CALLBACKMEMBER(void, pfnProcessDisplayData,(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, unsigned uScreenId));
826
827 /**
828 * Process the guest Video HW Acceleration command.
829 *
830 * @param pInterface Pointer to this interface.
831 * @param pCmd Video HW Acceleration Command to be processed.
832 * @returns VINF_SUCCESS - command is completed,
833 * VINF_CALLBACK_RETURN - command will by asynchronously completed via complete callback
834 * VERR_INVALID_STATE - the command could not be processed (most likely because the framebuffer was disconnected) - the post should be retried later
835 * @thread The emulation thread.
836 */
837 DECLR3CALLBACKMEMBER(int, pfnVHWACommandProcess,(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCmd));
838
839 /**
840 * Process the guest chromium command.
841 *
842 * @param pInterface Pointer to this interface.
843 * @param pCmd Video HW Acceleration Command to be processed.
844 * @thread The emulation thread.
845 */
846 DECLR3CALLBACKMEMBER(void, pfnCrHgsmiCommandProcess,(PPDMIDISPLAYCONNECTOR pInterface, struct VBOXVDMACMD_CHROMIUM_CMD* pCmd, uint32_t cbCmd));
847
848 /**
849 * Process the guest chromium control command.
850 *
851 * @param pInterface Pointer to this interface.
852 * @param pCmd Video HW Acceleration Command to be processed.
853 * @thread The emulation thread.
854 */
855 DECLR3CALLBACKMEMBER(void, pfnCrHgsmiControlProcess,(PPDMIDISPLAYCONNECTOR pInterface, struct VBOXVDMACMD_CHROMIUM_CTL* pCtl, uint32_t cbCtl));
856
857 /**
858 * Process the guest chromium control command.
859 *
860 * @param pInterface Pointer to this interface.
861 * @param pCmd Video HW Acceleration Command to be processed.
862 * @param cbCmd Undocumented!
863 * @param pfnCompletion Undocumented!
864 * @param pvCompletion Undocumented!
865 * @thread The emulation thread.
866 */
867 DECLR3CALLBACKMEMBER(int, pfnCrHgcmCtlSubmit,(PPDMIDISPLAYCONNECTOR pInterface, struct VBOXCRCMDCTL *pCmd, uint32_t cbCmd,
868 PFNCRCTLCOMPLETION pfnCompletion, void *pvCompletion));
869
870 /**
871 * The specified screen enters VBVA mode.
872 *
873 * @param pInterface Pointer to this interface.
874 * @param uScreenId The screen updates are for.
875 * @param pHostFlags Undocumented!
876 * @param fRenderThreadMode if true - the graphics device has a separate thread that does all rendering.
877 * This means that:
878 * 1. most pfnVBVAXxx callbacks (see the individual documentation for each one)
879 * will be called in the context of the render thread rather than the emulation thread
880 * 2. PDMIDISPLAYCONNECTOR implementor (i.e. DisplayImpl) must NOT notify crogl backend
881 * about vbva-originated events (e.g. resize), because crogl is working in CrCmd mode,
882 * in the context of the render thread as part of the Graphics device, and gets notified about those events directly
883 * @thread if fRenderThreadMode is TRUE - the render thread, otherwise - the emulation thread.
884 */
885 DECLR3CALLBACKMEMBER(int, pfnVBVAEnable,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId,
886 PVBVAHOSTFLAGS pHostFlags, bool fRenderThreadMode));
887
888 /**
889 * The specified screen leaves VBVA mode.
890 *
891 * @param pInterface Pointer to this interface.
892 * @param uScreenId The screen updates are for.
893 * @thread if render thread mode is on (fRenderThreadMode that was passed to pfnVBVAEnable is TRUE) - the render thread pfnVBVAEnable was called in,
894 * otherwise - the emulation thread.
895 */
896 DECLR3CALLBACKMEMBER(void, pfnVBVADisable,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId));
897
898 /**
899 * A sequence of pfnVBVAUpdateProcess calls begins.
900 *
901 * @param pInterface Pointer to this interface.
902 * @param uScreenId The screen updates are for.
903 * @thread if render thread mode is on (fRenderThreadMode that was passed to pfnVBVAEnable is TRUE) - the render thread pfnVBVAEnable was called in,
904 * otherwise - the emulation thread.
905 */
906 DECLR3CALLBACKMEMBER(void, pfnVBVAUpdateBegin,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId));
907
908 /**
909 * Process the guest VBVA command.
910 *
911 * @param pInterface Pointer to this interface.
912 * @param uScreenId The screen updates are for.
913 * @param pCmd Video HW Acceleration Command to be processed.
914 * @param cbCmd Undocumented!
915 * @thread if render thread mode is on (fRenderThreadMode that was passed to pfnVBVAEnable is TRUE) - the render thread pfnVBVAEnable was called in,
916 * otherwise - the emulation thread.
917 */
918 DECLR3CALLBACKMEMBER(void, pfnVBVAUpdateProcess,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId,
919 const PVBVACMDHDR pCmd, size_t cbCmd));
920
921 /**
922 * A sequence of pfnVBVAUpdateProcess calls ends.
923 *
924 * @param pInterface Pointer to this interface.
925 * @param uScreenId The screen updates are for.
926 * @param x The upper left corner x coordinate of the combined rectangle of all VBVA updates.
927 * @param y The upper left corner y coordinate of the rectangle.
928 * @param cx The width of the rectangle.
929 * @param cy The height of the rectangle.
930 * @thread if render thread mode is on (fRenderThreadMode that was passed to pfnVBVAEnable is TRUE) - the render thread pfnVBVAEnable was called in,
931 * otherwise - the emulation thread.
932 */
933 DECLR3CALLBACKMEMBER(void, pfnVBVAUpdateEnd,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, int32_t x, int32_t y, uint32_t cx, uint32_t cy));
934
935 /**
936 * Resize the display.
937 * This is called when the resolution changes. This usually happens on
938 * request from the guest os, but may also happen as the result of a reset.
939 * If the callback returns VINF_VGA_RESIZE_IN_PROGRESS, the caller (VGA device)
940 * must not access the connector and return.
941 *
942 * @todo Merge with pfnResize.
943 *
944 * @returns VINF_SUCCESS if the framebuffer resize was completed,
945 * VINF_VGA_RESIZE_IN_PROGRESS if resize takes time and not yet finished.
946 * @param pInterface Pointer to this interface.
947 * @param pView The description of VRAM block for this screen.
948 * @param pScreen The data of screen being resized.
949 * @param pvVRAM Address of the guest VRAM.
950 * @thread if render thread mode is on (fRenderThreadMode that was passed to pfnVBVAEnable is TRUE) - the render thread pfnVBVAEnable was called in,
951 * otherwise - the emulation thread.
952 */
953 DECLR3CALLBACKMEMBER(int, pfnVBVAResize,(PPDMIDISPLAYCONNECTOR pInterface, const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN pScreen, void *pvVRAM));
954
955 /**
956 * Update the pointer shape.
957 * This is called when the mouse pointer shape changes. The new shape
958 * is passed as a caller allocated buffer that will be freed after returning
959 *
960 * @param pInterface Pointer to this interface.
961 * @param fVisible Visibility indicator (if false, the other parameters are undefined).
962 * @param fAlpha Flag whether alpha channel is being passed.
963 * @param xHot Pointer hot spot x coordinate.
964 * @param yHot Pointer hot spot y coordinate.
965 * @param x Pointer new x coordinate on screen.
966 * @param y Pointer new y coordinate on screen.
967 * @param cx Pointer width in pixels.
968 * @param cy Pointer height in pixels.
969 * @param cbScanline Size of one scanline in bytes.
970 * @param pvShape New shape buffer.
971 * @thread The emulation thread.
972 */
973 DECLR3CALLBACKMEMBER(int, pfnVBVAMousePointerShape,(PPDMIDISPLAYCONNECTOR pInterface, bool fVisible, bool fAlpha,
974 uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy,
975 const void *pvShape));
976
977 /**
978 * The guest capabilities were updated.
979 *
980 * @param pInterface Pointer to this interface.
981 * @param fCapabilities The new capability flag state.
982 * @thread The emulation thread.
983 */
984 DECLR3CALLBACKMEMBER(void, pfnVBVAGuestCapabilityUpdate,(PPDMIDISPLAYCONNECTOR pInterface, uint32_t fCapabilities));
985
986 /** Read-only attributes.
987 * For preformance reasons some readonly attributes are kept in the interface.
988 * We trust the interface users to respect the readonlyness of these.
989 * @{
990 */
991 /** Pointer to the display data buffer. */
992 uint8_t *pbData;
993 /** Size of a scanline in the data buffer. */
994 uint32_t cbScanline;
995 /** The color depth (in bits) the graphics card is supposed to provide. */
996 uint32_t cBits;
997 /** The display width. */
998 uint32_t cx;
999 /** The display height. */
1000 uint32_t cy;
1001 /** @} */
1002
1003 /**
1004 * The guest display input mapping rectangle was updated.
1005 *
1006 * @param pInterface Pointer to this interface.
1007 * @param xOrigin Upper left X co-ordinate relative to the first screen.
1008 * @param yOrigin Upper left Y co-ordinate relative to the first screen.
1009 * @param cx Rectangle width.
1010 * @param cy Rectangle height.
1011 * @thread The emulation thread.
1012 */
1013 DECLR3CALLBACKMEMBER(void, pfnVBVAInputMappingUpdate,(PPDMIDISPLAYCONNECTOR pInterface, int32_t xOrigin, int32_t yOrigin, uint32_t cx, uint32_t cy));
1014} PDMIDISPLAYCONNECTOR;
1015/** PDMIDISPLAYCONNECTOR interface ID. */
1016#define PDMIDISPLAYCONNECTOR_IID "e883a720-85fb-11e4-a307-0b06689c9661"
1017
1018
1019/** Pointer to a block port interface. */
1020typedef struct PDMIBLOCKPORT *PPDMIBLOCKPORT;
1021/**
1022 * Block notify interface (down).
1023 * Pair with PDMIBLOCK.
1024 */
1025typedef struct PDMIBLOCKPORT
1026{
1027 /**
1028 * Returns the storage controller name, instance and LUN of the attached medium.
1029 *
1030 * @returns VBox status.
1031 * @param pInterface Pointer to this interface.
1032 * @param ppcszController Where to store the name of the storage controller.
1033 * @param piInstance Where to store the instance number of the controller.
1034 * @param piLUN Where to store the LUN of the attached device.
1035 */
1036 DECLR3CALLBACKMEMBER(int, pfnQueryDeviceLocation, (PPDMIBLOCKPORT pInterface, const char **ppcszController,
1037 uint32_t *piInstance, uint32_t *piLUN));
1038
1039} PDMIBLOCKPORT;
1040/** PDMIBLOCKPORT interface ID. */
1041#define PDMIBLOCKPORT_IID "bbbed4cf-0862-4ffd-b60c-f7a65ef8e8ff"
1042
1043
1044/**
1045 * Callback which provides progress information.
1046 *
1047 * @return VBox status code.
1048 * @param pvUser Opaque user data.
1049 * @param uPercent Completion percentage.
1050 */
1051typedef DECLCALLBACK(int) FNSIMPLEPROGRESS(void *pvUser, unsigned uPercentage);
1052/** Pointer to FNSIMPLEPROGRESS() */
1053typedef FNSIMPLEPROGRESS *PFNSIMPLEPROGRESS;
1054
1055
1056/**
1057 * Block drive type.
1058 */
1059typedef enum PDMBLOCKTYPE
1060{
1061 /** Error (for the query function). */
1062 PDMBLOCKTYPE_ERROR = 1,
1063 /** 360KB 5 1/4" floppy drive. */
1064 PDMBLOCKTYPE_FLOPPY_360,
1065 /** 720KB 3 1/2" floppy drive. */
1066 PDMBLOCKTYPE_FLOPPY_720,
1067 /** 1.2MB 5 1/4" floppy drive. */
1068 PDMBLOCKTYPE_FLOPPY_1_20,
1069 /** 1.44MB 3 1/2" floppy drive. */
1070 PDMBLOCKTYPE_FLOPPY_1_44,
1071 /** 2.88MB 3 1/2" floppy drive. */
1072 PDMBLOCKTYPE_FLOPPY_2_88,
1073 /** Fake drive that can take up to 15.6 MB images.
1074 * C=255, H=2, S=63. */
1075 PDMBLOCKTYPE_FLOPPY_FAKE_15_6,
1076 /** Fake drive that can take up to 63.5 MB images.
1077 * C=255, H=2, S=255. */
1078 PDMBLOCKTYPE_FLOPPY_FAKE_63_5,
1079 /** CDROM drive. */
1080 PDMBLOCKTYPE_CDROM,
1081 /** DVD drive. */
1082 PDMBLOCKTYPE_DVD,
1083 /** Hard disk drive. */
1084 PDMBLOCKTYPE_HARD_DISK
1085} PDMBLOCKTYPE;
1086
1087/** Check if the given block type is a floppy. */
1088#define PDMBLOCKTYPE_IS_FLOPPY(a_enmType) ( (a_enmType) >= PDMBLOCKTYPE_FLOPPY_360 && (a_enmType) <= PDMBLOCKTYPE_FLOPPY_2_88 )
1089
1090/**
1091 * Block raw command data transfer direction.
1092 */
1093typedef enum PDMBLOCKTXDIR
1094{
1095 PDMBLOCKTXDIR_NONE = 0,
1096 PDMBLOCKTXDIR_FROM_DEVICE,
1097 PDMBLOCKTXDIR_TO_DEVICE
1098} PDMBLOCKTXDIR;
1099
1100
1101/** Pointer to a block interface. */
1102typedef struct PDMIBLOCK *PPDMIBLOCK;
1103/**
1104 * Block interface (up).
1105 * Pair with PDMIBLOCKPORT.
1106 */
1107typedef struct PDMIBLOCK
1108{
1109 /**
1110 * Read bits.
1111 *
1112 * @returns VBox status code.
1113 * @param pInterface Pointer to the interface structure containing the called function pointer.
1114 * @param off Offset to start reading from. The offset must be aligned to a sector boundary.
1115 * @param pvBuf Where to store the read bits.
1116 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary.
1117 * @thread Any thread.
1118 */
1119 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIBLOCK pInterface, uint64_t off, void *pvBuf, size_t cbRead));
1120
1121 /**
1122 * Read bits - version for DevPcBios.
1123 *
1124 * @returns VBox status code.
1125 * @param pInterface Pointer to the interface structure containing the called function pointer.
1126 * @param off Offset to start reading from. The offset must be aligned to a sector boundary.
1127 * @param pvBuf Where to store the read bits.
1128 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary.
1129 * @thread Any thread.
1130 *
1131 * @note: Special version of pfnRead which doesn't try to suspend the VM when the DEKs for encrypted disks
1132 * are missing but just returns an error.
1133 */
1134 DECLR3CALLBACKMEMBER(int, pfnReadPcBios,(PPDMIBLOCK pInterface, uint64_t off, void *pvBuf, size_t cbRead));
1135
1136 /**
1137 * Write bits.
1138 *
1139 * @returns VBox status code.
1140 * @param pInterface Pointer to the interface structure containing the called function pointer.
1141 * @param off Offset to start writing at. The offset must be aligned to a sector boundary.
1142 * @param pvBuf Where to store the write bits.
1143 * @param cbWrite Number of bytes to write. Must be aligned to a sector boundary.
1144 * @thread Any thread.
1145 */
1146 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIBLOCK pInterface, uint64_t off, const void *pvBuf, size_t cbWrite));
1147
1148 /**
1149 * Make sure that the bits written are actually on the storage medium.
1150 *
1151 * @returns VBox status code.
1152 * @param pInterface Pointer to the interface structure containing the called function pointer.
1153 * @thread Any thread.
1154 */
1155 DECLR3CALLBACKMEMBER(int, pfnFlush,(PPDMIBLOCK pInterface));
1156
1157 /**
1158 * Send a raw command to the underlying device (CDROM).
1159 * This method is optional (i.e. the function pointer may be NULL).
1160 *
1161 * @returns VBox status code.
1162 * @param pInterface Pointer to the interface structure containing the called function pointer.
1163 * @param pbCmd Offset to start reading from.
1164 * @param enmTxDir Direction of transfer.
1165 * @param pvBuf Pointer tp the transfer buffer.
1166 * @param cbBuf Size of the transfer buffer.
1167 * @param pbSenseKey Status of the command (when return value is VERR_DEV_IO_ERROR).
1168 * @param cTimeoutMillies Command timeout in milliseconds.
1169 * @thread Any thread.
1170 */
1171 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));
1172
1173 /**
1174 * Merge medium contents during a live snapshot deletion.
1175 *
1176 * @returns VBox status code.
1177 * @param pInterface Pointer to the interface structure containing the called function pointer.
1178 * @param pfnProgress Function pointer for progress notification.
1179 * @param pvUser Opaque user data for progress notification.
1180 * @thread Any thread.
1181 */
1182 DECLR3CALLBACKMEMBER(int, pfnMerge,(PPDMIBLOCK pInterface, PFNSIMPLEPROGRESS pfnProgress, void *pvUser));
1183
1184 /**
1185 * Check if the media is readonly or not.
1186 *
1187 * @returns true if readonly.
1188 * @returns false if read/write.
1189 * @param pInterface Pointer to the interface structure containing the called function pointer.
1190 * @thread Any thread.
1191 */
1192 DECLR3CALLBACKMEMBER(bool, pfnIsReadOnly,(PPDMIBLOCK pInterface));
1193
1194 /**
1195 * Gets the media size in bytes.
1196 *
1197 * @returns Media size in bytes.
1198 * @param pInterface Pointer to the interface structure containing the called function pointer.
1199 * @thread Any thread.
1200 */
1201 DECLR3CALLBACKMEMBER(uint64_t, pfnGetSize,(PPDMIBLOCK pInterface));
1202
1203 /**
1204 * Gets the media sector size in bytes.
1205 *
1206 * @returns Media sector size in bytes.
1207 * @param pInterface Pointer to the interface structure containing the called function pointer.
1208 * @thread Any thread.
1209 */
1210 DECLR3CALLBACKMEMBER(uint32_t, pfnGetSectorSize,(PPDMIBLOCK pInterface));
1211
1212 /**
1213 * Gets the block drive type.
1214 *
1215 * @returns block drive type.
1216 * @param pInterface Pointer to the interface structure containing the called function pointer.
1217 * @thread Any thread.
1218 */
1219 DECLR3CALLBACKMEMBER(PDMBLOCKTYPE, pfnGetType,(PPDMIBLOCK pInterface));
1220
1221 /**
1222 * Gets the UUID of the block drive.
1223 * Don't return the media UUID if it's removable.
1224 *
1225 * @returns VBox status code.
1226 * @param pInterface Pointer to the interface structure containing the called function pointer.
1227 * @param pUuid Where to store the UUID on success.
1228 * @thread Any thread.
1229 */
1230 DECLR3CALLBACKMEMBER(int, pfnGetUuid,(PPDMIBLOCK pInterface, PRTUUID pUuid));
1231
1232 /**
1233 * Discards the given range.
1234 *
1235 * @returns VBox status code.
1236 * @param pInterface Pointer to the interface structure containing the called function pointer.
1237 * @param paRanges Array of ranges to discard.
1238 * @param cRanges Number of entries in the array.
1239 * @thread Any thread.
1240 */
1241 DECLR3CALLBACKMEMBER(int, pfnDiscard,(PPDMIBLOCK pInterface, PCRTRANGE paRanges, unsigned cRanges));
1242
1243 /**
1244 * Allocate buffer memory which is suitable for I/O and might have special proerties for secure
1245 * environments (non-pageable memory for sensitive data which should not end up on the disk).
1246 *
1247 * @returns VBox status code.
1248 * @param pInterface Pointer to the interface structure containing the called function pointer.
1249 * @param cb Amount of memory to allocate.
1250 * @param ppvNew Where to store the pointer to the buffer on success.
1251 */
1252 DECLR3CALLBACKMEMBER(int, pfnIoBufAlloc, (PPDMIBLOCK pInterface, size_t cb, void **ppvNew));
1253
1254 /**
1255 * Free memory allocated with PDMIBLOCK::pfnIoBufAlloc().
1256 *
1257 * @returns VBox status code.
1258 * @param pInterface Pointer to the interface structure containing the called function pointer.
1259 * @param pv Pointer to the memory to free.
1260 * @param cb Amount of bytes given in PDMIBLOCK::pfnIoBufAlloc().
1261 */
1262 DECLR3CALLBACKMEMBER(int, pfnIoBufFree, (PPDMIBLOCK pInterface, void *pv, size_t cb));
1263
1264} PDMIBLOCK;
1265/** PDMIBLOCK interface ID. */
1266#define PDMIBLOCK_IID "4e804e8e-3c01-4f20-98d9-a30ece8ec9f5"
1267
1268
1269/** Pointer to a mount interface. */
1270typedef struct PDMIMOUNTNOTIFY *PPDMIMOUNTNOTIFY;
1271/**
1272 * Block interface (up).
1273 * Pair with PDMIMOUNT.
1274 */
1275typedef struct PDMIMOUNTNOTIFY
1276{
1277 /**
1278 * Called when a media is mounted.
1279 *
1280 * @param pInterface Pointer to the interface structure containing the called function pointer.
1281 * @thread The emulation thread.
1282 */
1283 DECLR3CALLBACKMEMBER(void, pfnMountNotify,(PPDMIMOUNTNOTIFY pInterface));
1284
1285 /**
1286 * Called when a media is unmounted
1287 * @param pInterface Pointer to the interface structure containing the called function pointer.
1288 * @thread The emulation thread.
1289 */
1290 DECLR3CALLBACKMEMBER(void, pfnUnmountNotify,(PPDMIMOUNTNOTIFY pInterface));
1291} PDMIMOUNTNOTIFY;
1292/** PDMIMOUNTNOTIFY interface ID. */
1293#define PDMIMOUNTNOTIFY_IID "fa143ac9-9fc6-498e-997f-945380a558f9"
1294
1295
1296/** Pointer to mount interface. */
1297typedef struct PDMIMOUNT *PPDMIMOUNT;
1298/**
1299 * Mount interface (down).
1300 * Pair with PDMIMOUNTNOTIFY.
1301 */
1302typedef struct PDMIMOUNT
1303{
1304 /**
1305 * Mount a media.
1306 *
1307 * This will not unmount any currently mounted media!
1308 *
1309 * @returns VBox status code.
1310 * @param pInterface Pointer to the interface structure containing the called function pointer.
1311 * @param pszFilename Pointer to filename. If this is NULL it assumed that the caller have
1312 * constructed a configuration which can be attached to the bottom driver.
1313 * @param pszCoreDriver Core driver name. NULL will cause autodetection. Ignored if pszFilanem is NULL.
1314 * @thread The emulation thread.
1315 */
1316 DECLR3CALLBACKMEMBER(int, pfnMount,(PPDMIMOUNT pInterface, const char *pszFilename, const char *pszCoreDriver));
1317
1318 /**
1319 * Unmount the media.
1320 *
1321 * The driver will validate and pass it on. On the rebounce it will decide whether or not to detach it self.
1322 *
1323 * @returns VBox status code.
1324 * @param pInterface Pointer to the interface structure containing the called function pointer.
1325 * @thread The emulation thread.
1326 * @param fForce Force the unmount, even for locked media.
1327 * @param fEject Eject the medium. Only relevant for host drives.
1328 * @thread The emulation thread.
1329 */
1330 DECLR3CALLBACKMEMBER(int, pfnUnmount,(PPDMIMOUNT pInterface, bool fForce, bool fEject));
1331
1332 /**
1333 * Checks if a media is mounted.
1334 *
1335 * @returns true if mounted.
1336 * @returns false if not mounted.
1337 * @param pInterface Pointer to the interface structure containing the called function pointer.
1338 * @thread Any thread.
1339 */
1340 DECLR3CALLBACKMEMBER(bool, pfnIsMounted,(PPDMIMOUNT pInterface));
1341
1342 /**
1343 * Locks the media, preventing any unmounting of it.
1344 *
1345 * @returns VBox status code.
1346 * @param pInterface Pointer to the interface structure containing the called function pointer.
1347 * @thread The emulation thread.
1348 */
1349 DECLR3CALLBACKMEMBER(int, pfnLock,(PPDMIMOUNT pInterface));
1350
1351 /**
1352 * Unlocks the media, canceling previous calls to pfnLock().
1353 *
1354 * @returns VBox status code.
1355 * @param pInterface Pointer to the interface structure containing the called function pointer.
1356 * @thread The emulation thread.
1357 */
1358 DECLR3CALLBACKMEMBER(int, pfnUnlock,(PPDMIMOUNT pInterface));
1359
1360 /**
1361 * Checks if a media is locked.
1362 *
1363 * @returns true if locked.
1364 * @returns false if not locked.
1365 * @param pInterface Pointer to the interface structure containing the called function pointer.
1366 * @thread Any thread.
1367 */
1368 DECLR3CALLBACKMEMBER(bool, pfnIsLocked,(PPDMIMOUNT pInterface));
1369} PDMIMOUNT;
1370/** PDMIMOUNT interface ID. */
1371#define PDMIMOUNT_IID "34fc7a4c-623a-4806-a6bf-5be1be33c99f"
1372
1373/** Pointer to a secret key interface. */
1374typedef struct PDMISECKEY *PPDMISECKEY;
1375
1376/**
1377 * Secret key interface to retrieve secret keys.
1378 */
1379typedef struct PDMISECKEY
1380{
1381 /**
1382 * Retains a key identified by the ID. The caller will only hold a reference
1383 * to the key and must not modify the key buffer in any way.
1384 *
1385 * @returns VBox status code.
1386 * @param pInterface Pointer to this interface.
1387 * @param pszId The alias/id for the key to retrieve.
1388 * @param ppbKey Where to store the pointer to the key buffer on success.
1389 * @param pcbKey Where to store the size of the key in bytes on success.
1390 */
1391 DECLR3CALLBACKMEMBER(int, pfnKeyRetain, (PPDMISECKEY pInterface, const char *pszId,
1392 const uint8_t **pbKey, size_t *pcbKey));
1393
1394 /**
1395 * Releases one reference of the key identified by the given identifier.
1396 * The caller must not access the key buffer after calling this operation.
1397 *
1398 * @returns VBox status code.
1399 * @param pInterface Pointer to this interface.
1400 * @param pszId The alias/id for the key to release.
1401 *
1402 * @note: It is advised to release the key whenever it is not used anymore so the entity
1403 * storing the key can do anything to make retrieving the key from memory more
1404 * difficult like scrambling the memory buffer for instance.
1405 */
1406 DECLR3CALLBACKMEMBER(int, pfnKeyRelease, (PPDMISECKEY pInterface, const char *pszId));
1407
1408 /**
1409 * Retains a password identified by the ID. The caller will only hold a reference
1410 * to the password and must not modify the buffer in any way.
1411 *
1412 * @returns VBox status code.
1413 * @param pInterface Pointer to this interface.
1414 * @param pszId The alias/id for the password to retrieve.
1415 * @param ppszPassword Where to store the pointer to the password on success.
1416 */
1417 DECLR3CALLBACKMEMBER(int, pfnPasswordRetain, (PPDMISECKEY pInterface, const char *pszId,
1418 const char **ppszPassword));
1419
1420 /**
1421 * Releases one reference of the password identified by the given identifier.
1422 * The caller must not access the password after calling this operation.
1423 *
1424 * @returns VBox status code.
1425 * @param pInterface Pointer to this interface.
1426 * @param pszId The alias/id for the password to release.
1427 *
1428 * @note: It is advised to release the password whenever it is not used anymore so the entity
1429 * storing the password can do anything to make retrieving the password from memory more
1430 * difficult like scrambling the memory buffer for instance.
1431 */
1432 DECLR3CALLBACKMEMBER(int, pfnPasswordRelease, (PPDMISECKEY pInterface, const char *pszId));
1433} PDMISECKEY;
1434/** PDMISECKEY interface ID. */
1435#define PDMISECKEY_IID "3d698355-d995-453d-960f-31566a891df2"
1436
1437/** Pointer to a secret key helper interface. */
1438typedef struct PDMISECKEYHLP *PPDMISECKEYHLP;
1439
1440/**
1441 * Secret key helper interface for non critical functionality.
1442 */
1443typedef struct PDMISECKEYHLP
1444{
1445 /**
1446 * Notifies the interface provider that a key couldn't be retrieved from the key store.
1447 *
1448 * @returns VBox status code.
1449 * @param pInterface Pointer to this interface.
1450 */
1451 DECLR3CALLBACKMEMBER(int, pfnKeyMissingNotify, (PPDMISECKEYHLP pInterface));
1452
1453} PDMISECKEYHLP;
1454/** PDMISECKEY interface ID. */
1455#define PDMISECKEYHLP_IID "7be96168-4156-40ac-86d2-3073bf8b318e"
1456
1457/**
1458 * Media geometry structure.
1459 */
1460typedef struct PDMMEDIAGEOMETRY
1461{
1462 /** Number of cylinders. */
1463 uint32_t cCylinders;
1464 /** Number of heads. */
1465 uint32_t cHeads;
1466 /** Number of sectors. */
1467 uint32_t cSectors;
1468} PDMMEDIAGEOMETRY;
1469
1470/** Pointer to media geometry structure. */
1471typedef PDMMEDIAGEOMETRY *PPDMMEDIAGEOMETRY;
1472/** Pointer to constant media geometry structure. */
1473typedef const PDMMEDIAGEOMETRY *PCPDMMEDIAGEOMETRY;
1474
1475/** Pointer to a media port interface. */
1476typedef struct PDMIMEDIAPORT *PPDMIMEDIAPORT;
1477/**
1478 * Media port interface (down).
1479 */
1480typedef struct PDMIMEDIAPORT
1481{
1482 /**
1483 * Returns the storage controller name, instance and LUN of the attached medium.
1484 *
1485 * @returns VBox status.
1486 * @param pInterface Pointer to this interface.
1487 * @param ppcszController Where to store the name of the storage controller.
1488 * @param piInstance Where to store the instance number of the controller.
1489 * @param piLUN Where to store the LUN of the attached device.
1490 */
1491 DECLR3CALLBACKMEMBER(int, pfnQueryDeviceLocation, (PPDMIMEDIAPORT pInterface, const char **ppcszController,
1492 uint32_t *piInstance, uint32_t *piLUN));
1493
1494} PDMIMEDIAPORT;
1495/** PDMIMEDIAPORT interface ID. */
1496#define PDMIMEDIAPORT_IID "9f7e8c9e-6d35-4453-bbef-1f78033174d6"
1497
1498/** Pointer to a media interface. */
1499typedef struct PDMIMEDIA *PPDMIMEDIA;
1500/**
1501 * Media interface (up).
1502 * Makes up the foundation for PDMIBLOCK and PDMIBLOCKBIOS.
1503 * Pairs with PDMIMEDIAPORT.
1504 */
1505typedef struct PDMIMEDIA
1506{
1507 /**
1508 * Read bits.
1509 *
1510 * @returns VBox status code.
1511 * @param pInterface Pointer to the interface structure containing the called function pointer.
1512 * @param off Offset to start reading from. The offset must be aligned to a sector boundary.
1513 * @param pvBuf Where to store the read bits.
1514 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary.
1515 * @thread Any thread.
1516 */
1517 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIMEDIA pInterface, uint64_t off, void *pvBuf, size_t cbRead));
1518
1519 /**
1520 * Read bits - version for DevPcBios.
1521 *
1522 * @returns VBox status code.
1523 * @param pInterface Pointer to the interface structure containing the called function pointer.
1524 * @param off Offset to start reading from. The offset must be aligned to a sector boundary.
1525 * @param pvBuf Where to store the read bits.
1526 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary.
1527 * @thread Any thread.
1528 *
1529 * @note: Special version of pfnRead which doesn't try to suspend the VM when the DEKs for encrypted disks
1530 * are missing but just returns an error.
1531 */
1532 DECLR3CALLBACKMEMBER(int, pfnReadPcBios,(PPDMIMEDIA pInterface, uint64_t off, void *pvBuf, size_t cbRead));
1533
1534 /**
1535 * Write bits.
1536 *
1537 * @returns VBox status code.
1538 * @param pInterface Pointer to the interface structure containing the called function pointer.
1539 * @param off Offset to start writing at. The offset must be aligned to a sector boundary.
1540 * @param pvBuf Where to store the write bits.
1541 * @param cbWrite Number of bytes to write. Must be aligned to a sector boundary.
1542 * @thread Any thread.
1543 */
1544 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIMEDIA pInterface, uint64_t off, const void *pvBuf, size_t cbWrite));
1545
1546 /**
1547 * Make sure that the bits written are actually on the storage medium.
1548 *
1549 * @returns VBox status code.
1550 * @param pInterface Pointer to the interface structure containing the called function pointer.
1551 * @thread Any thread.
1552 */
1553 DECLR3CALLBACKMEMBER(int, pfnFlush,(PPDMIMEDIA pInterface));
1554
1555 /**
1556 * Merge medium contents during a live snapshot deletion. All details
1557 * must have been configured through CFGM or this will fail.
1558 * This method is optional (i.e. the function pointer may be NULL).
1559 *
1560 * @returns VBox status code.
1561 * @param pInterface Pointer to the interface structure containing the called function pointer.
1562 * @param pfnProgress Function pointer for progress notification.
1563 * @param pvUser Opaque user data for progress notification.
1564 * @thread Any thread.
1565 */
1566 DECLR3CALLBACKMEMBER(int, pfnMerge,(PPDMIMEDIA pInterface, PFNSIMPLEPROGRESS pfnProgress, void *pvUser));
1567
1568 /**
1569 * Sets the secret key retrieval interface to use to get secret keys.
1570 *
1571 * @returns VBox status code.
1572 * @param pInterface Pointer to the interface structure containing the called function pointer.
1573 * @param pIfSecKey The secret key interface to use.
1574 * Use NULL to clear the currently set interface and clear all secret
1575 * keys from the user.
1576 * @param pIfSecKeyHlp The secret key helper interface to use.
1577 * @thread Any thread.
1578 */
1579 DECLR3CALLBACKMEMBER(int, pfnSetSecKeyIf,(PPDMIMEDIA pInterface, PPDMISECKEY pIfSecKey,
1580 PPDMISECKEYHLP pIfSecKeyHlp));
1581
1582 /**
1583 * Get the media size in bytes.
1584 *
1585 * @returns Media size in bytes.
1586 * @param pInterface Pointer to the interface structure containing the called function pointer.
1587 * @thread Any thread.
1588 */
1589 DECLR3CALLBACKMEMBER(uint64_t, pfnGetSize,(PPDMIMEDIA pInterface));
1590
1591 /**
1592 * Gets the media sector size in bytes.
1593 *
1594 * @returns Media sector size in bytes.
1595 * @param pInterface Pointer to the interface structure containing the called function pointer.
1596 * @thread Any thread.
1597 */
1598 DECLR3CALLBACKMEMBER(uint32_t, pfnGetSectorSize,(PPDMIMEDIA pInterface));
1599
1600 /**
1601 * Check if the media is readonly or not.
1602 *
1603 * @returns true if readonly.
1604 * @returns false if read/write.
1605 * @param pInterface Pointer to the interface structure containing the called function pointer.
1606 * @thread Any thread.
1607 */
1608 DECLR3CALLBACKMEMBER(bool, pfnIsReadOnly,(PPDMIMEDIA pInterface));
1609
1610 /**
1611 * Get stored media geometry (physical CHS, PCHS) - BIOS property.
1612 * This is an optional feature of a media.
1613 *
1614 * @returns VBox status code.
1615 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1616 * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnBiosSetPCHSGeometry() yet.
1617 * @param pInterface Pointer to the interface structure containing the called function pointer.
1618 * @param pPCHSGeometry Pointer to PCHS geometry (cylinders/heads/sectors).
1619 * @remark This has no influence on the read/write operations.
1620 * @thread Any thread.
1621 */
1622 DECLR3CALLBACKMEMBER(int, pfnBiosGetPCHSGeometry,(PPDMIMEDIA pInterface, PPDMMEDIAGEOMETRY pPCHSGeometry));
1623
1624 /**
1625 * Store the media geometry (physical CHS, PCHS) - BIOS property.
1626 * This is an optional feature of a media.
1627 *
1628 * @returns VBox status code.
1629 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1630 * @param pInterface Pointer to the interface structure containing the called function pointer.
1631 * @param pPCHSGeometry Pointer to PCHS geometry (cylinders/heads/sectors).
1632 * @remark This has no influence on the read/write operations.
1633 * @thread The emulation thread.
1634 */
1635 DECLR3CALLBACKMEMBER(int, pfnBiosSetPCHSGeometry,(PPDMIMEDIA pInterface, PCPDMMEDIAGEOMETRY pPCHSGeometry));
1636
1637 /**
1638 * Get stored media geometry (logical CHS, LCHS) - BIOS property.
1639 * This is an optional feature of a media.
1640 *
1641 * @returns VBox status code.
1642 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1643 * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnBiosSetLCHSGeometry() yet.
1644 * @param pInterface Pointer to the interface structure containing the called function pointer.
1645 * @param pLCHSGeometry Pointer to LCHS geometry (cylinders/heads/sectors).
1646 * @remark This has no influence on the read/write operations.
1647 * @thread Any thread.
1648 */
1649 DECLR3CALLBACKMEMBER(int, pfnBiosGetLCHSGeometry,(PPDMIMEDIA pInterface, PPDMMEDIAGEOMETRY pLCHSGeometry));
1650
1651 /**
1652 * Store the media geometry (logical CHS, LCHS) - BIOS property.
1653 * This is an optional feature of a media.
1654 *
1655 * @returns VBox status code.
1656 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1657 * @param pInterface Pointer to the interface structure containing the called function pointer.
1658 * @param pLCHSGeometry Pointer to LCHS geometry (cylinders/heads/sectors).
1659 * @remark This has no influence on the read/write operations.
1660 * @thread The emulation thread.
1661 */
1662 DECLR3CALLBACKMEMBER(int, pfnBiosSetLCHSGeometry,(PPDMIMEDIA pInterface, PCPDMMEDIAGEOMETRY pLCHSGeometry));
1663
1664 /**
1665 * Gets the UUID of the media drive.
1666 *
1667 * @returns VBox status code.
1668 * @param pInterface Pointer to the interface structure containing the called function pointer.
1669 * @param pUuid Where to store the UUID on success.
1670 * @thread Any thread.
1671 */
1672 DECLR3CALLBACKMEMBER(int, pfnGetUuid,(PPDMIMEDIA pInterface, PRTUUID pUuid));
1673
1674 /**
1675 * Discards the given range.
1676 *
1677 * @returns VBox status code.
1678 * @param pInterface Pointer to the interface structure containing the called function pointer.
1679 * @param paRanges Array of ranges to discard.
1680 * @param cRanges Number of entries in the array.
1681 * @thread Any thread.
1682 */
1683 DECLR3CALLBACKMEMBER(int, pfnDiscard,(PPDMIMEDIA pInterface, PCRTRANGE paRanges, unsigned cRanges));
1684
1685 /**
1686 * Allocate buffer memory which is suitable for I/O and might have special proerties for secure
1687 * environments (non-pageable memory for sensitive data which should not end up on the disk).
1688 *
1689 * @returns VBox status code.
1690 * @param pInterface Pointer to the interface structure containing the called function pointer.
1691 * @param cb Amount of memory to allocate.
1692 * @param ppvNew Where to store the pointer to the buffer on success.
1693 */
1694 DECLR3CALLBACKMEMBER(int, pfnIoBufAlloc, (PPDMIMEDIA pInterface, size_t cb, void **ppvNew));
1695
1696 /**
1697 * Free memory allocated with PDMIMEDIA::pfnIoBufAlloc().
1698 *
1699 * @returns VBox status code.
1700 * @param pInterface Pointer to the interface structure containing the called function pointer.
1701 * @param pv Pointer to the memory to free.
1702 * @param cb Amount of bytes given in PDMIMEDIA::pfnIoBufAlloc().
1703 */
1704 DECLR3CALLBACKMEMBER(int, pfnIoBufFree, (PPDMIMEDIA pInterface, void *pv, size_t cb));
1705
1706} PDMIMEDIA;
1707/** PDMIMEDIA interface ID. */
1708#define PDMIMEDIA_IID "d8997ad8-4dda-4352-aa99-99bf87d54102"
1709
1710
1711/** Pointer to a block BIOS interface. */
1712typedef struct PDMIBLOCKBIOS *PPDMIBLOCKBIOS;
1713/**
1714 * Media BIOS interface (Up / External).
1715 * The interface the getting and setting properties which the BIOS/CMOS care about.
1716 */
1717typedef struct PDMIBLOCKBIOS
1718{
1719 /**
1720 * Get stored media geometry (physical CHS, PCHS) - BIOS property.
1721 * This is an optional feature of a media.
1722 *
1723 * @returns VBox status code.
1724 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1725 * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnSetPCHSGeometry() yet.
1726 * @param pInterface Pointer to the interface structure containing the called function pointer.
1727 * @param pPCHSGeometry Pointer to PCHS geometry (cylinders/heads/sectors).
1728 * @remark This has no influence on the read/write operations.
1729 * @thread Any thread.
1730 */
1731 DECLR3CALLBACKMEMBER(int, pfnGetPCHSGeometry,(PPDMIBLOCKBIOS pInterface, PPDMMEDIAGEOMETRY pPCHSGeometry));
1732
1733 /**
1734 * Store the media geometry (physical CHS, PCHS) - BIOS property.
1735 * This is an optional feature of a media.
1736 *
1737 * @returns VBox status code.
1738 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1739 * @param pInterface Pointer to the interface structure containing the called function pointer.
1740 * @param pPCHSGeometry Pointer to PCHS geometry (cylinders/heads/sectors).
1741 * @remark This has no influence on the read/write operations.
1742 * @thread The emulation thread.
1743 */
1744 DECLR3CALLBACKMEMBER(int, pfnSetPCHSGeometry,(PPDMIBLOCKBIOS pInterface, PCPDMMEDIAGEOMETRY pPCHSGeometry));
1745
1746 /**
1747 * Get stored media geometry (logical CHS, LCHS) - BIOS property.
1748 * This is an optional feature of a media.
1749 *
1750 * @returns VBox status code.
1751 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1752 * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnSetLCHSGeometry() yet.
1753 * @param pInterface Pointer to the interface structure containing the called function pointer.
1754 * @param pLCHSGeometry Pointer to LCHS geometry (cylinders/heads/sectors).
1755 * @remark This has no influence on the read/write operations.
1756 * @thread Any thread.
1757 */
1758 DECLR3CALLBACKMEMBER(int, pfnGetLCHSGeometry,(PPDMIBLOCKBIOS pInterface, PPDMMEDIAGEOMETRY pLCHSGeometry));
1759
1760 /**
1761 * Store the media geometry (logical CHS, LCHS) - BIOS property.
1762 * This is an optional feature of a media.
1763 *
1764 * @returns VBox status code.
1765 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1766 * @param pInterface Pointer to the interface structure containing the called function pointer.
1767 * @param pLCHSGeometry Pointer to LCHS geometry (cylinders/heads/sectors).
1768 * @remark This has no influence on the read/write operations.
1769 * @thread The emulation thread.
1770 */
1771 DECLR3CALLBACKMEMBER(int, pfnSetLCHSGeometry,(PPDMIBLOCKBIOS pInterface, PCPDMMEDIAGEOMETRY pLCHSGeometry));
1772
1773 /**
1774 * Checks if the device should be visible to the BIOS or not.
1775 *
1776 * @returns true if the device is visible to the BIOS.
1777 * @returns false if the device is not visible to the BIOS.
1778 * @param pInterface Pointer to the interface structure containing the called function pointer.
1779 * @thread Any thread.
1780 */
1781 DECLR3CALLBACKMEMBER(bool, pfnIsVisible,(PPDMIBLOCKBIOS pInterface));
1782
1783 /**
1784 * Gets the block drive type.
1785 *
1786 * @returns block drive type.
1787 * @param pInterface Pointer to the interface structure containing the called function pointer.
1788 * @thread Any thread.
1789 */
1790 DECLR3CALLBACKMEMBER(PDMBLOCKTYPE, pfnGetType,(PPDMIBLOCKBIOS pInterface));
1791
1792} PDMIBLOCKBIOS;
1793/** PDMIBLOCKBIOS interface ID. */
1794#define PDMIBLOCKBIOS_IID "477c3eee-a48d-48a9-82fd-2a54de16b2e9"
1795
1796
1797/** Pointer to a static block core driver interface. */
1798typedef struct PDMIMEDIASTATIC *PPDMIMEDIASTATIC;
1799/**
1800 * Static block core driver interface.
1801 */
1802typedef struct PDMIMEDIASTATIC
1803{
1804 /**
1805 * Check if the specified file is a format which the core driver can handle.
1806 *
1807 * @returns true / false accordingly.
1808 * @param pInterface Pointer to the interface structure containing the called function pointer.
1809 * @param pszFilename Name of the file to probe.
1810 */
1811 DECLR3CALLBACKMEMBER(bool, pfnCanHandle,(PPDMIMEDIASTATIC pInterface, const char *pszFilename));
1812} PDMIMEDIASTATIC;
1813
1814
1815
1816
1817
1818/** Pointer to an asynchronous block notify interface. */
1819typedef struct PDMIBLOCKASYNCPORT *PPDMIBLOCKASYNCPORT;
1820/**
1821 * Asynchronous block notify interface (up).
1822 * Pair with PDMIBLOCKASYNC.
1823 */
1824typedef struct PDMIBLOCKASYNCPORT
1825{
1826 /**
1827 * Notify completion of an asynchronous transfer.
1828 *
1829 * @returns VBox status code.
1830 * @param pInterface Pointer to the interface structure containing the called function pointer.
1831 * @param pvUser The user argument given in pfnStartWrite/Read.
1832 * @param rcReq IPRT Status code of the completed request.
1833 * @thread Any thread.
1834 */
1835 DECLR3CALLBACKMEMBER(int, pfnTransferCompleteNotify, (PPDMIBLOCKASYNCPORT pInterface, void *pvUser, int rcReq));
1836} PDMIBLOCKASYNCPORT;
1837/** PDMIBLOCKASYNCPORT interface ID. */
1838#define PDMIBLOCKASYNCPORT_IID "e3bdc0cb-9d99-41dd-8eec-0dc8cf5b2a92"
1839
1840
1841
1842/** Pointer to an asynchronous block interface. */
1843typedef struct PDMIBLOCKASYNC *PPDMIBLOCKASYNC;
1844/**
1845 * Asynchronous block interface (down).
1846 * Pair with PDMIBLOCKASYNCPORT.
1847 */
1848typedef struct PDMIBLOCKASYNC
1849{
1850 /**
1851 * Start reading task.
1852 *
1853 * @returns VBox status code.
1854 * @param pInterface Pointer to the interface structure containing the called function pointer.
1855 * @param off Offset to start reading from.c
1856 * @param paSegs Pointer to the S/G segment array.
1857 * @param cSegs Number of entries in the array.
1858 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary.
1859 * @param pvUser User argument which is returned in completion callback.
1860 * @thread Any thread.
1861 */
1862 DECLR3CALLBACKMEMBER(int, pfnStartRead,(PPDMIBLOCKASYNC pInterface, uint64_t off, PCRTSGSEG paSegs, unsigned cSegs, size_t cbRead, void *pvUser));
1863
1864 /**
1865 * Write bits.
1866 *
1867 * @returns VBox status code.
1868 * @param pInterface Pointer to the interface structure containing the called function pointer.
1869 * @param off Offset to start writing at. The offset must be aligned to a sector boundary.
1870 * @param paSegs Pointer to the S/G segment array.
1871 * @param cSegs Number of entries in the array.
1872 * @param cbWrite Number of bytes to write. Must be aligned to a sector boundary.
1873 * @param pvUser User argument which is returned in completion callback.
1874 * @thread Any thread.
1875 */
1876 DECLR3CALLBACKMEMBER(int, pfnStartWrite,(PPDMIBLOCKASYNC pInterface, uint64_t off, PCRTSGSEG paSegs, unsigned cSegs, size_t cbWrite, void *pvUser));
1877
1878 /**
1879 * Flush everything to disk.
1880 *
1881 * @returns VBox status code.
1882 * @param pInterface Pointer to the interface structure containing the called function pointer.
1883 * @param pvUser User argument which is returned in completion callback.
1884 * @thread Any thread.
1885 */
1886 DECLR3CALLBACKMEMBER(int, pfnStartFlush,(PPDMIBLOCKASYNC pInterface, void *pvUser));
1887
1888 /**
1889 * Discards the given range.
1890 *
1891 * @returns VBox status code.
1892 * @param pInterface Pointer to the interface structure containing the called function pointer.
1893 * @param paRanges Array of ranges to discard.
1894 * @param cRanges Number of entries in the array.
1895 * @param pvUser User argument which is returned in completion callback.
1896 * @thread Any thread.
1897 */
1898 DECLR3CALLBACKMEMBER(int, pfnStartDiscard,(PPDMIBLOCKASYNC pInterface, PCRTRANGE paRanges, unsigned cRanges, void *pvUser));
1899
1900} PDMIBLOCKASYNC;
1901/** PDMIBLOCKASYNC interface ID. */
1902#define PDMIBLOCKASYNC_IID "a921dd96-1748-4ecd-941e-d5f3cd4c8fe4"
1903
1904
1905/** Pointer to an asynchronous notification interface. */
1906typedef struct PDMIMEDIAASYNCPORT *PPDMIMEDIAASYNCPORT;
1907/**
1908 * Asynchronous version of the media interface (up).
1909 * Pair with PDMIMEDIAASYNC.
1910 */
1911typedef struct PDMIMEDIAASYNCPORT
1912{
1913 /**
1914 * Notify completion of a task.
1915 *
1916 * @returns VBox status code.
1917 * @param pInterface Pointer to the interface structure containing the called function pointer.
1918 * @param pvUser The user argument given in pfnStartWrite.
1919 * @param rcReq IPRT Status code of the completed request.
1920 * @thread Any thread.
1921 */
1922 DECLR3CALLBACKMEMBER(int, pfnTransferCompleteNotify, (PPDMIMEDIAASYNCPORT pInterface, void *pvUser, int rcReq));
1923} PDMIMEDIAASYNCPORT;
1924/** PDMIMEDIAASYNCPORT interface ID. */
1925#define PDMIMEDIAASYNCPORT_IID "22d38853-901f-4a71-9670-4d9da6e82317"
1926
1927
1928/** Pointer to an asynchronous media interface. */
1929typedef struct PDMIMEDIAASYNC *PPDMIMEDIAASYNC;
1930/**
1931 * Asynchronous version of PDMIMEDIA (down).
1932 * Pair with PDMIMEDIAASYNCPORT.
1933 */
1934typedef struct PDMIMEDIAASYNC
1935{
1936 /**
1937 * Start reading task.
1938 *
1939 * @returns VBox status code.
1940 * @param pInterface Pointer to the interface structure containing the called function pointer.
1941 * @param off Offset to start reading from. Must be aligned to a sector boundary.
1942 * @param paSegs Pointer to the S/G segment array.
1943 * @param cSegs Number of entries in the array.
1944 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary.
1945 * @param pvUser User data.
1946 * @thread Any thread.
1947 */
1948 DECLR3CALLBACKMEMBER(int, pfnStartRead,(PPDMIMEDIAASYNC pInterface, uint64_t off, PCRTSGSEG paSegs, unsigned cSegs, size_t cbRead, void *pvUser));
1949
1950 /**
1951 * Start writing task.
1952 *
1953 * @returns VBox status code.
1954 * @param pInterface Pointer to the interface structure containing the called function pointer.
1955 * @param off Offset to start writing at. Must be aligned to a sector boundary.
1956 * @param paSegs Pointer to the S/G segment array.
1957 * @param cSegs Number of entries in the array.
1958 * @param cbWrite Number of bytes to write. Must be aligned to a sector boundary.
1959 * @param pvUser User data.
1960 * @thread Any thread.
1961 */
1962 DECLR3CALLBACKMEMBER(int, pfnStartWrite,(PPDMIMEDIAASYNC pInterface, uint64_t off, PCRTSGSEG paSegs, unsigned cSegs, size_t cbWrite, void *pvUser));
1963
1964 /**
1965 * Flush everything to disk.
1966 *
1967 * @returns VBox status code.
1968 * @param pInterface Pointer to the interface structure containing the called function pointer.
1969 * @param pvUser User argument which is returned in completion callback.
1970 * @thread Any thread.
1971 */
1972 DECLR3CALLBACKMEMBER(int, pfnStartFlush,(PPDMIMEDIAASYNC pInterface, void *pvUser));
1973
1974 /**
1975 * Discards the given range.
1976 *
1977 * @returns VBox status code.
1978 * @param pInterface Pointer to the interface structure containing the called function pointer.
1979 * @param paRanges Array of ranges to discard.
1980 * @param cRanges Number of entries in the array.
1981 * @param pvUser User argument which is returned in completion callback.
1982 * @thread Any thread.
1983 */
1984 DECLR3CALLBACKMEMBER(int, pfnStartDiscard,(PPDMIMEDIAASYNC pInterface, PCRTRANGE paRanges, unsigned cRanges, void *pvUser));
1985
1986} PDMIMEDIAASYNC;
1987/** PDMIMEDIAASYNC interface ID. */
1988#define PDMIMEDIAASYNC_IID "4be209d3-ccb5-4297-82fe-7d8018bc6ab4"
1989
1990
1991/** Pointer to a char port interface. */
1992typedef struct PDMICHARPORT *PPDMICHARPORT;
1993/**
1994 * Char port interface (down).
1995 * Pair with PDMICHARCONNECTOR.
1996 */
1997typedef struct PDMICHARPORT
1998{
1999 /**
2000 * Deliver data read to the device/driver.
2001 *
2002 * @returns VBox status code.
2003 * @param pInterface Pointer to the interface structure containing the called function pointer.
2004 * @param pvBuf Where the read bits are stored.
2005 * @param pcbRead Number of bytes available for reading/having been read.
2006 * @thread Any thread.
2007 */
2008 DECLR3CALLBACKMEMBER(int, pfnNotifyRead,(PPDMICHARPORT pInterface, const void *pvBuf, size_t *pcbRead));
2009
2010 /**
2011 * Notify the device/driver when the status lines changed.
2012 *
2013 * @returns VBox status code.
2014 * @param pInterface Pointer to the interface structure containing the called function pointer.
2015 * @param fNewStatusLine New state of the status line pins.
2016 * @thread Any thread.
2017 */
2018 DECLR3CALLBACKMEMBER(int, pfnNotifyStatusLinesChanged,(PPDMICHARPORT pInterface, uint32_t fNewStatusLines));
2019
2020 /**
2021 * Notify the device when the driver buffer is full.
2022 *
2023 * @returns VBox status code.
2024 * @param pInterface Pointer to the interface structure containing the called function pointer.
2025 * @param fFull Buffer full.
2026 * @thread Any thread.
2027 */
2028 DECLR3CALLBACKMEMBER(int, pfnNotifyBufferFull,(PPDMICHARPORT pInterface, bool fFull));
2029
2030 /**
2031 * Notify the device/driver that a break occurred.
2032 *
2033 * @returns VBox statsus code.
2034 * @param pInterface Pointer to the interface structure containing the called function pointer.
2035 * @thread Any thread.
2036 */
2037 DECLR3CALLBACKMEMBER(int, pfnNotifyBreak,(PPDMICHARPORT pInterface));
2038} PDMICHARPORT;
2039/** PDMICHARPORT interface ID. */
2040#define PDMICHARPORT_IID "22769834-ea8b-4a6d-ade1-213dcdbd1228"
2041
2042/** @name Bit mask definitions for status line type.
2043 * @{ */
2044#define PDMICHARPORT_STATUS_LINES_DCD RT_BIT(0)
2045#define PDMICHARPORT_STATUS_LINES_RI RT_BIT(1)
2046#define PDMICHARPORT_STATUS_LINES_DSR RT_BIT(2)
2047#define PDMICHARPORT_STATUS_LINES_CTS RT_BIT(3)
2048/** @} */
2049
2050
2051/** Pointer to a char interface. */
2052typedef struct PDMICHARCONNECTOR *PPDMICHARCONNECTOR;
2053/**
2054 * Char connector interface (up).
2055 * Pair with PDMICHARPORT.
2056 */
2057typedef struct PDMICHARCONNECTOR
2058{
2059 /**
2060 * Write bits.
2061 *
2062 * @returns VBox status code.
2063 * @param pInterface Pointer to the interface structure containing the called function pointer.
2064 * @param pvBuf Where to store the write bits.
2065 * @param cbWrite Number of bytes to write.
2066 * @thread Any thread.
2067 */
2068 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMICHARCONNECTOR pInterface, const void *pvBuf, size_t cbWrite));
2069
2070 /**
2071 * Set device parameters.
2072 *
2073 * @returns VBox status code.
2074 * @param pInterface Pointer to the interface structure containing the called function pointer.
2075 * @param Bps Speed of the serial connection. (bits per second)
2076 * @param chParity Parity method: 'E' - even, 'O' - odd, 'N' - none.
2077 * @param cDataBits Number of data bits.
2078 * @param cStopBits Number of stop bits.
2079 * @thread Any thread.
2080 */
2081 DECLR3CALLBACKMEMBER(int, pfnSetParameters,(PPDMICHARCONNECTOR pInterface, unsigned Bps, char chParity, unsigned cDataBits, unsigned cStopBits));
2082
2083 /**
2084 * Set the state of the modem lines.
2085 *
2086 * @returns VBox status code.
2087 * @param pInterface Pointer to the interface structure containing the called function pointer.
2088 * @param fRequestToSend Set to true to make the Request to Send line active otherwise to 0.
2089 * @param fDataTerminalReady Set to true to make the Data Terminal Ready line active otherwise 0.
2090 * @thread Any thread.
2091 */
2092 DECLR3CALLBACKMEMBER(int, pfnSetModemLines,(PPDMICHARCONNECTOR pInterface, bool fRequestToSend, bool fDataTerminalReady));
2093
2094 /**
2095 * Sets the TD line into break condition.
2096 *
2097 * @returns VBox status code.
2098 * @param pInterface Pointer to the interface structure containing the called function pointer.
2099 * @param fBreak Set to true to let the device send a break false to put into normal operation.
2100 * @thread Any thread.
2101 */
2102 DECLR3CALLBACKMEMBER(int, pfnSetBreak,(PPDMICHARCONNECTOR pInterface, bool fBreak));
2103} PDMICHARCONNECTOR;
2104/** PDMICHARCONNECTOR interface ID. */
2105#define PDMICHARCONNECTOR_IID "4ad5c190-b408-4cef-926f-fbffce0dc5cc"
2106
2107
2108/** Pointer to a stream interface. */
2109typedef struct PDMISTREAM *PPDMISTREAM;
2110/**
2111 * Stream interface (up).
2112 * Makes up the foundation for PDMICHARCONNECTOR. No pair interface.
2113 */
2114typedef struct PDMISTREAM
2115{
2116 /**
2117 * Read bits.
2118 *
2119 * @returns VBox status code.
2120 * @param pInterface Pointer to the interface structure containing the called function pointer.
2121 * @param pvBuf Where to store the read bits.
2122 * @param cbRead Number of bytes to read/bytes actually read.
2123 * @thread Any thread.
2124 */
2125 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMISTREAM pInterface, void *pvBuf, size_t *cbRead));
2126
2127 /**
2128 * Write bits.
2129 *
2130 * @returns VBox status code.
2131 * @param pInterface Pointer to the interface structure containing the called function pointer.
2132 * @param pvBuf Where to store the write bits.
2133 * @param cbWrite Number of bytes to write/bytes actually written.
2134 * @thread Any thread.
2135 */
2136 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMISTREAM pInterface, const void *pvBuf, size_t *cbWrite));
2137} PDMISTREAM;
2138/** PDMISTREAM interface ID. */
2139#define PDMISTREAM_IID "d1a5bf5e-3d2c-449a-bde9-addd7920b71f"
2140
2141
2142/** Mode of the parallel port */
2143typedef enum PDMPARALLELPORTMODE
2144{
2145 /** First invalid mode. */
2146 PDM_PARALLEL_PORT_MODE_INVALID = 0,
2147 /** SPP (Compatibility mode). */
2148 PDM_PARALLEL_PORT_MODE_SPP,
2149 /** EPP Data mode. */
2150 PDM_PARALLEL_PORT_MODE_EPP_DATA,
2151 /** EPP Address mode. */
2152 PDM_PARALLEL_PORT_MODE_EPP_ADDR,
2153 /** ECP mode (not implemented yet). */
2154 PDM_PARALLEL_PORT_MODE_ECP,
2155 /** 32bit hack. */
2156 PDM_PARALLEL_PORT_MODE_32BIT_HACK = 0x7fffffff
2157} PDMPARALLELPORTMODE;
2158
2159/** Pointer to a host parallel port interface. */
2160typedef struct PDMIHOSTPARALLELPORT *PPDMIHOSTPARALLELPORT;
2161/**
2162 * Host parallel port interface (down).
2163 * Pair with PDMIHOSTPARALLELCONNECTOR.
2164 */
2165typedef struct PDMIHOSTPARALLELPORT
2166{
2167 /**
2168 * Notify device/driver that an interrupt has occurred.
2169 *
2170 * @returns VBox status code.
2171 * @param pInterface Pointer to the interface structure containing the called function pointer.
2172 * @thread Any thread.
2173 */
2174 DECLR3CALLBACKMEMBER(int, pfnNotifyInterrupt,(PPDMIHOSTPARALLELPORT pInterface));
2175} PDMIHOSTPARALLELPORT;
2176/** PDMIHOSTPARALLELPORT interface ID. */
2177#define PDMIHOSTPARALLELPORT_IID "f24b8668-e7f6-4eaa-a14c-4aa2a5f7048e"
2178
2179
2180
2181/** Pointer to a Host Parallel connector interface. */
2182typedef struct PDMIHOSTPARALLELCONNECTOR *PPDMIHOSTPARALLELCONNECTOR;
2183/**
2184 * Host parallel connector interface (up).
2185 * Pair with PDMIHOSTPARALLELPORT.
2186 */
2187typedef struct PDMIHOSTPARALLELCONNECTOR
2188{
2189 /**
2190 * Write bits.
2191 *
2192 * @returns VBox status code.
2193 * @param pInterface Pointer to the interface structure containing the called function pointer.
2194 * @param pvBuf Where to store the write bits.
2195 * @param cbWrite Number of bytes to write.
2196 * @param enmMode Mode to write the data.
2197 * @thread Any thread.
2198 * @todo r=klaus cbWrite only defines buffer length, method needs a way top return actually written amount of data.
2199 */
2200 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIHOSTPARALLELCONNECTOR pInterface, const void *pvBuf,
2201 size_t cbWrite, PDMPARALLELPORTMODE enmMode));
2202
2203 /**
2204 * Read bits.
2205 *
2206 * @returns VBox status code.
2207 * @param pInterface Pointer to the interface structure containing the called function pointer.
2208 * @param pvBuf Where to store the read bits.
2209 * @param cbRead Number of bytes to read.
2210 * @param enmMode Mode to read the data.
2211 * @thread Any thread.
2212 * @todo r=klaus cbRead only defines buffer length, method needs a way top return actually read amount of data.
2213 */
2214 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIHOSTPARALLELCONNECTOR pInterface, void *pvBuf,
2215 size_t cbRead, PDMPARALLELPORTMODE enmMode));
2216
2217 /**
2218 * Set data direction of the port (forward/reverse).
2219 *
2220 * @returns VBox status code.
2221 * @param pInterface Pointer to the interface structure containing the called function pointer.
2222 * @param fForward Flag whether to indicate whether the port is operated in forward or reverse mode.
2223 * @thread Any thread.
2224 */
2225 DECLR3CALLBACKMEMBER(int, pfnSetPortDirection,(PPDMIHOSTPARALLELCONNECTOR pInterface, bool fForward));
2226
2227 /**
2228 * Write control register bits.
2229 *
2230 * @returns VBox status code.
2231 * @param pInterface Pointer to the interface structure containing the called function pointer.
2232 * @param fReg The new control register value.
2233 * @thread Any thread.
2234 */
2235 DECLR3CALLBACKMEMBER(int, pfnWriteControl,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t fReg));
2236
2237 /**
2238 * Read control register bits.
2239 *
2240 * @returns VBox status code.
2241 * @param pInterface Pointer to the interface structure containing the called function pointer.
2242 * @param pfReg Where to store the control register bits.
2243 * @thread Any thread.
2244 */
2245 DECLR3CALLBACKMEMBER(int, pfnReadControl,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t *pfReg));
2246
2247 /**
2248 * Read status register bits.
2249 *
2250 * @returns VBox status code.
2251 * @param pInterface Pointer to the interface structure containing the called function pointer.
2252 * @param pfReg Where to store the status register bits.
2253 * @thread Any thread.
2254 */
2255 DECLR3CALLBACKMEMBER(int, pfnReadStatus,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t *pfReg));
2256
2257} PDMIHOSTPARALLELCONNECTOR;
2258/** PDMIHOSTPARALLELCONNECTOR interface ID. */
2259#define PDMIHOSTPARALLELCONNECTOR_IID "7c532602-7438-4fbc-9265-349d9f0415f9"
2260
2261
2262/** ACPI power source identifier */
2263typedef enum PDMACPIPOWERSOURCE
2264{
2265 PDM_ACPI_POWER_SOURCE_UNKNOWN = 0,
2266 PDM_ACPI_POWER_SOURCE_OUTLET,
2267 PDM_ACPI_POWER_SOURCE_BATTERY
2268} PDMACPIPOWERSOURCE;
2269/** Pointer to ACPI battery state. */
2270typedef PDMACPIPOWERSOURCE *PPDMACPIPOWERSOURCE;
2271
2272/** ACPI battey capacity */
2273typedef enum PDMACPIBATCAPACITY
2274{
2275 PDM_ACPI_BAT_CAPACITY_MIN = 0,
2276 PDM_ACPI_BAT_CAPACITY_MAX = 100,
2277 PDM_ACPI_BAT_CAPACITY_UNKNOWN = 255
2278} PDMACPIBATCAPACITY;
2279/** Pointer to ACPI battery capacity. */
2280typedef PDMACPIBATCAPACITY *PPDMACPIBATCAPACITY;
2281
2282/** ACPI battery state. See ACPI 3.0 spec '_BST (Battery Status)' */
2283typedef enum PDMACPIBATSTATE
2284{
2285 PDM_ACPI_BAT_STATE_CHARGED = 0x00,
2286 PDM_ACPI_BAT_STATE_DISCHARGING = 0x01,
2287 PDM_ACPI_BAT_STATE_CHARGING = 0x02,
2288 PDM_ACPI_BAT_STATE_CRITICAL = 0x04
2289} PDMACPIBATSTATE;
2290/** Pointer to ACPI battery state. */
2291typedef PDMACPIBATSTATE *PPDMACPIBATSTATE;
2292
2293/** Pointer to an ACPI port interface. */
2294typedef struct PDMIACPIPORT *PPDMIACPIPORT;
2295/**
2296 * ACPI port interface (down). Used by both the ACPI driver and (grumble) main.
2297 * Pair with PDMIACPICONNECTOR.
2298 */
2299typedef struct PDMIACPIPORT
2300{
2301 /**
2302 * Send an ACPI power off event.
2303 *
2304 * @returns VBox status code
2305 * @param pInterface Pointer to the interface structure containing the called function pointer.
2306 */
2307 DECLR3CALLBACKMEMBER(int, pfnPowerButtonPress,(PPDMIACPIPORT pInterface));
2308
2309 /**
2310 * Send an ACPI sleep button event.
2311 *
2312 * @returns VBox status code
2313 * @param pInterface Pointer to the interface structure containing the called function pointer.
2314 */
2315 DECLR3CALLBACKMEMBER(int, pfnSleepButtonPress,(PPDMIACPIPORT pInterface));
2316
2317 /**
2318 * Check if the last power button event was handled by the guest.
2319 *
2320 * @returns VBox status code
2321 * @param pInterface Pointer to the interface structure containing the called function pointer.
2322 * @param pfHandled Is set to true if the last power button event was handled, false otherwise.
2323 */
2324 DECLR3CALLBACKMEMBER(int, pfnGetPowerButtonHandled,(PPDMIACPIPORT pInterface, bool *pfHandled));
2325
2326 /**
2327 * Check if the guest entered the ACPI mode.
2328 *
2329 * @returns VBox status code
2330 * @param pInterface Pointer to the interface structure containing the called function pointer.
2331 * @param pfEnabled Is set to true if the guest entered the ACPI mode, false otherwise.
2332 */
2333 DECLR3CALLBACKMEMBER(int, pfnGetGuestEnteredACPIMode,(PPDMIACPIPORT pInterface, bool *pfEntered));
2334
2335 /**
2336 * Check if the given CPU is still locked by the guest.
2337 *
2338 * @returns VBox status code
2339 * @param pInterface Pointer to the interface structure containing the called function pointer.
2340 * @param uCpu The CPU to check for.
2341 * @param pfLocked Is set to true if the CPU is still locked by the guest, false otherwise.
2342 */
2343 DECLR3CALLBACKMEMBER(int, pfnGetCpuStatus,(PPDMIACPIPORT pInterface, unsigned uCpu, bool *pfLocked));
2344
2345 /**
2346 * Send an ACPI monitor hot-plug event.
2347 *
2348 * @returns VBox status code
2349 * @param pInterface Pointer to the interface structure containing
2350 * the called function pointer.
2351 */
2352 DECLR3CALLBACKMEMBER(int, pfnMonitorHotPlugEvent,(PPDMIACPIPORT pInterface));
2353} PDMIACPIPORT;
2354/** PDMIACPIPORT interface ID. */
2355#define PDMIACPIPORT_IID "d64233e3-7bb0-4ef1-a313-2bcfafbe6260"
2356
2357
2358/** Pointer to an ACPI connector interface. */
2359typedef struct PDMIACPICONNECTOR *PPDMIACPICONNECTOR;
2360/**
2361 * ACPI connector interface (up).
2362 * Pair with PDMIACPIPORT.
2363 */
2364typedef struct PDMIACPICONNECTOR
2365{
2366 /**
2367 * Get the current power source of the host system.
2368 *
2369 * @returns VBox status code
2370 * @param pInterface Pointer to the interface structure containing the called function pointer.
2371 * @param penmPowerSource Pointer to the power source result variable.
2372 */
2373 DECLR3CALLBACKMEMBER(int, pfnQueryPowerSource,(PPDMIACPICONNECTOR, PPDMACPIPOWERSOURCE penmPowerSource));
2374
2375 /**
2376 * Query the current battery status of the host system.
2377 *
2378 * @returns VBox status code?
2379 * @param pInterface Pointer to the interface structure containing the called function pointer.
2380 * @param pfPresent Is set to true if battery is present, false otherwise.
2381 * @param penmRemainingCapacity Pointer to the battery remaining capacity (0 - 100 or 255 for unknown).
2382 * @param penmBatteryState Pointer to the battery status.
2383 * @param pu32PresentRate Pointer to the present rate (0..1000 of the total capacity).
2384 */
2385 DECLR3CALLBACKMEMBER(int, pfnQueryBatteryStatus,(PPDMIACPICONNECTOR, bool *pfPresent, PPDMACPIBATCAPACITY penmRemainingCapacity,
2386 PPDMACPIBATSTATE penmBatteryState, uint32_t *pu32PresentRate));
2387} PDMIACPICONNECTOR;
2388/** PDMIACPICONNECTOR interface ID. */
2389#define PDMIACPICONNECTOR_IID "5f14bf8d-1edf-4e3a-a1e1-cca9fd08e359"
2390
2391
2392/** Pointer to a VMMDevice port interface. */
2393typedef struct PDMIVMMDEVPORT *PPDMIVMMDEVPORT;
2394/**
2395 * VMMDevice port interface (down).
2396 * Pair with PDMIVMMDEVCONNECTOR.
2397 */
2398typedef struct PDMIVMMDEVPORT
2399{
2400 /**
2401 * Return the current absolute mouse position in pixels
2402 *
2403 * @returns VBox status code
2404 * @param pInterface Pointer to the interface structure containing the called function pointer.
2405 * @param pxAbs Pointer of result value, can be NULL
2406 * @param pyAbs Pointer of result value, can be NULL
2407 */
2408 DECLR3CALLBACKMEMBER(int, pfnQueryAbsoluteMouse,(PPDMIVMMDEVPORT pInterface, int32_t *pxAbs, int32_t *pyAbs));
2409
2410 /**
2411 * Set the new absolute mouse position in pixels
2412 *
2413 * @returns VBox status code
2414 * @param pInterface Pointer to the interface structure containing the called function pointer.
2415 * @param xabs New absolute X position
2416 * @param yAbs New absolute Y position
2417 */
2418 DECLR3CALLBACKMEMBER(int, pfnSetAbsoluteMouse,(PPDMIVMMDEVPORT pInterface, int32_t xAbs, int32_t yAbs));
2419
2420 /**
2421 * Return the current mouse capability flags
2422 *
2423 * @returns VBox status code
2424 * @param pInterface Pointer to the interface structure containing the called function pointer.
2425 * @param pfCapabilities Pointer of result value
2426 */
2427 DECLR3CALLBACKMEMBER(int, pfnQueryMouseCapabilities,(PPDMIVMMDEVPORT pInterface, uint32_t *pfCapabilities));
2428
2429 /**
2430 * Set the current mouse capability flag (host side)
2431 *
2432 * @returns VBox status code
2433 * @param pInterface Pointer to the interface structure containing the called function pointer.
2434 * @param fCapsAdded Mask of capabilities to add to the flag
2435 * @param fCapsRemoved Mask of capabilities to remove from the flag
2436 */
2437 DECLR3CALLBACKMEMBER(int, pfnUpdateMouseCapabilities,(PPDMIVMMDEVPORT pInterface, uint32_t fCapsAdded, uint32_t fCapsRemoved));
2438
2439 /**
2440 * Issue a display resolution change request.
2441 *
2442 * Note that there can only one request in the queue and that in case the guest does
2443 * not process it, issuing another request will overwrite the previous.
2444 *
2445 * @returns VBox status code
2446 * @param pInterface Pointer to the interface structure containing the called function pointer.
2447 * @param cx Horizontal pixel resolution (0 = do not change).
2448 * @param cy Vertical pixel resolution (0 = do not change).
2449 * @param cBits Bits per pixel (0 = do not change).
2450 * @param idxDisplay The display index.
2451 * @param xOrigin The X coordinate of the lower left
2452 * corner of the secondary display with
2453 * ID = idxDisplay
2454 * @param yOrigin The Y coordinate of the lower left
2455 * corner of the secondary display with
2456 * ID = idxDisplay
2457 * @param fEnabled Whether the display is enabled or not. (Guessing
2458 * again.)
2459 * @param fChangeOrigin Whether the display origin point changed. (Guess)
2460 */
2461 DECLR3CALLBACKMEMBER(int, pfnRequestDisplayChange,(PPDMIVMMDEVPORT pInterface, uint32_t cx,
2462 uint32_t cy, uint32_t cBits, uint32_t idxDisplay,
2463 int32_t xOrigin, int32_t yOrigin, bool fEnabled, bool fChangeOrigin));
2464
2465 /**
2466 * Pass credentials to guest.
2467 *
2468 * Note that there can only be one set of credentials and the guest may or may not
2469 * query them and may do whatever it wants with them.
2470 *
2471 * @returns VBox status code.
2472 * @param pInterface Pointer to the interface structure containing the called function pointer.
2473 * @param pszUsername User name, may be empty (UTF-8).
2474 * @param pszPassword Password, may be empty (UTF-8).
2475 * @param pszDomain Domain name, may be empty (UTF-8).
2476 * @param fFlags VMMDEV_SETCREDENTIALS_*.
2477 */
2478 DECLR3CALLBACKMEMBER(int, pfnSetCredentials,(PPDMIVMMDEVPORT pInterface, const char *pszUsername,
2479 const char *pszPassword, const char *pszDomain,
2480 uint32_t fFlags));
2481
2482 /**
2483 * Notify the driver about a VBVA status change.
2484 *
2485 * @returns Nothing. Because it is informational callback.
2486 * @param pInterface Pointer to the interface structure containing the called function pointer.
2487 * @param fEnabled Current VBVA status.
2488 */
2489 DECLR3CALLBACKMEMBER(void, pfnVBVAChange, (PPDMIVMMDEVPORT pInterface, bool fEnabled));
2490
2491 /**
2492 * Issue a seamless mode change request.
2493 *
2494 * Note that there can only one request in the queue and that in case the guest does
2495 * not process it, issuing another request will overwrite the previous.
2496 *
2497 * @returns VBox status code
2498 * @param pInterface Pointer to the interface structure containing the called function pointer.
2499 * @param fEnabled Seamless mode enabled or not
2500 */
2501 DECLR3CALLBACKMEMBER(int, pfnRequestSeamlessChange,(PPDMIVMMDEVPORT pInterface, bool fEnabled));
2502
2503 /**
2504 * Issue a memory balloon change request.
2505 *
2506 * Note that there can only one request in the queue and that in case the guest does
2507 * not process it, issuing another request will overwrite the previous.
2508 *
2509 * @returns VBox status code
2510 * @param pInterface Pointer to the interface structure containing the called function pointer.
2511 * @param cMbBalloon Balloon size in megabytes
2512 */
2513 DECLR3CALLBACKMEMBER(int, pfnSetMemoryBalloon,(PPDMIVMMDEVPORT pInterface, uint32_t cMbBalloon));
2514
2515 /**
2516 * Issue a statistcs interval change request.
2517 *
2518 * Note that there can only one request in the queue and that in case the guest does
2519 * not process it, issuing another request will overwrite the previous.
2520 *
2521 * @returns VBox status code
2522 * @param pInterface Pointer to the interface structure containing the called function pointer.
2523 * @param cSecsStatInterval Statistics query interval in seconds
2524 * (0=disable).
2525 */
2526 DECLR3CALLBACKMEMBER(int, pfnSetStatisticsInterval,(PPDMIVMMDEVPORT pInterface, uint32_t cSecsStatInterval));
2527
2528 /**
2529 * Notify the guest about a VRDP status change.
2530 *
2531 * @returns VBox status code
2532 * @param pInterface Pointer to the interface structure containing the called function pointer.
2533 * @param fVRDPEnabled Current VRDP status.
2534 * @param uVRDPExperienceLevel Which visual effects to be disabled in
2535 * the guest.
2536 */
2537 DECLR3CALLBACKMEMBER(int, pfnVRDPChange, (PPDMIVMMDEVPORT pInterface, bool fVRDPEnabled, uint32_t uVRDPExperienceLevel));
2538
2539 /**
2540 * Notify the guest of CPU hot-unplug event.
2541 *
2542 * @returns VBox status code
2543 * @param pInterface Pointer to the interface structure containing the called function pointer.
2544 * @param idCpuCore The core id of the CPU to remove.
2545 * @param idCpuPackage The package id of the CPU to remove.
2546 */
2547 DECLR3CALLBACKMEMBER(int, pfnCpuHotUnplug, (PPDMIVMMDEVPORT pInterface, uint32_t idCpuCore, uint32_t idCpuPackage));
2548
2549 /**
2550 * Notify the guest of CPU hot-plug event.
2551 *
2552 * @returns VBox status code
2553 * @param pInterface Pointer to the interface structure containing the called function pointer.
2554 * @param idCpuCore The core id of the CPU to add.
2555 * @param idCpuPackage The package id of the CPU to add.
2556 */
2557 DECLR3CALLBACKMEMBER(int, pfnCpuHotPlug, (PPDMIVMMDEVPORT pInterface, uint32_t idCpuCore, uint32_t idCpuPackage));
2558
2559} PDMIVMMDEVPORT;
2560/** PDMIVMMDEVPORT interface ID. */
2561#define PDMIVMMDEVPORT_IID "d7e52035-3b6c-422e-9215-2a75646a945d"
2562
2563
2564/** Pointer to a HPET legacy notification interface. */
2565typedef struct PDMIHPETLEGACYNOTIFY *PPDMIHPETLEGACYNOTIFY;
2566/**
2567 * HPET legacy notification interface.
2568 */
2569typedef struct PDMIHPETLEGACYNOTIFY
2570{
2571 /**
2572 * Notify about change of HPET legacy mode.
2573 *
2574 * @param pInterface Pointer to the interface structure containing the
2575 * called function pointer.
2576 * @param fActivated If HPET legacy mode is activated (@c true) or
2577 * deactivated (@c false).
2578 */
2579 DECLR3CALLBACKMEMBER(void, pfnModeChanged,(PPDMIHPETLEGACYNOTIFY pInterface, bool fActivated));
2580} PDMIHPETLEGACYNOTIFY;
2581/** PDMIHPETLEGACYNOTIFY interface ID. */
2582#define PDMIHPETLEGACYNOTIFY_IID "c9ada595-4b65-4311-8b21-b10498997774"
2583
2584
2585/** @name Flags for PDMIVMMDEVPORT::pfnSetCredentials.
2586 * @{ */
2587/** The guest should perform a logon with the credentials. */
2588#define VMMDEV_SETCREDENTIALS_GUESTLOGON RT_BIT(0)
2589/** The guest should prevent local logons. */
2590#define VMMDEV_SETCREDENTIALS_NOLOCALLOGON RT_BIT(1)
2591/** The guest should verify the credentials. */
2592#define VMMDEV_SETCREDENTIALS_JUDGE RT_BIT(15)
2593/** @} */
2594
2595/** Forward declaration of the guest information structure. */
2596struct VBoxGuestInfo;
2597/** Forward declaration of the guest information-2 structure. */
2598struct VBoxGuestInfo2;
2599/** Forward declaration of the guest statistics structure */
2600struct VBoxGuestStatistics;
2601/** Forward declaration of the guest status structure */
2602struct VBoxGuestStatus;
2603
2604/** Forward declaration of the video accelerator command memory. */
2605struct VBVAMEMORY;
2606/** Pointer to video accelerator command memory. */
2607typedef struct VBVAMEMORY *PVBVAMEMORY;
2608
2609/** Pointer to a VMMDev connector interface. */
2610typedef struct PDMIVMMDEVCONNECTOR *PPDMIVMMDEVCONNECTOR;
2611/**
2612 * VMMDev connector interface (up).
2613 * Pair with PDMIVMMDEVPORT.
2614 */
2615typedef struct PDMIVMMDEVCONNECTOR
2616{
2617 /**
2618 * Update guest facility status.
2619 *
2620 * Called in response to VMMDevReq_ReportGuestStatus, reset or state restore.
2621 *
2622 * @param pInterface Pointer to this interface.
2623 * @param uFacility The facility.
2624 * @param uStatus The status.
2625 * @param fFlags Flags assoicated with the update. Currently
2626 * reserved and should be ignored.
2627 * @param pTimeSpecTS Pointer to the timestamp of this report.
2628 * @thread The emulation thread.
2629 */
2630 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestStatus,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t uFacility, uint16_t uStatus,
2631 uint32_t fFlags, PCRTTIMESPEC pTimeSpecTS));
2632
2633 /**
2634 * Updates a guest user state.
2635 *
2636 * Called in response to VMMDevReq_ReportGuestUserState.
2637 *
2638 * @param pInterface Pointer to this interface.
2639 * @param pszUser Guest user name to update status for.
2640 * @param pszDomain Domain the guest user is bound to. Optional.
2641 * @param uState New guest user state to notify host about.
2642 * @param puDetails Pointer to optional state data.
2643 * @param cbDetails Size (in bytes) of optional state data.
2644 * @thread The emulation thread.
2645 */
2646 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestUserState,(PPDMIVMMDEVCONNECTOR pInterface, const char *pszUser, const char *pszDomain,
2647 uint32_t uState,
2648 const uint8_t *puDetails, uint32_t cbDetails));
2649
2650 /**
2651 * Reports the guest API and OS version.
2652 * Called whenever the Additions issue a guest info report request.
2653 *
2654 * @param pInterface Pointer to this interface.
2655 * @param pGuestInfo Pointer to guest information structure
2656 * @thread The emulation thread.
2657 */
2658 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestInfo,(PPDMIVMMDEVCONNECTOR pInterface, const struct VBoxGuestInfo *pGuestInfo));
2659
2660 /**
2661 * Reports the detailed Guest Additions version.
2662 *
2663 * @param pInterface Pointer to this interface.
2664 * @param uFullVersion The guest additions version as a full version.
2665 * Use VBOX_FULL_VERSION_GET_MAJOR,
2666 * VBOX_FULL_VERSION_GET_MINOR and
2667 * VBOX_FULL_VERSION_GET_BUILD to access it.
2668 * (This will not be zero, so turn down the
2669 * paranoia level a notch.)
2670 * @param pszName Pointer to the sanitized version name. This can
2671 * be empty, but will not be NULL. If not empty,
2672 * it will contain a build type tag and/or a
2673 * publisher tag. If both, then they are separated
2674 * by an underscore (VBOX_VERSION_STRING fashion).
2675 * @param uRevision The SVN revision. Can be 0.
2676 * @param fFeatures Feature mask, currently none are defined.
2677 *
2678 * @thread The emulation thread.
2679 */
2680 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestInfo2,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t uFullVersion,
2681 const char *pszName, uint32_t uRevision, uint32_t fFeatures));
2682
2683 /**
2684 * Update the guest additions capabilities.
2685 * This is called when the guest additions capabilities change. The new capabilities
2686 * are given and the connector should update its internal state.
2687 *
2688 * @param pInterface Pointer to this interface.
2689 * @param newCapabilities New capabilities.
2690 * @thread The emulation thread.
2691 */
2692 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestCapabilities,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities));
2693
2694 /**
2695 * Update the mouse capabilities.
2696 * This is called when the mouse capabilities change. The new capabilities
2697 * are given and the connector should update its internal state.
2698 *
2699 * @param pInterface Pointer to this interface.
2700 * @param newCapabilities New capabilities.
2701 * @thread The emulation thread.
2702 */
2703 DECLR3CALLBACKMEMBER(void, pfnUpdateMouseCapabilities,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities));
2704
2705 /**
2706 * Update the pointer shape.
2707 * This is called when the mouse pointer shape changes. The new shape
2708 * is passed as a caller allocated buffer that will be freed after returning
2709 *
2710 * @param pInterface Pointer to this interface.
2711 * @param fVisible Visibility indicator (if false, the other parameters are undefined).
2712 * @param fAlpha Flag whether alpha channel is being passed.
2713 * @param xHot Pointer hot spot x coordinate.
2714 * @param yHot Pointer hot spot y coordinate.
2715 * @param x Pointer new x coordinate on screen.
2716 * @param y Pointer new y coordinate on screen.
2717 * @param cx Pointer width in pixels.
2718 * @param cy Pointer height in pixels.
2719 * @param cbScanline Size of one scanline in bytes.
2720 * @param pvShape New shape buffer.
2721 * @thread The emulation thread.
2722 */
2723 DECLR3CALLBACKMEMBER(void, pfnUpdatePointerShape,(PPDMIVMMDEVCONNECTOR pInterface, bool fVisible, bool fAlpha,
2724 uint32_t xHot, uint32_t yHot,
2725 uint32_t cx, uint32_t cy,
2726 void *pvShape));
2727
2728 /**
2729 * Enable or disable video acceleration on behalf of guest.
2730 *
2731 * @param pInterface Pointer to this interface.
2732 * @param fEnable Whether to enable acceleration.
2733 * @param pVbvaMemory Video accelerator memory.
2734
2735 * @return VBox rc. VINF_SUCCESS if VBVA was enabled.
2736 * @thread The emulation thread.
2737 */
2738 DECLR3CALLBACKMEMBER(int, pfnVideoAccelEnable,(PPDMIVMMDEVCONNECTOR pInterface, bool fEnable, PVBVAMEMORY pVbvaMemory));
2739
2740 /**
2741 * Force video queue processing.
2742 *
2743 * @param pInterface Pointer to this interface.
2744 * @thread The emulation thread.
2745 */
2746 DECLR3CALLBACKMEMBER(void, pfnVideoAccelFlush,(PPDMIVMMDEVCONNECTOR pInterface));
2747
2748 /**
2749 * Return whether the given video mode is supported/wanted by the host.
2750 *
2751 * @returns VBox status code
2752 * @param pInterface Pointer to this interface.
2753 * @param display The guest monitor, 0 for primary.
2754 * @param cy Video mode horizontal resolution in pixels.
2755 * @param cx Video mode vertical resolution in pixels.
2756 * @param cBits Video mode bits per pixel.
2757 * @param pfSupported Where to put the indicator for whether this mode is supported. (output)
2758 * @thread The emulation thread.
2759 */
2760 DECLR3CALLBACKMEMBER(int, pfnVideoModeSupported,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t display, uint32_t cx, uint32_t cy, uint32_t cBits, bool *pfSupported));
2761
2762 /**
2763 * Queries by how many pixels the height should be reduced when calculating video modes
2764 *
2765 * @returns VBox status code
2766 * @param pInterface Pointer to this interface.
2767 * @param pcyReduction Pointer to the result value.
2768 * @thread The emulation thread.
2769 */
2770 DECLR3CALLBACKMEMBER(int, pfnGetHeightReduction,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcyReduction));
2771
2772 /**
2773 * Informs about a credentials judgement result from the guest.
2774 *
2775 * @returns VBox status code
2776 * @param pInterface Pointer to this interface.
2777 * @param fFlags Judgement result flags.
2778 * @thread The emulation thread.
2779 */
2780 DECLR3CALLBACKMEMBER(int, pfnSetCredentialsJudgementResult,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t fFlags));
2781
2782 /**
2783 * Set the visible region of the display
2784 *
2785 * @returns VBox status code.
2786 * @param pInterface Pointer to this interface.
2787 * @param cRect Number of rectangles in pRect
2788 * @param pRect Rectangle array
2789 * @thread The emulation thread.
2790 */
2791 DECLR3CALLBACKMEMBER(int, pfnSetVisibleRegion,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t cRect, PRTRECT pRect));
2792
2793 /**
2794 * Query the visible region of the display
2795 *
2796 * @returns VBox status code.
2797 * @param pInterface Pointer to this interface.
2798 * @param pcRect Number of rectangles in pRect
2799 * @param pRect Rectangle array (set to NULL to query the number of rectangles)
2800 * @thread The emulation thread.
2801 */
2802 DECLR3CALLBACKMEMBER(int, pfnQueryVisibleRegion,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcRect, PRTRECT pRect));
2803
2804 /**
2805 * Request the statistics interval
2806 *
2807 * @returns VBox status code.
2808 * @param pInterface Pointer to this interface.
2809 * @param pulInterval Pointer to interval in seconds
2810 * @thread The emulation thread.
2811 */
2812 DECLR3CALLBACKMEMBER(int, pfnQueryStatisticsInterval,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pulInterval));
2813
2814 /**
2815 * Report new guest statistics
2816 *
2817 * @returns VBox status code.
2818 * @param pInterface Pointer to this interface.
2819 * @param pGuestStats Guest statistics
2820 * @thread The emulation thread.
2821 */
2822 DECLR3CALLBACKMEMBER(int, pfnReportStatistics,(PPDMIVMMDEVCONNECTOR pInterface, struct VBoxGuestStatistics *pGuestStats));
2823
2824 /**
2825 * Query the current balloon size
2826 *
2827 * @returns VBox status code.
2828 * @param pInterface Pointer to this interface.
2829 * @param pcbBalloon Balloon size
2830 * @thread The emulation thread.
2831 */
2832 DECLR3CALLBACKMEMBER(int, pfnQueryBalloonSize,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcbBalloon));
2833
2834 /**
2835 * Query the current page fusion setting
2836 *
2837 * @returns VBox status code.
2838 * @param pInterface Pointer to this interface.
2839 * @param pfPageFusionEnabled Pointer to boolean
2840 * @thread The emulation thread.
2841 */
2842 DECLR3CALLBACKMEMBER(int, pfnIsPageFusionEnabled,(PPDMIVMMDEVCONNECTOR pInterface, bool *pfPageFusionEnabled));
2843
2844} PDMIVMMDEVCONNECTOR;
2845/** PDMIVMMDEVCONNECTOR interface ID. */
2846#define PDMIVMMDEVCONNECTOR_IID "aff90240-a443-434e-9132-80c186ab97d4"
2847
2848
2849/**
2850 * Generic status LED core.
2851 * Note that a unit doesn't have to support all the indicators.
2852 */
2853typedef union PDMLEDCORE
2854{
2855 /** 32-bit view. */
2856 uint32_t volatile u32;
2857 /** Bit view. */
2858 struct
2859 {
2860 /** Reading/Receiving indicator. */
2861 uint32_t fReading : 1;
2862 /** Writing/Sending indicator. */
2863 uint32_t fWriting : 1;
2864 /** Busy indicator. */
2865 uint32_t fBusy : 1;
2866 /** Error indicator. */
2867 uint32_t fError : 1;
2868 } s;
2869} PDMLEDCORE;
2870
2871/** LED bit masks for the u32 view.
2872 * @{ */
2873/** Reading/Receiving indicator. */
2874#define PDMLED_READING RT_BIT(0)
2875/** Writing/Sending indicator. */
2876#define PDMLED_WRITING RT_BIT(1)
2877/** Busy indicator. */
2878#define PDMLED_BUSY RT_BIT(2)
2879/** Error indicator. */
2880#define PDMLED_ERROR RT_BIT(3)
2881/** @} */
2882
2883
2884/**
2885 * Generic status LED.
2886 * Note that a unit doesn't have to support all the indicators.
2887 */
2888typedef struct PDMLED
2889{
2890 /** Just a magic for sanity checking. */
2891 uint32_t u32Magic;
2892 uint32_t u32Alignment; /**< structure size alignment. */
2893 /** The actual LED status.
2894 * Only the device is allowed to change this. */
2895 PDMLEDCORE Actual;
2896 /** The asserted LED status which is cleared by the reader.
2897 * The device will assert the bits but never clear them.
2898 * The driver clears them as it sees fit. */
2899 PDMLEDCORE Asserted;
2900} PDMLED;
2901
2902/** Pointer to an LED. */
2903typedef PDMLED *PPDMLED;
2904/** Pointer to a const LED. */
2905typedef const PDMLED *PCPDMLED;
2906
2907/** Magic value for PDMLED::u32Magic. */
2908#define PDMLED_MAGIC UINT32_C(0x11335577)
2909
2910/** Pointer to an LED ports interface. */
2911typedef struct PDMILEDPORTS *PPDMILEDPORTS;
2912/**
2913 * Interface for exporting LEDs (down).
2914 * Pair with PDMILEDCONNECTORS.
2915 */
2916typedef struct PDMILEDPORTS
2917{
2918 /**
2919 * Gets the pointer to the status LED of a unit.
2920 *
2921 * @returns VBox status code.
2922 * @param pInterface Pointer to the interface structure containing the called function pointer.
2923 * @param iLUN The unit which status LED we desire.
2924 * @param ppLed Where to store the LED pointer.
2925 */
2926 DECLR3CALLBACKMEMBER(int, pfnQueryStatusLed,(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed));
2927
2928} PDMILEDPORTS;
2929/** PDMILEDPORTS interface ID. */
2930#define PDMILEDPORTS_IID "435e0cec-8549-4ca0-8c0d-98e52f1dc038"
2931
2932
2933/** Pointer to an LED connectors interface. */
2934typedef struct PDMILEDCONNECTORS *PPDMILEDCONNECTORS;
2935/**
2936 * Interface for reading LEDs (up).
2937 * Pair with PDMILEDPORTS.
2938 */
2939typedef struct PDMILEDCONNECTORS
2940{
2941 /**
2942 * Notification about a unit which have been changed.
2943 *
2944 * The driver must discard any pointers to data owned by
2945 * the unit and requery it.
2946 *
2947 * @param pInterface Pointer to the interface structure containing the called function pointer.
2948 * @param iLUN The unit number.
2949 */
2950 DECLR3CALLBACKMEMBER(void, pfnUnitChanged,(PPDMILEDCONNECTORS pInterface, unsigned iLUN));
2951} PDMILEDCONNECTORS;
2952/** PDMILEDCONNECTORS interface ID. */
2953#define PDMILEDCONNECTORS_IID "8ed63568-82a7-4193-b57b-db8085ac4495"
2954
2955
2956/** Pointer to a Media Notification interface. */
2957typedef struct PDMIMEDIANOTIFY *PPDMIMEDIANOTIFY;
2958/**
2959 * Interface for exporting Medium eject information (up). No interface pair.
2960 */
2961typedef struct PDMIMEDIANOTIFY
2962{
2963 /**
2964 * Signals that the medium was ejected.
2965 *
2966 * @returns VBox status code.
2967 * @param pInterface Pointer to the interface structure containing the called function pointer.
2968 * @param iLUN The unit which had the medium ejected.
2969 */
2970 DECLR3CALLBACKMEMBER(int, pfnEjected,(PPDMIMEDIANOTIFY pInterface, unsigned iLUN));
2971
2972} PDMIMEDIANOTIFY;
2973/** PDMIMEDIANOTIFY interface ID. */
2974#define PDMIMEDIANOTIFY_IID "fc22d53e-feb1-4a9c-b9fb-0a990a6ab288"
2975
2976
2977/** The special status unit number */
2978#define PDM_STATUS_LUN 999
2979
2980
2981#ifdef VBOX_WITH_HGCM
2982
2983/** Abstract HGCM command structure. Used only to define a typed pointer. */
2984struct VBOXHGCMCMD;
2985
2986/** Pointer to HGCM command structure. This pointer is unique and identifies
2987 * the command being processed. The pointer is passed to HGCM connector methods,
2988 * and must be passed back to HGCM port when command is completed.
2989 */
2990typedef struct VBOXHGCMCMD *PVBOXHGCMCMD;
2991
2992/** Pointer to a HGCM port interface. */
2993typedef struct PDMIHGCMPORT *PPDMIHGCMPORT;
2994/**
2995 * Host-Guest communication manager port interface (down). Normally implemented
2996 * by VMMDev.
2997 * Pair with PDMIHGCMCONNECTOR.
2998 */
2999typedef struct PDMIHGCMPORT
3000{
3001 /**
3002 * Notify the guest on a command completion.
3003 *
3004 * @param pInterface Pointer to this interface.
3005 * @param rc The return code (VBox error code).
3006 * @param pCmd A pointer that identifies the completed command.
3007 *
3008 * @returns VBox status code
3009 */
3010 DECLR3CALLBACKMEMBER(void, pfnCompleted,(PPDMIHGCMPORT pInterface, int32_t rc, PVBOXHGCMCMD pCmd));
3011
3012} PDMIHGCMPORT;
3013/** PDMIHGCMPORT interface ID. */
3014# define PDMIHGCMPORT_IID "e00a0cbf-b75a-45c3-87f4-41cddbc5ae0b"
3015
3016
3017/** Pointer to a HGCM service location structure. */
3018typedef struct HGCMSERVICELOCATION *PHGCMSERVICELOCATION;
3019
3020/** Pointer to a HGCM connector interface. */
3021typedef struct PDMIHGCMCONNECTOR *PPDMIHGCMCONNECTOR;
3022/**
3023 * The Host-Guest communication manager connector interface (up). Normally
3024 * implemented by Main::VMMDevInterface.
3025 * Pair with PDMIHGCMPORT.
3026 */
3027typedef struct PDMIHGCMCONNECTOR
3028{
3029 /**
3030 * Locate a service and inform it about a client connection.
3031 *
3032 * @param pInterface Pointer to this interface.
3033 * @param pCmd A pointer that identifies the command.
3034 * @param pServiceLocation Pointer to the service location structure.
3035 * @param pu32ClientID Where to store the client id for the connection.
3036 * @return VBox status code.
3037 * @thread The emulation thread.
3038 */
3039 DECLR3CALLBACKMEMBER(int, pfnConnect,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, PHGCMSERVICELOCATION pServiceLocation, uint32_t *pu32ClientID));
3040
3041 /**
3042 * Disconnect from service.
3043 *
3044 * @param pInterface Pointer to this interface.
3045 * @param pCmd A pointer that identifies the command.
3046 * @param u32ClientID The client id returned by the pfnConnect call.
3047 * @return VBox status code.
3048 * @thread The emulation thread.
3049 */
3050 DECLR3CALLBACKMEMBER(int, pfnDisconnect,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID));
3051
3052 /**
3053 * Process a guest issued command.
3054 *
3055 * @param pInterface Pointer to this interface.
3056 * @param pCmd A pointer that identifies the command.
3057 * @param u32ClientID The client id returned by the pfnConnect call.
3058 * @param u32Function Function to be performed by the service.
3059 * @param cParms Number of parameters in the array pointed to by paParams.
3060 * @param paParms Pointer to an array of parameters.
3061 * @return VBox status code.
3062 * @thread The emulation thread.
3063 */
3064 DECLR3CALLBACKMEMBER(int, pfnCall,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID, uint32_t u32Function,
3065 uint32_t cParms, PVBOXHGCMSVCPARM paParms));
3066
3067} PDMIHGCMCONNECTOR;
3068/** PDMIHGCMCONNECTOR interface ID. */
3069# define PDMIHGCMCONNECTOR_IID "a1104758-c888-4437-8f2a-7bac17865b5c"
3070
3071#endif /* VBOX_WITH_HGCM */
3072
3073/**
3074 * Data direction.
3075 */
3076typedef enum PDMSCSIREQUESTTXDIR
3077{
3078 PDMSCSIREQUESTTXDIR_UNKNOWN = 0x00,
3079 PDMSCSIREQUESTTXDIR_FROM_DEVICE = 0x01,
3080 PDMSCSIREQUESTTXDIR_TO_DEVICE = 0x02,
3081 PDMSCSIREQUESTTXDIR_NONE = 0x03,
3082 PDMSCSIREQUESTTXDIR_32BIT_HACK = 0x7fffffff
3083} PDMSCSIREQUESTTXDIR;
3084
3085/**
3086 * SCSI request structure.
3087 */
3088typedef struct PDMSCSIREQUEST
3089{
3090 /** The logical unit. */
3091 uint32_t uLogicalUnit;
3092 /** Direction of the data flow. */
3093 PDMSCSIREQUESTTXDIR uDataDirection;
3094 /** Size of the SCSI CDB. */
3095 uint32_t cbCDB;
3096 /** Pointer to the SCSI CDB. */
3097 uint8_t *pbCDB;
3098 /** Overall size of all scatter gather list elements
3099 * for data transfer if any. */
3100 uint32_t cbScatterGather;
3101 /** Number of elements in the scatter gather list. */
3102 uint32_t cScatterGatherEntries;
3103 /** Pointer to the head of the scatter gather list. */
3104 PRTSGSEG paScatterGatherHead;
3105 /** Size of the sense buffer. */
3106 uint32_t cbSenseBuffer;
3107 /** Pointer to the sense buffer. *
3108 * Current assumption that the sense buffer is not scattered. */
3109 uint8_t *pbSenseBuffer;
3110 /** Opaque user data for use by the device. Left untouched by everything else! */
3111 void *pvUser;
3112} PDMSCSIREQUEST, *PPDMSCSIREQUEST;
3113/** Pointer to a const SCSI request structure. */
3114typedef const PDMSCSIREQUEST *PCSCSIREQUEST;
3115
3116/** Pointer to a SCSI port interface. */
3117typedef struct PDMISCSIPORT *PPDMISCSIPORT;
3118/**
3119 * SCSI command execution port interface (down).
3120 * Pair with PDMISCSICONNECTOR.
3121 */
3122typedef struct PDMISCSIPORT
3123{
3124
3125 /**
3126 * Notify the device on request completion.
3127 *
3128 * @returns VBox status code.
3129 * @param pInterface Pointer to this interface.
3130 * @param pSCSIRequest Pointer to the finished SCSI request.
3131 * @param rcCompletion SCSI_STATUS_* code for the completed request.
3132 * @param fRedo Flag whether the request can to be redone
3133 * when it failed.
3134 * @param rcReq The status code the request completed with (VERR_*)
3135 * Should be only used to choose the correct error message
3136 * displayed to the user if the error can be fixed by him
3137 * (fRedo is true).
3138 */
3139 DECLR3CALLBACKMEMBER(int, pfnSCSIRequestCompleted, (PPDMISCSIPORT pInterface, PPDMSCSIREQUEST pSCSIRequest,
3140 int rcCompletion, bool fRedo, int rcReq));
3141
3142 /**
3143 * Returns the storage controller name, instance and LUN of the attached medium.
3144 *
3145 * @returns VBox status.
3146 * @param pInterface Pointer to this interface.
3147 * @param ppcszController Where to store the name of the storage controller.
3148 * @param piInstance Where to store the instance number of the controller.
3149 * @param piLUN Where to store the LUN of the attached device.
3150 */
3151 DECLR3CALLBACKMEMBER(int, pfnQueryDeviceLocation, (PPDMISCSIPORT pInterface, const char **ppcszController,
3152 uint32_t *piInstance, uint32_t *piLUN));
3153
3154} PDMISCSIPORT;
3155/** PDMISCSIPORT interface ID. */
3156#define PDMISCSIPORT_IID "05d9fc3b-e38c-4b30-8344-a323feebcfe5"
3157
3158/**
3159 * LUN type.
3160 */
3161typedef enum PDMSCSILUNTYPE
3162{
3163 PDMSCSILUNTYPE_INVALID = 0,
3164 PDMSCSILUNTYPE_SBC, /** Hard disk (SBC) */
3165 PDMSCSILUNTYPE_MMC, /** CD/DVD drive (MMC) */
3166 PDMSCSILUNTYPE_SSC, /** Tape drive (SSC) */
3167 PDMSCSILUNTYPE_32BIT_HACK = 0x7fffffff
3168} PDMSCSILUNTYPE, *PPDMSCSILUNTYPE;
3169
3170
3171/** Pointer to a SCSI connector interface. */
3172typedef struct PDMISCSICONNECTOR *PPDMISCSICONNECTOR;
3173/**
3174 * SCSI command execution connector interface (up).
3175 * Pair with PDMISCSIPORT.
3176 */
3177typedef struct PDMISCSICONNECTOR
3178{
3179
3180 /**
3181 * Submits a SCSI request for execution.
3182 *
3183 * @returns VBox status code.
3184 * @param pInterface Pointer to this interface.
3185 * @param pSCSIRequest Pointer to the SCSI request to execute.
3186 */
3187 DECLR3CALLBACKMEMBER(int, pfnSCSIRequestSend, (PPDMISCSICONNECTOR pInterface, PPDMSCSIREQUEST pSCSIRequest));
3188
3189 /**
3190 * Queries the type of the attached LUN.
3191 *
3192 * @returns VBox status code.
3193 * @param pInterface Pointer to this interface.
3194 * @param iLUN The logical unit number.
3195 * @param pSCSIRequest Pointer to the LUN to be returned.
3196 */
3197 DECLR3CALLBACKMEMBER(int, pfnQueryLUNType, (PPDMISCSICONNECTOR pInterface, uint32_t iLun, PPDMSCSILUNTYPE pLUNType));
3198
3199} PDMISCSICONNECTOR;
3200/** PDMISCSICONNECTOR interface ID. */
3201#define PDMISCSICONNECTOR_IID "94465fbd-a2f2-447e-88c9-7366421bfbfe"
3202
3203
3204/** Pointer to a display VBVA callbacks interface. */
3205typedef struct PDMIDISPLAYVBVACALLBACKS *PPDMIDISPLAYVBVACALLBACKS;
3206/**
3207 * Display VBVA callbacks interface (up).
3208 */
3209typedef struct PDMIDISPLAYVBVACALLBACKS
3210{
3211
3212 /**
3213 * Informs guest about completion of processing the given Video HW Acceleration
3214 * command, does not wait for the guest to process the command.
3215 *
3216 * @returns ???
3217 * @param pInterface Pointer to this interface.
3218 * @param pCmd The Video HW Acceleration Command that was
3219 * completed.
3220 */
3221 DECLR3CALLBACKMEMBER(int, pfnVHWACommandCompleteAsync, (PPDMIDISPLAYVBVACALLBACKS pInterface,
3222 PVBOXVHWACMD pCmd));
3223
3224 DECLR3CALLBACKMEMBER(int, pfnCrHgsmiCommandCompleteAsync, (PPDMIDISPLAYVBVACALLBACKS pInterface,
3225 struct VBOXVDMACMD_CHROMIUM_CMD* pCmd, int rc));
3226
3227 DECLR3CALLBACKMEMBER(int, pfnCrHgsmiControlCompleteAsync, (PPDMIDISPLAYVBVACALLBACKS pInterface,
3228 struct VBOXVDMACMD_CHROMIUM_CTL* pCmd, int rc));
3229
3230 DECLR3CALLBACKMEMBER(int, pfnCrCtlSubmit, (PPDMIDISPLAYVBVACALLBACKS pInterface,
3231 struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
3232 PFNCRCTLCOMPLETION pfnCompletion,
3233 void *pvCompletion));
3234
3235 DECLR3CALLBACKMEMBER(int, pfnCrCtlSubmitSync, (PPDMIDISPLAYVBVACALLBACKS pInterface,
3236 struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd));
3237} PDMIDISPLAYVBVACALLBACKS;
3238/** PDMIDISPLAYVBVACALLBACKS */
3239#define PDMIDISPLAYVBVACALLBACKS_IID "ddac0bd0-332d-4671-8853-732921a80216"
3240
3241/** Pointer to a PCI raw connector interface. */
3242typedef struct PDMIPCIRAWCONNECTOR *PPDMIPCIRAWCONNECTOR;
3243/**
3244 * PCI raw connector interface (up).
3245 */
3246typedef struct PDMIPCIRAWCONNECTOR
3247{
3248
3249 /**
3250 *
3251 */
3252 DECLR3CALLBACKMEMBER(int, pfnDeviceConstructComplete, (PPDMIPCIRAWCONNECTOR pInterface, const char *pcszName,
3253 uint32_t uHostPciAddress, uint32_t uGuestPciAddress,
3254 int rc));
3255
3256} PDMIPCIRAWCONNECTOR;
3257/** PDMIPCIRAWCONNECTOR interface ID. */
3258#define PDMIPCIRAWCONNECTOR_IID "14aa9c6c-8869-4782-9dfc-910071a6aebf"
3259
3260/** @} */
3261
3262RT_C_DECLS_END
3263
3264#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