VirtualBox

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

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

PDM/VSCSI: Added PDMISCSICONNECTOR interface to report LUN type.

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