VirtualBox

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

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

Disk encryption: Make sure the DekMissing guest property is set before the state change handler is called when the VM is suspended

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