VirtualBox

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

Last change on this file since 52023 was 52023, checked in by vboxsync, 10 years ago

pdmifs.h,DrvBlock,DrvVD: Add methods to allocate and free I/O buffer memory to PDMIBLOCK and PDMIMEDIA. DrvVD decides how to allocate the memory based on the setup

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