VirtualBox

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

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

Devices/Graphics, Main: optionally send cursor integration toggle and guest cursor position information through the graphics device.

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

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