VirtualBox

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

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

spaces

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 136.5 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/**
1341 * Media geometry structure.
1342 */
1343typedef struct PDMMEDIAGEOMETRY
1344{
1345 /** Number of cylinders. */
1346 uint32_t cCylinders;
1347 /** Number of heads. */
1348 uint32_t cHeads;
1349 /** Number of sectors. */
1350 uint32_t cSectors;
1351} PDMMEDIAGEOMETRY;
1352
1353/** Pointer to media geometry structure. */
1354typedef PDMMEDIAGEOMETRY *PPDMMEDIAGEOMETRY;
1355/** Pointer to constant media geometry structure. */
1356typedef const PDMMEDIAGEOMETRY *PCPDMMEDIAGEOMETRY;
1357
1358/** Pointer to a media port interface. */
1359typedef struct PDMIMEDIAPORT *PPDMIMEDIAPORT;
1360/**
1361 * Media port interface (down).
1362 */
1363typedef struct PDMIMEDIAPORT
1364{
1365 /**
1366 * Returns the storage controller name, instance and LUN of the attached medium.
1367 *
1368 * @returns VBox status.
1369 * @param pInterface Pointer to this interface.
1370 * @param ppcszController Where to store the name of the storage controller.
1371 * @param piInstance Where to store the instance number of the controller.
1372 * @param piLUN Where to store the LUN of the attached device.
1373 */
1374 DECLR3CALLBACKMEMBER(int, pfnQueryDeviceLocation, (PPDMIMEDIAPORT pInterface, const char **ppcszController,
1375 uint32_t *piInstance, uint32_t *piLUN));
1376
1377} PDMIMEDIAPORT;
1378/** PDMIMEDIAPORT interface ID. */
1379#define PDMIMEDIAPORT_IID "9f7e8c9e-6d35-4453-bbef-1f78033174d6"
1380
1381/** Pointer to a media interface. */
1382typedef struct PDMIMEDIA *PPDMIMEDIA;
1383/**
1384 * Media interface (up).
1385 * Makes up the foundation for PDMIBLOCK and PDMIBLOCKBIOS.
1386 * Pairs with PDMIMEDIAPORT.
1387 */
1388typedef struct PDMIMEDIA
1389{
1390 /**
1391 * Read bits.
1392 *
1393 * @returns VBox status code.
1394 * @param pInterface Pointer to the interface structure containing the called function pointer.
1395 * @param off Offset to start reading from. The offset must be aligned to a sector boundary.
1396 * @param pvBuf Where to store the read bits.
1397 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary.
1398 * @thread Any thread.
1399 */
1400 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIMEDIA pInterface, uint64_t off, void *pvBuf, size_t cbRead));
1401
1402 /**
1403 * Read bits - version for DevPcBios.
1404 *
1405 * @returns VBox status code.
1406 * @param pInterface Pointer to the interface structure containing the called function pointer.
1407 * @param off Offset to start reading from. The offset must be aligned to a sector boundary.
1408 * @param pvBuf Where to store the read bits.
1409 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary.
1410 * @thread Any thread.
1411 *
1412 * @note: Special version of pfnRead which doesn't try to suspend the VM when the DEKs for encrypted disks
1413 * are missing but just returns an error.
1414 */
1415 DECLR3CALLBACKMEMBER(int, pfnReadPcBios,(PPDMIMEDIA pInterface, uint64_t off, void *pvBuf, size_t cbRead));
1416
1417 /**
1418 * Write bits.
1419 *
1420 * @returns VBox status code.
1421 * @param pInterface Pointer to the interface structure containing the called function pointer.
1422 * @param off Offset to start writing at. The offset must be aligned to a sector boundary.
1423 * @param pvBuf Where to store the write bits.
1424 * @param cbWrite Number of bytes to write. Must be aligned to a sector boundary.
1425 * @thread Any thread.
1426 */
1427 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIMEDIA pInterface, uint64_t off, const void *pvBuf, size_t cbWrite));
1428
1429 /**
1430 * Make sure that the bits written are actually on the storage medium.
1431 *
1432 * @returns VBox status code.
1433 * @param pInterface Pointer to the interface structure containing the called function pointer.
1434 * @thread Any thread.
1435 */
1436 DECLR3CALLBACKMEMBER(int, pfnFlush,(PPDMIMEDIA pInterface));
1437
1438 /**
1439 * Merge medium contents during a live snapshot deletion. All details
1440 * must have been configured through CFGM or this will fail.
1441 * This method is optional (i.e. the function pointer may be NULL).
1442 *
1443 * @returns VBox status code.
1444 * @param pInterface Pointer to the interface structure containing the called function pointer.
1445 * @param pfnProgress Function pointer for progress notification.
1446 * @param pvUser Opaque user data for progress notification.
1447 * @thread Any thread.
1448 */
1449 DECLR3CALLBACKMEMBER(int, pfnMerge,(PPDMIMEDIA pInterface, PFNSIMPLEPROGRESS pfnProgress, void *pvUser));
1450
1451 /**
1452 * Sets the secret key retrieval interface to use to get secret keys.
1453 *
1454 * @returns VBox status code.
1455 * @param pInterface Pointer to the interface structure containing the called function pointer.
1456 * @param pIfSecKey The secret key interface to use.
1457 * Use NULL to clear the currently set interface and clear all secret
1458 * keys from the user.
1459 * @thread Any thread.
1460 */
1461 DECLR3CALLBACKMEMBER(int, pfnSetSecKeyIf,(PPDMIMEDIA pInterface, PPDMISECKEY pIfSecKey));
1462
1463 /**
1464 * Get the media size in bytes.
1465 *
1466 * @returns Media size in bytes.
1467 * @param pInterface Pointer to the interface structure containing the called function pointer.
1468 * @thread Any thread.
1469 */
1470 DECLR3CALLBACKMEMBER(uint64_t, pfnGetSize,(PPDMIMEDIA pInterface));
1471
1472 /**
1473 * Gets the media sector size in bytes.
1474 *
1475 * @returns Media sector size in bytes.
1476 * @param pInterface Pointer to the interface structure containing the called function pointer.
1477 * @thread Any thread.
1478 */
1479 DECLR3CALLBACKMEMBER(uint32_t, pfnGetSectorSize,(PPDMIMEDIA pInterface));
1480
1481 /**
1482 * Check if the media is readonly or not.
1483 *
1484 * @returns true if readonly.
1485 * @returns false if read/write.
1486 * @param pInterface Pointer to the interface structure containing the called function pointer.
1487 * @thread Any thread.
1488 */
1489 DECLR3CALLBACKMEMBER(bool, pfnIsReadOnly,(PPDMIMEDIA pInterface));
1490
1491 /**
1492 * Get stored media geometry (physical CHS, PCHS) - BIOS property.
1493 * This is an optional feature of a media.
1494 *
1495 * @returns VBox status code.
1496 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1497 * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnBiosSetPCHSGeometry() yet.
1498 * @param pInterface Pointer to the interface structure containing the called function pointer.
1499 * @param pPCHSGeometry Pointer to PCHS geometry (cylinders/heads/sectors).
1500 * @remark This has no influence on the read/write operations.
1501 * @thread Any thread.
1502 */
1503 DECLR3CALLBACKMEMBER(int, pfnBiosGetPCHSGeometry,(PPDMIMEDIA pInterface, PPDMMEDIAGEOMETRY pPCHSGeometry));
1504
1505 /**
1506 * Store the media geometry (physical CHS, PCHS) - BIOS property.
1507 * This is an optional feature of a media.
1508 *
1509 * @returns VBox status code.
1510 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1511 * @param pInterface Pointer to the interface structure containing the called function pointer.
1512 * @param pPCHSGeometry Pointer to PCHS geometry (cylinders/heads/sectors).
1513 * @remark This has no influence on the read/write operations.
1514 * @thread The emulation thread.
1515 */
1516 DECLR3CALLBACKMEMBER(int, pfnBiosSetPCHSGeometry,(PPDMIMEDIA pInterface, PCPDMMEDIAGEOMETRY pPCHSGeometry));
1517
1518 /**
1519 * Get stored media geometry (logical CHS, LCHS) - BIOS property.
1520 * This is an optional feature of a media.
1521 *
1522 * @returns VBox status code.
1523 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1524 * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnBiosSetLCHSGeometry() yet.
1525 * @param pInterface Pointer to the interface structure containing the called function pointer.
1526 * @param pLCHSGeometry Pointer to LCHS geometry (cylinders/heads/sectors).
1527 * @remark This has no influence on the read/write operations.
1528 * @thread Any thread.
1529 */
1530 DECLR3CALLBACKMEMBER(int, pfnBiosGetLCHSGeometry,(PPDMIMEDIA pInterface, PPDMMEDIAGEOMETRY pLCHSGeometry));
1531
1532 /**
1533 * Store the media geometry (logical CHS, LCHS) - BIOS property.
1534 * This is an optional feature of a media.
1535 *
1536 * @returns VBox status code.
1537 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1538 * @param pInterface Pointer to the interface structure containing the called function pointer.
1539 * @param pLCHSGeometry Pointer to LCHS geometry (cylinders/heads/sectors).
1540 * @remark This has no influence on the read/write operations.
1541 * @thread The emulation thread.
1542 */
1543 DECLR3CALLBACKMEMBER(int, pfnBiosSetLCHSGeometry,(PPDMIMEDIA pInterface, PCPDMMEDIAGEOMETRY pLCHSGeometry));
1544
1545 /**
1546 * Gets the UUID of the media drive.
1547 *
1548 * @returns VBox status code.
1549 * @param pInterface Pointer to the interface structure containing the called function pointer.
1550 * @param pUuid Where to store the UUID on success.
1551 * @thread Any thread.
1552 */
1553 DECLR3CALLBACKMEMBER(int, pfnGetUuid,(PPDMIMEDIA pInterface, PRTUUID pUuid));
1554
1555 /**
1556 * Discards the given range.
1557 *
1558 * @returns VBox status code.
1559 * @param pInterface Pointer to the interface structure containing the called function pointer.
1560 * @param paRanges Array of ranges to discard.
1561 * @param cRanges Number of entries in the array.
1562 * @thread Any thread.
1563 */
1564 DECLR3CALLBACKMEMBER(int, pfnDiscard,(PPDMIMEDIA pInterface, PCRTRANGE paRanges, unsigned cRanges));
1565
1566 /**
1567 * Allocate buffer memory which is suitable for I/O and might have special proerties for secure
1568 * environments (non-pageable memory for sensitive data which should not end up on the disk).
1569 *
1570 * @returns VBox status code.
1571 * @param pInterface Pointer to the interface structure containing the called function pointer.
1572 * @param cb Amount of memory to allocate.
1573 * @param ppvNew Where to store the pointer to the buffer on success.
1574 */
1575 DECLR3CALLBACKMEMBER(int, pfnIoBufAlloc, (PPDMIMEDIA pInterface, size_t cb, void **ppvNew));
1576
1577 /**
1578 * Free memory allocated with PDMIMEDIA::pfnIoBufAlloc().
1579 *
1580 * @returns VBox status code.
1581 * @param pInterface Pointer to the interface structure containing the called function pointer.
1582 * @param pv Pointer to the memory to free.
1583 * @param cb Amount of bytes given in PDMIMEDIA::pfnIoBufAlloc().
1584 */
1585 DECLR3CALLBACKMEMBER(int, pfnIoBufFree, (PPDMIMEDIA pInterface, void *pv, size_t cb));
1586
1587} PDMIMEDIA;
1588/** PDMIMEDIA interface ID. */
1589#define PDMIMEDIA_IID "b4acf420-c9e3-4333-9ed5-e86f6b2d5f1a"
1590
1591
1592/** Pointer to a block BIOS interface. */
1593typedef struct PDMIBLOCKBIOS *PPDMIBLOCKBIOS;
1594/**
1595 * Media BIOS interface (Up / External).
1596 * The interface the getting and setting properties which the BIOS/CMOS care about.
1597 */
1598typedef struct PDMIBLOCKBIOS
1599{
1600 /**
1601 * Get stored media geometry (physical CHS, PCHS) - BIOS property.
1602 * This is an optional feature of a media.
1603 *
1604 * @returns VBox status code.
1605 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1606 * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnSetPCHSGeometry() yet.
1607 * @param pInterface Pointer to the interface structure containing the called function pointer.
1608 * @param pPCHSGeometry Pointer to PCHS geometry (cylinders/heads/sectors).
1609 * @remark This has no influence on the read/write operations.
1610 * @thread Any thread.
1611 */
1612 DECLR3CALLBACKMEMBER(int, pfnGetPCHSGeometry,(PPDMIBLOCKBIOS pInterface, PPDMMEDIAGEOMETRY pPCHSGeometry));
1613
1614 /**
1615 * Store the media geometry (physical CHS, PCHS) - BIOS property.
1616 * This is an optional feature of a media.
1617 *
1618 * @returns VBox status code.
1619 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1620 * @param pInterface Pointer to the interface structure containing the called function pointer.
1621 * @param pPCHSGeometry Pointer to PCHS geometry (cylinders/heads/sectors).
1622 * @remark This has no influence on the read/write operations.
1623 * @thread The emulation thread.
1624 */
1625 DECLR3CALLBACKMEMBER(int, pfnSetPCHSGeometry,(PPDMIBLOCKBIOS pInterface, PCPDMMEDIAGEOMETRY pPCHSGeometry));
1626
1627 /**
1628 * Get stored media geometry (logical CHS, LCHS) - BIOS property.
1629 * This is an optional feature of a media.
1630 *
1631 * @returns VBox status code.
1632 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1633 * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnSetLCHSGeometry() yet.
1634 * @param pInterface Pointer to the interface structure containing the called function pointer.
1635 * @param pLCHSGeometry Pointer to LCHS geometry (cylinders/heads/sectors).
1636 * @remark This has no influence on the read/write operations.
1637 * @thread Any thread.
1638 */
1639 DECLR3CALLBACKMEMBER(int, pfnGetLCHSGeometry,(PPDMIBLOCKBIOS pInterface, PPDMMEDIAGEOMETRY pLCHSGeometry));
1640
1641 /**
1642 * Store the media geometry (logical CHS, LCHS) - BIOS property.
1643 * This is an optional feature of a media.
1644 *
1645 * @returns VBox status code.
1646 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1647 * @param pInterface Pointer to the interface structure containing the called function pointer.
1648 * @param pLCHSGeometry Pointer to LCHS geometry (cylinders/heads/sectors).
1649 * @remark This has no influence on the read/write operations.
1650 * @thread The emulation thread.
1651 */
1652 DECLR3CALLBACKMEMBER(int, pfnSetLCHSGeometry,(PPDMIBLOCKBIOS pInterface, PCPDMMEDIAGEOMETRY pLCHSGeometry));
1653
1654 /**
1655 * Checks if the device should be visible to the BIOS or not.
1656 *
1657 * @returns true if the device is visible to the BIOS.
1658 * @returns false if the device is not visible to the BIOS.
1659 * @param pInterface Pointer to the interface structure containing the called function pointer.
1660 * @thread Any thread.
1661 */
1662 DECLR3CALLBACKMEMBER(bool, pfnIsVisible,(PPDMIBLOCKBIOS pInterface));
1663
1664 /**
1665 * Gets the block drive type.
1666 *
1667 * @returns block drive type.
1668 * @param pInterface Pointer to the interface structure containing the called function pointer.
1669 * @thread Any thread.
1670 */
1671 DECLR3CALLBACKMEMBER(PDMBLOCKTYPE, pfnGetType,(PPDMIBLOCKBIOS pInterface));
1672
1673} PDMIBLOCKBIOS;
1674/** PDMIBLOCKBIOS interface ID. */
1675#define PDMIBLOCKBIOS_IID "477c3eee-a48d-48a9-82fd-2a54de16b2e9"
1676
1677
1678/** Pointer to a static block core driver interface. */
1679typedef struct PDMIMEDIASTATIC *PPDMIMEDIASTATIC;
1680/**
1681 * Static block core driver interface.
1682 */
1683typedef struct PDMIMEDIASTATIC
1684{
1685 /**
1686 * Check if the specified file is a format which the core driver can handle.
1687 *
1688 * @returns true / false accordingly.
1689 * @param pInterface Pointer to the interface structure containing the called function pointer.
1690 * @param pszFilename Name of the file to probe.
1691 */
1692 DECLR3CALLBACKMEMBER(bool, pfnCanHandle,(PPDMIMEDIASTATIC pInterface, const char *pszFilename));
1693} PDMIMEDIASTATIC;
1694
1695
1696
1697
1698
1699/** Pointer to an asynchronous block notify interface. */
1700typedef struct PDMIBLOCKASYNCPORT *PPDMIBLOCKASYNCPORT;
1701/**
1702 * Asynchronous block notify interface (up).
1703 * Pair with PDMIBLOCKASYNC.
1704 */
1705typedef struct PDMIBLOCKASYNCPORT
1706{
1707 /**
1708 * Notify completion of an asynchronous transfer.
1709 *
1710 * @returns VBox status code.
1711 * @param pInterface Pointer to the interface structure containing the called function pointer.
1712 * @param pvUser The user argument given in pfnStartWrite/Read.
1713 * @param rcReq IPRT Status code of the completed request.
1714 * @thread Any thread.
1715 */
1716 DECLR3CALLBACKMEMBER(int, pfnTransferCompleteNotify, (PPDMIBLOCKASYNCPORT pInterface, void *pvUser, int rcReq));
1717} PDMIBLOCKASYNCPORT;
1718/** PDMIBLOCKASYNCPORT interface ID. */
1719#define PDMIBLOCKASYNCPORT_IID "e3bdc0cb-9d99-41dd-8eec-0dc8cf5b2a92"
1720
1721
1722
1723/** Pointer to an asynchronous block interface. */
1724typedef struct PDMIBLOCKASYNC *PPDMIBLOCKASYNC;
1725/**
1726 * Asynchronous block interface (down).
1727 * Pair with PDMIBLOCKASYNCPORT.
1728 */
1729typedef struct PDMIBLOCKASYNC
1730{
1731 /**
1732 * Start reading task.
1733 *
1734 * @returns VBox status code.
1735 * @param pInterface Pointer to the interface structure containing the called function pointer.
1736 * @param off Offset to start reading from.c
1737 * @param paSegs Pointer to the S/G segment array.
1738 * @param cSegs Number of entries in the array.
1739 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary.
1740 * @param pvUser User argument which is returned in completion callback.
1741 * @thread Any thread.
1742 */
1743 DECLR3CALLBACKMEMBER(int, pfnStartRead,(PPDMIBLOCKASYNC pInterface, uint64_t off, PCRTSGSEG paSegs, unsigned cSegs, size_t cbRead, void *pvUser));
1744
1745 /**
1746 * Write bits.
1747 *
1748 * @returns VBox status code.
1749 * @param pInterface Pointer to the interface structure containing the called function pointer.
1750 * @param off Offset to start writing at. The offset must be aligned to a sector boundary.
1751 * @param paSegs Pointer to the S/G segment array.
1752 * @param cSegs Number of entries in the array.
1753 * @param cbWrite Number of bytes to write. Must be aligned to a sector boundary.
1754 * @param pvUser User argument which is returned in completion callback.
1755 * @thread Any thread.
1756 */
1757 DECLR3CALLBACKMEMBER(int, pfnStartWrite,(PPDMIBLOCKASYNC pInterface, uint64_t off, PCRTSGSEG paSegs, unsigned cSegs, size_t cbWrite, void *pvUser));
1758
1759 /**
1760 * Flush everything to disk.
1761 *
1762 * @returns VBox status code.
1763 * @param pInterface Pointer to the interface structure containing the called function pointer.
1764 * @param pvUser User argument which is returned in completion callback.
1765 * @thread Any thread.
1766 */
1767 DECLR3CALLBACKMEMBER(int, pfnStartFlush,(PPDMIBLOCKASYNC pInterface, void *pvUser));
1768
1769 /**
1770 * Discards the given range.
1771 *
1772 * @returns VBox status code.
1773 * @param pInterface Pointer to the interface structure containing the called function pointer.
1774 * @param paRanges Array of ranges to discard.
1775 * @param cRanges Number of entries in the array.
1776 * @param pvUser User argument which is returned in completion callback.
1777 * @thread Any thread.
1778 */
1779 DECLR3CALLBACKMEMBER(int, pfnStartDiscard,(PPDMIBLOCKASYNC pInterface, PCRTRANGE paRanges, unsigned cRanges, void *pvUser));
1780
1781} PDMIBLOCKASYNC;
1782/** PDMIBLOCKASYNC interface ID. */
1783#define PDMIBLOCKASYNC_IID "a921dd96-1748-4ecd-941e-d5f3cd4c8fe4"
1784
1785
1786/** Pointer to an asynchronous notification interface. */
1787typedef struct PDMIMEDIAASYNCPORT *PPDMIMEDIAASYNCPORT;
1788/**
1789 * Asynchronous version of the media interface (up).
1790 * Pair with PDMIMEDIAASYNC.
1791 */
1792typedef struct PDMIMEDIAASYNCPORT
1793{
1794 /**
1795 * Notify completion of a task.
1796 *
1797 * @returns VBox status code.
1798 * @param pInterface Pointer to the interface structure containing the called function pointer.
1799 * @param pvUser The user argument given in pfnStartWrite.
1800 * @param rcReq IPRT Status code of the completed request.
1801 * @thread Any thread.
1802 */
1803 DECLR3CALLBACKMEMBER(int, pfnTransferCompleteNotify, (PPDMIMEDIAASYNCPORT pInterface, void *pvUser, int rcReq));
1804} PDMIMEDIAASYNCPORT;
1805/** PDMIMEDIAASYNCPORT interface ID. */
1806#define PDMIMEDIAASYNCPORT_IID "22d38853-901f-4a71-9670-4d9da6e82317"
1807
1808
1809/** Pointer to an asynchronous media interface. */
1810typedef struct PDMIMEDIAASYNC *PPDMIMEDIAASYNC;
1811/**
1812 * Asynchronous version of PDMIMEDIA (down).
1813 * Pair with PDMIMEDIAASYNCPORT.
1814 */
1815typedef struct PDMIMEDIAASYNC
1816{
1817 /**
1818 * Start reading task.
1819 *
1820 * @returns VBox status code.
1821 * @param pInterface Pointer to the interface structure containing the called function pointer.
1822 * @param off Offset to start reading from. Must be aligned to a sector boundary.
1823 * @param paSegs Pointer to the S/G segment array.
1824 * @param cSegs Number of entries in the array.
1825 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary.
1826 * @param pvUser User data.
1827 * @thread Any thread.
1828 */
1829 DECLR3CALLBACKMEMBER(int, pfnStartRead,(PPDMIMEDIAASYNC pInterface, uint64_t off, PCRTSGSEG paSegs, unsigned cSegs, size_t cbRead, void *pvUser));
1830
1831 /**
1832 * Start writing task.
1833 *
1834 * @returns VBox status code.
1835 * @param pInterface Pointer to the interface structure containing the called function pointer.
1836 * @param off Offset to start writing at. Must be aligned to a sector boundary.
1837 * @param paSegs Pointer to the S/G segment array.
1838 * @param cSegs Number of entries in the array.
1839 * @param cbWrite Number of bytes to write. Must be aligned to a sector boundary.
1840 * @param pvUser User data.
1841 * @thread Any thread.
1842 */
1843 DECLR3CALLBACKMEMBER(int, pfnStartWrite,(PPDMIMEDIAASYNC pInterface, uint64_t off, PCRTSGSEG paSegs, unsigned cSegs, size_t cbWrite, void *pvUser));
1844
1845 /**
1846 * Flush everything to disk.
1847 *
1848 * @returns VBox status code.
1849 * @param pInterface Pointer to the interface structure containing the called function pointer.
1850 * @param pvUser User argument which is returned in completion callback.
1851 * @thread Any thread.
1852 */
1853 DECLR3CALLBACKMEMBER(int, pfnStartFlush,(PPDMIMEDIAASYNC pInterface, void *pvUser));
1854
1855 /**
1856 * Discards the given range.
1857 *
1858 * @returns VBox status code.
1859 * @param pInterface Pointer to the interface structure containing the called function pointer.
1860 * @param paRanges Array of ranges to discard.
1861 * @param cRanges Number of entries in the array.
1862 * @param pvUser User argument which is returned in completion callback.
1863 * @thread Any thread.
1864 */
1865 DECLR3CALLBACKMEMBER(int, pfnStartDiscard,(PPDMIMEDIAASYNC pInterface, PCRTRANGE paRanges, unsigned cRanges, void *pvUser));
1866
1867} PDMIMEDIAASYNC;
1868/** PDMIMEDIAASYNC interface ID. */
1869#define PDMIMEDIAASYNC_IID "4be209d3-ccb5-4297-82fe-7d8018bc6ab4"
1870
1871
1872/** Pointer to a char port interface. */
1873typedef struct PDMICHARPORT *PPDMICHARPORT;
1874/**
1875 * Char port interface (down).
1876 * Pair with PDMICHARCONNECTOR.
1877 */
1878typedef struct PDMICHARPORT
1879{
1880 /**
1881 * Deliver data read to the device/driver.
1882 *
1883 * @returns VBox status code.
1884 * @param pInterface Pointer to the interface structure containing the called function pointer.
1885 * @param pvBuf Where the read bits are stored.
1886 * @param pcbRead Number of bytes available for reading/having been read.
1887 * @thread Any thread.
1888 */
1889 DECLR3CALLBACKMEMBER(int, pfnNotifyRead,(PPDMICHARPORT pInterface, const void *pvBuf, size_t *pcbRead));
1890
1891 /**
1892 * Notify the device/driver when the status lines changed.
1893 *
1894 * @returns VBox status code.
1895 * @param pInterface Pointer to the interface structure containing the called function pointer.
1896 * @param fNewStatusLine New state of the status line pins.
1897 * @thread Any thread.
1898 */
1899 DECLR3CALLBACKMEMBER(int, pfnNotifyStatusLinesChanged,(PPDMICHARPORT pInterface, uint32_t fNewStatusLines));
1900
1901 /**
1902 * Notify the device when the driver buffer is full.
1903 *
1904 * @returns VBox status code.
1905 * @param pInterface Pointer to the interface structure containing the called function pointer.
1906 * @param fFull Buffer full.
1907 * @thread Any thread.
1908 */
1909 DECLR3CALLBACKMEMBER(int, pfnNotifyBufferFull,(PPDMICHARPORT pInterface, bool fFull));
1910
1911 /**
1912 * Notify the device/driver that a break occurred.
1913 *
1914 * @returns VBox statsus code.
1915 * @param pInterface Pointer to the interface structure containing the called function pointer.
1916 * @thread Any thread.
1917 */
1918 DECLR3CALLBACKMEMBER(int, pfnNotifyBreak,(PPDMICHARPORT pInterface));
1919} PDMICHARPORT;
1920/** PDMICHARPORT interface ID. */
1921#define PDMICHARPORT_IID "22769834-ea8b-4a6d-ade1-213dcdbd1228"
1922
1923/** @name Bit mask definitions for status line type.
1924 * @{ */
1925#define PDMICHARPORT_STATUS_LINES_DCD RT_BIT(0)
1926#define PDMICHARPORT_STATUS_LINES_RI RT_BIT(1)
1927#define PDMICHARPORT_STATUS_LINES_DSR RT_BIT(2)
1928#define PDMICHARPORT_STATUS_LINES_CTS RT_BIT(3)
1929/** @} */
1930
1931
1932/** Pointer to a char interface. */
1933typedef struct PDMICHARCONNECTOR *PPDMICHARCONNECTOR;
1934/**
1935 * Char connector interface (up).
1936 * Pair with PDMICHARPORT.
1937 */
1938typedef struct PDMICHARCONNECTOR
1939{
1940 /**
1941 * Write bits.
1942 *
1943 * @returns VBox status code.
1944 * @param pInterface Pointer to the interface structure containing the called function pointer.
1945 * @param pvBuf Where to store the write bits.
1946 * @param cbWrite Number of bytes to write.
1947 * @thread Any thread.
1948 */
1949 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMICHARCONNECTOR pInterface, const void *pvBuf, size_t cbWrite));
1950
1951 /**
1952 * Set device parameters.
1953 *
1954 * @returns VBox status code.
1955 * @param pInterface Pointer to the interface structure containing the called function pointer.
1956 * @param Bps Speed of the serial connection. (bits per second)
1957 * @param chParity Parity method: 'E' - even, 'O' - odd, 'N' - none.
1958 * @param cDataBits Number of data bits.
1959 * @param cStopBits Number of stop bits.
1960 * @thread Any thread.
1961 */
1962 DECLR3CALLBACKMEMBER(int, pfnSetParameters,(PPDMICHARCONNECTOR pInterface, unsigned Bps, char chParity, unsigned cDataBits, unsigned cStopBits));
1963
1964 /**
1965 * Set the state of the modem lines.
1966 *
1967 * @returns VBox status code.
1968 * @param pInterface Pointer to the interface structure containing the called function pointer.
1969 * @param fRequestToSend Set to true to make the Request to Send line active otherwise to 0.
1970 * @param fDataTerminalReady Set to true to make the Data Terminal Ready line active otherwise 0.
1971 * @thread Any thread.
1972 */
1973 DECLR3CALLBACKMEMBER(int, pfnSetModemLines,(PPDMICHARCONNECTOR pInterface, bool fRequestToSend, bool fDataTerminalReady));
1974
1975 /**
1976 * Sets the TD line into break condition.
1977 *
1978 * @returns VBox status code.
1979 * @param pInterface Pointer to the interface structure containing the called function pointer.
1980 * @param fBreak Set to true to let the device send a break false to put into normal operation.
1981 * @thread Any thread.
1982 */
1983 DECLR3CALLBACKMEMBER(int, pfnSetBreak,(PPDMICHARCONNECTOR pInterface, bool fBreak));
1984} PDMICHARCONNECTOR;
1985/** PDMICHARCONNECTOR interface ID. */
1986#define PDMICHARCONNECTOR_IID "4ad5c190-b408-4cef-926f-fbffce0dc5cc"
1987
1988
1989/** Pointer to a stream interface. */
1990typedef struct PDMISTREAM *PPDMISTREAM;
1991/**
1992 * Stream interface (up).
1993 * Makes up the foundation for PDMICHARCONNECTOR. No pair interface.
1994 */
1995typedef struct PDMISTREAM
1996{
1997 /**
1998 * Read bits.
1999 *
2000 * @returns VBox status code.
2001 * @param pInterface Pointer to the interface structure containing the called function pointer.
2002 * @param pvBuf Where to store the read bits.
2003 * @param cbRead Number of bytes to read/bytes actually read.
2004 * @thread Any thread.
2005 */
2006 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMISTREAM pInterface, void *pvBuf, size_t *cbRead));
2007
2008 /**
2009 * Write bits.
2010 *
2011 * @returns VBox status code.
2012 * @param pInterface Pointer to the interface structure containing the called function pointer.
2013 * @param pvBuf Where to store the write bits.
2014 * @param cbWrite Number of bytes to write/bytes actually written.
2015 * @thread Any thread.
2016 */
2017 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMISTREAM pInterface, const void *pvBuf, size_t *cbWrite));
2018} PDMISTREAM;
2019/** PDMISTREAM interface ID. */
2020#define PDMISTREAM_IID "d1a5bf5e-3d2c-449a-bde9-addd7920b71f"
2021
2022
2023/** Mode of the parallel port */
2024typedef enum PDMPARALLELPORTMODE
2025{
2026 /** First invalid mode. */
2027 PDM_PARALLEL_PORT_MODE_INVALID = 0,
2028 /** SPP (Compatibility mode). */
2029 PDM_PARALLEL_PORT_MODE_SPP,
2030 /** EPP Data mode. */
2031 PDM_PARALLEL_PORT_MODE_EPP_DATA,
2032 /** EPP Address mode. */
2033 PDM_PARALLEL_PORT_MODE_EPP_ADDR,
2034 /** ECP mode (not implemented yet). */
2035 PDM_PARALLEL_PORT_MODE_ECP,
2036 /** 32bit hack. */
2037 PDM_PARALLEL_PORT_MODE_32BIT_HACK = 0x7fffffff
2038} PDMPARALLELPORTMODE;
2039
2040/** Pointer to a host parallel port interface. */
2041typedef struct PDMIHOSTPARALLELPORT *PPDMIHOSTPARALLELPORT;
2042/**
2043 * Host parallel port interface (down).
2044 * Pair with PDMIHOSTPARALLELCONNECTOR.
2045 */
2046typedef struct PDMIHOSTPARALLELPORT
2047{
2048 /**
2049 * Notify device/driver that an interrupt has occurred.
2050 *
2051 * @returns VBox status code.
2052 * @param pInterface Pointer to the interface structure containing the called function pointer.
2053 * @thread Any thread.
2054 */
2055 DECLR3CALLBACKMEMBER(int, pfnNotifyInterrupt,(PPDMIHOSTPARALLELPORT pInterface));
2056} PDMIHOSTPARALLELPORT;
2057/** PDMIHOSTPARALLELPORT interface ID. */
2058#define PDMIHOSTPARALLELPORT_IID "f24b8668-e7f6-4eaa-a14c-4aa2a5f7048e"
2059
2060
2061
2062/** Pointer to a Host Parallel connector interface. */
2063typedef struct PDMIHOSTPARALLELCONNECTOR *PPDMIHOSTPARALLELCONNECTOR;
2064/**
2065 * Host parallel connector interface (up).
2066 * Pair with PDMIHOSTPARALLELPORT.
2067 */
2068typedef struct PDMIHOSTPARALLELCONNECTOR
2069{
2070 /**
2071 * Write bits.
2072 *
2073 * @returns VBox status code.
2074 * @param pInterface Pointer to the interface structure containing the called function pointer.
2075 * @param pvBuf Where to store the write bits.
2076 * @param cbWrite Number of bytes to write.
2077 * @param enmMode Mode to write the data.
2078 * @thread Any thread.
2079 * @todo r=klaus cbWrite only defines buffer length, method needs a way top return actually written amount of data.
2080 */
2081 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIHOSTPARALLELCONNECTOR pInterface, const void *pvBuf,
2082 size_t cbWrite, PDMPARALLELPORTMODE enmMode));
2083
2084 /**
2085 * Read bits.
2086 *
2087 * @returns VBox status code.
2088 * @param pInterface Pointer to the interface structure containing the called function pointer.
2089 * @param pvBuf Where to store the read bits.
2090 * @param cbRead Number of bytes to read.
2091 * @param enmMode Mode to read the data.
2092 * @thread Any thread.
2093 * @todo r=klaus cbRead only defines buffer length, method needs a way top return actually read amount of data.
2094 */
2095 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIHOSTPARALLELCONNECTOR pInterface, void *pvBuf,
2096 size_t cbRead, PDMPARALLELPORTMODE enmMode));
2097
2098 /**
2099 * Set data direction of the port (forward/reverse).
2100 *
2101 * @returns VBox status code.
2102 * @param pInterface Pointer to the interface structure containing the called function pointer.
2103 * @param fForward Flag whether to indicate whether the port is operated in forward or reverse mode.
2104 * @thread Any thread.
2105 */
2106 DECLR3CALLBACKMEMBER(int, pfnSetPortDirection,(PPDMIHOSTPARALLELCONNECTOR pInterface, bool fForward));
2107
2108 /**
2109 * Write control register bits.
2110 *
2111 * @returns VBox status code.
2112 * @param pInterface Pointer to the interface structure containing the called function pointer.
2113 * @param fReg The new control register value.
2114 * @thread Any thread.
2115 */
2116 DECLR3CALLBACKMEMBER(int, pfnWriteControl,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t fReg));
2117
2118 /**
2119 * Read control register bits.
2120 *
2121 * @returns VBox status code.
2122 * @param pInterface Pointer to the interface structure containing the called function pointer.
2123 * @param pfReg Where to store the control register bits.
2124 * @thread Any thread.
2125 */
2126 DECLR3CALLBACKMEMBER(int, pfnReadControl,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t *pfReg));
2127
2128 /**
2129 * Read status register bits.
2130 *
2131 * @returns VBox status code.
2132 * @param pInterface Pointer to the interface structure containing the called function pointer.
2133 * @param pfReg Where to store the status register bits.
2134 * @thread Any thread.
2135 */
2136 DECLR3CALLBACKMEMBER(int, pfnReadStatus,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t *pfReg));
2137
2138} PDMIHOSTPARALLELCONNECTOR;
2139/** PDMIHOSTPARALLELCONNECTOR interface ID. */
2140#define PDMIHOSTPARALLELCONNECTOR_IID "7c532602-7438-4fbc-9265-349d9f0415f9"
2141
2142
2143/** ACPI power source identifier */
2144typedef enum PDMACPIPOWERSOURCE
2145{
2146 PDM_ACPI_POWER_SOURCE_UNKNOWN = 0,
2147 PDM_ACPI_POWER_SOURCE_OUTLET,
2148 PDM_ACPI_POWER_SOURCE_BATTERY
2149} PDMACPIPOWERSOURCE;
2150/** Pointer to ACPI battery state. */
2151typedef PDMACPIPOWERSOURCE *PPDMACPIPOWERSOURCE;
2152
2153/** ACPI battey capacity */
2154typedef enum PDMACPIBATCAPACITY
2155{
2156 PDM_ACPI_BAT_CAPACITY_MIN = 0,
2157 PDM_ACPI_BAT_CAPACITY_MAX = 100,
2158 PDM_ACPI_BAT_CAPACITY_UNKNOWN = 255
2159} PDMACPIBATCAPACITY;
2160/** Pointer to ACPI battery capacity. */
2161typedef PDMACPIBATCAPACITY *PPDMACPIBATCAPACITY;
2162
2163/** ACPI battery state. See ACPI 3.0 spec '_BST (Battery Status)' */
2164typedef enum PDMACPIBATSTATE
2165{
2166 PDM_ACPI_BAT_STATE_CHARGED = 0x00,
2167 PDM_ACPI_BAT_STATE_DISCHARGING = 0x01,
2168 PDM_ACPI_BAT_STATE_CHARGING = 0x02,
2169 PDM_ACPI_BAT_STATE_CRITICAL = 0x04
2170} PDMACPIBATSTATE;
2171/** Pointer to ACPI battery state. */
2172typedef PDMACPIBATSTATE *PPDMACPIBATSTATE;
2173
2174/** Pointer to an ACPI port interface. */
2175typedef struct PDMIACPIPORT *PPDMIACPIPORT;
2176/**
2177 * ACPI port interface (down). Used by both the ACPI driver and (grumble) main.
2178 * Pair with PDMIACPICONNECTOR.
2179 */
2180typedef struct PDMIACPIPORT
2181{
2182 /**
2183 * Send an ACPI power off event.
2184 *
2185 * @returns VBox status code
2186 * @param pInterface Pointer to the interface structure containing the called function pointer.
2187 */
2188 DECLR3CALLBACKMEMBER(int, pfnPowerButtonPress,(PPDMIACPIPORT pInterface));
2189
2190 /**
2191 * Send an ACPI sleep button event.
2192 *
2193 * @returns VBox status code
2194 * @param pInterface Pointer to the interface structure containing the called function pointer.
2195 */
2196 DECLR3CALLBACKMEMBER(int, pfnSleepButtonPress,(PPDMIACPIPORT pInterface));
2197
2198 /**
2199 * Check if the last power button event was handled by the guest.
2200 *
2201 * @returns VBox status code
2202 * @param pInterface Pointer to the interface structure containing the called function pointer.
2203 * @param pfHandled Is set to true if the last power button event was handled, false otherwise.
2204 */
2205 DECLR3CALLBACKMEMBER(int, pfnGetPowerButtonHandled,(PPDMIACPIPORT pInterface, bool *pfHandled));
2206
2207 /**
2208 * Check if the guest entered the ACPI mode.
2209 *
2210 * @returns VBox status code
2211 * @param pInterface Pointer to the interface structure containing the called function pointer.
2212 * @param pfEnabled Is set to true if the guest entered the ACPI mode, false otherwise.
2213 */
2214 DECLR3CALLBACKMEMBER(int, pfnGetGuestEnteredACPIMode,(PPDMIACPIPORT pInterface, bool *pfEntered));
2215
2216 /**
2217 * Check if the given CPU is still locked by the guest.
2218 *
2219 * @returns VBox status code
2220 * @param pInterface Pointer to the interface structure containing the called function pointer.
2221 * @param uCpu The CPU to check for.
2222 * @param pfLocked Is set to true if the CPU is still locked by the guest, false otherwise.
2223 */
2224 DECLR3CALLBACKMEMBER(int, pfnGetCpuStatus,(PPDMIACPIPORT pInterface, unsigned uCpu, bool *pfLocked));
2225} PDMIACPIPORT;
2226/** PDMIACPIPORT interface ID. */
2227#define PDMIACPIPORT_IID "30d3dc4c-6a73-40c8-80e9-34309deacbb3"
2228
2229
2230/** Pointer to an ACPI connector interface. */
2231typedef struct PDMIACPICONNECTOR *PPDMIACPICONNECTOR;
2232/**
2233 * ACPI connector interface (up).
2234 * Pair with PDMIACPIPORT.
2235 */
2236typedef struct PDMIACPICONNECTOR
2237{
2238 /**
2239 * Get the current power source of the host system.
2240 *
2241 * @returns VBox status code
2242 * @param pInterface Pointer to the interface structure containing the called function pointer.
2243 * @param penmPowerSource Pointer to the power source result variable.
2244 */
2245 DECLR3CALLBACKMEMBER(int, pfnQueryPowerSource,(PPDMIACPICONNECTOR, PPDMACPIPOWERSOURCE penmPowerSource));
2246
2247 /**
2248 * Query the current battery status of the host system.
2249 *
2250 * @returns VBox status code?
2251 * @param pInterface Pointer to the interface structure containing the called function pointer.
2252 * @param pfPresent Is set to true if battery is present, false otherwise.
2253 * @param penmRemainingCapacity Pointer to the battery remaining capacity (0 - 100 or 255 for unknown).
2254 * @param penmBatteryState Pointer to the battery status.
2255 * @param pu32PresentRate Pointer to the present rate (0..1000 of the total capacity).
2256 */
2257 DECLR3CALLBACKMEMBER(int, pfnQueryBatteryStatus,(PPDMIACPICONNECTOR, bool *pfPresent, PPDMACPIBATCAPACITY penmRemainingCapacity,
2258 PPDMACPIBATSTATE penmBatteryState, uint32_t *pu32PresentRate));
2259} PDMIACPICONNECTOR;
2260/** PDMIACPICONNECTOR interface ID. */
2261#define PDMIACPICONNECTOR_IID "5f14bf8d-1edf-4e3a-a1e1-cca9fd08e359"
2262
2263
2264/** Pointer to a VMMDevice port interface. */
2265typedef struct PDMIVMMDEVPORT *PPDMIVMMDEVPORT;
2266/**
2267 * VMMDevice port interface (down).
2268 * Pair with PDMIVMMDEVCONNECTOR.
2269 */
2270typedef struct PDMIVMMDEVPORT
2271{
2272 /**
2273 * Return the current absolute mouse position in pixels
2274 *
2275 * @returns VBox status code
2276 * @param pInterface Pointer to the interface structure containing the called function pointer.
2277 * @param pxAbs Pointer of result value, can be NULL
2278 * @param pyAbs Pointer of result value, can be NULL
2279 */
2280 DECLR3CALLBACKMEMBER(int, pfnQueryAbsoluteMouse,(PPDMIVMMDEVPORT pInterface, int32_t *pxAbs, int32_t *pyAbs));
2281
2282 /**
2283 * Set the new absolute mouse position in pixels
2284 *
2285 * @returns VBox status code
2286 * @param pInterface Pointer to the interface structure containing the called function pointer.
2287 * @param xabs New absolute X position
2288 * @param yAbs New absolute Y position
2289 */
2290 DECLR3CALLBACKMEMBER(int, pfnSetAbsoluteMouse,(PPDMIVMMDEVPORT pInterface, int32_t xAbs, int32_t yAbs));
2291
2292 /**
2293 * Return the current mouse capability flags
2294 *
2295 * @returns VBox status code
2296 * @param pInterface Pointer to the interface structure containing the called function pointer.
2297 * @param pfCapabilities Pointer of result value
2298 */
2299 DECLR3CALLBACKMEMBER(int, pfnQueryMouseCapabilities,(PPDMIVMMDEVPORT pInterface, uint32_t *pfCapabilities));
2300
2301 /**
2302 * Set the current mouse capability flag (host side)
2303 *
2304 * @returns VBox status code
2305 * @param pInterface Pointer to the interface structure containing the called function pointer.
2306 * @param fCapsAdded Mask of capabilities to add to the flag
2307 * @param fCapsRemoved Mask of capabilities to remove from the flag
2308 */
2309 DECLR3CALLBACKMEMBER(int, pfnUpdateMouseCapabilities,(PPDMIVMMDEVPORT pInterface, uint32_t fCapsAdded, uint32_t fCapsRemoved));
2310
2311 /**
2312 * Issue a display resolution change request.
2313 *
2314 * Note that there can only one request in the queue and that in case the guest does
2315 * not process it, issuing another request will overwrite the previous.
2316 *
2317 * @returns VBox status code
2318 * @param pInterface Pointer to the interface structure containing the called function pointer.
2319 * @param cx Horizontal pixel resolution (0 = do not change).
2320 * @param cy Vertical pixel resolution (0 = do not change).
2321 * @param cBits Bits per pixel (0 = do not change).
2322 * @param idxDisplay The display index.
2323 * @param xOrigin The X coordinate of the lower left
2324 * corner of the secondary display with
2325 * ID = idxDisplay
2326 * @param yOrigin The Y coordinate of the lower left
2327 * corner of the secondary display with
2328 * ID = idxDisplay
2329 * @param fEnabled Whether the display is enabled or not. (Guessing
2330 * again.)
2331 * @param fChangeOrigin Whether the display origin point changed. (Guess)
2332 */
2333 DECLR3CALLBACKMEMBER(int, pfnRequestDisplayChange,(PPDMIVMMDEVPORT pInterface, uint32_t cx,
2334 uint32_t cy, uint32_t cBits, uint32_t idxDisplay,
2335 int32_t xOrigin, int32_t yOrigin, bool fEnabled, bool fChangeOrigin));
2336
2337 /**
2338 * Pass credentials to guest.
2339 *
2340 * Note that there can only be one set of credentials and the guest may or may not
2341 * query them and may do whatever it wants with them.
2342 *
2343 * @returns VBox status code.
2344 * @param pInterface Pointer to the interface structure containing the called function pointer.
2345 * @param pszUsername User name, may be empty (UTF-8).
2346 * @param pszPassword Password, may be empty (UTF-8).
2347 * @param pszDomain Domain name, may be empty (UTF-8).
2348 * @param fFlags VMMDEV_SETCREDENTIALS_*.
2349 */
2350 DECLR3CALLBACKMEMBER(int, pfnSetCredentials,(PPDMIVMMDEVPORT pInterface, const char *pszUsername,
2351 const char *pszPassword, const char *pszDomain,
2352 uint32_t fFlags));
2353
2354 /**
2355 * Notify the driver about a VBVA status change.
2356 *
2357 * @returns Nothing. Because it is informational callback.
2358 * @param pInterface Pointer to the interface structure containing the called function pointer.
2359 * @param fEnabled Current VBVA status.
2360 */
2361 DECLR3CALLBACKMEMBER(void, pfnVBVAChange, (PPDMIVMMDEVPORT pInterface, bool fEnabled));
2362
2363 /**
2364 * Issue a seamless mode change request.
2365 *
2366 * Note that there can only one request in the queue and that in case the guest does
2367 * not process it, issuing another request will overwrite the previous.
2368 *
2369 * @returns VBox status code
2370 * @param pInterface Pointer to the interface structure containing the called function pointer.
2371 * @param fEnabled Seamless mode enabled or not
2372 */
2373 DECLR3CALLBACKMEMBER(int, pfnRequestSeamlessChange,(PPDMIVMMDEVPORT pInterface, bool fEnabled));
2374
2375 /**
2376 * Issue a memory balloon change request.
2377 *
2378 * Note that there can only one request in the queue and that in case the guest does
2379 * not process it, issuing another request will overwrite the previous.
2380 *
2381 * @returns VBox status code
2382 * @param pInterface Pointer to the interface structure containing the called function pointer.
2383 * @param cMbBalloon Balloon size in megabytes
2384 */
2385 DECLR3CALLBACKMEMBER(int, pfnSetMemoryBalloon,(PPDMIVMMDEVPORT pInterface, uint32_t cMbBalloon));
2386
2387 /**
2388 * Issue a statistcs interval change request.
2389 *
2390 * Note that there can only one request in the queue and that in case the guest does
2391 * not process it, issuing another request will overwrite the previous.
2392 *
2393 * @returns VBox status code
2394 * @param pInterface Pointer to the interface structure containing the called function pointer.
2395 * @param cSecsStatInterval Statistics query interval in seconds
2396 * (0=disable).
2397 */
2398 DECLR3CALLBACKMEMBER(int, pfnSetStatisticsInterval,(PPDMIVMMDEVPORT pInterface, uint32_t cSecsStatInterval));
2399
2400 /**
2401 * Notify the guest about a VRDP status change.
2402 *
2403 * @returns VBox status code
2404 * @param pInterface Pointer to the interface structure containing the called function pointer.
2405 * @param fVRDPEnabled Current VRDP status.
2406 * @param uVRDPExperienceLevel Which visual effects to be disabled in
2407 * the guest.
2408 */
2409 DECLR3CALLBACKMEMBER(int, pfnVRDPChange, (PPDMIVMMDEVPORT pInterface, bool fVRDPEnabled, uint32_t uVRDPExperienceLevel));
2410
2411 /**
2412 * Notify the guest of CPU hot-unplug event.
2413 *
2414 * @returns VBox status code
2415 * @param pInterface Pointer to the interface structure containing the called function pointer.
2416 * @param idCpuCore The core id of the CPU to remove.
2417 * @param idCpuPackage The package id of the CPU to remove.
2418 */
2419 DECLR3CALLBACKMEMBER(int, pfnCpuHotUnplug, (PPDMIVMMDEVPORT pInterface, uint32_t idCpuCore, uint32_t idCpuPackage));
2420
2421 /**
2422 * Notify the guest of CPU hot-plug event.
2423 *
2424 * @returns VBox status code
2425 * @param pInterface Pointer to the interface structure containing the called function pointer.
2426 * @param idCpuCore The core id of the CPU to add.
2427 * @param idCpuPackage The package id of the CPU to add.
2428 */
2429 DECLR3CALLBACKMEMBER(int, pfnCpuHotPlug, (PPDMIVMMDEVPORT pInterface, uint32_t idCpuCore, uint32_t idCpuPackage));
2430
2431} PDMIVMMDEVPORT;
2432/** PDMIVMMDEVPORT interface ID. */
2433#define PDMIVMMDEVPORT_IID "d7e52035-3b6c-422e-9215-2a75646a945d"
2434
2435
2436/** Pointer to a HPET legacy notification interface. */
2437typedef struct PDMIHPETLEGACYNOTIFY *PPDMIHPETLEGACYNOTIFY;
2438/**
2439 * HPET legacy notification interface.
2440 */
2441typedef struct PDMIHPETLEGACYNOTIFY
2442{
2443 /**
2444 * Notify about change of HPET legacy mode.
2445 *
2446 * @param pInterface Pointer to the interface structure containing the
2447 * called function pointer.
2448 * @param fActivated If HPET legacy mode is activated (@c true) or
2449 * deactivated (@c false).
2450 */
2451 DECLR3CALLBACKMEMBER(void, pfnModeChanged,(PPDMIHPETLEGACYNOTIFY pInterface, bool fActivated));
2452} PDMIHPETLEGACYNOTIFY;
2453/** PDMIHPETLEGACYNOTIFY interface ID. */
2454#define PDMIHPETLEGACYNOTIFY_IID "c9ada595-4b65-4311-8b21-b10498997774"
2455
2456
2457/** @name Flags for PDMIVMMDEVPORT::pfnSetCredentials.
2458 * @{ */
2459/** The guest should perform a logon with the credentials. */
2460#define VMMDEV_SETCREDENTIALS_GUESTLOGON RT_BIT(0)
2461/** The guest should prevent local logons. */
2462#define VMMDEV_SETCREDENTIALS_NOLOCALLOGON RT_BIT(1)
2463/** The guest should verify the credentials. */
2464#define VMMDEV_SETCREDENTIALS_JUDGE RT_BIT(15)
2465/** @} */
2466
2467/** Forward declaration of the guest information structure. */
2468struct VBoxGuestInfo;
2469/** Forward declaration of the guest information-2 structure. */
2470struct VBoxGuestInfo2;
2471/** Forward declaration of the guest statistics structure */
2472struct VBoxGuestStatistics;
2473/** Forward declaration of the guest status structure */
2474struct VBoxGuestStatus;
2475
2476/** Forward declaration of the video accelerator command memory. */
2477struct VBVAMEMORY;
2478/** Pointer to video accelerator command memory. */
2479typedef struct VBVAMEMORY *PVBVAMEMORY;
2480
2481/** Pointer to a VMMDev connector interface. */
2482typedef struct PDMIVMMDEVCONNECTOR *PPDMIVMMDEVCONNECTOR;
2483/**
2484 * VMMDev connector interface (up).
2485 * Pair with PDMIVMMDEVPORT.
2486 */
2487typedef struct PDMIVMMDEVCONNECTOR
2488{
2489 /**
2490 * Update guest facility status.
2491 *
2492 * Called in response to VMMDevReq_ReportGuestStatus, reset or state restore.
2493 *
2494 * @param pInterface Pointer to this interface.
2495 * @param uFacility The facility.
2496 * @param uStatus The status.
2497 * @param fFlags Flags assoicated with the update. Currently
2498 * reserved and should be ignored.
2499 * @param pTimeSpecTS Pointer to the timestamp of this report.
2500 * @thread The emulation thread.
2501 */
2502 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestStatus,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t uFacility, uint16_t uStatus,
2503 uint32_t fFlags, PCRTTIMESPEC pTimeSpecTS));
2504
2505 /**
2506 * Updates a guest user state.
2507 *
2508 * Called in response to VMMDevReq_ReportGuestUserState.
2509 *
2510 * @param pInterface Pointer to this interface.
2511 * @param pszUser Guest user name to update status for.
2512 * @param pszDomain Domain the guest user is bound to. Optional.
2513 * @param uState New guest user state to notify host about.
2514 * @param puDetails Pointer to optional state data.
2515 * @param cbDetails Size (in bytes) of optional state data.
2516 * @thread The emulation thread.
2517 */
2518 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestUserState,(PPDMIVMMDEVCONNECTOR pInterface, const char *pszUser, const char *pszDomain,
2519 uint32_t uState,
2520 const uint8_t *puDetails, uint32_t cbDetails));
2521
2522 /**
2523 * Reports the guest API and OS version.
2524 * Called whenever the Additions issue a guest info report request.
2525 *
2526 * @param pInterface Pointer to this interface.
2527 * @param pGuestInfo Pointer to guest information structure
2528 * @thread The emulation thread.
2529 */
2530 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestInfo,(PPDMIVMMDEVCONNECTOR pInterface, const struct VBoxGuestInfo *pGuestInfo));
2531
2532 /**
2533 * Reports the detailed Guest Additions version.
2534 *
2535 * @param pInterface Pointer to this interface.
2536 * @param uFullVersion The guest additions version as a full version.
2537 * Use VBOX_FULL_VERSION_GET_MAJOR,
2538 * VBOX_FULL_VERSION_GET_MINOR and
2539 * VBOX_FULL_VERSION_GET_BUILD to access it.
2540 * (This will not be zero, so turn down the
2541 * paranoia level a notch.)
2542 * @param pszName Pointer to the sanitized version name. This can
2543 * be empty, but will not be NULL. If not empty,
2544 * it will contain a build type tag and/or a
2545 * publisher tag. If both, then they are separated
2546 * by an underscore (VBOX_VERSION_STRING fashion).
2547 * @param uRevision The SVN revision. Can be 0.
2548 * @param fFeatures Feature mask, currently none are defined.
2549 *
2550 * @thread The emulation thread.
2551 */
2552 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestInfo2,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t uFullVersion,
2553 const char *pszName, uint32_t uRevision, uint32_t fFeatures));
2554
2555 /**
2556 * Update the guest additions capabilities.
2557 * This is called when the guest additions capabilities change. The new capabilities
2558 * are given and the connector should update its internal state.
2559 *
2560 * @param pInterface Pointer to this interface.
2561 * @param newCapabilities New capabilities.
2562 * @thread The emulation thread.
2563 */
2564 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestCapabilities,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities));
2565
2566 /**
2567 * Update the mouse capabilities.
2568 * This is called when the mouse capabilities change. The new capabilities
2569 * are given and the connector should update its internal state.
2570 *
2571 * @param pInterface Pointer to this interface.
2572 * @param newCapabilities New capabilities.
2573 * @thread The emulation thread.
2574 */
2575 DECLR3CALLBACKMEMBER(void, pfnUpdateMouseCapabilities,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities));
2576
2577 /**
2578 * Update the pointer shape.
2579 * This is called when the mouse pointer shape changes. The new shape
2580 * is passed as a caller allocated buffer that will be freed after returning
2581 *
2582 * @param pInterface Pointer to this interface.
2583 * @param fVisible Visibility indicator (if false, the other parameters are undefined).
2584 * @param fAlpha Flag whether alpha channel is being passed.
2585 * @param xHot Pointer hot spot x coordinate.
2586 * @param yHot Pointer hot spot y coordinate.
2587 * @param x Pointer new x coordinate on screen.
2588 * @param y Pointer new y coordinate on screen.
2589 * @param cx Pointer width in pixels.
2590 * @param cy Pointer height in pixels.
2591 * @param cbScanline Size of one scanline in bytes.
2592 * @param pvShape New shape buffer.
2593 * @thread The emulation thread.
2594 */
2595 DECLR3CALLBACKMEMBER(void, pfnUpdatePointerShape,(PPDMIVMMDEVCONNECTOR pInterface, bool fVisible, bool fAlpha,
2596 uint32_t xHot, uint32_t yHot,
2597 uint32_t cx, uint32_t cy,
2598 void *pvShape));
2599
2600 /**
2601 * Enable or disable video acceleration on behalf of guest.
2602 *
2603 * @param pInterface Pointer to this interface.
2604 * @param fEnable Whether to enable acceleration.
2605 * @param pVbvaMemory Video accelerator memory.
2606
2607 * @return VBox rc. VINF_SUCCESS if VBVA was enabled.
2608 * @thread The emulation thread.
2609 */
2610 DECLR3CALLBACKMEMBER(int, pfnVideoAccelEnable,(PPDMIVMMDEVCONNECTOR pInterface, bool fEnable, PVBVAMEMORY pVbvaMemory));
2611
2612 /**
2613 * Force video queue processing.
2614 *
2615 * @param pInterface Pointer to this interface.
2616 * @thread The emulation thread.
2617 */
2618 DECLR3CALLBACKMEMBER(void, pfnVideoAccelFlush,(PPDMIVMMDEVCONNECTOR pInterface));
2619
2620 /**
2621 * Return whether the given video mode is supported/wanted by the host.
2622 *
2623 * @returns VBox status code
2624 * @param pInterface Pointer to this interface.
2625 * @param display The guest monitor, 0 for primary.
2626 * @param cy Video mode horizontal resolution in pixels.
2627 * @param cx Video mode vertical resolution in pixels.
2628 * @param cBits Video mode bits per pixel.
2629 * @param pfSupported Where to put the indicator for whether this mode is supported. (output)
2630 * @thread The emulation thread.
2631 */
2632 DECLR3CALLBACKMEMBER(int, pfnVideoModeSupported,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t display, uint32_t cx, uint32_t cy, uint32_t cBits, bool *pfSupported));
2633
2634 /**
2635 * Queries by how many pixels the height should be reduced when calculating video modes
2636 *
2637 * @returns VBox status code
2638 * @param pInterface Pointer to this interface.
2639 * @param pcyReduction Pointer to the result value.
2640 * @thread The emulation thread.
2641 */
2642 DECLR3CALLBACKMEMBER(int, pfnGetHeightReduction,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcyReduction));
2643
2644 /**
2645 * Informs about a credentials judgement result from the guest.
2646 *
2647 * @returns VBox status code
2648 * @param pInterface Pointer to this interface.
2649 * @param fFlags Judgement result flags.
2650 * @thread The emulation thread.
2651 */
2652 DECLR3CALLBACKMEMBER(int, pfnSetCredentialsJudgementResult,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t fFlags));
2653
2654 /**
2655 * Set the visible region of the display
2656 *
2657 * @returns VBox status code.
2658 * @param pInterface Pointer to this interface.
2659 * @param cRect Number of rectangles in pRect
2660 * @param pRect Rectangle array
2661 * @thread The emulation thread.
2662 */
2663 DECLR3CALLBACKMEMBER(int, pfnSetVisibleRegion,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t cRect, PRTRECT pRect));
2664
2665 /**
2666 * Query the visible region of the display
2667 *
2668 * @returns VBox status code.
2669 * @param pInterface Pointer to this interface.
2670 * @param pcRect Number of rectangles in pRect
2671 * @param pRect Rectangle array (set to NULL to query the number of rectangles)
2672 * @thread The emulation thread.
2673 */
2674 DECLR3CALLBACKMEMBER(int, pfnQueryVisibleRegion,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcRect, PRTRECT pRect));
2675
2676 /**
2677 * Request the statistics interval
2678 *
2679 * @returns VBox status code.
2680 * @param pInterface Pointer to this interface.
2681 * @param pulInterval Pointer to interval in seconds
2682 * @thread The emulation thread.
2683 */
2684 DECLR3CALLBACKMEMBER(int, pfnQueryStatisticsInterval,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pulInterval));
2685
2686 /**
2687 * Report new guest statistics
2688 *
2689 * @returns VBox status code.
2690 * @param pInterface Pointer to this interface.
2691 * @param pGuestStats Guest statistics
2692 * @thread The emulation thread.
2693 */
2694 DECLR3CALLBACKMEMBER(int, pfnReportStatistics,(PPDMIVMMDEVCONNECTOR pInterface, struct VBoxGuestStatistics *pGuestStats));
2695
2696 /**
2697 * Query the current balloon size
2698 *
2699 * @returns VBox status code.
2700 * @param pInterface Pointer to this interface.
2701 * @param pcbBalloon Balloon size
2702 * @thread The emulation thread.
2703 */
2704 DECLR3CALLBACKMEMBER(int, pfnQueryBalloonSize,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcbBalloon));
2705
2706 /**
2707 * Query the current page fusion setting
2708 *
2709 * @returns VBox status code.
2710 * @param pInterface Pointer to this interface.
2711 * @param pfPageFusionEnabled Pointer to boolean
2712 * @thread The emulation thread.
2713 */
2714 DECLR3CALLBACKMEMBER(int, pfnIsPageFusionEnabled,(PPDMIVMMDEVCONNECTOR pInterface, bool *pfPageFusionEnabled));
2715
2716} PDMIVMMDEVCONNECTOR;
2717/** PDMIVMMDEVCONNECTOR interface ID. */
2718#define PDMIVMMDEVCONNECTOR_IID "aff90240-a443-434e-9132-80c186ab97d4"
2719
2720
2721#ifndef VBOX_WITH_PDM_AUDIO_DRIVER
2722/** Pointer to a network connector interface */
2723typedef struct PDMIAUDIOCONNECTOR *PPDMIAUDIOCONNECTOR;
2724/**
2725 * Audio connector interface (up).
2726 * No interface pair yet.
2727 */
2728typedef struct PDMIAUDIOCONNECTOR
2729{
2730 DECLR3CALLBACKMEMBER(void, pfnRun,(PPDMIAUDIOCONNECTOR pInterface));
2731
2732/* DECLR3CALLBACKMEMBER(int, pfnSetRecordSource,(PPDMIAUDIOINCONNECTOR pInterface, AUDIORECSOURCE)); */
2733
2734} PDMIAUDIOCONNECTOR;
2735/** PDMIAUDIOCONNECTOR interface ID. */
2736#define PDMIAUDIOCONNECTOR_IID "85d52af5-b3aa-4b3e-b176-4b5ebfc52f47"
2737
2738
2739#endif
2740/** @todo r=bird: the two following interfaces are hacks to work around the missing audio driver
2741 * interface. This should be addressed rather than making more temporary hacks. */
2742
2743/** Pointer to a Audio Sniffer Device port interface. */
2744typedef struct PDMIAUDIOSNIFFERPORT *PPDMIAUDIOSNIFFERPORT;
2745/**
2746 * Audio Sniffer port interface (down).
2747 * Pair with PDMIAUDIOSNIFFERCONNECTOR.
2748 */
2749typedef struct PDMIAUDIOSNIFFERPORT
2750{
2751 /**
2752 * Enables or disables sniffing.
2753 *
2754 * If sniffing is being enabled also sets a flag whether the audio must be also
2755 * left on the host.
2756 *
2757 * @returns VBox status code
2758 * @param pInterface Pointer to this interface.
2759 * @param fEnable 'true' for enable sniffing, 'false' to disable.
2760 * @param fKeepHostAudio Indicates whether host audio should also present
2761 * 'true' means that sound should not be played
2762 * by the audio device.
2763 */
2764 DECLR3CALLBACKMEMBER(int, pfnSetup,(PPDMIAUDIOSNIFFERPORT pInterface, bool fEnable, bool fKeepHostAudio));
2765
2766 /**
2767 * Enables or disables audio input.
2768 *
2769 * @returns VBox status code
2770 * @param pInterface Pointer to this interface.
2771 * @param fIntercept 'true' for interception of audio input,
2772 * 'false' to let the host audio backend do audio input.
2773 */
2774 DECLR3CALLBACKMEMBER(int, pfnAudioInputIntercept,(PPDMIAUDIOSNIFFERPORT pInterface, bool fIntercept));
2775
2776 /**
2777 * Audio input is about to start.
2778 *
2779 * @returns VBox status code.
2780 * @param pvContext The callback context, supplied in the
2781 * PDMIAUDIOSNIFFERCONNECTOR::pfnAudioInputBegin as pvContext.
2782 * @param iSampleHz The sample frequency in Hz.
2783 * @param cChannels Number of channels. 1 for mono, 2 for stereo.
2784 * @param cBits How many bits a sample for a single channel has. Normally 8 or 16.
2785 * @param fUnsigned Whether samples are unsigned values.
2786 */
2787 DECLR3CALLBACKMEMBER(int, pfnAudioInputEventBegin,(PPDMIAUDIOSNIFFERPORT pInterface,
2788 void *pvContext,
2789 int iSampleHz,
2790 int cChannels,
2791 int cBits,
2792 bool fUnsigned));
2793
2794 /**
2795 * Callback which delivers audio data to the audio device.
2796 *
2797 * @returns VBox status code.
2798 * @param pvContext The callback context, supplied in the
2799 * PDMIAUDIOSNIFFERCONNECTOR::pfnAudioInputBegin as pvContext.
2800 * @param pvData Event specific data.
2801 * @param cbData Size of the buffer pointed by pvData.
2802 */
2803 DECLR3CALLBACKMEMBER(int, pfnAudioInputEventData,(PPDMIAUDIOSNIFFERPORT pInterface,
2804 void *pvContext,
2805 const void *pvData,
2806 uint32_t cbData));
2807
2808 /**
2809 * Audio input ends.
2810 *
2811 * @param pvContext The callback context, supplied in the
2812 * PDMIAUDIOSNIFFERCONNECTOR::pfnAudioInputBegin as pvContext.
2813 */
2814 DECLR3CALLBACKMEMBER(void, pfnAudioInputEventEnd,(PPDMIAUDIOSNIFFERPORT pInterface,
2815 void *pvContext));
2816} PDMIAUDIOSNIFFERPORT;
2817/** PDMIAUDIOSNIFFERPORT interface ID. */
2818#define PDMIAUDIOSNIFFERPORT_IID "8ad25d78-46e9-479b-a363-bb0bc0fe022f"
2819
2820
2821/** Pointer to a Audio Sniffer connector interface. */
2822typedef struct PDMIAUDIOSNIFFERCONNECTOR *PPDMIAUDIOSNIFFERCONNECTOR;
2823
2824/**
2825 * Audio Sniffer connector interface (up).
2826 * Pair with PDMIAUDIOSNIFFERPORT.
2827 */
2828typedef struct PDMIAUDIOSNIFFERCONNECTOR
2829{
2830 /**
2831 * AudioSniffer device calls this method when audio samples
2832 * are about to be played and sniffing is enabled.
2833 *
2834 * @param pInterface Pointer to this interface.
2835 * @param pvSamples Audio samples buffer.
2836 * @param cSamples How many complete samples are in the buffer.
2837 * @param iSampleHz The sample frequency in Hz.
2838 * @param cChannels Number of channels. 1 for mono, 2 for stereo.
2839 * @param cBits How many bits a sample for a single channel has. Normally 8 or 16.
2840 * @param fUnsigned Whether samples are unsigned values.
2841 * @thread The emulation thread.
2842 */
2843 DECLR3CALLBACKMEMBER(void, pfnAudioSamplesOut,(PPDMIAUDIOSNIFFERCONNECTOR pInterface, void *pvSamples, uint32_t cSamples,
2844 int iSampleHz, int cChannels, int cBits, bool fUnsigned));
2845
2846 /**
2847 * AudioSniffer device calls this method when output volume is changed.
2848 *
2849 * @param pInterface Pointer to this interface.
2850 * @param u16LeftVolume 0..0xFFFF volume level for left channel.
2851 * @param u16RightVolume 0..0xFFFF volume level for right channel.
2852 * @thread The emulation thread.
2853 */
2854 DECLR3CALLBACKMEMBER(void, pfnAudioVolumeOut,(PPDMIAUDIOSNIFFERCONNECTOR pInterface, uint16_t u16LeftVolume, uint16_t u16RightVolume));
2855
2856 /**
2857 * Audio input has been requested by the virtual audio device.
2858 *
2859 * @param pInterface Pointer to this interface.
2860 * @param ppvUserCtx The interface context for this audio input stream,
2861 * it will be used in the pfnAudioInputEnd call.
2862 * @param pvContext The context pointer to be used in PDMIAUDIOSNIFFERPORT::pfnAudioInputEvent.
2863 * @param cSamples How many samples in a block is preferred in
2864 * PDMIAUDIOSNIFFERPORT::pfnAudioInputEvent.
2865 * @param iSampleHz The sample frequency in Hz.
2866 * @param cChannels Number of channels. 1 for mono, 2 for stereo.
2867 * @param cBits How many bits a sample for a single channel has. Normally 8 or 16.
2868 * @thread The emulation thread.
2869 */
2870 DECLR3CALLBACKMEMBER(int, pfnAudioInputBegin,(PPDMIAUDIOSNIFFERCONNECTOR pInterface,
2871 void **ppvUserCtx,
2872 void *pvContext,
2873 uint32_t cSamples,
2874 uint32_t iSampleHz,
2875 uint32_t cChannels,
2876 uint32_t cBits));
2877
2878 /**
2879 * Audio input has been requested by the virtual audio device.
2880 *
2881 * @param pInterface Pointer to this interface.
2882 * @param pvUserCtx The interface context for this audio input stream,
2883 * which was returned by pfnAudioInputBegin call.
2884 * @thread The emulation thread.
2885 */
2886 DECLR3CALLBACKMEMBER(void, pfnAudioInputEnd,(PPDMIAUDIOSNIFFERCONNECTOR pInterface,
2887 void *pvUserCtx));
2888} PDMIAUDIOSNIFFERCONNECTOR;
2889/** PDMIAUDIOSNIFFERCONNECTOR - The Audio Sniffer Driver connector interface. */
2890#define PDMIAUDIOSNIFFERCONNECTOR_IID "9d37f543-27af-45f8-8002-8ef7abac71e4"
2891
2892
2893/**
2894 * Generic status LED core.
2895 * Note that a unit doesn't have to support all the indicators.
2896 */
2897typedef union PDMLEDCORE
2898{
2899 /** 32-bit view. */
2900 uint32_t volatile u32;
2901 /** Bit view. */
2902 struct
2903 {
2904 /** Reading/Receiving indicator. */
2905 uint32_t fReading : 1;
2906 /** Writing/Sending indicator. */
2907 uint32_t fWriting : 1;
2908 /** Busy indicator. */
2909 uint32_t fBusy : 1;
2910 /** Error indicator. */
2911 uint32_t fError : 1;
2912 } s;
2913} PDMLEDCORE;
2914
2915/** LED bit masks for the u32 view.
2916 * @{ */
2917/** Reading/Receiving indicator. */
2918#define PDMLED_READING RT_BIT(0)
2919/** Writing/Sending indicator. */
2920#define PDMLED_WRITING RT_BIT(1)
2921/** Busy indicator. */
2922#define PDMLED_BUSY RT_BIT(2)
2923/** Error indicator. */
2924#define PDMLED_ERROR RT_BIT(3)
2925/** @} */
2926
2927
2928/**
2929 * Generic status LED.
2930 * Note that a unit doesn't have to support all the indicators.
2931 */
2932typedef struct PDMLED
2933{
2934 /** Just a magic for sanity checking. */
2935 uint32_t u32Magic;
2936 uint32_t u32Alignment; /**< structure size alignment. */
2937 /** The actual LED status.
2938 * Only the device is allowed to change this. */
2939 PDMLEDCORE Actual;
2940 /** The asserted LED status which is cleared by the reader.
2941 * The device will assert the bits but never clear them.
2942 * The driver clears them as it sees fit. */
2943 PDMLEDCORE Asserted;
2944} PDMLED;
2945
2946/** Pointer to an LED. */
2947typedef PDMLED *PPDMLED;
2948/** Pointer to a const LED. */
2949typedef const PDMLED *PCPDMLED;
2950
2951/** Magic value for PDMLED::u32Magic. */
2952#define PDMLED_MAGIC UINT32_C(0x11335577)
2953
2954/** Pointer to an LED ports interface. */
2955typedef struct PDMILEDPORTS *PPDMILEDPORTS;
2956/**
2957 * Interface for exporting LEDs (down).
2958 * Pair with PDMILEDCONNECTORS.
2959 */
2960typedef struct PDMILEDPORTS
2961{
2962 /**
2963 * Gets the pointer to the status LED of a unit.
2964 *
2965 * @returns VBox status code.
2966 * @param pInterface Pointer to the interface structure containing the called function pointer.
2967 * @param iLUN The unit which status LED we desire.
2968 * @param ppLed Where to store the LED pointer.
2969 */
2970 DECLR3CALLBACKMEMBER(int, pfnQueryStatusLed,(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed));
2971
2972} PDMILEDPORTS;
2973/** PDMILEDPORTS interface ID. */
2974#define PDMILEDPORTS_IID "435e0cec-8549-4ca0-8c0d-98e52f1dc038"
2975
2976
2977/** Pointer to an LED connectors interface. */
2978typedef struct PDMILEDCONNECTORS *PPDMILEDCONNECTORS;
2979/**
2980 * Interface for reading LEDs (up).
2981 * Pair with PDMILEDPORTS.
2982 */
2983typedef struct PDMILEDCONNECTORS
2984{
2985 /**
2986 * Notification about a unit which have been changed.
2987 *
2988 * The driver must discard any pointers to data owned by
2989 * the unit and requery it.
2990 *
2991 * @param pInterface Pointer to the interface structure containing the called function pointer.
2992 * @param iLUN The unit number.
2993 */
2994 DECLR3CALLBACKMEMBER(void, pfnUnitChanged,(PPDMILEDCONNECTORS pInterface, unsigned iLUN));
2995} PDMILEDCONNECTORS;
2996/** PDMILEDCONNECTORS interface ID. */
2997#define PDMILEDCONNECTORS_IID "8ed63568-82a7-4193-b57b-db8085ac4495"
2998
2999
3000/** Pointer to a Media Notification interface. */
3001typedef struct PDMIMEDIANOTIFY *PPDMIMEDIANOTIFY;
3002/**
3003 * Interface for exporting Medium eject information (up). No interface pair.
3004 */
3005typedef struct PDMIMEDIANOTIFY
3006{
3007 /**
3008 * Signals that the medium was ejected.
3009 *
3010 * @returns VBox status code.
3011 * @param pInterface Pointer to the interface structure containing the called function pointer.
3012 * @param iLUN The unit which had the medium ejected.
3013 */
3014 DECLR3CALLBACKMEMBER(int, pfnEjected,(PPDMIMEDIANOTIFY pInterface, unsigned iLUN));
3015
3016} PDMIMEDIANOTIFY;
3017/** PDMIMEDIANOTIFY interface ID. */
3018#define PDMIMEDIANOTIFY_IID "fc22d53e-feb1-4a9c-b9fb-0a990a6ab288"
3019
3020
3021/** The special status unit number */
3022#define PDM_STATUS_LUN 999
3023
3024
3025#ifdef VBOX_WITH_HGCM
3026
3027/** Abstract HGCM command structure. Used only to define a typed pointer. */
3028struct VBOXHGCMCMD;
3029
3030/** Pointer to HGCM command structure. This pointer is unique and identifies
3031 * the command being processed. The pointer is passed to HGCM connector methods,
3032 * and must be passed back to HGCM port when command is completed.
3033 */
3034typedef struct VBOXHGCMCMD *PVBOXHGCMCMD;
3035
3036/** Pointer to a HGCM port interface. */
3037typedef struct PDMIHGCMPORT *PPDMIHGCMPORT;
3038/**
3039 * Host-Guest communication manager port interface (down). Normally implemented
3040 * by VMMDev.
3041 * Pair with PDMIHGCMCONNECTOR.
3042 */
3043typedef struct PDMIHGCMPORT
3044{
3045 /**
3046 * Notify the guest on a command completion.
3047 *
3048 * @param pInterface Pointer to this interface.
3049 * @param rc The return code (VBox error code).
3050 * @param pCmd A pointer that identifies the completed command.
3051 *
3052 * @returns VBox status code
3053 */
3054 DECLR3CALLBACKMEMBER(void, pfnCompleted,(PPDMIHGCMPORT pInterface, int32_t rc, PVBOXHGCMCMD pCmd));
3055
3056} PDMIHGCMPORT;
3057/** PDMIHGCMPORT interface ID. */
3058# define PDMIHGCMPORT_IID "e00a0cbf-b75a-45c3-87f4-41cddbc5ae0b"
3059
3060
3061/** Pointer to a HGCM service location structure. */
3062typedef struct HGCMSERVICELOCATION *PHGCMSERVICELOCATION;
3063
3064/** Pointer to a HGCM connector interface. */
3065typedef struct PDMIHGCMCONNECTOR *PPDMIHGCMCONNECTOR;
3066/**
3067 * The Host-Guest communication manager connector interface (up). Normally
3068 * implemented by Main::VMMDevInterface.
3069 * Pair with PDMIHGCMPORT.
3070 */
3071typedef struct PDMIHGCMCONNECTOR
3072{
3073 /**
3074 * Locate a service and inform it about a client connection.
3075 *
3076 * @param pInterface Pointer to this interface.
3077 * @param pCmd A pointer that identifies the command.
3078 * @param pServiceLocation Pointer to the service location structure.
3079 * @param pu32ClientID Where to store the client id for the connection.
3080 * @return VBox status code.
3081 * @thread The emulation thread.
3082 */
3083 DECLR3CALLBACKMEMBER(int, pfnConnect,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, PHGCMSERVICELOCATION pServiceLocation, uint32_t *pu32ClientID));
3084
3085 /**
3086 * Disconnect from service.
3087 *
3088 * @param pInterface Pointer to this interface.
3089 * @param pCmd A pointer that identifies the command.
3090 * @param u32ClientID The client id returned by the pfnConnect call.
3091 * @return VBox status code.
3092 * @thread The emulation thread.
3093 */
3094 DECLR3CALLBACKMEMBER(int, pfnDisconnect,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID));
3095
3096 /**
3097 * Process a guest issued command.
3098 *
3099 * @param pInterface Pointer to this interface.
3100 * @param pCmd A pointer that identifies the command.
3101 * @param u32ClientID The client id returned by the pfnConnect call.
3102 * @param u32Function Function to be performed by the service.
3103 * @param cParms Number of parameters in the array pointed to by paParams.
3104 * @param paParms Pointer to an array of parameters.
3105 * @return VBox status code.
3106 * @thread The emulation thread.
3107 */
3108 DECLR3CALLBACKMEMBER(int, pfnCall,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID, uint32_t u32Function,
3109 uint32_t cParms, PVBOXHGCMSVCPARM paParms));
3110
3111} PDMIHGCMCONNECTOR;
3112/** PDMIHGCMCONNECTOR interface ID. */
3113# define PDMIHGCMCONNECTOR_IID "a1104758-c888-4437-8f2a-7bac17865b5c"
3114
3115#endif /* VBOX_WITH_HGCM */
3116
3117/**
3118 * Data direction.
3119 */
3120typedef enum PDMSCSIREQUESTTXDIR
3121{
3122 PDMSCSIREQUESTTXDIR_UNKNOWN = 0x00,
3123 PDMSCSIREQUESTTXDIR_FROM_DEVICE = 0x01,
3124 PDMSCSIREQUESTTXDIR_TO_DEVICE = 0x02,
3125 PDMSCSIREQUESTTXDIR_NONE = 0x03,
3126 PDMSCSIREQUESTTXDIR_32BIT_HACK = 0x7fffffff
3127} PDMSCSIREQUESTTXDIR;
3128
3129/**
3130 * SCSI request structure.
3131 */
3132typedef struct PDMSCSIREQUEST
3133{
3134 /** The logical unit. */
3135 uint32_t uLogicalUnit;
3136 /** Direction of the data flow. */
3137 PDMSCSIREQUESTTXDIR uDataDirection;
3138 /** Size of the SCSI CDB. */
3139 uint32_t cbCDB;
3140 /** Pointer to the SCSI CDB. */
3141 uint8_t *pbCDB;
3142 /** Overall size of all scatter gather list elements
3143 * for data transfer if any. */
3144 uint32_t cbScatterGather;
3145 /** Number of elements in the scatter gather list. */
3146 uint32_t cScatterGatherEntries;
3147 /** Pointer to the head of the scatter gather list. */
3148 PRTSGSEG paScatterGatherHead;
3149 /** Size of the sense buffer. */
3150 uint32_t cbSenseBuffer;
3151 /** Pointer to the sense buffer. *
3152 * Current assumption that the sense buffer is not scattered. */
3153 uint8_t *pbSenseBuffer;
3154 /** Opaque user data for use by the device. Left untouched by everything else! */
3155 void *pvUser;
3156} PDMSCSIREQUEST, *PPDMSCSIREQUEST;
3157/** Pointer to a const SCSI request structure. */
3158typedef const PDMSCSIREQUEST *PCSCSIREQUEST;
3159
3160/** Pointer to a SCSI port interface. */
3161typedef struct PDMISCSIPORT *PPDMISCSIPORT;
3162/**
3163 * SCSI command execution port interface (down).
3164 * Pair with PDMISCSICONNECTOR.
3165 */
3166typedef struct PDMISCSIPORT
3167{
3168
3169 /**
3170 * Notify the device on request completion.
3171 *
3172 * @returns VBox status code.
3173 * @param pInterface Pointer to this interface.
3174 * @param pSCSIRequest Pointer to the finished SCSI request.
3175 * @param rcCompletion SCSI_STATUS_* code for the completed request.
3176 * @param fRedo Flag whether the request can to be redone
3177 * when it failed.
3178 * @param rcReq The status code the request completed with (VERR_*)
3179 * Should be only used to choose the correct error message
3180 * displayed to the user if the error can be fixed by him
3181 * (fRedo is true).
3182 */
3183 DECLR3CALLBACKMEMBER(int, pfnSCSIRequestCompleted, (PPDMISCSIPORT pInterface, PPDMSCSIREQUEST pSCSIRequest,
3184 int rcCompletion, bool fRedo, int rcReq));
3185
3186 /**
3187 * Returns the storage controller name, instance and LUN of the attached medium.
3188 *
3189 * @returns VBox status.
3190 * @param pInterface Pointer to this interface.
3191 * @param ppcszController Where to store the name of the storage controller.
3192 * @param piInstance Where to store the instance number of the controller.
3193 * @param piLUN Where to store the LUN of the attached device.
3194 */
3195 DECLR3CALLBACKMEMBER(int, pfnQueryDeviceLocation, (PPDMISCSIPORT pInterface, const char **ppcszController,
3196 uint32_t *piInstance, uint32_t *piLUN));
3197
3198} PDMISCSIPORT;
3199/** PDMISCSIPORT interface ID. */
3200#define PDMISCSIPORT_IID "05d9fc3b-e38c-4b30-8344-a323feebcfe5"
3201
3202
3203/** Pointer to a SCSI connector interface. */
3204typedef struct PDMISCSICONNECTOR *PPDMISCSICONNECTOR;
3205/**
3206 * SCSI command execution connector interface (up).
3207 * Pair with PDMISCSIPORT.
3208 */
3209typedef struct PDMISCSICONNECTOR
3210{
3211
3212 /**
3213 * Submits a SCSI request for execution.
3214 *
3215 * @returns VBox status code.
3216 * @param pInterface Pointer to this interface.
3217 * @param pSCSIRequest Pointer to the SCSI request to execute.
3218 */
3219 DECLR3CALLBACKMEMBER(int, pfnSCSIRequestSend, (PPDMISCSICONNECTOR pInterface, PPDMSCSIREQUEST pSCSIRequest));
3220
3221} PDMISCSICONNECTOR;
3222/** PDMISCSICONNECTOR interface ID. */
3223#define PDMISCSICONNECTOR_IID "94465fbd-a2f2-447e-88c9-7366421bfbfe"
3224
3225
3226/** Pointer to a display VBVA callbacks interface. */
3227typedef struct PDMIDISPLAYVBVACALLBACKS *PPDMIDISPLAYVBVACALLBACKS;
3228/**
3229 * Display VBVA callbacks interface (up).
3230 */
3231typedef struct PDMIDISPLAYVBVACALLBACKS
3232{
3233
3234 /**
3235 * Informs guest about completion of processing the given Video HW Acceleration
3236 * command, does not wait for the guest to process the command.
3237 *
3238 * @returns ???
3239 * @param pInterface Pointer to this interface.
3240 * @param pCmd The Video HW Acceleration Command that was
3241 * completed.
3242 */
3243 DECLR3CALLBACKMEMBER(int, pfnVHWACommandCompleteAsync, (PPDMIDISPLAYVBVACALLBACKS pInterface,
3244 PVBOXVHWACMD pCmd));
3245
3246 DECLR3CALLBACKMEMBER(int, pfnCrHgsmiCommandCompleteAsync, (PPDMIDISPLAYVBVACALLBACKS pInterface,
3247 struct VBOXVDMACMD_CHROMIUM_CMD* pCmd, int rc));
3248
3249 DECLR3CALLBACKMEMBER(int, pfnCrHgsmiControlCompleteAsync, (PPDMIDISPLAYVBVACALLBACKS pInterface,
3250 struct VBOXVDMACMD_CHROMIUM_CTL* pCmd, int rc));
3251
3252 DECLR3CALLBACKMEMBER(int, pfnCrCtlSubmit, (PPDMIDISPLAYVBVACALLBACKS pInterface,
3253 struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
3254 PFNCRCTLCOMPLETION pfnCompletion,
3255 void *pvCompletion));
3256
3257 DECLR3CALLBACKMEMBER(int, pfnCrCtlSubmitSync, (PPDMIDISPLAYVBVACALLBACKS pInterface,
3258 struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd));
3259} PDMIDISPLAYVBVACALLBACKS;
3260/** PDMIDISPLAYVBVACALLBACKS */
3261#define PDMIDISPLAYVBVACALLBACKS_IID "ddac0bd0-332d-4671-8853-732921a80216"
3262
3263/** Pointer to a PCI raw connector interface. */
3264typedef struct PDMIPCIRAWCONNECTOR *PPDMIPCIRAWCONNECTOR;
3265/**
3266 * PCI raw connector interface (up).
3267 */
3268typedef struct PDMIPCIRAWCONNECTOR
3269{
3270
3271 /**
3272 *
3273 */
3274 DECLR3CALLBACKMEMBER(int, pfnDeviceConstructComplete, (PPDMIPCIRAWCONNECTOR pInterface, const char *pcszName,
3275 uint32_t uHostPciAddress, uint32_t uGuestPciAddress,
3276 int rc));
3277
3278} PDMIPCIRAWCONNECTOR;
3279/** PDMIPCIRAWCONNECTOR interface ID. */
3280#define PDMIPCIRAWCONNECTOR_IID "14aa9c6c-8869-4782-9dfc-910071a6aebf"
3281
3282/** @} */
3283
3284RT_C_DECLS_END
3285
3286#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