VirtualBox

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

Last change on this file since 11454 was 11157, checked in by vboxsync, 16 years ago

Replaced PDMMAC by RTMAC.

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