VirtualBox

source: vbox/trunk/include/VBox/pdmifs.h@ 25149

Last change on this file since 25149 was 25052, checked in by vboxsync, 15 years ago

HGSMI/VBVA: enable VRDP commands only if there are connected RDP clients.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 100.8 KB
Line 
1/** @file
2 * PDM - Pluggable Device Manager, Interfaces. (VMM)
3 */
4
5/*
6 * Copyright (C) 2006-2008 Sun Microsystems, Inc.
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 *
25 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
26 * Clara, CA 95054 USA or visit http://www.sun.com if you need
27 * additional information or have any questions.
28 */
29
30#ifndef ___VBox_pdmifs_h
31#define ___VBox_pdmifs_h
32
33#include <VBox/types.h>
34#include <VBox/hgcmsvc.h>
35
36RT_C_DECLS_BEGIN
37
38/** @defgroup grp_pdm_interfaces The PDM Interface Definitions
39 * @ingroup grp_pdm
40 * @{
41 */
42
43/**
44 * Driver interface identficators.
45 *
46 * @remark All interfaces have to be declared here. There is no such thing as
47 * private interface identifiers since they must be unique.
48 *
49 * That said, interface structures and other stuff can be put elsewhere,
50 * actually, it is best if this file is not flooded with structures that
51 * could be put closer to home.
52 */
53typedef enum PDMINTERFACE
54{
55 /** PDMIBASE - The interface everyone supports. */
56 PDMINTERFACE_BASE = 1,
57 /** PDMIMOUSEPORT - The mouse port interface. (Down) Coupled with PDMINTERFACE_MOUSE_CONNECTOR. */
58 PDMINTERFACE_MOUSE_PORT,
59 /** PDMIMOUSECONNECTOR - The mouse connector interface. (Up) Coupled with PDMINTERFACE_MOUSE_PORT. */
60 PDMINTERFACE_MOUSE_CONNECTOR,
61 /** PDMIKEYBOARDPORT - The keyboard port interface. (Down) Coupled with PDMINTERFACE_KEYBOARD_CONNECTOR. */
62 PDMINTERFACE_KEYBOARD_PORT,
63 /** PDMIKEYBOARDCONNECTOR - The keyboard connector interface. (Up) Coupled with PDMINTERFACE_KEYBOARD_PORT. */
64 PDMINTERFACE_KEYBOARD_CONNECTOR,
65 /** PDMIDISPLAYPORT - The display port interface. (Down) Coupled with PDMINTERFACE_DISPLAY_CONNECTOR. */
66 PDMINTERFACE_DISPLAY_PORT,
67 /** PDMIDISPLAYCONNECTOR - The display connector interface. (Up) Coupled with PDMINTERFACE_DISPLAY_PORT. */
68 PDMINTERFACE_DISPLAY_CONNECTOR,
69 /** PDMICHARPORT - The char notify interface. (Down) Coupled with PDMINTERFACE_CHAR. */
70 PDMINTERFACE_CHAR_PORT,
71 /** PDMICHAR - The char driver interface. (Up) Coupled with PDMINTERFACE_CHAR_PORT. */
72 PDMINTERFACE_CHAR,
73 /** PDMISTREAM - The stream driver interface (Up) No coupling.
74 * Used by a char driver to implement PDMINTERFACE_CHAR. */
75 PDMINTERFACE_STREAM,
76 /** PDMIBLOCKPORT - The block notify interface (Down) Coupled with PDMINTERFACE_BLOCK. */
77 PDMINTERFACE_BLOCK_PORT,
78 /** PDMIBLOCK - The block driver interface (Up) Coupled with PDMINTERFACE_BLOCK_PORT. */
79 PDMINTERFACE_BLOCK,
80 /** PDMIBLOCKBIOS - The block bios interface. (External) */
81 PDMINTERFACE_BLOCK_BIOS,
82 /** PDMIMOUNTNOTIFY - The mountable notification interface. (Down) Coupled with PDMINTERFACE_MOUNT. */
83 PDMINTERFACE_MOUNT_NOTIFY,
84 /** PDMIMOUNT - The mountable interface. (Up) Coupled with PDMINTERFACE_MOUNT_NOTIFY. */
85 PDMINTERFACE_MOUNT,
86 /** PDMIMEDIA - The media interface. (Up) No coupling.
87 * Used by a block unit driver to implement PDMINTERFACE_BLOCK and PDMINTERFACE_BLOCK_BIOS. */
88 PDMINTERFACE_MEDIA,
89 /** PDMIISCSITRANSPORT - The iSCSI transport interface (Up) No coupling.
90 * used by the iSCSI media driver. */
91 PDMINTERFACE_ISCSITRANSPORT,
92 /** PDMIISCSITRANSPORTASYNC - The asynchronous iSCSI interface (Up) Couple with PDMINTERFACE_ISCSITRANSPORT.
93 * extension used by the iSCSI media driver. */
94 PDMINTERFACE_ISCSITRANSPORTASYNC,
95 /** PDMIISCSITRANSPORTASYNCPORT - The asynchronous iSCSI interface (Down) Couple with PDMINTERFACE_ISCSITRANSPORTASYNC.
96 * notify port used by the iSCSI media driver. */
97 PDMINTERFACE_ISCSITRANSPORTASYNCPORT,
98 /** PDMIMEDIAASYNC - Async version of the media interface (Down) Coupled with PDMINTERFACE_MEDIA_ASYNC_PORT. */
99 PDMINTERFACE_MEDIA_ASYNC,
100 /** PDMIMEDIAASYNCPORT - Async version of the media interface (Up) Coupled with PDMINTERFACE_MEDIA_ASYNC. */
101 PDMINTERFACE_MEDIA_ASYNC_PORT,
102 /** PDMIBLOCKASYNC - Async version of the block interface (Down) Coupled with PDMINTERFACE_BLOCK_ASYNC_PORT. */
103 PDMINTERFACE_BLOCK_ASYNC,
104 /** PDMIBLOCKASYNCPORT - Async version of the block interface (Up) Coupled with PDMINTERFACE_BLOCK_ASYNC. */
105 PDMINTERFACE_BLOCK_ASYNC_PORT,
106
107
108 /** PDMINETWORKPORT - The network port interface. (Down) Coupled with PDMINTERFACE_NETWORK_CONNECTOR. */
109 PDMINTERFACE_NETWORK_PORT,
110 /** PDMINETWORKPORT - The network connector interface. (Up) Coupled with PDMINTERFACE_NETWORK_PORT. */
111 PDMINTERFACE_NETWORK_CONNECTOR,
112 /** PDMINETWORKCONFIG - The network configuartion interface. (Main) Used by the managment api. */
113 PDMINTERFACE_NETWORK_CONFIG,
114
115 /** PDMIAUDIOCONNECTOR - The audio driver interface. (Up) No coupling. */
116 PDMINTERFACE_AUDIO_CONNECTOR,
117
118 /** PDMIAUDIOSNIFFERPORT - The Audio Sniffer Device port interface. */
119 PDMINTERFACE_AUDIO_SNIFFER_PORT,
120 /** PDMIAUDIOSNIFFERCONNECTOR - The Audio Sniffer Driver connector interface. */
121 PDMINTERFACE_AUDIO_SNIFFER_CONNECTOR,
122
123 /** PDMIVMMDEVPORT - The VMM Device port interface. */
124 PDMINTERFACE_VMMDEV_PORT,
125 /** PDMIVMMDEVCONNECTOR - The VMM Device connector interface. */
126 PDMINTERFACE_VMMDEV_CONNECTOR,
127
128 /** PDMILEDPORTS - The generic LED port interface. (Down) Coupled with PDMINTERFACE_LED_CONNECTORS. */
129 PDMINTERFACE_LED_PORTS,
130 /** PDMILEDCONNECTORS - The generic LED connector interface. (Up) Coupled with PDMINTERFACE_LED_PORTS. */
131 PDMINTERFACE_LED_CONNECTORS,
132
133 /** PDMIACPIPORT - ACPI port interface. (Down) Coupled with PDMINTERFACE_ACPI_CONNECTOR. */
134 PDMINTERFACE_ACPI_PORT,
135 /** PDMIACPICONNECTOR - ACPI connector interface. (Up) Coupled with PDMINTERFACE_ACPI_PORT. */
136 PDMINTERFACE_ACPI_CONNECTOR,
137
138 /** PDMIHGCMPORT - The Host-Guest communication manager port interface. Normally implemented by VMMDev. */
139 PDMINTERFACE_HGCM_PORT,
140 /** PDMIHGCMCONNECTOR - The Host-Guest communication manager connector interface. Normally implemented by Main::VMMDevInterface. */
141 PDMINTERFACE_HGCM_CONNECTOR,
142
143 /** VUSBIROOTHUBPORT - VUSB RootHub port interface. (Down) Coupled with PDMINTERFACE_USB_RH_CONNECTOR. */
144 PDMINTERFACE_VUSB_RH_PORT,
145 /** VUSBIROOTHUBCONNECTOR - VUSB RootHub connector interface. (Up) Coupled with PDMINTERFACE_USB_RH_PORT. */
146 PDMINTERFACE_VUSB_RH_CONNECTOR,
147 /** VUSBIRHCONFIG - VUSB RootHub configuration interface. (Main) Used by the managment api. */
148 PDMINTERFACE_VUSB_RH_CONFIG,
149
150 /** VUSBIDEVICE - VUSB Device interface. (Up) No coupling. */
151 PDMINTERFACE_VUSB_DEVICE,
152
153 /** PDMIHOSTPARALLELPORT - The Host Parallel port interface. (Down) Coupled with PDMINTERFACE_HOST_PARALLEL_CONNECTOR. */
154 PDMINTERFACE_HOST_PARALLEL_PORT,
155 /** PDMIHOSTPARALLELCONNECTOR - The Host Parallel connector interface (Up) Coupled with PDMINTERFACE_HOST_PARALLEL_PORT. */
156 PDMINTERFACE_HOST_PARALLEL_CONNECTOR,
157
158 /** PDMISCSIPORT - The SCSI command execution port interface (Down) Coupled with PDMINTERFACE_SCSI_CONNECTOR. */
159 PDMINTERFACE_SCSI_PORT,
160 /** PDMISCSICONNECTOR - The SCSI command execution connector interface (Up) Coupled with PDMINTERFACE_SCSI_PORT. */
161 PDMINTERFACE_SCSI_CONNECTOR,
162 /** PDMDDISPLAYVBVACALLBACKS - The Display VBVA callbacks. */
163 PDMINTERFACE_DISPLAY_VBVA_CALLBACKS,
164
165 /** Maximum interface number. */
166 PDMINTERFACE_MAX
167} PDMINTERFACE;
168
169
170/**
171 * PDM Driver Base Interface.
172 */
173typedef struct PDMIBASE
174{
175 /**
176 * Queries an interface to the driver.
177 *
178 * @returns Pointer to interface.
179 * @returns NULL if the interface was not supported by the driver.
180 * @param pInterface Pointer to this interface structure.
181 * @param enmInterface The requested interface identification.
182 * @thread Any thread.
183 */
184 DECLR3CALLBACKMEMBER(void *, pfnQueryInterface,(struct PDMIBASE *pInterface, PDMINTERFACE enmInterface));
185} PDMIBASE;
186
187
188/**
189 * Dummy interface.
190 *
191 * This is used to typedef other dummy interfaces. The purpose of a dummy
192 * interface is to validate the logical function of a driver/device and
193 * full a natural interface pair.
194 */
195typedef struct PDMIDUMMY
196{
197 RTHCPTR pvDummy;
198} PDMIDUMMY;
199
200
201/** Pointer to a mouse port interface. */
202typedef struct PDMIMOUSEPORT *PPDMIMOUSEPORT;
203/**
204 * Mouse port interface.
205 * Pair with PDMIMOUSECONNECTOR.
206 */
207typedef struct PDMIMOUSEPORT
208{
209 /**
210 * Puts a mouse event.
211 * This is called by the source of mouse events. The event will be passed up until the
212 * topmost driver, which then calls the registered event handler.
213 *
214 * @returns VBox status code.
215 * @param pInterface Pointer to this interface structure.
216 * @param i32DeltaX The X delta.
217 * @param i32DeltaY The Y delta.
218 * @param i32DeltaZ The Z delta.
219 * @param i32DeltaW The W (horizontal scroll button) delta.
220 * @param fButtonStates The button states, see the PDMIMOUSEPORT_BUTTON_* \#defines.
221 * @thread The emulation thread.
222 */
223 DECLR3CALLBACKMEMBER(int, pfnPutEvent,(PPDMIMOUSEPORT pInterface, int32_t i32DeltaX, int32_t i32DeltaY, int32_t i32DeltaZ, int32_t i32DeltaW, uint32_t fButtonStates));
224} PDMIMOUSEPORT;
225
226/** Mouse button defines for PDMIMOUSEPORT::pfnPutEvent.
227 * @{ */
228#define PDMIMOUSEPORT_BUTTON_LEFT RT_BIT(0)
229#define PDMIMOUSEPORT_BUTTON_RIGHT RT_BIT(1)
230#define PDMIMOUSEPORT_BUTTON_MIDDLE RT_BIT(2)
231#define PDMIMOUSEPORT_BUTTON_X1 RT_BIT(3)
232#define PDMIMOUSEPORT_BUTTON_X2 RT_BIT(4)
233/** @} */
234
235
236/**
237 * Mouse connector interface.
238 * Pair with PDMIMOUSEPORT.
239 */
240typedef PDMIDUMMY PDMIMOUSECONNECTOR;
241 /** Pointer to a mouse connector interface. */
242typedef PDMIMOUSECONNECTOR *PPDMIMOUSECONNECTOR;
243
244
245/** Pointer to a keyboard port interface. */
246typedef struct PDMIKEYBOARDPORT *PPDMIKEYBOARDPORT;
247/**
248 * Keyboard port interface.
249 * Pair with PDMIKEYBOARDCONNECTOR.
250 */
251typedef struct PDMIKEYBOARDPORT
252{
253 /**
254 * Puts a keyboard event.
255 * This is called by the source of keyboard events. The event will be passed up until the
256 * topmost driver, which then calls the registered event handler.
257 *
258 * @returns VBox status code.
259 * @param pInterface Pointer to this interface structure.
260 * @param u8KeyCode The keycode to queue.
261 * @thread The emulation thread.
262 */
263 DECLR3CALLBACKMEMBER(int, pfnPutEvent,(PPDMIKEYBOARDPORT pInterface, uint8_t u8KeyCode));
264} PDMIKEYBOARDPORT;
265
266/**
267 * Keyboard LEDs.
268 */
269typedef enum PDMKEYBLEDS
270{
271 /** No leds. */
272 PDMKEYBLEDS_NONE = 0x0000,
273 /** Num Lock */
274 PDMKEYBLEDS_NUMLOCK = 0x0001,
275 /** Caps Lock */
276 PDMKEYBLEDS_CAPSLOCK = 0x0002,
277 /** Scroll Lock */
278 PDMKEYBLEDS_SCROLLLOCK = 0x0004
279} PDMKEYBLEDS;
280
281/** Pointer to keyboard connector interface. */
282typedef struct PDMIKEYBOARDCONNECTOR *PPDMIKEYBOARDCONNECTOR;
283
284
285/**
286 * Keyboard connector interface.
287 * Pair with PDMIKEYBOARDPORT
288 */
289typedef struct PDMIKEYBOARDCONNECTOR
290{
291 /**
292 * Notifies the the downstream driver about an LED change initiated by the guest.
293 *
294 * @param pInterface Pointer to the this interface.
295 * @param enmLeds The new led mask.
296 */
297 DECLR3CALLBACKMEMBER(void, pfnLedStatusChange,(PPDMIKEYBOARDCONNECTOR pInterface, PDMKEYBLEDS enmLeds));
298
299} PDMIKEYBOARDCONNECTOR;
300
301
302
303/** Pointer to a display port interface. */
304typedef struct PDMIDISPLAYPORT *PPDMIDISPLAYPORT;
305/**
306 * Display port interface.
307 * Pair with PDMIDISPLAYCONNECTOR.
308 */
309typedef struct PDMIDISPLAYPORT
310{
311 /**
312 * Update the display with any changed regions.
313 *
314 * Flushes any display changes to the memory pointed to by the
315 * PDMIDISPLAYCONNECTOR interface and calles PDMIDISPLAYCONNECTOR::pfnUpdateRect()
316 * while doing so.
317 *
318 * @returns VBox status code.
319 * @param pInterface Pointer to this interface.
320 * @thread The emulation thread.
321 */
322 DECLR3CALLBACKMEMBER(int, pfnUpdateDisplay,(PPDMIDISPLAYPORT pInterface));
323
324 /**
325 * Update the entire display.
326 *
327 * Flushes the entire display content to the memory pointed to by the
328 * PDMIDISPLAYCONNECTOR interface and calles PDMIDISPLAYCONNECTOR::pfnUpdateRect().
329 *
330 * @returns VBox status code.
331 * @param pInterface Pointer to this interface.
332 * @thread The emulation thread.
333 */
334 DECLR3CALLBACKMEMBER(int, pfnUpdateDisplayAll,(PPDMIDISPLAYPORT pInterface));
335
336 /**
337 * Return the current guest color depth in bits per pixel (bpp).
338 *
339 * As the graphics card is able to provide display updates with the bpp
340 * requested by the host, this method can be used to query the actual
341 * guest color depth.
342 *
343 * @returns VBox status code.
344 * @param pInterface Pointer to this interface.
345 * @param pcBits Where to store the current guest color depth.
346 * @thread Any thread.
347 */
348 DECLR3CALLBACKMEMBER(int, pfnQueryColorDepth,(PPDMIDISPLAYPORT pInterface, uint32_t *pcBits));
349
350 /**
351 * Sets the refresh rate and restart the timer.
352 * The rate is defined as the minimum interval between the return of
353 * one PDMIDISPLAYPORT::pfnRefresh() call to the next one.
354 *
355 * The interval timer will be restarted by this call. So at VM startup
356 * this function must be called to start the refresh cycle. The refresh
357 * rate is not saved, but have to be when resuming a loaded VM state.
358 *
359 * @returns VBox status code.
360 * @param pInterface Pointer to this interface.
361 * @param cMilliesInterval Number of millies between two refreshes.
362 * @thread Any thread.
363 */
364 DECLR3CALLBACKMEMBER(int, pfnSetRefreshRate,(PPDMIDISPLAYPORT pInterface, uint32_t cMilliesInterval));
365
366 /**
367 * Create a 32-bbp screenshot of the display.
368 *
369 * This will allocate and return a 32-bbp bitmap. Size of the bitmap scanline in bytes is 4*width.
370 *
371 * The allocated bitmap buffer must be freed with pfnFreeScreenshot.
372 *
373 * @param pInterface Pointer to this interface.
374 * @param ppu8Data Where to store the pointer to the allocated buffer.
375 * @param pcbData Where to store the actual size of the bitmap.
376 * @param pcx Where to store the width of the bitmap.
377 * @param pcy Where to store the height of the bitmap.
378 * @thread The emulation thread.
379 */
380 DECLR3CALLBACKMEMBER(int, pfnTakeScreenshot,(PPDMIDISPLAYPORT pInterface, uint8_t **ppu8Data, size_t *pcbData, uint32_t *pcx, uint32_t *pcy));
381
382 /**
383 * Free screenshot buffer.
384 *
385 * This will free the memory buffer allocated by pfnTakeScreenshot.
386 *
387 * @param pInterface Pointer to this interface.
388 * @param ppu8Data Pointer to the buffer returned by pfnTakeScreenshot.
389 * @thread Any.
390 */
391 DECLR3CALLBACKMEMBER(void, pfnFreeScreenshot,(PPDMIDISPLAYPORT pInterface, uint8_t *pu8Data));
392
393 /**
394 * Copy bitmap to the display.
395 *
396 * This will convert and copy a 32-bbp bitmap (with dword aligned scanline length) to
397 * the memory pointed to by the PDMIDISPLAYCONNECTOR interface.
398 *
399 * @param pInterface Pointer to this interface.
400 * @param pvData Pointer to the bitmap bits.
401 * @param x The upper left corner x coordinate of the destination rectangle.
402 * @param y The upper left corner y coordinate of the destination rectangle.
403 * @param cx The width of the source and destination rectangles.
404 * @param cy The height of the source and destination rectangles.
405 * @thread The emulation thread.
406 * @remark This is just a convenience for using the bitmap conversions of the
407 * graphics device.
408 */
409 DECLR3CALLBACKMEMBER(int, pfnDisplayBlt,(PPDMIDISPLAYPORT pInterface, const void *pvData, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy));
410
411 /**
412 * Render a rectangle from guest VRAM to Framebuffer.
413 *
414 * @param pInterface Pointer to this interface.
415 * @param x The upper left corner x coordinate of the rectangle to be updated.
416 * @param y The upper left corner y coordinate of the rectangle to be updated.
417 * @param cx The width of the rectangle to be updated.
418 * @param cy The height of the rectangle to be updated.
419 * @thread The emulation thread.
420 */
421 DECLR3CALLBACKMEMBER(void, pfnUpdateDisplayRect,(PPDMIDISPLAYPORT pInterface, int32_t x, int32_t y, uint32_t cx, uint32_t cy));
422
423 /**
424 * Inform the VGA device whether the Display is directly using the guest VRAM and there is no need
425 * to render the VRAM to the framebuffer memory.
426 *
427 * @param pInterface Pointer to this interface.
428 * @param fRender Whether the VRAM content must be rendered to the framebuffer.
429 * @thread The emulation thread.
430 */
431 DECLR3CALLBACKMEMBER(void, pfnSetRenderVRAM,(PPDMIDISPLAYPORT pInterface, bool fRender));
432
433} PDMIDISPLAYPORT;
434
435
436typedef struct _VBOXVHWACMD *PVBOXVHWACMD; /**< @todo r=bird: _VBOXVHWACMD -> VBOXVHWACMD; avoid using 1 or 2 leading underscores. Also, a line what it is to make doxygen happy. */
437typedef struct VBVACMDHDR *PVBVACMDHDR;
438typedef struct VBVAINFOSCREEN *PVBVAINFOSCREEN;
439typedef struct VBVAINFOVIEW *PVBVAINFOVIEW;
440typedef struct VBVAHOSTFLAGS *PVBVAHOSTFLAGS;
441
442/** Pointer to a display connector interface. */
443typedef struct PDMIDISPLAYCONNECTOR *PPDMIDISPLAYCONNECTOR;
444/**
445 * Display connector interface.
446 * Pair with PDMIDISPLAYPORT.
447 */
448typedef struct PDMIDISPLAYCONNECTOR
449{
450 /**
451 * Resize the display.
452 * This is called when the resolution changes. This usually happens on
453 * request from the guest os, but may also happen as the result of a reset.
454 * If the callback returns VINF_VGA_RESIZE_IN_PROGRESS, the caller (VGA device)
455 * must not access the connector and return.
456 *
457 * @returns VINF_SUCCESS if the framebuffer resize was completed,
458 * VINF_VGA_RESIZE_IN_PROGRESS if resize takes time and not yet finished.
459 * @param pInterface Pointer to this interface.
460 * @param cBits Color depth (bits per pixel) of the new video mode.
461 * @param pvVRAM Address of the guest VRAM.
462 * @param cbLine Size in bytes of a single scan line.
463 * @param cx New display width.
464 * @param cy New display height.
465 * @thread The emulation thread.
466 */
467 DECLR3CALLBACKMEMBER(int, pfnResize,(PPDMIDISPLAYCONNECTOR pInterface, uint32_t cBits, void *pvVRAM, uint32_t cbLine, uint32_t cx, uint32_t cy));
468
469 /**
470 * Update a rectangle of the display.
471 * PDMIDISPLAYPORT::pfnUpdateDisplay is the caller.
472 *
473 * @param pInterface Pointer to this interface.
474 * @param x The upper left corner x coordinate of the rectangle.
475 * @param y The upper left corner y coordinate of the rectangle.
476 * @param cx The width of the rectangle.
477 * @param cy The height of the rectangle.
478 * @thread The emulation thread.
479 */
480 DECLR3CALLBACKMEMBER(void, pfnUpdateRect,(PPDMIDISPLAYCONNECTOR pInterface, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy));
481
482 /**
483 * Refresh the display.
484 *
485 * The interval between these calls is set by
486 * PDMIDISPLAYPORT::pfnSetRefreshRate(). The driver should call
487 * PDMIDISPLAYPORT::pfnUpdateDisplay() if it wishes to refresh the
488 * display. PDMIDISPLAYPORT::pfnUpdateDisplay calls pfnUpdateRect with
489 * the changed rectangles.
490 *
491 * @param pInterface Pointer to this interface.
492 * @thread The emulation thread.
493 */
494 DECLR3CALLBACKMEMBER(void, pfnRefresh,(PPDMIDISPLAYCONNECTOR pInterface));
495
496 /**
497 * Reset the display.
498 *
499 * Notification message when the graphics card has been reset.
500 *
501 * @param pInterface Pointer to this interface.
502 * @thread The emulation thread.
503 */
504 DECLR3CALLBACKMEMBER(void, pfnReset,(PPDMIDISPLAYCONNECTOR pInterface));
505
506 /**
507 * LFB video mode enter/exit.
508 *
509 * Notification message when LinearFrameBuffer video mode is enabled/disabled.
510 *
511 * @param pInterface Pointer to this interface.
512 * @param fEnabled false - LFB mode was disabled,
513 * true - an LFB mode was disabled
514 * @thread The emulation thread.
515 */
516 DECLR3CALLBACKMEMBER(void, pfnLFBModeChange, (PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled));
517
518 /**
519 * Process the guest graphics adapter information.
520 *
521 * Direct notification from guest to the display connector.
522 *
523 * @param pInterface Pointer to this interface.
524 * @param pvVRAM Address of the guest VRAM.
525 * @param u32VRAMSize Size of the guest VRAM.
526 * @thread The emulation thread.
527 */
528 DECLR3CALLBACKMEMBER(void, pfnProcessAdapterData, (PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, uint32_t u32VRAMSize));
529
530 /**
531 * Process the guest display information.
532 *
533 * Direct notification from guest to the display connector.
534 *
535 * @param pInterface Pointer to this interface.
536 * @param pvVRAM Address of the guest VRAM.
537 * @param uScreenId The index of the guest display to be processed.
538 * @thread The emulation thread.
539 */
540 DECLR3CALLBACKMEMBER(void, pfnProcessDisplayData, (PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, unsigned uScreenId));
541
542 /**
543 * Process the guest Video HW Acceleration command.
544 *
545 * @param pInterface Pointer to this interface.
546 * @param pCmd Video HW Acceleration Command to be processed.
547 * @thread The emulation thread.
548 */
549 DECLR3CALLBACKMEMBER(void, pfnVHWACommandProcess, (PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCmd));
550
551 /**
552 * The specified screen enters VBVA mode.
553 *
554 * @param pInterface Pointer to this interface.
555 * @param uScreenId The screen updates are for.
556 * @thread The emulation thread.
557 */
558 DECLR3CALLBACKMEMBER(int, pfnVBVAEnable,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, PVBVAHOSTFLAGS pHostFlags));
559
560 /**
561 * The specified screen leaves VBVA mode.
562 *
563 * @param pInterface Pointer to this interface.
564 * @param uScreenId The screen updates are for.
565 * @thread The emulation thread.
566 */
567 DECLR3CALLBACKMEMBER(void, pfnVBVADisable,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId));
568
569 /**
570 * A sequence of pfnVBVAUpdateProcess calls begins.
571 *
572 * @param pInterface Pointer to this interface.
573 * @param uScreenId The screen updates are for.
574 * @thread The emulation thread.
575 */
576 DECLR3CALLBACKMEMBER(void, pfnVBVAUpdateBegin,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId));
577
578 /**
579 * Process the guest VBVA command.
580 *
581 * @param pInterface Pointer to this interface.
582 * @param pCmd Video HW Acceleration Command to be processed.
583 * @thread The emulation thread.
584 */
585 DECLR3CALLBACKMEMBER(void, pfnVBVAUpdateProcess,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, const PVBVACMDHDR pCmd, size_t cbCmd));
586
587 /**
588 * A sequence of pfnVBVAUpdateProcess calls ends.
589 *
590 * @param pInterface Pointer to this interface.
591 * @param uScreenId The screen updates are for.
592 * @param x The upper left corner x coordinate of the combined rectangle of all VBVA updates.
593 * @param y The upper left corner y coordinate of the rectangle.
594 * @param cx The width of the rectangle.
595 * @param cy The height of the rectangle.
596 * @thread The emulation thread.
597 */
598 DECLR3CALLBACKMEMBER(void, pfnVBVAUpdateEnd,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, int32_t x, int32_t y, uint32_t cx, uint32_t cy));
599
600 /**
601 * Resize the display.
602 * This is called when the resolution changes. This usually happens on
603 * request from the guest os, but may also happen as the result of a reset.
604 * If the callback returns VINF_VGA_RESIZE_IN_PROGRESS, the caller (VGA device)
605 * must not access the connector and return.
606 *
607 * @todo Merge with pfnResize.
608 *
609 * @returns VINF_SUCCESS if the framebuffer resize was completed,
610 * VINF_VGA_RESIZE_IN_PROGRESS if resize takes time and not yet finished.
611 * @param pInterface Pointer to this interface.
612 * @param pView The description of VRAM block for this screen.
613 * @param pScreen The data of screen being resized.
614 * @param pvVRAM Address of the guest VRAM.
615 * @thread The emulation thread.
616 */
617 DECLR3CALLBACKMEMBER(int, pfnVBVAResize,(PPDMIDISPLAYCONNECTOR pInterface, const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN pScreen, void *pvVRAM));
618
619 /**
620 * Update the pointer shape.
621 * This is called when the mouse pointer shape changes. The new shape
622 * is passed as a caller allocated buffer that will be freed after returning
623 *
624 * @param pInterface Pointer to this interface.
625 * @param fVisible Visibility indicator (if false, the other parameters are undefined).
626 * @param fAlpha Flag whether alpha channel is being passed.
627 * @param xHot Pointer hot spot x coordinate.
628 * @param yHot Pointer hot spot y coordinate.
629 * @param x Pointer new x coordinate on screen.
630 * @param y Pointer new y coordinate on screen.
631 * @param cx Pointer width in pixels.
632 * @param cy Pointer height in pixels.
633 * @param cbScanline Size of one scanline in bytes.
634 * @param pvShape New shape buffer.
635 * @thread The emulation thread.
636 */
637 DECLR3CALLBACKMEMBER(int, pfnVBVAMousePointerShape,(PPDMIDISPLAYCONNECTOR pInterface, bool fVisible, bool fAlpha,
638 uint32_t xHot, uint32_t yHot,
639 uint32_t cx, uint32_t cy,
640 const void *pvShape));
641
642 /** Read-only attributes.
643 * For preformance reasons some readonly attributes are kept in the interface.
644 * We trust the interface users to respect the readonlyness of these.
645 * @{
646 */
647 /** Pointer to the display data buffer. */
648 uint8_t *pu8Data;
649 /** Size of a scanline in the data buffer. */
650 uint32_t cbScanline;
651 /** The color depth (in bits) the graphics card is supposed to provide. */
652 uint32_t cBits;
653 /** The display width. */
654 uint32_t cx;
655 /** The display height. */
656 uint32_t cy;
657 /** @} */
658} PDMIDISPLAYCONNECTOR;
659
660
661
662/**
663 * Block drive type.
664 */
665typedef enum PDMBLOCKTYPE
666{
667 /** Error (for the query function). */
668 PDMBLOCKTYPE_ERROR = 1,
669 /** 360KB 5 1/4" floppy drive. */
670 PDMBLOCKTYPE_FLOPPY_360,
671 /** 720KB 3 1/2" floppy drive. */
672 PDMBLOCKTYPE_FLOPPY_720,
673 /** 1.2MB 5 1/4" floppy drive. */
674 PDMBLOCKTYPE_FLOPPY_1_20,
675 /** 1.44MB 3 1/2" floppy drive. */
676 PDMBLOCKTYPE_FLOPPY_1_44,
677 /** 2.88MB 3 1/2" floppy drive. */
678 PDMBLOCKTYPE_FLOPPY_2_88,
679 /** CDROM drive. */
680 PDMBLOCKTYPE_CDROM,
681 /** DVD drive. */
682 PDMBLOCKTYPE_DVD,
683 /** Hard disk drive. */
684 PDMBLOCKTYPE_HARD_DISK
685} PDMBLOCKTYPE;
686
687
688/**
689 * Block raw command data transfer direction.
690 */
691typedef enum PDMBLOCKTXDIR
692{
693 PDMBLOCKTXDIR_NONE = 0,
694 PDMBLOCKTXDIR_FROM_DEVICE,
695 PDMBLOCKTXDIR_TO_DEVICE
696} PDMBLOCKTXDIR;
697
698/**
699 * Block notify interface.
700 * Pair with PDMIBLOCK.
701 */
702typedef PDMIDUMMY PDMIBLOCKPORT;
703/** Pointer to a block notify interface (dummy). */
704typedef PDMIBLOCKPORT *PPDMIBLOCKPORT;
705
706/** Pointer to a block interface. */
707typedef struct PDMIBLOCK *PPDMIBLOCK;
708/**
709 * Block interface.
710 * Pair with PDMIBLOCKPORT.
711 */
712typedef struct PDMIBLOCK
713{
714 /**
715 * Read bits.
716 *
717 * @returns VBox status code.
718 * @param pInterface Pointer to the interface structure containing the called function pointer.
719 * @param off Offset to start reading from. The offset must be aligned to a sector boundary.
720 * @param pvBuf Where to store the read bits.
721 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary.
722 * @thread Any thread.
723 */
724 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIBLOCK pInterface, uint64_t off, void *pvBuf, size_t cbRead));
725
726 /**
727 * Write bits.
728 *
729 * @returns VBox status code.
730 * @param pInterface Pointer to the interface structure containing the called function pointer.
731 * @param off Offset to start writing at. The offset must be aligned to a sector boundary.
732 * @param pvBuf Where to store the write bits.
733 * @param cbWrite Number of bytes to write. Must be aligned to a sector boundary.
734 * @thread Any thread.
735 */
736 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIBLOCK pInterface, uint64_t off, const void *pvBuf, size_t cbWrite));
737
738 /**
739 * Make sure that the bits written are actually on the storage medium.
740 *
741 * @returns VBox status code.
742 * @param pInterface Pointer to the interface structure containing the called function pointer.
743 * @thread Any thread.
744 */
745 DECLR3CALLBACKMEMBER(int, pfnFlush,(PPDMIBLOCK pInterface));
746
747 /**
748 * Send a raw command to the underlying device (CDROM).
749 * This method is optional (i.e. the function pointer may be NULL).
750 *
751 * @returns VBox status code.
752 * @param pInterface Pointer to the interface structure containing the called function pointer.
753 * @param pbCmd Offset to start reading from.
754 * @param enmTxDir Direction of transfer.
755 * @param pvBuf Pointer tp the transfer buffer.
756 * @param cbBuf Size of the transfer buffer.
757 * @param pbSenseKey Status of the command (when return value is VERR_DEV_IO_ERROR).
758 * @param cTimeoutMillies Command timeout in milliseconds.
759 * @thread Any thread.
760 */
761 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));
762
763 /**
764 * Check if the media is readonly or not.
765 *
766 * @returns true if readonly.
767 * @returns false if read/write.
768 * @param pInterface Pointer to the interface structure containing the called function pointer.
769 * @thread Any thread.
770 */
771 DECLR3CALLBACKMEMBER(bool, pfnIsReadOnly,(PPDMIBLOCK pInterface));
772
773 /**
774 * Gets the media size in bytes.
775 *
776 * @returns Media size in bytes.
777 * @param pInterface Pointer to the interface structure containing the called function pointer.
778 * @thread Any thread.
779 */
780 DECLR3CALLBACKMEMBER(uint64_t, pfnGetSize,(PPDMIBLOCK pInterface));
781
782 /**
783 * Gets the block drive type.
784 *
785 * @returns block drive type.
786 * @param pInterface Pointer to the interface structure containing the called function pointer.
787 * @thread Any thread.
788 */
789 DECLR3CALLBACKMEMBER(PDMBLOCKTYPE, pfnGetType,(PPDMIBLOCK pInterface));
790
791 /**
792 * Gets the UUID of the block drive.
793 * Don't return the media UUID if it's removable.
794 *
795 * @returns VBox status code.
796 * @param pInterface Pointer to the interface structure containing the called function pointer.
797 * @param pUuid Where to store the UUID on success.
798 * @thread Any thread.
799 */
800 DECLR3CALLBACKMEMBER(int, pfnGetUuid,(PPDMIBLOCK pInterface, PRTUUID pUuid));
801} PDMIBLOCK;
802
803
804/** Pointer to a mount interface. */
805typedef struct PDMIMOUNTNOTIFY *PPDMIMOUNTNOTIFY;
806/**
807 * Block interface.
808 * Pair with PDMIMOUNT.
809 */
810typedef struct PDMIMOUNTNOTIFY
811{
812 /**
813 * Called when a media is mounted.
814 *
815 * @param pInterface Pointer to the interface structure containing the called function pointer.
816 * @thread The emulation thread.
817 */
818 DECLR3CALLBACKMEMBER(void, pfnMountNotify,(PPDMIMOUNTNOTIFY pInterface));
819
820 /**
821 * Called when a media is unmounted
822 * @param pInterface Pointer to the interface structure containing the called function pointer.
823 * @thread The emulation thread.
824 */
825 DECLR3CALLBACKMEMBER(void, pfnUnmountNotify,(PPDMIMOUNTNOTIFY pInterface));
826} PDMIMOUNTNOTIFY;
827
828
829/* Pointer to mount interface. */
830typedef struct PDMIMOUNT *PPDMIMOUNT;
831/**
832 * Mount interface.
833 * Pair with PDMIMOUNTNOTIFY.
834 */
835typedef struct PDMIMOUNT
836{
837 /**
838 * Mount a media.
839 *
840 * This will not unmount any currently mounted media!
841 *
842 * @returns VBox status code.
843 * @param pInterface Pointer to the interface structure containing the called function pointer.
844 * @param pszFilename Pointer to filename. If this is NULL it assumed that the caller have
845 * constructed a configuration which can be attached to the bottom driver.
846 * @param pszCoreDriver Core driver name. NULL will cause autodetection. Ignored if pszFilanem is NULL.
847 * @thread The emulation thread.
848 */
849 DECLR3CALLBACKMEMBER(int, pfnMount,(PPDMIMOUNT pInterface, const char *pszFilename, const char *pszCoreDriver));
850
851 /**
852 * Unmount the media.
853 *
854 * The driver will validate and pass it on. On the rebounce it will decide whether or not to detach it self.
855 *
856 * @returns VBox status code.
857 * @param pInterface Pointer to the interface structure containing the called function pointer.
858 * @thread The emulation thread.
859 * @param fForce Force the unmount, even for locked media.
860 * @thread The emulation thread.
861 */
862 DECLR3CALLBACKMEMBER(int, pfnUnmount,(PPDMIMOUNT pInterface, bool fForce));
863
864 /**
865 * Checks if a media is mounted.
866 *
867 * @returns true if mounted.
868 * @returns false if not mounted.
869 * @param pInterface Pointer to the interface structure containing the called function pointer.
870 * @thread Any thread.
871 */
872 DECLR3CALLBACKMEMBER(bool, pfnIsMounted,(PPDMIMOUNT pInterface));
873
874 /**
875 * Locks the media, preventing any unmounting of it.
876 *
877 * @returns VBox status code.
878 * @param pInterface Pointer to the interface structure containing the called function pointer.
879 * @thread The emulation thread.
880 */
881 DECLR3CALLBACKMEMBER(int, pfnLock,(PPDMIMOUNT pInterface));
882
883 /**
884 * Unlocks the media, canceling previous calls to pfnLock().
885 *
886 * @returns VBox status code.
887 * @param pInterface Pointer to the interface structure containing the called function pointer.
888 * @thread The emulation thread.
889 */
890 DECLR3CALLBACKMEMBER(int, pfnUnlock,(PPDMIMOUNT pInterface));
891
892 /**
893 * Checks if a media is locked.
894 *
895 * @returns true if locked.
896 * @returns false if not locked.
897 * @param pInterface Pointer to the interface structure containing the called function pointer.
898 * @thread Any thread.
899 */
900 DECLR3CALLBACKMEMBER(bool, pfnIsLocked,(PPDMIMOUNT pInterface));
901} PDMIBLOCKMOUNT;
902
903/**
904 * Media geometry structure.
905 */
906typedef struct PDMMEDIAGEOMETRY
907{
908 /** Number of cylinders. */
909 uint32_t cCylinders;
910 /** Number of heads. */
911 uint32_t cHeads;
912 /** Number of sectors. */
913 uint32_t cSectors;
914} PDMMEDIAGEOMETRY;
915
916/** Pointer to media geometry structure. */
917typedef PDMMEDIAGEOMETRY *PPDMMEDIAGEOMETRY;
918/** Pointer to constant media geometry structure. */
919typedef const PDMMEDIAGEOMETRY *PCPDMMEDIAGEOMETRY;
920
921/** Pointer to a media interface. */
922typedef struct PDMIMEDIA *PPDMIMEDIA;
923/**
924 * Media interface.
925 * Makes up the foundation for PDMIBLOCK and PDMIBLOCKBIOS.
926 */
927typedef struct PDMIMEDIA
928{
929 /**
930 * Read bits.
931 *
932 * @returns VBox status code.
933 * @param pInterface Pointer to the interface structure containing the called function pointer.
934 * @param off Offset to start reading from. The offset must be aligned to a sector boundary.
935 * @param pvBuf Where to store the read bits.
936 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary.
937 * @thread Any thread.
938 */
939 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIMEDIA pInterface, uint64_t off, void *pvBuf, size_t cbRead));
940
941 /**
942 * Write bits.
943 *
944 * @returns VBox status code.
945 * @param pInterface Pointer to the interface structure containing the called function pointer.
946 * @param off Offset to start writing at. The offset must be aligned to a sector boundary.
947 * @param pvBuf Where to store the write bits.
948 * @param cbWrite Number of bytes to write. Must be aligned to a sector boundary.
949 * @thread Any thread.
950 */
951 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIMEDIA pInterface, uint64_t off, const void *pvBuf, size_t cbWrite));
952
953 /**
954 * Make sure that the bits written are actually on the storage medium.
955 *
956 * @returns VBox status code.
957 * @param pInterface Pointer to the interface structure containing the called function pointer.
958 * @thread Any thread.
959 */
960 DECLR3CALLBACKMEMBER(int, pfnFlush,(PPDMIMEDIA pInterface));
961
962 /**
963 * Get the media size in bytes.
964 *
965 * @returns Media size in bytes.
966 * @param pInterface Pointer to the interface structure containing the called function pointer.
967 * @thread Any thread.
968 */
969 DECLR3CALLBACKMEMBER(uint64_t, pfnGetSize,(PPDMIMEDIA pInterface));
970
971 /**
972 * Check if the media is readonly or not.
973 *
974 * @returns true if readonly.
975 * @returns false if read/write.
976 * @param pInterface Pointer to the interface structure containing the called function pointer.
977 * @thread Any thread.
978 */
979 DECLR3CALLBACKMEMBER(bool, pfnIsReadOnly,(PPDMIMEDIA pInterface));
980
981 /**
982 * Get stored media geometry (physical CHS, PCHS) - BIOS property.
983 * This is an optional feature of a media.
984 *
985 * @returns VBox status code.
986 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
987 * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnBiosSetPCHSGeometry() yet.
988 * @param pInterface Pointer to the interface structure containing the called function pointer.
989 * @param pPCHSGeometry Pointer to PCHS geometry (cylinders/heads/sectors).
990 * @remark This has no influence on the read/write operations.
991 * @thread Any thread.
992 */
993 DECLR3CALLBACKMEMBER(int, pfnBiosGetPCHSGeometry,(PPDMIMEDIA pInterface, PPDMMEDIAGEOMETRY pPCHSGeometry));
994
995 /**
996 * Store the media geometry (physical CHS, PCHS) - BIOS property.
997 * This is an optional feature of a media.
998 *
999 * @returns VBox status code.
1000 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1001 * @param pInterface Pointer to the interface structure containing the called function pointer.
1002 * @param pPCHSGeometry Pointer to PCHS geometry (cylinders/heads/sectors).
1003 * @remark This has no influence on the read/write operations.
1004 * @thread The emulation thread.
1005 */
1006 DECLR3CALLBACKMEMBER(int, pfnBiosSetPCHSGeometry,(PPDMIMEDIA pInterface, PCPDMMEDIAGEOMETRY pPCHSGeometry));
1007
1008 /**
1009 * Get stored media geometry (logical CHS, LCHS) - BIOS property.
1010 * This is an optional feature of a media.
1011 *
1012 * @returns VBox status code.
1013 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1014 * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnBiosSetLCHSGeometry() yet.
1015 * @param pInterface Pointer to the interface structure containing the called function pointer.
1016 * @param pLCHSGeometry Pointer to LCHS geometry (cylinders/heads/sectors).
1017 * @remark This has no influence on the read/write operations.
1018 * @thread Any thread.
1019 */
1020 DECLR3CALLBACKMEMBER(int, pfnBiosGetLCHSGeometry,(PPDMIMEDIA pInterface, PPDMMEDIAGEOMETRY pLCHSGeometry));
1021
1022 /**
1023 * Store the media geometry (logical CHS, LCHS) - BIOS property.
1024 * This is an optional feature of a media.
1025 *
1026 * @returns VBox status code.
1027 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1028 * @param pInterface Pointer to the interface structure containing the called function pointer.
1029 * @param pLCHSGeometry Pointer to LCHS geometry (cylinders/heads/sectors).
1030 * @remark This has no influence on the read/write operations.
1031 * @thread The emulation thread.
1032 */
1033 DECLR3CALLBACKMEMBER(int, pfnBiosSetLCHSGeometry,(PPDMIMEDIA pInterface, PCPDMMEDIAGEOMETRY pLCHSGeometry));
1034
1035 /**
1036 * Gets the UUID of the media drive.
1037 *
1038 * @returns VBox status code.
1039 * @param pInterface Pointer to the interface structure containing the called function pointer.
1040 * @param pUuid Where to store the UUID on success.
1041 * @thread Any thread.
1042 */
1043 DECLR3CALLBACKMEMBER(int, pfnGetUuid,(PPDMIMEDIA pInterface, PRTUUID pUuid));
1044
1045} PDMIMEDIA;
1046
1047
1048/** Pointer to a block BIOS interface. */
1049typedef struct PDMIBLOCKBIOS *PPDMIBLOCKBIOS;
1050/**
1051 * Media BIOS interface.
1052 * The interface the getting and setting properties which the BIOS/CMOS care about.
1053 */
1054typedef struct PDMIBLOCKBIOS
1055{
1056 /**
1057 * Get stored media geometry (physical CHS, PCHS) - BIOS property.
1058 * This is an optional feature of a media.
1059 *
1060 * @returns VBox status code.
1061 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1062 * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnSetPCHSGeometry() yet.
1063 * @param pInterface Pointer to the interface structure containing the called function pointer.
1064 * @param pPCHSGeometry Pointer to PCHS geometry (cylinders/heads/sectors).
1065 * @remark This has no influence on the read/write operations.
1066 * @thread Any thread.
1067 */
1068 DECLR3CALLBACKMEMBER(int, pfnGetPCHSGeometry,(PPDMIBLOCKBIOS pInterface, PPDMMEDIAGEOMETRY pPCHSGeometry));
1069
1070 /**
1071 * Store the media geometry (physical CHS, PCHS) - BIOS property.
1072 * This is an optional feature of a media.
1073 *
1074 * @returns VBox status code.
1075 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1076 * @param pInterface Pointer to the interface structure containing the called function pointer.
1077 * @param pPCHSGeometry Pointer to PCHS geometry (cylinders/heads/sectors).
1078 * @remark This has no influence on the read/write operations.
1079 * @thread The emulation thread.
1080 */
1081 DECLR3CALLBACKMEMBER(int, pfnSetPCHSGeometry,(PPDMIBLOCKBIOS pInterface, PCPDMMEDIAGEOMETRY pPCHSGeometry));
1082
1083 /**
1084 * Get stored media geometry (logical CHS, LCHS) - BIOS property.
1085 * This is an optional feature of a media.
1086 *
1087 * @returns VBox status code.
1088 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1089 * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnSetLCHSGeometry() yet.
1090 * @param pInterface Pointer to the interface structure containing the called function pointer.
1091 * @param pLCHSGeometry Pointer to LCHS geometry (cylinders/heads/sectors).
1092 * @remark This has no influence on the read/write operations.
1093 * @thread Any thread.
1094 */
1095 DECLR3CALLBACKMEMBER(int, pfnGetLCHSGeometry,(PPDMIBLOCKBIOS pInterface, PPDMMEDIAGEOMETRY pLCHSGeometry));
1096
1097 /**
1098 * Store the media geometry (logical CHS, LCHS) - BIOS property.
1099 * This is an optional feature of a media.
1100 *
1101 * @returns VBox status code.
1102 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
1103 * @param pInterface Pointer to the interface structure containing the called function pointer.
1104 * @param pLCHSGeometry Pointer to LCHS geometry (cylinders/heads/sectors).
1105 * @remark This has no influence on the read/write operations.
1106 * @thread The emulation thread.
1107 */
1108 DECLR3CALLBACKMEMBER(int, pfnSetLCHSGeometry,(PPDMIBLOCKBIOS pInterface, PCPDMMEDIAGEOMETRY pLCHSGeometry));
1109
1110 /**
1111 * Checks if the device should be visible to the BIOS or not.
1112 *
1113 * @returns true if the device is visible to the BIOS.
1114 * @returns false if the device is not visible to the BIOS.
1115 * @param pInterface Pointer to the interface structure containing the called function pointer.
1116 * @thread Any thread.
1117 */
1118 DECLR3CALLBACKMEMBER(bool, pfnIsVisible,(PPDMIBLOCKBIOS pInterface));
1119
1120 /**
1121 * Gets the block drive type.
1122 *
1123 * @returns block drive type.
1124 * @param pInterface Pointer to the interface structure containing the called function pointer.
1125 * @thread Any thread.
1126 */
1127 DECLR3CALLBACKMEMBER(PDMBLOCKTYPE, pfnGetType,(PPDMIBLOCKBIOS pInterface));
1128
1129} PDMIBLOCKBIOS;
1130
1131
1132/** Pointer to a static block core driver interface. */
1133typedef struct PDMIMEDIASTATIC *PPDMIMEDIASTATIC;
1134/**
1135 * Static block core driver interface.
1136 */
1137typedef struct PDMIMEDIASTATIC
1138{
1139 /**
1140 * Check if the specified file is a format which the core driver can handle.
1141 *
1142 * @returns true / false accordingly.
1143 * @param pInterface Pointer to the interface structure containing the called function pointer.
1144 * @param pszFilename Name of the file to probe.
1145 */
1146 DECLR3CALLBACKMEMBER(bool, pfnCanHandle,(PPDMIMEDIASTATIC pInterface, const char *pszFilename));
1147} PDMIMEDIASTATIC;
1148
1149
1150/**
1151 * iSCSI Request PDU buffer (gather).
1152 */
1153typedef struct ISCSIREQ
1154{
1155 /** Length of PDU segment in bytes. */
1156 size_t cbSeg;
1157 /** Pointer to PDU segment. */
1158 const void *pcvSeg;
1159} ISCSIREQ;
1160/** Pointer to an iSCSI Request PDU buffer. */
1161typedef ISCSIREQ *PISCSIREQ;
1162/** Pointer to a const iSCSI Request PDU buffer. */
1163typedef ISCSIREQ const *PCISCSIREQ;
1164
1165
1166/**
1167 * iSCSI Response PDU buffer (scatter).
1168 */
1169typedef struct ISCSIRES
1170{
1171 /** Length of PDU segment. */
1172 size_t cbSeg;
1173 /** Pointer to PDU segment. */
1174 void *pvSeg;
1175} ISCSIRES;
1176/** Pointer to an iSCSI Response PDU buffer. */
1177typedef ISCSIRES *PISCSIRES;
1178/** Pointer to a const iSCSI Response PDU buffer. */
1179typedef ISCSIRES const *PCISCSIRES;
1180
1181
1182/** Pointer to an iSCSI transport driver interface. */
1183typedef struct PDMIISCSITRANSPORT *PPDMIISCSITRANSPORT;
1184/**
1185 * iSCSI transport driver interface.
1186 */
1187typedef struct PDMIISCSITRANSPORT
1188{
1189 /**
1190 * Read bytes from an iSCSI transport stream. If the connection fails, it is automatically
1191 * reopened on the next call after the error is signalled. Error recovery in this case is
1192 * the duty of the caller.
1193 *
1194 * @returns VBox status code.
1195 * @param pTransport Pointer to the interface structure containing the called function pointer.
1196 * @param paResponses Array of scatter segments.
1197 * @param cResponses The number of segments.
1198 * @thread Any thread.
1199 * @todo Correct the docs.
1200 */
1201 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIISCSITRANSPORT pTransport, PISCSIRES paResponses, unsigned cResponses));
1202
1203 /**
1204 * Write bytes to an iSCSI transport stream. Padding is performed when necessary. If the connection
1205 * fails, it is automatically reopened on the next call after the error is signalled. Error recovery
1206 * in this case is the duty of the caller.
1207 *
1208 * @returns VBox status code.
1209 * @param pTransport Pointer to the interface structure containing the called function pointer.
1210 * @param paRequests Array of gather segments.
1211 * @param cRequests The number of segments.
1212 * @thread Any thread.
1213 * @todo Correct the docs.
1214 */
1215 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIISCSITRANSPORT pTransport, PISCSIREQ paRequests, unsigned cRequests));
1216
1217 /**
1218 * Open the iSCSI transport stream.
1219 *
1220 * @returns VBox status code.
1221 * @param pTransport Pointer to the interface structure containing the called function pointer.
1222 * @param pszTargetAddress Pointer to string of the format address:port.
1223 * @thread Any thread.
1224 */
1225 DECLR3CALLBACKMEMBER(int, pfnOpen,(PPDMIISCSITRANSPORT pTransport, const char *pszTargetAddress));
1226
1227 /**
1228 * Close the iSCSI transport stream.
1229 *
1230 * @returns VBox status code.
1231 * @param pTransport Pointer to the interface structure containing the called function pointer.
1232 * @thread Any thread.
1233 */
1234 DECLR3CALLBACKMEMBER(int, pfnClose,(PPDMIISCSITRANSPORT pTransport));
1235} PDMIISCSITRANSPORT;
1236
1237
1238/** Pointer to an asynchronous iSCSI transport driver interface. */
1239typedef struct PDMIISCSITRANSPORTASYNC *PPDMIISCSITRANSPORTASYNC;
1240/**
1241 * Asynchronous iSCSI transport driver interface.
1242 */
1243typedef struct PDMIISCSITRANSPORTASYNC
1244{
1245 /**
1246 * Start an asynchronous read request from an iSCSI transport stream. Padding is performed when necessary.
1247 *
1248 * @returns VBox status code.
1249 * @param pTransport Pointer to the interface structure containing the called function pointer.
1250 * @param paResponses Pointer to a array of scatter segments.
1251 * @param cResponses Number of segments in the array.
1252 * @param pvUser User argument which is returned in completion callback.
1253 * @thread EMT thread.
1254 */
1255 DECLR3CALLBACKMEMBER(int, pfnStartRead,(PPDMIISCSITRANSPORTASYNC pTransport, PISCSIRES paResponses, unsigned cResponses, void *pvUser));
1256
1257 /**
1258 * Start an asychronous write to an iSCSI transport stream. Padding is performed when necessary.
1259 *
1260 * @returns VBox status code.
1261 * @param pTransport Pointer to the interface structure containing the called function pointer.
1262 * @param paRequests Pointer to a array of gather segments.
1263 * @param cRequests Number of segments in the array.
1264 * @param pvUser User argument which is returned in completion callback.
1265 * @thread EMT thread.
1266 */
1267 DECLR3CALLBACKMEMBER(int, pfnStartWrite,(PPDMIISCSITRANSPORTASYNC pTransport, PISCSIREQ pRequests, unsigned cRequests, void *pvUser));
1268} PDMIISCSITRANSPORTASYNC;
1269
1270
1271/** Pointer to a asynchronous iSCSI transport notify interface. */
1272typedef struct PDMIISCSITRANSPORTASYNCPORT *PPDMIISCSITRANSPORTASYNCPORT;
1273/**
1274 * Asynchronous iSCSI transport notify interface.
1275 * Pair with PDMIISCSITRANSPORTASYNC.
1276 */
1277typedef struct PDMIISCSITRANSPORTASYNCPORT
1278{
1279 /**
1280 * Notify completion of a read task.
1281 *
1282 * @returns VBox status code.
1283 * @param pInterface Pointer to the interface structure containing the called function pointer.
1284 * @param paResponses Pointer to a array of scatter segments.
1285 * @param cResponses Number of segments in the array.
1286 * @param pvUser The user argument given in pfnStartRead.
1287 * @thread Any thread.
1288 */
1289 DECLR3CALLBACKMEMBER(int, pfnReadCompleteNotify, (PPDMIISCSITRANSPORTASYNCPORT pInterface, PISCSIRES paResponses, unsigned cResponse, void *pvUser));
1290
1291 /**
1292 * Notify completion of a write task.
1293 *
1294 * @returns VBox status code.
1295 * @param pInterface Pointer to the interface structure containing the called function pointer.
1296 * @param paRequests Pointer to a array of gather segments.
1297 * @param cRequests Number of segments in the array.
1298 * @param pvUser The user argument given in pfnStartWrite.
1299 * @thread Any thread.
1300 */
1301 DECLR3CALLBACKMEMBER(int, pfnWriteCompleteNotify, (PPDMIISCSITRANSPORTASYNCPORT pTransport, PISCSIREQ paRequests, unsigned cRequests, void *pvUser));
1302} PDMIISCSITRANSPORTASYNCPORT;
1303
1304
1305/** Pointer to a asynchronous block notify interface. */
1306typedef struct PDMIBLOCKASYNCPORT *PPDMIBLOCKASYNCPORT;
1307/**
1308 * Asynchronous block notify interface.
1309 * Pair with PDMIBLOCKASYNC.
1310 */
1311typedef struct PDMIBLOCKASYNCPORT
1312{
1313 /**
1314 * Notify completion of a asynchronous transfer.
1315 *
1316 * @returns VBox status code.
1317 * @param pInterface Pointer to the interface structure containing the called function pointer.
1318 * @param pvUser The user argument given in pfnStartWrite/Read.
1319 * @thread Any thread.
1320 */
1321 DECLR3CALLBACKMEMBER(int, pfnTransferCompleteNotify, (PPDMIBLOCKASYNCPORT pInterface, void *pvUser));
1322} PDMIBLOCKASYNCPORT;
1323
1324
1325/** Pointer to a asynchronous block interface. */
1326typedef struct PDMIBLOCKASYNC *PPDMIBLOCKASYNC;
1327/**
1328 * Asynchronous block interface.
1329 * Pair with PDMIBLOCKASYNCPORT.
1330 */
1331typedef struct PDMIBLOCKASYNC
1332{
1333 /**
1334 * Start reading task.
1335 *
1336 * @returns VBox status code.
1337 * @param pInterface Pointer to the interface structure containing the called function pointer.
1338 * @param off Offset to start reading from.c
1339 * @param pSeg Pointer to the first element in the scatter list.
1340 * @param cSeg Number of entries in the list.
1341 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary.
1342 * @param pvUser User argument which is returned in completion callback.
1343 * @thread Any thread.
1344 */
1345 DECLR3CALLBACKMEMBER(int, pfnStartRead,(PPDMIBLOCKASYNC pInterface, uint64_t off, PPDMDATASEG pSeg, unsigned cSeg, size_t cbRead, void *pvUser));
1346
1347 /**
1348 * Write bits.
1349 *
1350 * @returns VBox status code.
1351 * @param pInterface Pointer to the interface structure containing the called function pointer.
1352 * @param off Offset to start writing at. The offset must be aligned to a sector boundary.
1353 * @param pSeg Pointer to the first element in the gather list.
1354 * @param cSeg Number of entries in the list.
1355 * @param cbWrite Number of bytes to write. Must be aligned to a sector boundary.
1356 * @param pvUser User argument which is returned in completion callback.
1357 * @thread Any thread.
1358 */
1359 DECLR3CALLBACKMEMBER(int, pfnStartWrite,(PPDMIBLOCKASYNC pInterface, uint64_t off, PPDMDATASEG pSeg, unsigned cSeg, size_t cbWrite, void *pvUser));
1360
1361} PDMIBLOCKASYNC;
1362
1363
1364/** Pointer to a asynchronous notification interface. */
1365typedef struct PDMIMEDIAASYNCPORT *PPDMIMEDIAASYNCPORT;
1366/**
1367 * Asynchronous media interface.
1368 * Makes up the fundation for PDMIBLOCKASYNC and PDMIBLOCKBIOS.
1369 */
1370typedef struct PDMIMEDIAASYNCPORT
1371{
1372 /**
1373 * Notify completion of a task.
1374 *
1375 * @returns VBox status code.
1376 * @param pInterface Pointer to the interface structure containing the called function pointer.
1377 * @param pvUser The user argument given in pfnStartWrite.
1378 * @thread Any thread.
1379 */
1380 DECLR3CALLBACKMEMBER(int, pfnTransferCompleteNotify, (PPDMIMEDIAASYNCPORT pInterface, void *pvUser));
1381} PDMIMEDIAASYNCPORT;
1382
1383
1384/** Pointer to a asynchronous media interface. */
1385typedef struct PDMIMEDIAASYNC *PPDMIMEDIAASYNC;
1386/**
1387 * Asynchronous media interface.
1388 * Makes up the fundation for PDMIBLOCKASYNC and PDMIBLOCKBIOS.
1389 */
1390typedef struct PDMIMEDIAASYNC
1391{
1392 /**
1393 * Start reading task.
1394 *
1395 * @returns VBox status code.
1396 * @param pInterface Pointer to the interface structure containing the called function pointer.
1397 * @param off Offset to start reading from. Must be aligned to a sector boundary.
1398 * @param pSeg Pointer to the first element in the scatter list.
1399 * @param cSeg Number of entries in the list.
1400 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary.
1401 * @param pvUser User data.
1402 * @thread Any thread.
1403 */
1404 DECLR3CALLBACKMEMBER(int, pfnStartRead,(PPDMIMEDIAASYNC pInterface, uint64_t off, PPDMDATASEG pSeg, unsigned cSeg, size_t cbRead, void *pvUser));
1405
1406 /**
1407 * Start writing task.
1408 *
1409 * @returns VBox status code.
1410 * @param pInterface Pointer to the interface structure containing the called function pointer.
1411 * @param off Offset to start writing at. Must be aligned to a sector boundary.
1412 * @param pSeg Pointer to the first element in the gather list.
1413 * @param cSeg Number of entries in the list.
1414 * @param cbWrite Number of bytes to write. Must be aligned to a sector boundary.
1415 * @param pvUser User data.
1416 * @thread Any thread.
1417 */
1418 DECLR3CALLBACKMEMBER(int, pfnStartWrite,(PPDMIMEDIAASYNC pInterface, uint64_t off, PPDMDATASEG pSeg, unsigned cSeg, size_t cbWrite, void *pvUser));
1419
1420} PDMIMEDIAASYNC;
1421
1422
1423/** @name Bit mask definitions for status line type
1424 * @{ */
1425#define PDM_ICHAR_STATUS_LINES_DCD RT_BIT(0)
1426#define PDM_ICHAR_STATUS_LINES_RI RT_BIT(1)
1427#define PDM_ICHAR_STATUS_LINES_DSR RT_BIT(2)
1428#define PDM_ICHAR_STATUS_LINES_CTS RT_BIT(3)
1429/** @} */
1430
1431/** Pointer to a char port interface. */
1432typedef struct PDMICHARPORT *PPDMICHARPORT;
1433/**
1434 * Char port interface.
1435 * Pair with PDMICHAR.
1436 */
1437typedef struct PDMICHARPORT
1438{
1439 /**
1440 * Deliver data read to the device/driver.
1441 *
1442 * @returns VBox status code.
1443 * @param pInterface Pointer to the interface structure containing the called function pointer.
1444 * @param pvBuf Where the read bits are stored.
1445 * @param pcbRead Number of bytes available for reading/having been read.
1446 * @thread Any thread.
1447 */
1448 DECLR3CALLBACKMEMBER(int, pfnNotifyRead,(PPDMICHARPORT pInterface, const void *pvBuf, size_t *pcbRead));
1449
1450 /**
1451 * Notify the device/driver when the status lines changed.
1452 *
1453 * @returns VBox status code.
1454 * @param pInterface Pointer to the interface structure containing the called function pointer.
1455 * @param fNewStatusLine New state of the status line pins.
1456 * @thread Any thread.
1457 */
1458 DECLR3CALLBACKMEMBER(int, pfnNotifyStatusLinesChanged,(PPDMICHARPORT pInterface, uint32_t fNewStatusLines));
1459
1460 /**
1461 * Notify the device/driver that a break occurred.
1462 *
1463 * @returns VBox statsus code.
1464 * @param pInterface Pointer to the interface structure containing the called function pointer.
1465 * @thread Any thread.
1466 */
1467 DECLR3CALLBACKMEMBER(int, pfnNotifyBreak,(PPDMICHARPORT pInterface));
1468} PDMICHARPORT;
1469
1470
1471/** Pointer to a char interface. */
1472typedef struct PDMICHAR *PPDMICHAR;
1473/**
1474 * Char interface.
1475 * Pair with PDMICHARPORT.
1476 */
1477typedef struct PDMICHAR
1478{
1479 /**
1480 * Write bits.
1481 *
1482 * @returns VBox status code.
1483 * @param pInterface Pointer to the interface structure containing the called function pointer.
1484 * @param pvBuf Where to store the write bits.
1485 * @param cbWrite Number of bytes to write.
1486 * @thread Any thread.
1487 */
1488 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMICHAR pInterface, const void *pvBuf, size_t cbWrite));
1489
1490 /**
1491 * Set device parameters.
1492 *
1493 * @returns VBox status code.
1494 * @param pInterface Pointer to the interface structure containing the called function pointer.
1495 * @param Bps Speed of the serial connection. (bits per second)
1496 * @param chParity Parity method: 'E' - even, 'O' - odd, 'N' - none.
1497 * @param cDataBits Number of data bits.
1498 * @param cStopBits Number of stop bits.
1499 * @thread Any thread.
1500 */
1501 DECLR3CALLBACKMEMBER(int, pfnSetParameters,(PPDMICHAR pInterface, unsigned Bps, char chParity, unsigned cDataBits, unsigned cStopBits));
1502
1503 /**
1504 * Set the state of the modem lines.
1505 *
1506 * @returns VBox status code.
1507 * @param pInterface Pointer to the interface structure containing the called function pointer.
1508 * @param fRequestToSend Set to true to make the Request to Send line active otherwise to 0.
1509 * @param fDataTerminalReady Set to true to make the Data Terminal Ready line active otherwise 0.
1510 * @thread Any thread.
1511 */
1512 DECLR3CALLBACKMEMBER(int, pfnSetModemLines,(PPDMICHAR pInterface, bool fRequestToSend, bool fDataTerminalReady));
1513
1514 /**
1515 * Sets the TD line into break condition.
1516 *
1517 * @returns VBox status code.
1518 * @param pInterface Pointer to the interface structure containing the called function pointer.
1519 * @param fBreak Set to true to let the device send a break false to put into normal operation.
1520 * @thread Any thread.
1521 */
1522 DECLR3CALLBACKMEMBER(int, pfnSetBreak,(PPDMICHAR pInterface, bool fBreak));
1523} PDMICHAR;
1524
1525
1526/** Pointer to a stream interface. */
1527typedef struct PDMISTREAM *PPDMISTREAM;
1528/**
1529 * Stream interface.
1530 * Makes up the foundation for PDMICHAR.
1531 */
1532typedef struct PDMISTREAM
1533{
1534 /**
1535 * Read bits.
1536 *
1537 * @returns VBox status code.
1538 * @param pInterface Pointer to the interface structure containing the called function pointer.
1539 * @param pvBuf Where to store the read bits.
1540 * @param cbRead Number of bytes to read/bytes actually read.
1541 * @thread Any thread.
1542 */
1543 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMISTREAM pInterface, void *pvBuf, size_t *cbRead));
1544
1545 /**
1546 * Write bits.
1547 *
1548 * @returns VBox status code.
1549 * @param pInterface Pointer to the interface structure containing the called function pointer.
1550 * @param pvBuf Where to store the write bits.
1551 * @param cbWrite Number of bytes to write/bytes actually written.
1552 * @thread Any thread.
1553 */
1554 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMISTREAM pInterface, const void *pvBuf, size_t *cbWrite));
1555} PDMISTREAM;
1556
1557
1558/** Mode of the parallel port */
1559typedef enum PDMPARALLELPORTMODE
1560{
1561 PDM_PARALLEL_PORT_MODE_COMPAT,
1562 PDM_PARALLEL_PORT_MODE_EPP,
1563 PDM_PARALLEL_PORT_MODE_ECP
1564} PDMPARALLELPORTMODE;
1565
1566/** Pointer to a host parallel port interface. */
1567typedef struct PDMIHOSTPARALLELPORT *PPDMIHOSTPARALLELPORT;
1568/**
1569 * Host parallel port interface.
1570 * Pair with PDMIHOSTPARALLELCONNECTOR.
1571 */
1572typedef struct PDMIHOSTPARALLELPORT
1573{
1574 /**
1575 * Deliver data read to the device/driver.
1576 *
1577 * @returns VBox status code.
1578 * @param pInterface Pointer to the interface structure containing the called function pointer.
1579 * @param pvBuf Where the read bits are stored.
1580 * @param pcbRead Number of bytes available for reading/having been read.
1581 * @thread Any thread.
1582 */
1583 DECLR3CALLBACKMEMBER(int, pfnNotifyRead,(PPDMIHOSTPARALLELPORT pInterface, const void *pvBuf, size_t *pcbRead));
1584
1585 /**
1586 * Notify device/driver that an interrupt has occured.
1587 *
1588 * @returns VBox status code.
1589 * @param pInterface Pointer to the interface structure containing the called function pointer.
1590 * @thread Any thread.
1591 */
1592 DECLR3CALLBACKMEMBER(int, pfnNotifyInterrupt,(PPDMIHOSTPARALLELPORT pInterface));
1593} PDMIHOSTPARALLELPORT;
1594
1595
1596
1597/** Pointer to a Host Parallel connector interface. */
1598typedef struct PDMIHOSTPARALLELCONNECTOR *PPDMIHOSTPARALLELCONNECTOR;
1599/**
1600 * Host parallel connector interface
1601 * Pair with PDMIHOSTPARALLELPORT.
1602 */
1603typedef struct PDMIHOSTPARALLELCONNECTOR
1604{
1605 /**
1606 * Write bits.
1607 *
1608 * @returns VBox status code.
1609 * @param pInterface Pointer to the interface structure containing the called function pointer.
1610 * @param pvBuf Where to store the write bits.
1611 * @param pcbWrite Number of bytes to write/bytes actually written.
1612 * @thread Any thread.
1613 */
1614 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIHOSTPARALLELCONNECTOR pInterface, const void *pvBuf, size_t *pcbWrite));
1615
1616 /**
1617 * Read bits.
1618 *
1619 * @returns VBox status code.
1620 * @param pInterface Pointer to the interface structure containing the called function pointer.
1621 * @param pvBuf Where to store the read bits.
1622 * @param pcbRead Number of bytes to read/bytes actually read.
1623 * @thread Any thread.
1624 */
1625 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIHOSTPARALLELCONNECTOR pInterface, void *pvBuf, size_t *pcbRead));
1626
1627 /**
1628 * Write control register bits.
1629 *
1630 * @returns VBox status code.
1631 * @param pInterface Pointer to the interface structure containing the called function pointer.
1632 * @param fReg The new control register value.
1633 * @thread Any thread.
1634 */
1635 DECLR3CALLBACKMEMBER(int, pfnWriteControl,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t fReg));
1636
1637 /**
1638 * Read control register bits.
1639 *
1640 * @returns VBox status code.
1641 * @param pInterface Pointer to the interface structure containing the called function pointer.
1642 * @param pfReg Where to store the control register bits.
1643 * @thread Any thread.
1644 */
1645 DECLR3CALLBACKMEMBER(int, pfnReadControl,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t *pfReg));
1646
1647 /**
1648 * Read status register bits.
1649 *
1650 * @returns VBox status code.
1651 * @param pInterface Pointer to the interface structure containing the called function pointer.
1652 * @param pfReg Where to store the status register bits.
1653 * @thread Any thread.
1654 */
1655 DECLR3CALLBACKMEMBER(int, pfnReadStatus,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t *pfReg));
1656
1657 /**
1658 * Set mode of the host parallel port.
1659 *
1660 * @returns VBox status code.
1661 * @param pInterface Pointer to the interface structure containing the called function pointer.
1662 * @param enmMode The mode of the host parallel port.
1663 * @thread Any thread.
1664 */
1665 DECLR3CALLBACKMEMBER(int, pfnSetMode,(PPDMIHOSTPARALLELCONNECTOR pInterface, PDMPARALLELPORTMODE enmMode));
1666} PDMIHOSTPARALLELCONNECTOR;
1667
1668
1669/** ACPI power source identifier */
1670typedef enum PDMACPIPOWERSOURCE
1671{
1672 PDM_ACPI_POWER_SOURCE_UNKNOWN = 0,
1673 PDM_ACPI_POWER_SOURCE_OUTLET,
1674 PDM_ACPI_POWER_SOURCE_BATTERY
1675} PDMACPIPOWERSOURCE;
1676/** Pointer to ACPI battery state. */
1677typedef PDMACPIPOWERSOURCE *PPDMACPIPOWERSOURCE;
1678
1679/** ACPI battey capacity */
1680typedef enum PDMACPIBATCAPACITY
1681{
1682 PDM_ACPI_BAT_CAPACITY_MIN = 0,
1683 PDM_ACPI_BAT_CAPACITY_MAX = 100,
1684 PDM_ACPI_BAT_CAPACITY_UNKNOWN = 255
1685} PDMACPIBATCAPACITY;
1686/** Pointer to ACPI battery capacity. */
1687typedef PDMACPIBATCAPACITY *PPDMACPIBATCAPACITY;
1688
1689/** ACPI battery state. See ACPI 3.0 spec '_BST (Battery Status)' */
1690typedef enum PDMACPIBATSTATE
1691{
1692 PDM_ACPI_BAT_STATE_CHARGED = 0x00,
1693 PDM_ACPI_BAT_STATE_DISCHARGING = 0x01,
1694 PDM_ACPI_BAT_STATE_CHARGING = 0x02,
1695 PDM_ACPI_BAT_STATE_CRITICAL = 0x04
1696} PDMACPIBATSTATE;
1697/** Pointer to ACPI battery state. */
1698typedef PDMACPIBATSTATE *PPDMACPIBATSTATE;
1699
1700/** Pointer to an ACPI port interface. */
1701typedef struct PDMIACPIPORT *PPDMIACPIPORT;
1702/**
1703 * ACPI port interface.
1704 */
1705typedef struct PDMIACPIPORT
1706{
1707 /**
1708 * Send an ACPI power off event.
1709 *
1710 * @returns VBox status code
1711 * @param pInterface Pointer to the interface structure containing the called function pointer.
1712 */
1713 DECLR3CALLBACKMEMBER(int, pfnPowerButtonPress,(PPDMIACPIPORT pInterface));
1714
1715 /**
1716 * Send an ACPI sleep button event.
1717 *
1718 * @returns VBox status code
1719 * @param pInterface Pointer to the interface structure containing the called function pointer.
1720 */
1721 DECLR3CALLBACKMEMBER(int, pfnSleepButtonPress,(PPDMIACPIPORT pInterface));
1722
1723 /**
1724 * Check if the last power button event was handled by the guest.
1725 *
1726 * @returns VBox status code
1727 * @param pInterface Pointer to the interface structure containing the called function pointer.
1728 * @param pfHandled Is set to true if the last power button event was handled, false otherwise.
1729 */
1730 DECLR3CALLBACKMEMBER(int, pfnGetPowerButtonHandled,(PPDMIACPIPORT pInterface, bool *pfHandled));
1731
1732 /**
1733 * Check if the guest entered the ACPI mode.
1734 *
1735 * @returns VBox status code
1736 * @param pInterface Pointer to the interface structure containing the called function pointer.
1737 * @param pfEnabled Is set to true if the guest entered the ACPI mode, false otherwise.
1738 */
1739 DECLR3CALLBACKMEMBER(int, pfnGetGuestEnteredACPIMode,(PPDMIACPIPORT pInterface, bool *pfEntered));
1740} PDMIACPIPORT;
1741
1742/** Pointer to an ACPI connector interface. */
1743typedef struct PDMIACPICONNECTOR *PPDMIACPICONNECTOR;
1744/**
1745 * ACPI connector interface.
1746 */
1747typedef struct PDMIACPICONNECTOR
1748{
1749 /**
1750 * Get the current power source of the host system.
1751 *
1752 * @returns VBox status code
1753 * @param pInterface Pointer to the interface structure containing the called function pointer.
1754 * @param penmPowerSource Pointer to the power source result variable.
1755 */
1756 DECLR3CALLBACKMEMBER(int, pfnQueryPowerSource,(PPDMIACPICONNECTOR, PPDMACPIPOWERSOURCE penmPowerSource));
1757
1758 /**
1759 * Query the current battery status of the host system.
1760 *
1761 * @returns VBox status code?
1762 * @param pInterface Pointer to the interface structure containing the called function pointer.
1763 * @param pfPresent Is set to true if battery is present, false otherwise.
1764 * @param penmRemainingCapacity Pointer to the battery remaining capacity (0 - 100 or 255 for unknown).
1765 * @param penmBatteryState Pointer to the battery status.
1766 * @param pu32PresentRate Pointer to the present rate (0..1000 of the total capacity).
1767 */
1768 DECLR3CALLBACKMEMBER(int, pfnQueryBatteryStatus,(PPDMIACPICONNECTOR, bool *pfPresent, PPDMACPIBATCAPACITY penmRemainingCapacity,
1769 PPDMACPIBATSTATE penmBatteryState, uint32_t *pu32PresentRate));
1770} PDMIACPICONNECTOR;
1771
1772
1773/** Pointer to a VMMDevice port interface. */
1774typedef struct PDMIVMMDEVPORT *PPDMIVMMDEVPORT;
1775/**
1776 * VMMDevice port interface.
1777 */
1778typedef struct PDMIVMMDEVPORT
1779{
1780 /**
1781 * Return the current absolute mouse position in pixels
1782 *
1783 * @returns VBox status code
1784 * @param pAbsX Pointer of result value, can be NULL
1785 * @param pAbsY Pointer of result value, can be NULL
1786 */
1787 DECLR3CALLBACKMEMBER(int, pfnQueryAbsoluteMouse,(PPDMIVMMDEVPORT pInterface, uint32_t *pAbsX, uint32_t *pAbsY));
1788
1789 /**
1790 * Set the new absolute mouse position in pixels
1791 *
1792 * @returns VBox status code
1793 * @param absX New absolute X position
1794 * @param absY New absolute Y position
1795 */
1796 DECLR3CALLBACKMEMBER(int, pfnSetAbsoluteMouse,(PPDMIVMMDEVPORT pInterface, uint32_t absX, uint32_t absY));
1797
1798 /**
1799 * Return the current mouse capability flags
1800 *
1801 * @returns VBox status code
1802 * @param pCapabilities Pointer of result value
1803 */
1804 DECLR3CALLBACKMEMBER(int, pfnQueryMouseCapabilities,(PPDMIVMMDEVPORT pInterface, uint32_t *pCapabilities));
1805
1806 /**
1807 * Set the current mouse capability flag (host side)
1808 *
1809 * @returns VBox status code
1810 * @param capabilities Capability mask
1811 */
1812 DECLR3CALLBACKMEMBER(int, pfnSetMouseCapabilities,(PPDMIVMMDEVPORT pInterface, uint32_t capabilities));
1813
1814 /**
1815 * Issue a display resolution change request.
1816 *
1817 * Note that there can only one request in the queue and that in case the guest does
1818 * not process it, issuing another request will overwrite the previous.
1819 *
1820 * @returns VBox status code
1821 * @param cx Horizontal pixel resolution (0 = do not change).
1822 * @param cy Vertical pixel resolution (0 = do not change).
1823 * @param cBits Bits per pixel (0 = do not change).
1824 * @param display The display index.
1825 */
1826 DECLR3CALLBACKMEMBER(int, pfnRequestDisplayChange,(PPDMIVMMDEVPORT pInterface, uint32_t cx, uint32_t cy, uint32_t cBits, uint32_t display));
1827
1828 /**
1829 * Pass credentials to guest.
1830 *
1831 * Note that there can only be one set of credentials and the guest may or may not
1832 * query them and may do whatever it wants with them.
1833 *
1834 * @returns VBox status code.
1835 * @param pszUsername User name, may be empty (UTF-8).
1836 * @param pszPassword Password, may be empty (UTF-8).
1837 * @param pszDomain Domain name, may be empty (UTF-8).
1838 * @param fFlags VMMDEV_SETCREDENTIALS_*.
1839 */
1840 DECLR3CALLBACKMEMBER(int, pfnSetCredentials,(PPDMIVMMDEVPORT pInterface, const char *pszUsername,
1841 const char *pszPassword, const char *pszDomain,
1842 uint32_t fFlags));
1843
1844 /**
1845 * Notify the driver about a VBVA status change.
1846 *
1847 * @returns Nothing. Because it is informational callback.
1848 * @param fEnabled Current VBVA status.
1849 */
1850 DECLR3CALLBACKMEMBER(void, pfnVBVAChange, (PPDMIVMMDEVPORT pInterface, bool fEnabled));
1851
1852 /**
1853 * Issue a seamless mode change request.
1854 *
1855 * Note that there can only one request in the queue and that in case the guest does
1856 * not process it, issuing another request will overwrite the previous.
1857 *
1858 * @returns VBox status code
1859 * @param fEnabled Seamless mode enabled or not
1860 */
1861 DECLR3CALLBACKMEMBER(int, pfnRequestSeamlessChange,(PPDMIVMMDEVPORT pInterface, bool fEnabled));
1862
1863 /**
1864 * Issue a memory balloon change request.
1865 *
1866 * Note that there can only one request in the queue and that in case the guest does
1867 * not process it, issuing another request will overwrite the previous.
1868 *
1869 * @returns VBox status code
1870 * @param ulBalloonSize Balloon size in megabytes
1871 */
1872 DECLR3CALLBACKMEMBER(int, pfnSetMemoryBalloon,(PPDMIVMMDEVPORT pInterface, uint32_t ulBalloonSize));
1873
1874 /**
1875 * Issue a statistcs interval change request.
1876 *
1877 * Note that there can only one request in the queue and that in case the guest does
1878 * not process it, issuing another request will overwrite the previous.
1879 *
1880 * @returns VBox status code
1881 * @param ulStatInterval Statistics query interval in seconds (0=disable)
1882 */
1883 DECLR3CALLBACKMEMBER(int, pfnSetStatisticsInterval,(PPDMIVMMDEVPORT pInterface, uint32_t ulStatInterval));
1884
1885 /**
1886 * Notify the guest about a VRDP status change.
1887 *
1888 * @returns VBox status code
1889 * @param fVRDPEnabled Current VRDP status.
1890 * @param u32VRDPExperienceLevel Which visual effects to be disabled in the guest.
1891 */
1892 DECLR3CALLBACKMEMBER(int, pfnVRDPChange, (PPDMIVMMDEVPORT pInterface, bool fVRDPEnabled, uint32_t u32VRDPExperienceLevel));
1893
1894} PDMIVMMDEVPORT;
1895
1896/** @name Flags for PDMIVMMDEVPORT::pfnSetCredentials.
1897 * @{ */
1898/** The guest should perform a logon with the credentials. */
1899#define VMMDEV_SETCREDENTIALS_GUESTLOGON RT_BIT(0)
1900/** The guest should prevent local logons. */
1901#define VMMDEV_SETCREDENTIALS_NOLOCALLOGON RT_BIT(1)
1902/** The guest should verify the credentials. */
1903#define VMMDEV_SETCREDENTIALS_JUDGE RT_BIT(15)
1904/** @} */
1905
1906
1907/** Forward declaration of the video accelerator command memory. */
1908struct VBVAMEMORY;
1909/** Forward declaration of the guest information structure. */
1910struct VBoxGuestInfo;
1911/** Forward declaration of the guest statistics structure */
1912struct VBoxGuestStatistics;
1913/** Pointer to video accelerator command memory. */
1914typedef struct VBVAMEMORY *PVBVAMEMORY;
1915
1916/** Pointer to a VMMDev connector interface. */
1917typedef struct PDMIVMMDEVCONNECTOR *PPDMIVMMDEVCONNECTOR;
1918/**
1919 * VMMDev connector interface.
1920 * Pair with PDMIVMMDEVPORT.
1921 */
1922typedef struct PDMIVMMDEVCONNECTOR
1923{
1924 /**
1925 * Report guest OS version.
1926 * Called whenever the Additions issue a guest version report request.
1927 *
1928 * @param pInterface Pointer to this interface.
1929 * @param pGuestInfo Pointer to guest information structure
1930 * @thread The emulation thread.
1931 */
1932 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestVersion,(PPDMIVMMDEVCONNECTOR pInterface, struct VBoxGuestInfo *pGuestInfo));
1933
1934 /**
1935 * Update the guest additions capabilities.
1936 * This is called when the guest additions capabilities change. The new capabilities
1937 * are given and the connector should update its internal state.
1938 *
1939 * @param pInterface Pointer to this interface.
1940 * @param newCapabilities New capabilities.
1941 * @thread The emulation thread.
1942 */
1943 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestCapabilities,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities));
1944
1945 /**
1946 * Update the mouse capabilities.
1947 * This is called when the mouse capabilities change. The new capabilities
1948 * are given and the connector should update its internal state.
1949 *
1950 * @param pInterface Pointer to this interface.
1951 * @param newCapabilities New capabilities.
1952 * @thread The emulation thread.
1953 */
1954 DECLR3CALLBACKMEMBER(void, pfnUpdateMouseCapabilities,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities));
1955
1956 /**
1957 * Update the pointer shape.
1958 * This is called when the mouse pointer shape changes. The new shape
1959 * is passed as a caller allocated buffer that will be freed after returning
1960 *
1961 * @param pInterface Pointer to this interface.
1962 * @param fVisible Visibility indicator (if false, the other parameters are undefined).
1963 * @param fAlpha Flag whether alpha channel is being passed.
1964 * @param xHot Pointer hot spot x coordinate.
1965 * @param yHot Pointer hot spot y coordinate.
1966 * @param x Pointer new x coordinate on screen.
1967 * @param y Pointer new y coordinate on screen.
1968 * @param cx Pointer width in pixels.
1969 * @param cy Pointer height in pixels.
1970 * @param cbScanline Size of one scanline in bytes.
1971 * @param pvShape New shape buffer.
1972 * @thread The emulation thread.
1973 */
1974 DECLR3CALLBACKMEMBER(void, pfnUpdatePointerShape,(PPDMIVMMDEVCONNECTOR pInterface, bool fVisible, bool fAlpha,
1975 uint32_t xHot, uint32_t yHot,
1976 uint32_t cx, uint32_t cy,
1977 void *pvShape));
1978
1979 /**
1980 * Enable or disable video acceleration on behalf of guest.
1981 *
1982 * @param pInterface Pointer to this interface.
1983 * @param fEnable Whether to enable acceleration.
1984 * @param pVbvaMemory Video accelerator memory.
1985
1986 * @return VBox rc. VINF_SUCCESS if VBVA was enabled.
1987 * @thread The emulation thread.
1988 */
1989 DECLR3CALLBACKMEMBER(int, pfnVideoAccelEnable,(PPDMIVMMDEVCONNECTOR pInterface, bool fEnable, PVBVAMEMORY pVbvaMemory));
1990
1991 /**
1992 * Force video queue processing.
1993 *
1994 * @param pInterface Pointer to this interface.
1995 * @thread The emulation thread.
1996 */
1997 DECLR3CALLBACKMEMBER(void, pfnVideoAccelFlush,(PPDMIVMMDEVCONNECTOR pInterface));
1998
1999 /**
2000 * Return whether the given video mode is supported/wanted by the host.
2001 *
2002 * @returns VBox status code
2003 * @param pInterface Pointer to this interface.
2004 * @param cy Video mode horizontal resolution in pixels.
2005 * @param cx Video mode vertical resolution in pixels.
2006 * @param cBits Video mode bits per pixel.
2007 * @param pfSupported Where to put the indicator for whether this mode is supported. (output)
2008 * @thread The emulation thread.
2009 */
2010 DECLR3CALLBACKMEMBER(int, pfnVideoModeSupported,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t cx, uint32_t cy, uint32_t cBits, bool *pfSupported));
2011
2012 /**
2013 * Queries by how many pixels the height should be reduced when calculating video modes
2014 *
2015 * @returns VBox status code
2016 * @param pInterface Pointer to this interface.
2017 * @param pcyReduction Pointer to the result value.
2018 * @thread The emulation thread.
2019 */
2020 DECLR3CALLBACKMEMBER(int, pfnGetHeightReduction,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcyReduction));
2021
2022 /**
2023 * Informs about a credentials judgement result from the guest.
2024 *
2025 * @returns VBox status code
2026 * @param pInterface Pointer to this interface.
2027 * @param fFlags Judgement result flags.
2028 * @thread The emulation thread.
2029 */
2030 DECLR3CALLBACKMEMBER(int, pfnSetCredentialsJudgementResult,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t fFlags));
2031
2032 /**
2033 * Set the visible region of the display
2034 *
2035 * @returns VBox status code.
2036 * @param pInterface Pointer to this interface.
2037 * @param cRect Number of rectangles in pRect
2038 * @param pRect Rectangle array
2039 * @thread The emulation thread.
2040 */
2041 DECLR3CALLBACKMEMBER(int, pfnSetVisibleRegion,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t cRect, PRTRECT pRect));
2042
2043 /**
2044 * Query the visible region of the display
2045 *
2046 * @returns VBox status code.
2047 * @param pInterface Pointer to this interface.
2048 * @param pcRect Number of rectangles in pRect
2049 * @param pRect Rectangle array (set to NULL to query the number of rectangles)
2050 * @thread The emulation thread.
2051 */
2052 DECLR3CALLBACKMEMBER(int, pfnQueryVisibleRegion,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcRect, PRTRECT pRect));
2053
2054 /**
2055 * Request the statistics interval
2056 *
2057 * @returns VBox status code.
2058 * @param pInterface Pointer to this interface.
2059 * @param pulInterval Pointer to interval in seconds
2060 * @thread The emulation thread.
2061 */
2062 DECLR3CALLBACKMEMBER(int, pfnQueryStatisticsInterval,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pulInterval));
2063
2064 /**
2065 * Report new guest statistics
2066 *
2067 * @returns VBox status code.
2068 * @param pInterface Pointer to this interface.
2069 * @param pGuestStats Guest statistics
2070 * @thread The emulation thread.
2071 */
2072 DECLR3CALLBACKMEMBER(int, pfnReportStatistics,(PPDMIVMMDEVCONNECTOR pInterface, struct VBoxGuestStatistics *pGuestStats));
2073
2074 /**
2075 * Inflate or deflate the memory balloon
2076 *
2077 * @returns VBox status code.
2078 * @param pInterface Pointer to this interface.
2079 * @param fInflate Inflate or deflate
2080 * @param cPages Number of physical pages (must be 256 as we allocate in 1 MB chunks)
2081 * @param aPhysPage Array of physical page addresses
2082 * @thread The emulation thread.
2083 */
2084 DECLR3CALLBACKMEMBER(int, pfnChangeMemoryBalloon, (PPDMIVMMDEVCONNECTOR pInterface, bool fInflate, uint32_t cPages, RTGCPHYS *aPhysPage));
2085
2086} PDMIVMMDEVCONNECTOR;
2087
2088
2089/** Pointer to a network port interface */
2090typedef struct PDMINETWORKPORT *PPDMINETWORKPORT;
2091/**
2092 * Network port interface.
2093 */
2094typedef struct PDMINETWORKPORT
2095{
2096 /**
2097 * Wait until there is space for receiving data. We do not care how much space is available
2098 * because pfnReceive() will re-check and notify the guest if necessary.
2099 *
2100 * This function must be called before the pfnRecieve() method is called.
2101 *
2102 * @returns VBox status code. VINF_SUCCESS means there is at least one receive descriptor available.
2103 * @param pInterface Pointer to the interface structure containing the called function pointer.
2104 * @param cMillies Number of milliseconds to wait. 0 means return immediately.
2105 */
2106 DECLR3CALLBACKMEMBER(int, pfnWaitReceiveAvail,(PPDMINETWORKPORT pInterface, unsigned cMillies));
2107
2108 /**
2109 * Receive data from the network.
2110 *
2111 * @returns VBox status code.
2112 * @param pInterface Pointer to the interface structure containing the called function pointer.
2113 * @param pvBuf The available data.
2114 * @param cb Number of bytes available in the buffer.
2115 * @thread EMT
2116 */
2117 DECLR3CALLBACKMEMBER(int, pfnReceive,(PPDMINETWORKPORT pInterface, const void *pvBuf, size_t cb));
2118
2119} PDMINETWORKPORT;
2120
2121
2122/**
2123 * Network link state.
2124 */
2125typedef enum PDMNETWORKLINKSTATE
2126{
2127 /** Invalid state. */
2128 PDMNETWORKLINKSTATE_INVALID = 0,
2129 /** The link is up. */
2130 PDMNETWORKLINKSTATE_UP,
2131 /** The link is down. */
2132 PDMNETWORKLINKSTATE_DOWN,
2133 /** The link is temporarily down while resuming. */
2134 PDMNETWORKLINKSTATE_DOWN_RESUME
2135} PDMNETWORKLINKSTATE;
2136
2137
2138/** Pointer to a network connector interface */
2139typedef struct PDMINETWORKCONNECTOR *PPDMINETWORKCONNECTOR;
2140/**
2141 * Network connector interface.
2142 */
2143typedef struct PDMINETWORKCONNECTOR
2144{
2145 /**
2146 * Send data to the network.
2147 *
2148 * @returns VBox status code.
2149 * @param pInterface Pointer to the interface structure containing the called function pointer.
2150 * @param pvBuf Data to send.
2151 * @param cb Number of bytes to send.
2152 * @thread EMT
2153 */
2154 DECLR3CALLBACKMEMBER(int, pfnSend,(PPDMINETWORKCONNECTOR pInterface, const void *pvBuf, size_t cb));
2155
2156 /**
2157 * Set promiscuous mode.
2158 *
2159 * This is called when the promiscuous mode is set. This means that there doesn't have
2160 * to be a mode change when it's called.
2161 *
2162 * @param pInterface Pointer to the interface structure containing the called function pointer.
2163 * @param fPromiscuous Set if the adaptor is now in promiscuous mode. Clear if it is not.
2164 * @thread EMT
2165 */
2166 DECLR3CALLBACKMEMBER(void, pfnSetPromiscuousMode,(PPDMINETWORKCONNECTOR pInterface, bool fPromiscuous));
2167
2168 /**
2169 * Notification on link status changes.
2170 *
2171 * @param pInterface Pointer to the interface structure containing the called function pointer.
2172 * @param enmLinkState The new link state.
2173 * @thread EMT
2174 */
2175 DECLR3CALLBACKMEMBER(void, pfnNotifyLinkChanged,(PPDMINETWORKCONNECTOR pInterface, PDMNETWORKLINKSTATE enmLinkState));
2176
2177 /** @todo Add a callback that informs the driver chain about MAC address changes if we ever implement that. */
2178
2179} PDMINETWORKCONNECTOR;
2180
2181
2182/** Pointer to a network config port interface */
2183typedef struct PDMINETWORKCONFIG *PPDMINETWORKCONFIG;
2184/**
2185 * Network config port interface.
2186 */
2187typedef struct PDMINETWORKCONFIG
2188{
2189 /**
2190 * Gets the current Media Access Control (MAC) address.
2191 *
2192 * @returns VBox status code.
2193 * @param pInterface Pointer to the interface structure containing the called function pointer.
2194 * @param pMac Where to store the MAC address.
2195 * @thread EMT
2196 */
2197 DECLR3CALLBACKMEMBER(int, pfnGetMac,(PPDMINETWORKCONFIG pInterface, PRTMAC pMac));
2198
2199 /**
2200 * Gets the new link state.
2201 *
2202 * @returns The current link state.
2203 * @param pInterface Pointer to the interface structure containing the called function pointer.
2204 * @thread EMT
2205 */
2206 DECLR3CALLBACKMEMBER(PDMNETWORKLINKSTATE, pfnGetLinkState,(PPDMINETWORKCONFIG pInterface));
2207
2208 /**
2209 * Sets the new link state.
2210 *
2211 * @returns VBox status code.
2212 * @param pInterface Pointer to the interface structure containing the called function pointer.
2213 * @param enmState The new link state
2214 * @thread EMT
2215 */
2216 DECLR3CALLBACKMEMBER(int, pfnSetLinkState,(PPDMINETWORKCONFIG pInterface, PDMNETWORKLINKSTATE enmState));
2217
2218} PDMINETWORKCONFIG;
2219
2220
2221/** Pointer to a network connector interface */
2222typedef struct PDMIAUDIOCONNECTOR *PPDMIAUDIOCONNECTOR;
2223/**
2224 * Audio connector interface.
2225 */
2226typedef struct PDMIAUDIOCONNECTOR
2227{
2228 DECLR3CALLBACKMEMBER(void, pfnRun,(PPDMIAUDIOCONNECTOR pInterface));
2229
2230/* DECLR3CALLBACKMEMBER(int, pfnSetRecordSource,(PPDMIAUDIOINCONNECTOR pInterface, AUDIORECSOURCE)); */
2231
2232} PDMIAUDIOCONNECTOR;
2233
2234
2235/** @todo r=bird: the two following interfaces are hacks to work around the missing audio driver
2236 * interface. This should be addressed rather than making more temporary hacks. */
2237
2238/** Pointer to a Audio Sniffer Device port interface. */
2239typedef struct PDMIAUDIOSNIFFERPORT *PPDMIAUDIOSNIFFERPORT;
2240
2241/**
2242 * Audio Sniffer port interface.
2243 */
2244typedef struct PDMIAUDIOSNIFFERPORT
2245{
2246 /**
2247 * Enables or disables sniffing. If sniffing is being enabled also sets a flag
2248 * whether the audio must be also left on the host.
2249 *
2250 * @returns VBox status code
2251 * @param pInterface Pointer to this interface.
2252 * @param fEnable 'true' for enable sniffing, 'false' to disable.
2253 * @param fKeepHostAudio Indicates whether host audio should also present
2254 * 'true' means that sound should not be played
2255 * by the audio device.
2256 */
2257 DECLR3CALLBACKMEMBER(int, pfnSetup,(PPDMIAUDIOSNIFFERPORT pInterface, bool fEnable, bool fKeepHostAudio));
2258
2259} PDMIAUDIOSNIFFERPORT;
2260
2261/** Pointer to a Audio Sniffer connector interface. */
2262typedef struct PDMIAUDIOSNIFFERCONNECTOR *PPDMIAUDIOSNIFFERCONNECTOR;
2263
2264/**
2265 * Audio Sniffer connector interface.
2266 * Pair with PDMIAUDIOSNIFFERPORT.
2267 */
2268typedef struct PDMIAUDIOSNIFFERCONNECTOR
2269{
2270 /**
2271 * AudioSniffer device calls this method when audio samples
2272 * are about to be played and sniffing is enabled.
2273 *
2274 * @param pInterface Pointer to this interface.
2275 * @param pvSamples Audio samples buffer.
2276 * @param cSamples How many complete samples are in the buffer.
2277 * @param iSampleHz The sample frequency in Hz.
2278 * @param cChannels Number of channels. 1 for mono, 2 for stereo.
2279 * @param cBits How many bits a sample for a single channel has. Normally 8 or 16.
2280 * @param fUnsigned Whether samples are unsigned values.
2281 * @thread The emulation thread.
2282 */
2283 DECLR3CALLBACKMEMBER(void, pfnAudioSamplesOut,(PPDMIAUDIOSNIFFERCONNECTOR pInterface, void *pvSamples, uint32_t cSamples,
2284 int iSampleHz, int cChannels, int cBits, bool fUnsigned));
2285
2286 /**
2287 * AudioSniffer device calls this method when output volume is changed.
2288 *
2289 * @param pInterface Pointer to this interface.
2290 * @param u16LeftVolume 0..0xFFFF volume level for left channel.
2291 * @param u16RightVolume 0..0xFFFF volume level for right channel.
2292 * @thread The emulation thread.
2293 */
2294 DECLR3CALLBACKMEMBER(void, pfnAudioVolumeOut,(PPDMIAUDIOSNIFFERCONNECTOR pInterface, uint16_t u16LeftVolume, uint16_t u16RightVolume));
2295
2296} PDMIAUDIOSNIFFERCONNECTOR;
2297
2298
2299/**
2300 * Generic status LED core.
2301 * Note that a unit doesn't have to support all the indicators.
2302 */
2303typedef union PDMLEDCORE
2304{
2305 /** 32-bit view. */
2306 uint32_t volatile u32;
2307 /** Bit view. */
2308 struct
2309 {
2310 /** Reading/Receiving indicator. */
2311 uint32_t fReading : 1;
2312 /** Writing/Sending indicator. */
2313 uint32_t fWriting : 1;
2314 /** Busy indicator. */
2315 uint32_t fBusy : 1;
2316 /** Error indicator. */
2317 uint32_t fError : 1;
2318 } s;
2319} PDMLEDCORE;
2320
2321/** LED bit masks for the u32 view.
2322 * @{ */
2323/** Reading/Receiving indicator. */
2324#define PDMLED_READING RT_BIT(0)
2325/** Writing/Sending indicator. */
2326#define PDMLED_WRITING RT_BIT(1)
2327/** Busy indicator. */
2328#define PDMLED_BUSY RT_BIT(2)
2329/** Error indicator. */
2330#define PDMLED_ERROR RT_BIT(3)
2331/** @} */
2332
2333
2334/**
2335 * Generic status LED.
2336 * Note that a unit doesn't have to support all the indicators.
2337 */
2338typedef struct PDMLED
2339{
2340 /** Just a magic for sanity checking. */
2341 uint32_t u32Magic;
2342 uint32_t u32Alignment; /**< structure size alignment. */
2343 /** The actual LED status.
2344 * Only the device is allowed to change this. */
2345 PDMLEDCORE Actual;
2346 /** The asserted LED status which is cleared by the reader.
2347 * The device will assert the bits but never clear them.
2348 * The driver clears them as it sees fit. */
2349 PDMLEDCORE Asserted;
2350} PDMLED;
2351
2352/** Pointer to an LED. */
2353typedef PDMLED *PPDMLED;
2354/** Pointer to a const LED. */
2355typedef const PDMLED *PCPDMLED;
2356
2357#define PDMLED_MAGIC ( 0x11335577 )
2358
2359/** Pointer to an LED ports interface. */
2360typedef struct PDMILEDPORTS *PPDMILEDPORTS;
2361/**
2362 * Interface for exporting LEDs.
2363 */
2364typedef struct PDMILEDPORTS
2365{
2366 /**
2367 * Gets the pointer to the status LED of a unit.
2368 *
2369 * @returns VBox status code.
2370 * @param pInterface Pointer to the interface structure containing the called function pointer.
2371 * @param iLUN The unit which status LED we desire.
2372 * @param ppLed Where to store the LED pointer.
2373 */
2374 DECLR3CALLBACKMEMBER(int, pfnQueryStatusLed,(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed));
2375
2376} PDMILEDPORTS;
2377
2378
2379/** Pointer to an LED connectors interface. */
2380typedef struct PDMILEDCONNECTORS *PPDMILEDCONNECTORS;
2381/**
2382 * Interface for reading LEDs.
2383 */
2384typedef struct PDMILEDCONNECTORS
2385{
2386 /**
2387 * Notification about a unit which have been changed.
2388 *
2389 * The driver must discard any pointers to data owned by
2390 * the unit and requery it.
2391 *
2392 * @param pInterface Pointer to the interface structure containing the called function pointer.
2393 * @param iLUN The unit number.
2394 */
2395 DECLR3CALLBACKMEMBER(void, pfnUnitChanged,(PPDMILEDCONNECTORS pInterface, unsigned iLUN));
2396} PDMILEDCONNECTORS;
2397
2398
2399/** The special status unit number */
2400#define PDM_STATUS_LUN 999
2401
2402
2403#ifdef VBOX_WITH_HGCM
2404
2405/** Abstract HGCM command structure. Used only to define a typed pointer. */
2406struct VBOXHGCMCMD;
2407
2408/** Pointer to HGCM command structure. This pointer is unique and identifies
2409 * the command being processed. The pointer is passed to HGCM connector methods,
2410 * and must be passed back to HGCM port when command is completed.
2411 */
2412typedef struct VBOXHGCMCMD *PVBOXHGCMCMD;
2413
2414/** Pointer to a HGCM port interface. */
2415typedef struct PDMIHGCMPORT *PPDMIHGCMPORT;
2416
2417/**
2418 * HGCM port interface. Normally implemented by VMMDev.
2419 */
2420typedef struct PDMIHGCMPORT
2421{
2422 /**
2423 * Notify the guest on a command completion.
2424 *
2425 * @param pInterface Pointer to this interface.
2426 * @param rc The return code (VBox error code).
2427 * @param pCmd A pointer that identifies the completed command.
2428 *
2429 * @returns VBox status code
2430 */
2431 DECLR3CALLBACKMEMBER(void, pfnCompleted,(PPDMIHGCMPORT pInterface, int32_t rc, PVBOXHGCMCMD pCmd));
2432
2433} PDMIHGCMPORT;
2434
2435
2436/** Pointer to a HGCM connector interface. */
2437typedef struct PDMIHGCMCONNECTOR *PPDMIHGCMCONNECTOR;
2438
2439/** Pointer to a HGCM service location structure. */
2440typedef struct HGCMSERVICELOCATION *PHGCMSERVICELOCATION;
2441
2442/**
2443 * HGCM connector interface.
2444 * Pair with PDMIHGCMPORT.
2445 */
2446typedef struct PDMIHGCMCONNECTOR
2447{
2448 /**
2449 * Locate a service and inform it about a client connection.
2450 *
2451 * @param pInterface Pointer to this interface.
2452 * @param pCmd A pointer that identifies the command.
2453 * @param pServiceLocation Pointer to the service location structure.
2454 * @param pu32ClientID Where to store the client id for the connection.
2455 * @return VBox status code.
2456 * @thread The emulation thread.
2457 */
2458 DECLR3CALLBACKMEMBER(int, pfnConnect,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, PHGCMSERVICELOCATION pServiceLocation, uint32_t *pu32ClientID));
2459
2460 /**
2461 * Disconnect from service.
2462 *
2463 * @param pInterface Pointer to this interface.
2464 * @param pCmd A pointer that identifies the command.
2465 * @param u32ClientID The client id returned by the pfnConnect call.
2466 * @return VBox status code.
2467 * @thread The emulation thread.
2468 */
2469 DECLR3CALLBACKMEMBER(int, pfnDisconnect,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID));
2470
2471 /**
2472 * Process a guest issued command.
2473 *
2474 * @param pInterface Pointer to this interface.
2475 * @param pCmd A pointer that identifies the command.
2476 * @param u32ClientID The client id returned by the pfnConnect call.
2477 * @param u32Function Function to be performed by the service.
2478 * @param cParms Number of parameters in the array pointed to by paParams.
2479 * @param paParms Pointer to an array of parameters.
2480 * @return VBox status code.
2481 * @thread The emulation thread.
2482 */
2483 DECLR3CALLBACKMEMBER(int, pfnCall,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID, uint32_t u32Function,
2484 uint32_t cParms, PVBOXHGCMSVCPARM paParms));
2485
2486} PDMIHGCMCONNECTOR;
2487
2488#endif
2489
2490/**
2491 * Data direction.
2492 */
2493typedef enum PDMSCSIREQUESTTXDIR
2494{
2495 PDMSCSIREQUESTTXDIR_UNKNOWN = 0x00,
2496 PDMSCSIREQUESTTXDIR_FROM_DEVICE = 0x01,
2497 PDMSCSIREQUESTTXDIR_TO_DEVICE = 0x02,
2498 PDMSCSIREQUESTTXDIR_NONE = 0x03,
2499 PDMSCSIREQUESTTXDIR_32BIT_HACK = 0x7fffffff
2500} PDMSCSIREQUESTTXDIR;
2501
2502/**
2503 * SCSI request structure.
2504 */
2505typedef struct PDMSCSIREQUEST
2506{
2507 /** The logical unit. */
2508 uint32_t uLogicalUnit;
2509 /** Direction of the data flow. */
2510 PDMSCSIREQUESTTXDIR uDataDirection;
2511 /** Size of the SCSI CDB. */
2512 uint32_t cbCDB;
2513 /** Pointer to the SCSI CDB. */
2514 uint8_t *pbCDB;
2515 /** Overall size of all scatter gather list elements
2516 * for data transfer if any. */
2517 uint32_t cbScatterGather;
2518 /** Number of elements in the scatter gather list. */
2519 uint32_t cScatterGatherEntries;
2520 /** Pointer to the head of the scatter gather list. */
2521 PPDMDATASEG paScatterGatherHead;
2522 /** Size of the sense buffer. */
2523 uint32_t cbSenseBuffer;
2524 /** Pointer to the sense buffer. *
2525 * Current assumption that the sense buffer is not scattered. */
2526 uint8_t *pbSenseBuffer;
2527 /** Opaque user data for use by the device. Left untouched by everything else! */
2528 void *pvUser;
2529} PDMSCSIREQUEST, *PPDMSCSIREQUEST;
2530/** Pointer to a const SCSI request structure. */
2531typedef const PDMSCSIREQUEST *PCSCSIREQUEST;
2532
2533/** Pointer to a SCSI port interface. */
2534typedef struct PDMISCSIPORT *PPDMISCSIPORT;
2535
2536/**
2537 * SCSI port interface.
2538 * Pair with PDMISCSICONNECTOR.
2539 */
2540typedef struct PDMISCSIPORT
2541{
2542
2543 /**
2544 * Notify the device on request completion.
2545 *
2546 * @returns VBox status code.
2547 * @param pInterface Pointer to this interface.
2548 * @param pSCSIRequest Pointer to the finished SCSI request.
2549 * @param rcCompletion SCSI_STATUS_* code for the completed request.
2550 */
2551 DECLR3CALLBACKMEMBER(int, pfnSCSIRequestCompleted, (PPDMISCSIPORT pInterface, PPDMSCSIREQUEST pSCSIRequest, int rcCompletion));
2552
2553} PDMISCSIPORT;
2554
2555/** Pointer to a SCSI connector interface. */
2556typedef struct PDMISCSICONNECTOR *PPDMISCSICONNECTOR;
2557
2558/**
2559 * SCSI connector interface.
2560 * Pair with PDMISCSIPORT.
2561 */
2562typedef struct PDMISCSICONNECTOR
2563{
2564
2565 /**
2566 * Submits a SCSI request for execution.
2567 *
2568 * @returns VBox status code.
2569 * @param pInterface Pointer to this interface.
2570 * @param pSCSIRequest Pointer to the SCSI request to execute.
2571 */
2572 DECLR3CALLBACKMEMBER(int, pfnSCSIRequestSend, (PPDMISCSICONNECTOR pInterface, PPDMSCSIREQUEST pSCSIRequest));
2573
2574} PDMISCSICONNECTOR;
2575
2576typedef struct PDMDDISPLAYVBVACALLBACKS *PPDMDDISPLAYVBVACALLBACKS;
2577/**
2578 * Display VBVA callbacks.
2579 */
2580typedef struct PDMDDISPLAYVBVACALLBACKS
2581{
2582
2583 /**
2584 * Informs guest about completion of processing the given Video HW Acceleration
2585 * command, does not wait for the guest to process the command.
2586 *
2587 * @returns ???
2588 * @param pInterface Pointer to this interface.
2589 * @param pCmd The Video HW Acceleration Command that was
2590 * completed.
2591 * @todo r=bird: if asynch mean asyncronous; then
2592 * s/pfnVHWACommandCompleteAsynch/pfnVHWACommandCompleteAsync/;
2593 * fi
2594 */
2595 DECLR3CALLBACKMEMBER(int, pfnVHWACommandCompleteAsynch, (PPDMDDISPLAYVBVACALLBACKS pInterface, PVBOXVHWACMD pCmd));
2596
2597} PDMDDISPLAYVBVACALLBACKS;
2598
2599/** @} */
2600
2601RT_C_DECLS_END
2602
2603#endif
Note: See TracBrowser for help on using the repository browser.

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