VirtualBox

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

最後變更 在這個檔案從53528是 53528,由 vboxsync 提交於 10 年 前

Devices/Graphics, Devices/PC/DevACPI, Main: add support for sending video mode hints through the VGA device.

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette