VirtualBox

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

Last change on this file since 10353 was 9765, checked in by vboxsync, 17 years ago

Promoted PDMMAC from pdmifs.h to types.h.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 98.6 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/**
1118 * Data transport buffer (scatter/gather)
1119 */
1120typedef struct PDMIDATATRANSPORTSEG
1121{
1122 /** Length of buffer in entry. */
1123 size_t cbSeg;
1124 /** Pointer to the start of the buffer. */
1125 void *pvSeg;
1126} PDMIDATATRANSPORTSEG;
1127/** Pointer to a data transport segment. */
1128typedef PDMIDATATRANSPORTSEG *PPDMIDATATRANSPORTSEG;
1129/** Pointer to a const data transport segment. */
1130typedef PDMIDATATRANSPORTSEG const *PCPDMIDATATRANSPORTSEG;
1131
1132
1133/** Pointer to an asynchronous iSCSI transport driver interface. */
1134typedef struct PDMIISCSITRANSPORTASYNC *PPDMIISCSITRANSPORTASYNC;
1135/**
1136 * Asynchronous iSCSI transport driver interface.
1137 */
1138typedef struct PDMIISCSITRANSPORTASYNC
1139{
1140 /**
1141 * Start an asynchronous read request from an iSCSI transport stream. Padding is performed when necessary.
1142 *
1143 * @returns VBox status code.
1144 * @param pTransport Pointer to the interface structure containing the called function pointer.
1145 * @param paResponses Pointer to a array of scatter segments.
1146 * @param cResponses Number of segments in the array.
1147 * @param pvUser User argument which is returned in completion callback.
1148 * @thread EMT thread.
1149 */
1150 DECLR3CALLBACKMEMBER(int, pfnStartRead,(PPDMIISCSITRANSPORTASYNC pTransport, PISCSIRES paResponses, unsigned cResponses, void *pvUser));
1151
1152 /**
1153 * Start an asychronous write to an iSCSI transport stream. Padding is performed when necessary.
1154 *
1155 * @returns VBox status code.
1156 * @param pTransport Pointer to the interface structure containing the called function pointer.
1157 * @param paRequests Pointer to a array of gather segments.
1158 * @param cRequests Number of segments in the array.
1159 * @param pvUser User argument which is returned in completion callback.
1160 * @thread EMT thread.
1161 */
1162 DECLR3CALLBACKMEMBER(int, pfnStartWrite,(PPDMIISCSITRANSPORTASYNC pTransport, PISCSIREQ pRequests, unsigned cRequests, void *pvUser));
1163} PDMIISCSITRANSPORTASYNC;
1164
1165
1166/** Pointer to a asynchronous iSCSI transport notify interface. */
1167typedef struct PDMIISCSITRANSPORTASYNCPORT *PPDMIISCSITRANSPORTASYNCPORT;
1168/**
1169 * Asynchronous iSCSI transport notify interface.
1170 * Pair with PDMIISCSITRANSPORTASYNC.
1171 */
1172typedef struct PDMIISCSITRANSPORTASYNCPORT
1173{
1174 /**
1175 * Notify completion of a read task.
1176 *
1177 * @returns VBox status code.
1178 * @param pInterface Pointer to the interface structure containing the called function pointer.
1179 * @param paResponses Pointer to a array of scatter segments.
1180 * @param cResponses Number of segments in the array.
1181 * @param pvUser The user argument given in pfnStartRead.
1182 * @thread Any thread.
1183 */
1184 DECLR3CALLBACKMEMBER(int, pfnReadCompleteNotify, (PPDMIISCSITRANSPORTASYNCPORT pInterface, PISCSIRES paResponses, unsigned cResponse, void *pvUser));
1185
1186 /**
1187 * Notify completion of a write task.
1188 *
1189 * @returns VBox status code.
1190 * @param pInterface Pointer to the interface structure containing the called function pointer.
1191 * @param paRequests Pointer to a array of gather segments.
1192 * @param cRequests Number of segments in the array.
1193 * @param pvUser The user argument given in pfnStartWrite.
1194 * @thread Any thread.
1195 */
1196 DECLR3CALLBACKMEMBER(int, pfnWriteCompleteNotify, (PPDMIISCSITRANSPORTASYNCPORT pTransport, PISCSIREQ paRequests, unsigned cRequests, void *pvUser));
1197} PDMIISCSITRANSPORTASYNCPORT;
1198
1199
1200/** Pointer to a asynchronous block notify interface. */
1201typedef struct PDMIBLOCKASYNCPORT *PPDMIBLOCKASYNCPORT;
1202/**
1203 * Asynchronous block notify interface.
1204 * Pair with PDMIBLOCKASYNC.
1205 */
1206typedef struct PDMIBLOCKASYNCPORT
1207{
1208 /**
1209 * Notify completion of a read task.
1210 *
1211 * @returns VBox status code.
1212 * @param pInterface Pointer to the interface structure containing the called function pointer.
1213 * @param off Offset the task read from.
1214 * @param pSeg Pointer to the first element in the gather list.
1215 * @param cSeg Number of segments in the gather list.
1216 * @param cbRead Number of bytes read.
1217 * @param pvUser The user argument given in pfnStartRead.
1218 * @thread Any thread.
1219 */
1220 DECLR3CALLBACKMEMBER(int, pfnReadCompleteNotify, (PPDMIBLOCKASYNCPORT pInterface, uint64_t off, PPDMIDATATRANSPORTSEG pSeg, unsigned cSeg, size_t cbRead, void *pvUser));
1221
1222 /**
1223 * Notify completion of a write task.
1224 *
1225 * @returns VBox status code.
1226 * @param pInterface Pointer to the interface structure containing the called function pointer.
1227 * @param off Offset the task has written to.
1228 * @param pSeg Pointer to the first element in the scatter list.
1229 * @param cSeg Number of segments in the scatter list.
1230 * @param cbWritten Number of bytes actually written.
1231 * @param pvUser The user argument given in pfnStartWrite.
1232 * @thread Any thread.
1233 */
1234 DECLR3CALLBACKMEMBER(int, pfnWriteCompleteNotify, (PPDMIBLOCKASYNCPORT pInterface, uint64_t off, PPDMIDATATRANSPORTSEG pSeg, unsigned cSeg, size_t cbWritten, void *pvUser));
1235} PDMIBLOCKASYNCPORT;
1236
1237
1238/** Pointer to a asynchronous block interface. */
1239typedef struct PDMIBLOCKASYNC *PPDMIBLOCKASYNC;
1240/**
1241 * Asynchronous block interface.
1242 * Pair with PDMIBLOCKASYNCPORT.
1243 */
1244typedef struct PDMIBLOCKASYNC
1245{
1246 /**
1247 * Start reading task.
1248 *
1249 * @returns VBox status code.
1250 * @param pInterface Pointer to the interface structure containing the called function pointer.
1251 * @param off Offset to start reading from.
1252 * @param pSeg Pointer to the first element in the scatter list.
1253 * @param cSeg Number of entries in the list.
1254 * @param cbRead Number of bytes to read.
1255 * @param pvUser User argument which is returned in completion callback.
1256 * @thread Any thread.
1257 */
1258 DECLR3CALLBACKMEMBER(int, pfnStartRead,(PPDMIBLOCKASYNC pInterface, uint64_t off, PPDMIDATATRANSPORTSEG pSeg, unsigned cSeg, size_t cbRead, void *pvUser));
1259
1260 /**
1261 * Write bits.
1262 *
1263 * @returns VBox status code.
1264 * @param pInterface Pointer to the interface structure containing the called function pointer.
1265 * @param off Offset to start writing at.
1266 * @param pSeg Pointer to the first element in the gather list.
1267 * @param cSeg Number of entries in the list.
1268 * @param cbWrite Number of bytes to write.
1269 * @param pvUser User argument which is returned in completion callback.
1270 * @thread Any thread.
1271 */
1272 DECLR3CALLBACKMEMBER(int, pfnStartWrite,(PPDMIBLOCKASYNC pInterface, uint64_t off, PPDMIDATATRANSPORTSEG pSeg, unsigned cSeg, size_t cbWrite, void *pvUser));
1273
1274} PDMIBLOCKASYNC;
1275
1276
1277/** Pointer to a asynchronous notification interface. */
1278typedef struct PDMIMEDIAASYNCPORT *PPDMIMEDIAASYNCPORT;
1279/**
1280 * Asynchronous media interface.
1281 * Makes up the fundation for PDMIBLOCKASYNC and PDMIBLOCKBIOS.
1282 */
1283typedef struct PDMIMEDIAASYNCPORT
1284{
1285 /**
1286 * Notify completion of a read task.
1287 *
1288 * @returns VBox status code.
1289 * @param pInterface Pointer to the interface structure containing the called function pointer.
1290 * @param off Offset the task read from.
1291 * @param pSeg Pointer to the first element in the scatter list.
1292 * @param cSeg Number of entries in the list.
1293 * @param cbRead Number of bytes read.
1294 * @param pvUser The user argument given in pfnStartRead.
1295 * @thread Any thread.
1296 */
1297 DECLR3CALLBACKMEMBER(int, pfnReadCompleteNotify, (PPDMIMEDIAASYNCPORT pInterface, uint64_t off, PPDMIDATATRANSPORTSEG pSeg, unsigned cSeg, size_t cbRead, void *pvUser));
1298
1299 /**
1300 * Notify completion of a write task.
1301 *
1302 * @returns VBox status code.
1303 * @param pInterface Pointer to the interface structure containing the called function pointer.
1304 * @param off Offset the task has written to.
1305 * @param pSeg Pointer to the first element in the gather list.
1306 * @param cSeg Number of entries in the list.
1307 * @param cbWritten Number of bytes actually written.
1308 * @param pvUser The user argument given in pfnStartWrite.
1309 * @thread Any thread.
1310 */
1311 DECLR3CALLBACKMEMBER(int, pfnWriteCompleteNotify, (PPDMIMEDIAASYNCPORT pInterface, uint64_t off, PPDMIDATATRANSPORTSEG pSeg, unsigned cSeg, size_t cbWritten, void *pvUser));
1312} PDMIMEDIAASYNCPORT;
1313
1314
1315/** Pointer to a asynchronous media interface. */
1316typedef struct PDMIMEDIAASYNC *PPDMIMEDIAASYNC;
1317/**
1318 * Asynchronous media interface.
1319 * Makes up the fundation for PDMIBLOCKASYNC and PDMIBLOCKBIOS.
1320 */
1321typedef struct PDMIMEDIAASYNC
1322{
1323 /**
1324 * Start reading task.
1325 *
1326 * @returns VBox status code.
1327 * @param pInterface Pointer to the interface structure containing the called function pointer.
1328 * @param off Offset to start reading from.
1329 * @param pSeg Pointer to the first element in the scatter list.
1330 * @param cSeg Number of entries in the list.
1331 * @param cbRead Number of bytes to read.
1332 * @param pvUser User data.
1333 * @thread Any thread.
1334 */
1335 DECLR3CALLBACKMEMBER(int, pfnStartRead,(PPDMIMEDIAASYNC pInterface, uint64_t off, PPDMIDATATRANSPORTSEG pSeg, unsigned cSeg, size_t cbRead, void *pvUser));
1336
1337 /**
1338 * Start writing task.
1339 *
1340 * @returns VBox status code.
1341 * @param pInterface Pointer to the interface structure containing the called function pointer.
1342 * @param off Offset to start writing at.
1343 * @param pSeg Pointer to the first element in the gather list.
1344 * @param cSeg Number of entries in the list.
1345 * @param cbWrite Number of bytes to write.
1346 * @param pvUser User data.
1347 * @thread Any thread.
1348 */
1349 DECLR3CALLBACKMEMBER(int, pfnStartWrite,(PPDMIMEDIAASYNC pInterface, uint64_t off, PPDMIDATATRANSPORTSEG pSeg, unsigned cSeg, size_t cbWrite, void *pvUser));
1350
1351} PDMIMEDIAASYNC;
1352
1353
1354/** Pointer to a async media notify interface. */
1355typedef struct PDMITRANSPORTASYNCPORT *PPDMITRANSPORTASYNCPORT;
1356/**
1357 * Notification interface for completed I/O tasks.
1358 * Pair with PDMITRANSPORTASYNC.
1359 */
1360typedef struct PDMITRANSPORTASYNCPORT
1361{
1362 /**
1363 * Notify completion of a read task.
1364 *
1365 * @returns VBox status code.
1366 * @param pInterface Pointer to the interface structure containing the called function pointer.
1367 * @param off Offset the task read from.
1368 * @param pSeg Pointer to the first element in the scatter list.
1369 * @param cSeg Number of entries in the list.
1370 * @param cbRead Number of bytes read.
1371 * @param pvUser The user argument given in pfnStartRead.
1372 * @thread Any thread.
1373 */
1374 DECLR3CALLBACKMEMBER(int, pfnReadCompleteNotify, (PPDMITRANSPORTASYNCPORT pInterface, uint64_t off, PPDMIDATATRANSPORTSEG pSeg, unsigned cSeg,
1375 size_t cbRead, void *pvUser));
1376
1377 /**
1378 * Notify completion of a write task.
1379 *
1380 * @returns VBox status code.
1381 * @param pInterface Pointer to the interface structure containing the called function pointer.
1382 * @param off Offset the task has written to.
1383 * @param pSeg Pointer to the first element in the gather list.
1384 * @param cSeg Number of entries in the list.
1385 * @param cbWritten Number of bytes actually written.
1386 * @param pvUser The user argument given in pfnStartWrite.
1387 * @thread Any thread.
1388 */
1389 DECLR3CALLBACKMEMBER(int, pfnWriteCompleteNotify, (PPDMITRANSPORTASYNCPORT pInterface, uint64_t off, PPDMIDATATRANSPORTSEG pSeg, unsigned cSeg,
1390 size_t cbWritten, void *pvUser));
1391} PDMITRANSPORTASYNCPORT;
1392
1393
1394/** Pointer to a async media interface. */
1395typedef struct PDMITRANSPORTASYNC *PPDMITRANSPORTASYNC;
1396/**
1397 * Asynchronous transport interface.
1398 * Makes up the fundation for PDMIMEDIAASYNC.
1399 */
1400typedef struct PDMITRANSPORTASYNC
1401{
1402 /**
1403 * Read bits synchronous.
1404 * Blocks until finished.
1405 *
1406 * @returns VBox status code.
1407 * @param pInterface Pointer to the interface structure containint the called function pointer.
1408 * @param off Offset to start reading from.
1409 * @param pvBuf here to store the read bits.
1410 * @param cbRead Number of bytes to read.
1411 * @param pcbRead Where to store the number of bytes actually read.
1412 * @thread Any thread.
1413 */
1414 DECLR3CALLBACKMEMBER(int, pfnReadSynchronous, (PPDMITRANSPORTASYNC pInterface, uint64_t off, void *pvBuf, size_t cbRead, size_t *pcbRead));
1415
1416 /**
1417 * Write bits synchronous.
1418 * Blocks until finished.
1419 *
1420 * @returns VBox status code.
1421 * @param pInterface Pointer to the interface structure containint the called function pointer.
1422 * @param off Offset to start reading from.
1423 * @param pvBuf here to store the read bits.
1424 * @param cbWrite Number of bytes to read.
1425 * @param pcbWritten Where to store the number of bytes actually read.
1426 * @thread Any thread.
1427 */
1428 DECLR3CALLBACKMEMBER(int, pfnWriteSynchronous, (PPDMITRANSPORTASYNC pInterface, uint64_t off, void *pvBuf, size_t cbWrite, size_t *pcbWritten));
1429
1430 /**
1431 * Start asynchronous read.
1432 *
1433 * @returns VBox status code.
1434 * @param pInterface Pointer to the interface structure containing the called function pointer.
1435 * @param off Offset to start reading from.
1436 * @param pSeg Pointer to the first element in the scatter list.
1437 * @param cSeg Number of entries in the list.
1438 * @param cbRead Number of bytes to read.
1439 * @param pvUser User argument returned in completion callback.
1440 * @thread Any thread.
1441 */
1442 DECLR3CALLBACKMEMBER(int, pfnReadStartAsynchronous,(PPDMITRANSPORTASYNC pInterface, uint64_t off, PPDMIDATATRANSPORTSEG pSeg, unsigned cSeg,
1443 size_t cbRead, void *pvUser));
1444
1445 /**
1446 * Start asynchronous write.
1447 *
1448 * @returns VBox status code.
1449 * @param pInterface Pointer to the interface structure containing the called function pointer.
1450 * @param off Offset to start writing at.
1451 * @param pSeg Pointer to the first element in the gather list.
1452 * @param cSeg Number of entries in the list.
1453 * @param cbWrite Number of bytes to write.
1454 * @param pvUser User argument returned in completion callback.
1455 * @thread Any thread.
1456 */
1457 DECLR3CALLBACKMEMBER(int, pfnWriteStartAsynchronous,(PPDMITRANSPORTASYNC pInterface, uint64_t off, PPDMIDATATRANSPORTSEG pSeg, unsigned cSeg,
1458 size_t cbWrite, void *pvUser));
1459
1460 /**
1461 * Make sure that the bits written are actually on the storage medium.
1462 * This is a synchronous task
1463 *
1464 * @returns VBox status code.
1465 * @param pInterface Pointer to the interface structure containing the called function pointer.
1466 * @thread Any thread.
1467 */
1468 DECLR3CALLBACKMEMBER(int, pfnFlushSynchronous,(PPDMITRANSPORTASYNC pInterface));
1469
1470 /**
1471 * Get the media size in bytes.
1472 *
1473 * @returns Media size in bytes.
1474 * @param pInterface Pointer to the interface structure containing the called function pointer.
1475 * @thread Any thread.
1476 */
1477 DECLR3CALLBACKMEMBER(uint64_t, pfnGetSize,(PPDMITRANSPORTASYNC pInterface));
1478
1479 /**
1480 * Check if the media is readonly or not.
1481 *
1482 * @returns true if readonly.
1483 * @returns false if read/write.
1484 * @param pInterface Pointer to the interface structure containing the called function pointer.
1485 * @thread Any thread.
1486 */
1487 DECLR3CALLBACKMEMBER(bool, pfnIsReadOnly,(PPDMITRANSPORTASYNC pInterface));
1488
1489 /**
1490 * Opens the data source.
1491 *
1492 * @returns VBox status code.
1493 * @param pInterface Pointer to the interface structure containing the called function pointer.
1494 * @param pszPath The path to open.
1495 * @param fReadonly If the target shoudl opened readonly.
1496 * @thread Any thread.
1497 */
1498 DECLR3CALLBACKMEMBER(int, pfnOpen, (PPDMITRANSPORTASYNC pInterface, const char *pszTargetPath, bool fReadonly));
1499
1500 /**
1501 * Close the data source.
1502 *
1503 * @returns VBox status code.
1504 * @param pInterface Pointer to the interface structure containing the called function pointer.
1505 * @thread Any thread.
1506 */
1507 DECLR3CALLBACKMEMBER(int, pfnClose, (PPDMITRANSPORTASYNC pInterface));
1508
1509} PDMITRANSPORTASYNC;
1510
1511
1512/** @name Bit mask definitions for status line type
1513 * @{ */
1514#define PDM_ICHAR_STATUS_LINES_DCD RT_BIT(0)
1515#define PDM_ICHAR_STATUS_LINES_RI RT_BIT(1)
1516#define PDM_ICHAR_STATUS_LINES_DSR RT_BIT(2)
1517#define PDM_ICHAR_STATUS_LINES_CTS RT_BIT(3)
1518/** @} */
1519
1520/** Pointer to a char port interface. */
1521typedef struct PDMICHARPORT *PPDMICHARPORT;
1522/**
1523 * Char port interface.
1524 * Pair with PDMICHAR.
1525 */
1526typedef struct PDMICHARPORT
1527{
1528 /**
1529 * Deliver data read to the device/driver.
1530 *
1531 * @returns VBox status code.
1532 * @param pInterface Pointer to the interface structure containing the called function pointer.
1533 * @param pvBuf Where the read bits are stored.
1534 * @param pcbRead Number of bytes available for reading/having been read.
1535 * @thread Any thread.
1536 */
1537 DECLR3CALLBACKMEMBER(int, pfnNotifyRead,(PPDMICHARPORT pInterface, const void *pvBuf, size_t *pcbRead));
1538
1539 /**
1540 * Notify the device/driver when the status lines changed.
1541 *
1542 * @returns VBox status code.
1543 * @param pInterface Pointer to the interface structure containing the called function pointer.
1544 * @param fNewStatusLine New state of the status line pins.
1545 * @thread Any thread.
1546 */
1547 DECLR3CALLBACKMEMBER(int, pfnNotifyStatusLinesChanged,(PPDMICHARPORT pInterface, uint32_t fNewStatusLines));
1548} PDMICHARPORT;
1549
1550
1551/** Pointer to a char interface. */
1552typedef struct PDMICHAR *PPDMICHAR;
1553/**
1554 * Char interface.
1555 * Pair with PDMICHARPORT.
1556 */
1557typedef struct PDMICHAR
1558{
1559 /**
1560 * Write bits.
1561 *
1562 * @returns VBox status code.
1563 * @param pInterface Pointer to the interface structure containing the called function pointer.
1564 * @param pvBuf Where to store the write bits.
1565 * @param cbWrite Number of bytes to write.
1566 * @thread Any thread.
1567 */
1568 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMICHAR pInterface, const void *pvBuf, size_t cbWrite));
1569
1570 /**
1571 * Set device parameters.
1572 *
1573 * @returns VBox status code.
1574 * @param pInterface Pointer to the interface structure containing the called function pointer.
1575 * @param Bps Speed of the serial connection. (bits per second)
1576 * @param chParity Parity method: 'E' - even, 'O' - odd, 'N' - none.
1577 * @param cDataBits Number of data bits.
1578 * @param cStopBits Number of stop bits.
1579 * @thread Any thread.
1580 */
1581 DECLR3CALLBACKMEMBER(int, pfnSetParameters,(PPDMICHAR pInterface, unsigned Bps, char chParity, unsigned cDataBits, unsigned cStopBits));
1582
1583 /**
1584 * Set the state of the modem lines.
1585 *
1586 * @returns VBox status code.
1587 * @param pInterface Pointer to the interface structure containing the called function pointer.
1588 * @param fRequestToSend Set to true to make the Request to Send line active otherwise to 0.
1589 * @param fDataTerminalReady Set to true to make the Data Terminal Ready line active otherwise 0.
1590 * @thread Any thread.
1591 */
1592 DECLR3CALLBACKMEMBER(int, pfnSetModemLines,(PPDMICHAR pInterface, bool fRequestToSend, bool fDataTerminalReady));
1593
1594} PDMICHAR;
1595
1596
1597/** Pointer to a stream interface. */
1598typedef struct PDMISTREAM *PPDMISTREAM;
1599/**
1600 * Stream interface.
1601 * Makes up the foundation for PDMICHAR.
1602 */
1603typedef struct PDMISTREAM
1604{
1605 /**
1606 * Read bits.
1607 *
1608 * @returns VBox status code.
1609 * @param pInterface Pointer to the interface structure containing the called function pointer.
1610 * @param pvBuf Where to store the read bits.
1611 * @param cbRead Number of bytes to read/bytes actually read.
1612 * @thread Any thread.
1613 */
1614 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMISTREAM pInterface, void *pvBuf, size_t *cbRead));
1615
1616 /**
1617 * Write bits.
1618 *
1619 * @returns VBox status code.
1620 * @param pInterface Pointer to the interface structure containing the called function pointer.
1621 * @param pvBuf Where to store the write bits.
1622 * @param cbWrite Number of bytes to write/bytes actually written.
1623 * @thread Any thread.
1624 */
1625 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMISTREAM pInterface, const void *pvBuf, size_t *cbWrite));
1626} PDMISTREAM;
1627
1628
1629/** Mode of the parallel port */
1630typedef enum PDMPARALLELPORTMODE
1631{
1632 PDM_PARALLEL_PORT_MODE_COMPAT,
1633 PDM_PARALLEL_PORT_MODE_EPP,
1634 PDM_PARALLEL_PORT_MODE_ECP
1635} PDMPARALLELPORTMODE;
1636
1637/** Pointer to a host parallel port interface. */
1638typedef struct PDMIHOSTPARALLELPORT *PPDMIHOSTPARALLELPORT;
1639/**
1640 * Host parallel port interface.
1641 * Pair with PDMIHOSTPARALLELCONNECTOR.
1642 */
1643typedef struct PDMIHOSTPARALLELPORT
1644{
1645 /**
1646 * Deliver data read to the device/driver.
1647 *
1648 * @returns VBox status code.
1649 * @param pInterface Pointer to the interface structure containing the called function pointer.
1650 * @param pvBuf Where the read bits are stored.
1651 * @param pcbRead Number of bytes available for reading/having been read.
1652 * @thread Any thread.
1653 */
1654 DECLR3CALLBACKMEMBER(int, pfnNotifyRead,(PPDMIHOSTPARALLELPORT pInterface, const void *pvBuf, size_t *pcbRead));
1655
1656 /**
1657 * Notify device/driver that an interrupt has occured.
1658 *
1659 * @returns VBox status code.
1660 * @param pInterface Pointer to the interface structure containing the called function pointer.
1661 * @thread Any thread.
1662 */
1663 DECLR3CALLBACKMEMBER(int, pfnNotifyInterrupt,(PPDMIHOSTPARALLELPORT pInterface));
1664} PDMIHOSTPARALLELPORT;
1665
1666
1667
1668/** Pointer to a Host Parallel connector interface. */
1669typedef struct PDMIHOSTPARALLELCONNECTOR *PPDMIHOSTPARALLELCONNECTOR;
1670/**
1671 * Host parallel connector interface
1672 * Pair with PDMIHOSTPARALLELPORT.
1673 */
1674typedef struct PDMIHOSTPARALLELCONNECTOR
1675{
1676 /**
1677 * Write bits.
1678 *
1679 * @returns VBox status code.
1680 * @param pInterface Pointer to the interface structure containing the called function pointer.
1681 * @param pvBuf Where to store the write bits.
1682 * @param pcbWrite Number of bytes to write/bytes actually written.
1683 * @thread Any thread.
1684 */
1685 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIHOSTPARALLELCONNECTOR pInterface, const void *pvBuf, size_t *pcbWrite));
1686
1687 /**
1688 * Read bits.
1689 *
1690 * @returns VBox status code.
1691 * @param pInterface Pointer to the interface structure containing the called function pointer.
1692 * @param pvBuf Where to store the read bits.
1693 * @param pcbRead Number of bytes to read/bytes actually read.
1694 * @thread Any thread.
1695 */
1696 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIHOSTPARALLELCONNECTOR pInterface, void *pvBuf, size_t *pcbRead));
1697
1698 /**
1699 * Write control register bits.
1700 *
1701 * @returns VBox status code.
1702 * @param pInterface Pointer to the interface structure containing the called function pointer.
1703 * @param fReg The new control register value.
1704 * @thread Any thread.
1705 */
1706 DECLR3CALLBACKMEMBER(int, pfnWriteControl,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t fReg));
1707
1708 /**
1709 * Read control register bits.
1710 *
1711 * @returns VBox status code.
1712 * @param pInterface Pointer to the interface structure containing the called function pointer.
1713 * @param pfReg Where to store the control register bits.
1714 * @thread Any thread.
1715 */
1716 DECLR3CALLBACKMEMBER(int, pfnReadControl,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t *pfReg));
1717
1718 /**
1719 * Read status register bits.
1720 *
1721 * @returns VBox status code.
1722 * @param pInterface Pointer to the interface structure containing the called function pointer.
1723 * @param pfReg Where to store the status register bits.
1724 * @thread Any thread.
1725 */
1726 DECLR3CALLBACKMEMBER(int, pfnReadStatus,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t *pfReg));
1727
1728 /**
1729 * Set mode of the host parallel port.
1730 *
1731 * @returns VBox status code.
1732 * @param pInterface Pointer to the interface structure containing the called function pointer.
1733 * @param enmMode The mode of the host parallel port.
1734 * @thread Any thread.
1735 */
1736 DECLR3CALLBACKMEMBER(int, pfnSetMode,(PPDMIHOSTPARALLELCONNECTOR pInterface, PDMPARALLELPORTMODE enmMode));
1737} PDMIHOSTPARALLELCONNECTOR;
1738
1739
1740/** ACPI power source identifier */
1741typedef enum PDMACPIPOWERSOURCE
1742{
1743 PDM_ACPI_POWER_SOURCE_UNKNOWN = 0,
1744 PDM_ACPI_POWER_SOURCE_OUTLET,
1745 PDM_ACPI_POWER_SOURCE_BATTERY
1746} PDMACPIPOWERSOURCE;
1747/** Pointer to ACPI battery state. */
1748typedef PDMACPIPOWERSOURCE *PPDMACPIPOWERSOURCE;
1749
1750/** ACPI battey capacity */
1751typedef enum PDMACPIBATCAPACITY
1752{
1753 PDM_ACPI_BAT_CAPACITY_MIN = 0,
1754 PDM_ACPI_BAT_CAPACITY_MAX = 100,
1755 PDM_ACPI_BAT_CAPACITY_UNKNOWN = 255
1756} PDMACPIBATCAPACITY;
1757/** Pointer to ACPI battery capacity. */
1758typedef PDMACPIBATCAPACITY *PPDMACPIBATCAPACITY;
1759
1760/** ACPI battery state. See ACPI 3.0 spec '_BST (Battery Status)' */
1761typedef enum PDMACPIBATSTATE
1762{
1763 PDM_ACPI_BAT_STATE_CHARGED = 0x00,
1764 PDM_ACPI_BAT_STATE_CHARGING = 0x01,
1765 PDM_ACPI_BAT_STATE_DISCHARGING = 0x02,
1766 PDM_ACPI_BAT_STATE_CRITICAL = 0x04
1767} PDMACPIBATSTATE;
1768/** Pointer to ACPI battery state. */
1769typedef PDMACPIBATSTATE *PPDMACPIBATSTATE;
1770
1771/** Pointer to an ACPI port interface. */
1772typedef struct PDMIACPIPORT *PPDMIACPIPORT;
1773/**
1774 * ACPI port interface.
1775 */
1776typedef struct PDMIACPIPORT
1777{
1778 /**
1779 * Send an ACPI power off event.
1780 *
1781 * @returns VBox status code
1782 * @param pInterface Pointer to the interface structure containing the called function pointer.
1783 */
1784 DECLR3CALLBACKMEMBER(int, pfnPowerButtonPress,(PPDMIACPIPORT pInterface));
1785
1786 /**
1787 * Send an ACPI sleep button event.
1788 *
1789 * @returns VBox status code
1790 * @param pInterface Pointer to the interface structure containing the called function pointer.
1791 */
1792 DECLR3CALLBACKMEMBER(int, pfnSleepButtonPress,(PPDMIACPIPORT pInterface));
1793
1794 /**
1795 * Check if the last power button event was handled by the guest.
1796 *
1797 * @returns VBox status code
1798 * @param pInterface Pointer to the interface structure containing the called function pointer.
1799 * @param pfHandled Is set to true if the last power button event was handled, false otherwise.
1800 */
1801 DECLR3CALLBACKMEMBER(int, pfnGetPowerButtonHandled,(PPDMIACPIPORT pInterface, bool *pfHandled));
1802} PDMIACPIPORT;
1803
1804/** Pointer to an ACPI connector interface. */
1805typedef struct PDMIACPICONNECTOR *PPDMIACPICONNECTOR;
1806/**
1807 * ACPI connector interface.
1808 */
1809typedef struct PDMIACPICONNECTOR
1810{
1811 /**
1812 * Get the current power source of the host system.
1813 *
1814 * @returns VBox status code
1815 * @param pInterface Pointer to the interface structure containing the called function pointer.
1816 * @param penmPowerSource Pointer to the power source result variable.
1817 */
1818 DECLR3CALLBACKMEMBER(int, pfnQueryPowerSource,(PPDMIACPICONNECTOR, PPDMACPIPOWERSOURCE penmPowerSource));
1819
1820 /**
1821 * Query the current battery status of the host system.
1822 *
1823 * @returns VBox status code?
1824 * @param pInterface Pointer to the interface structure containing the called function pointer.
1825 * @param pfPresent Is set to true if battery is present, false otherwise.
1826 * @param penmRemainingCapacity Pointer to the battery remaining capacity (0 - 100 or 255 for unknown).
1827 * @param penmBatteryState Pointer to the battery status.
1828 * @param pu32PresentRate Pointer to the present rate (0..1000 of the total capacity).
1829 */
1830 DECLR3CALLBACKMEMBER(int, pfnQueryBatteryStatus,(PPDMIACPICONNECTOR, bool *pfPresent, PPDMACPIBATCAPACITY penmRemainingCapacity,
1831 PPDMACPIBATSTATE penmBatteryState, uint32_t *pu32PresentRate));
1832} PDMIACPICONNECTOR;
1833
1834
1835/** Pointer to a VMMDevice port interface. */
1836typedef struct PDMIVMMDEVPORT *PPDMIVMMDEVPORT;
1837/**
1838 * VMMDevice port interface.
1839 */
1840typedef struct PDMIVMMDEVPORT
1841{
1842 /**
1843 * Return the current absolute mouse position in pixels
1844 *
1845 * @returns VBox status code
1846 * @param pAbsX Pointer of result value, can be NULL
1847 * @param pAbsY Pointer of result value, can be NULL
1848 */
1849 DECLR3CALLBACKMEMBER(int, pfnQueryAbsoluteMouse,(PPDMIVMMDEVPORT pInterface, uint32_t *pAbsX, uint32_t *pAbsY));
1850
1851 /**
1852 * Set the new absolute mouse position in pixels
1853 *
1854 * @returns VBox status code
1855 * @param absX New absolute X position
1856 * @param absY New absolute Y position
1857 */
1858 DECLR3CALLBACKMEMBER(int, pfnSetAbsoluteMouse,(PPDMIVMMDEVPORT pInterface, uint32_t absX, uint32_t absY));
1859
1860 /**
1861 * Return the current mouse capability flags
1862 *
1863 * @returns VBox status code
1864 * @param pCapabilities Pointer of result value
1865 */
1866 DECLR3CALLBACKMEMBER(int, pfnQueryMouseCapabilities,(PPDMIVMMDEVPORT pInterface, uint32_t *pCapabilities));
1867
1868 /**
1869 * Set the current mouse capability flag (host side)
1870 *
1871 * @returns VBox status code
1872 * @param capabilities Capability mask
1873 */
1874 DECLR3CALLBACKMEMBER(int, pfnSetMouseCapabilities,(PPDMIVMMDEVPORT pInterface, uint32_t capabilities));
1875
1876 /**
1877 * Issue a display resolution change request.
1878 *
1879 * Note that there can only one request in the queue and that in case the guest does
1880 * not process it, issuing another request will overwrite the previous.
1881 *
1882 * @returns VBox status code
1883 * @param cx Horizontal pixel resolution (0 = do not change).
1884 * @param cy Vertical pixel resolution (0 = do not change).
1885 * @param cBits Bits per pixel (0 = do not change).
1886 * @param display The display index.
1887 */
1888 DECLR3CALLBACKMEMBER(int, pfnRequestDisplayChange,(PPDMIVMMDEVPORT pInterface, uint32_t cx, uint32_t cy, uint32_t cBits, uint32_t display));
1889
1890 /**
1891 * Pass credentials to guest.
1892 *
1893 * Note that there can only be one set of credentials and the guest may or may not
1894 * query them and may do whatever it wants with them.
1895 *
1896 * @returns VBox status code
1897 * @param pszUsername User name, may be empty (UTF-8)
1898 * @param pszPassword Password, may be empty (UTF-8)
1899 * @param pszDomain Domain name, may be empty (UTF-8)
1900 * @param fFlags Bitflags
1901 */
1902 DECLR3CALLBACKMEMBER(int, pfnSetCredentials,(PPDMIVMMDEVPORT pInterface, const char *pszUsername,
1903 const char *pszPassword, const char *pszDomain,
1904 uint32_t fFlags));
1905
1906 /**
1907 * Notify the driver about a VBVA status change.
1908 *
1909 * @returns Nothing. Because it is informational callback.
1910 * @param fEnabled Current VBVA status.
1911 */
1912 DECLR3CALLBACKMEMBER(void, pfnVBVAChange, (PPDMIVMMDEVPORT pInterface, bool fEnabled));
1913
1914 /**
1915 * Issue a seamless mode change request.
1916 *
1917 * Note that there can only one request in the queue and that in case the guest does
1918 * not process it, issuing another request will overwrite the previous.
1919 *
1920 * @returns VBox status code
1921 * @param fEnabled Seamless mode enabled or not
1922 */
1923 DECLR3CALLBACKMEMBER(int, pfnRequestSeamlessChange,(PPDMIVMMDEVPORT pInterface, bool fEnabled));
1924
1925 /**
1926 * Issue a memory balloon change request.
1927 *
1928 * Note that there can only one request in the queue and that in case the guest does
1929 * not process it, issuing another request will overwrite the previous.
1930 *
1931 * @returns VBox status code
1932 * @param ulBalloonSize Balloon size in megabytes
1933 */
1934 DECLR3CALLBACKMEMBER(int, pfnSetMemoryBalloon,(PPDMIVMMDEVPORT pInterface, uint32_t ulBalloonSize));
1935
1936 /**
1937 * Issue a statistcs interval change request.
1938 *
1939 * Note that there can only one request in the queue and that in case the guest does
1940 * not process it, issuing another request will overwrite the previous.
1941 *
1942 * @returns VBox status code
1943 * @param ulStatInterval Statistics query interval in seconds (0=disable)
1944 */
1945 DECLR3CALLBACKMEMBER(int, pfnSetStatisticsInterval,(PPDMIVMMDEVPORT pInterface, uint32_t ulStatInterval));
1946
1947 /**
1948 * Notify the guest about a VRDP status change.
1949 *
1950 * @returns VBox status code
1951 * @param fVRDPEnabled Current VRDP status.
1952 * @param u32VRDPExperienceLevel Which visual effects to be disabled in the guest.
1953 */
1954 DECLR3CALLBACKMEMBER(int, pfnVRDPChange, (PPDMIVMMDEVPORT pInterface, bool fVRDPEnabled, uint32_t u32VRDPExperienceLevel));
1955
1956} PDMIVMMDEVPORT;
1957
1958/** Forward declaration of the video accelerator command memory. */
1959struct _VBVAMEMORY;
1960/** Forward declaration of the guest information structure. */
1961struct VBoxGuestInfo;
1962/** Forward declaration of the guest statistics structure */
1963struct VBoxGuestStatistics;
1964/** Pointer to video accelerator command memory. */
1965typedef struct _VBVAMEMORY *PVBVAMEMORY;
1966
1967/** Pointer to a VMMDev connector interface. */
1968typedef struct PDMIVMMDEVCONNECTOR *PPDMIVMMDEVCONNECTOR;
1969/**
1970 * VMMDev connector interface.
1971 * Pair with PDMIVMMDEVPORT.
1972 */
1973typedef struct PDMIVMMDEVCONNECTOR
1974{
1975 /**
1976 * Report guest OS version.
1977 * Called whenever the Additions issue a guest version report request.
1978 *
1979 * @param pInterface Pointer to this interface.
1980 * @param pGuestInfo Pointer to guest information structure
1981 * @thread The emulation thread.
1982 */
1983 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestVersion,(PPDMIVMMDEVCONNECTOR pInterface, struct VBoxGuestInfo *pGuestInfo));
1984
1985 /**
1986 * Update the guest additions capabilities.
1987 * This is called when the guest additions capabilities change. The new capabilities
1988 * are given and the connector should update its internal state.
1989 *
1990 * @param pInterface Pointer to this interface.
1991 * @param newCapabilities New capabilities.
1992 * @thread The emulation thread.
1993 */
1994 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestCapabilities,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities));
1995
1996 /**
1997 * Update the mouse capabilities.
1998 * This is called when the mouse capabilities change. The new capabilities
1999 * are given and the connector should update its internal state.
2000 *
2001 * @param pInterface Pointer to this interface.
2002 * @param newCapabilities New capabilities.
2003 * @thread The emulation thread.
2004 */
2005 DECLR3CALLBACKMEMBER(void, pfnUpdateMouseCapabilities,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities));
2006
2007 /**
2008 * Update the pointer shape.
2009 * This is called when the mouse pointer shape changes. The new shape
2010 * is passed as a caller allocated buffer that will be freed after returning
2011 *
2012 * @param pInterface Pointer to this interface.
2013 * @param fVisible Visibility indicator (if false, the other parameters are undefined).
2014 * @param fAlpha Flag whether alpha channel is being passed.
2015 * @param xHot Pointer hot spot x coordinate.
2016 * @param yHot Pointer hot spot y coordinate.
2017 * @param x Pointer new x coordinate on screen.
2018 * @param y Pointer new y coordinate on screen.
2019 * @param cx Pointer width in pixels.
2020 * @param cy Pointer height in pixels.
2021 * @param cbScanline Size of one scanline in bytes.
2022 * @param pvShape New shape buffer.
2023 * @thread The emulation thread.
2024 */
2025 DECLR3CALLBACKMEMBER(void, pfnUpdatePointerShape,(PPDMIVMMDEVCONNECTOR pInterface, bool fVisible, bool fAlpha,
2026 uint32_t xHot, uint32_t yHot,
2027 uint32_t cx, uint32_t cy,
2028 void *pvShape));
2029
2030 /**
2031 * Enable or disable video acceleration on behalf of guest.
2032 *
2033 * @param pInterface Pointer to this interface.
2034 * @param fEnable Whether to enable acceleration.
2035 * @param pVbvaMemory Video accelerator memory.
2036
2037 * @return VBox rc. VINF_SUCCESS if VBVA was enabled.
2038 * @thread The emulation thread.
2039 */
2040 DECLR3CALLBACKMEMBER(int, pfnVideoAccelEnable,(PPDMIVMMDEVCONNECTOR pInterface, bool fEnable, PVBVAMEMORY pVbvaMemory));
2041
2042 /**
2043 * Force video queue processing.
2044 *
2045 * @param pInterface Pointer to this interface.
2046 * @thread The emulation thread.
2047 */
2048 DECLR3CALLBACKMEMBER(void, pfnVideoAccelFlush,(PPDMIVMMDEVCONNECTOR pInterface));
2049
2050 /**
2051 * Return whether the given video mode is supported/wanted by the host.
2052 *
2053 * @returns VBox status code
2054 * @param pInterface Pointer to this interface.
2055 * @param cy Video mode horizontal resolution in pixels.
2056 * @param cx Video mode vertical resolution in pixels.
2057 * @param cBits Video mode bits per pixel.
2058 * @param pfSupported Where to put the indicator for whether this mode is supported. (output)
2059 * @thread The emulation thread.
2060 */
2061 DECLR3CALLBACKMEMBER(int, pfnVideoModeSupported,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t cx, uint32_t cy, uint32_t cBits, bool *pfSupported));
2062
2063 /**
2064 * Queries by how many pixels the height should be reduced when calculating video modes
2065 *
2066 * @returns VBox status code
2067 * @param pInterface Pointer to this interface.
2068 * @param pcyReduction Pointer to the result value.
2069 * @thread The emulation thread.
2070 */
2071 DECLR3CALLBACKMEMBER(int, pfnGetHeightReduction,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcyReduction));
2072
2073 /**
2074 * Informs about a credentials judgement result from the guest.
2075 *
2076 * @returns VBox status code
2077 * @param pInterface Pointer to this interface.
2078 * @param fFlags Judgement result flags.
2079 * @thread The emulation thread.
2080 */
2081 DECLR3CALLBACKMEMBER(int, pfnSetCredentialsJudgementResult,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t fFlags));
2082
2083 /**
2084 * Set the visible region of the display
2085 *
2086 * @returns VBox status code.
2087 * @param pInterface Pointer to this interface.
2088 * @param cRect Number of rectangles in pRect
2089 * @param pRect Rectangle array
2090 * @thread The emulation thread.
2091 */
2092 DECLR3CALLBACKMEMBER(int, pfnSetVisibleRegion,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t cRect, PRTRECT pRect));
2093
2094 /**
2095 * Query the visible region of the display
2096 *
2097 * @returns VBox status code.
2098 * @param pInterface Pointer to this interface.
2099 * @param pcRect Number of rectangles in pRect
2100 * @param pRect Rectangle array (set to NULL to query the number of rectangles)
2101 * @thread The emulation thread.
2102 */
2103 DECLR3CALLBACKMEMBER(int, pfnQueryVisibleRegion,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcRect, PRTRECT pRect));
2104
2105 /**
2106 * Request the statistics interval
2107 *
2108 * @returns VBox status code.
2109 * @param pInterface Pointer to this interface.
2110 * @param pulInterval Pointer to interval in seconds
2111 * @thread The emulation thread.
2112 */
2113 DECLR3CALLBACKMEMBER(int, pfnQueryStatisticsInterval,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pulInterval));
2114
2115 /**
2116 * Report new guest statistics
2117 *
2118 * @returns VBox status code.
2119 * @param pInterface Pointer to this interface.
2120 * @param pGuestStats Guest statistics
2121 * @thread The emulation thread.
2122 */
2123 DECLR3CALLBACKMEMBER(int, pfnReportStatistics,(PPDMIVMMDEVCONNECTOR pInterface, struct VBoxGuestStatistics *pGuestStats));
2124
2125 /**
2126 * Inflate or deflate the memory balloon
2127 *
2128 * @returns VBox status code.
2129 * @param pInterface Pointer to this interface.
2130 * @param fInflate Inflate or deflate
2131 * @param cPages Number of physical pages (must be 256 as we allocate in 1 MB chunks)
2132 * @param aPhysPage Array of physical page addresses
2133 * @thread The emulation thread.
2134 */
2135 DECLR3CALLBACKMEMBER(int, pfnChangeMemoryBalloon, (PPDMIVMMDEVCONNECTOR pInterface, bool fInflate, uint32_t cPages, RTGCPHYS *aPhysPage));
2136
2137} PDMIVMMDEVCONNECTOR;
2138
2139
2140/** Pointer to a network port interface */
2141typedef struct PDMINETWORKPORT *PPDMINETWORKPORT;
2142/**
2143 * Network port interface.
2144 */
2145typedef struct PDMINETWORKPORT
2146{
2147 /**
2148 * Wait until there is space for receiving data. We do not care how much space is available
2149 * because pfnReceive() will re-check and notify the guest if necessary.
2150 *
2151 * This function must be called before the pfnRecieve() method is called.
2152 *
2153 * @returns VBox status code. VINF_SUCCESS means there is at least one receive descriptor available.
2154 * @param pInterface Pointer to the interface structure containing the called function pointer.
2155 * @param cMillies Number of milliseconds to wait. 0 means return immediately.
2156 */
2157 DECLR3CALLBACKMEMBER(int, pfnWaitReceiveAvail,(PPDMINETWORKPORT pInterface, unsigned cMillies));
2158
2159 /**
2160 * Receive data from the network.
2161 *
2162 * @returns VBox status code.
2163 * @param pInterface Pointer to the interface structure containing the called function pointer.
2164 * @param pvBuf The available data.
2165 * @param cb Number of bytes available in the buffer.
2166 * @thread EMT
2167 */
2168 DECLR3CALLBACKMEMBER(int, pfnReceive,(PPDMINETWORKPORT pInterface, const void *pvBuf, size_t cb));
2169
2170} PDMINETWORKPORT;
2171
2172
2173/**
2174 * Network link state.
2175 */
2176typedef enum PDMNETWORKLINKSTATE
2177{
2178 /** Invalid state. */
2179 PDMNETWORKLINKSTATE_INVALID = 0,
2180 /** The link is up. */
2181 PDMNETWORKLINKSTATE_UP,
2182 /** The link is down. */
2183 PDMNETWORKLINKSTATE_DOWN,
2184 /** The link is temporarily down while resuming. */
2185 PDMNETWORKLINKSTATE_DOWN_RESUME
2186} PDMNETWORKLINKSTATE;
2187
2188
2189/** Pointer to a network connector interface */
2190typedef struct PDMINETWORKCONNECTOR *PPDMINETWORKCONNECTOR;
2191/**
2192 * Network connector interface.
2193 */
2194typedef struct PDMINETWORKCONNECTOR
2195{
2196 /**
2197 * Send data to the network.
2198 *
2199 * @returns VBox status code.
2200 * @param pInterface Pointer to the interface structure containing the called function pointer.
2201 * @param pvBuf Data to send.
2202 * @param cb Number of bytes to send.
2203 * @thread EMT
2204 */
2205 DECLR3CALLBACKMEMBER(int, pfnSend,(PPDMINETWORKCONNECTOR pInterface, const void *pvBuf, size_t cb));
2206
2207 /**
2208 * Set promiscuous mode.
2209 *
2210 * This is called when the promiscuous mode is set. This means that there doesn't have
2211 * to be a mode change when it's called.
2212 *
2213 * @param pInterface Pointer to the interface structure containing the called function pointer.
2214 * @param fPromiscuous Set if the adaptor is now in promiscuous mode. Clear if it is not.
2215 * @thread EMT
2216 */
2217 DECLR3CALLBACKMEMBER(void, pfnSetPromiscuousMode,(PPDMINETWORKCONNECTOR pInterface, bool fPromiscuous));
2218
2219 /**
2220 * Notification on link status changes.
2221 *
2222 * @param pInterface Pointer to the interface structure containing the called function pointer.
2223 * @param enmLinkState The new link state.
2224 * @thread EMT
2225 */
2226 DECLR3CALLBACKMEMBER(void, pfnNotifyLinkChanged,(PPDMINETWORKCONNECTOR pInterface, PDMNETWORKLINKSTATE enmLinkState));
2227
2228} PDMINETWORKCONNECTOR;
2229
2230
2231/** Pointer to a network config port interface */
2232typedef struct PDMINETWORKCONFIG *PPDMINETWORKCONFIG;
2233/**
2234 * Network config port interface.
2235 */
2236typedef struct PDMINETWORKCONFIG
2237{
2238 /**
2239 * Gets the current Media Access Control (MAC) address.
2240 *
2241 * @returns VBox status code.
2242 * @param pInterface Pointer to the interface structure containing the called function pointer.
2243 * @param pMac Where to store the MAC address.
2244 * @thread EMT
2245 */
2246 DECLR3CALLBACKMEMBER(int, pfnGetMac,(PPDMINETWORKCONFIG pInterface, PPDMMAC pMac));
2247
2248 /**
2249 * Gets the new link state.
2250 *
2251 * @returns The current link state.
2252 * @param pInterface Pointer to the interface structure containing the called function pointer.
2253 * @thread EMT
2254 */
2255 DECLR3CALLBACKMEMBER(PDMNETWORKLINKSTATE, pfnGetLinkState,(PPDMINETWORKCONFIG pInterface));
2256
2257 /**
2258 * Sets the new link state.
2259 *
2260 * @returns VBox status code.
2261 * @param pInterface Pointer to the interface structure containing the called function pointer.
2262 * @param enmState The new link state
2263 * @thread EMT
2264 */
2265 DECLR3CALLBACKMEMBER(int, pfnSetLinkState,(PPDMINETWORKCONFIG pInterface, PDMNETWORKLINKSTATE enmState));
2266
2267} PDMINETWORKCONFIG;
2268
2269
2270/** Pointer to a network connector interface */
2271typedef struct PDMIAUDIOCONNECTOR *PPDMIAUDIOCONNECTOR;
2272/**
2273 * Audio connector interface.
2274 */
2275typedef struct PDMIAUDIOCONNECTOR
2276{
2277 DECLR3CALLBACKMEMBER(void, pfnRun,(PPDMIAUDIOCONNECTOR pInterface));
2278
2279/* DECLR3CALLBACKMEMBER(int, pfnSetRecordSource,(PPDMIAUDIOINCONNECTOR pInterface, AUDIORECSOURCE)); */
2280
2281} PDMIAUDIOCONNECTOR;
2282
2283
2284/** @todo r=bird: the two following interfaces are hacks to work around the missing audio driver
2285 * interface. This should be addressed rather than making more temporary hacks. */
2286
2287/** Pointer to a Audio Sniffer Device port interface. */
2288typedef struct PDMIAUDIOSNIFFERPORT *PPDMIAUDIOSNIFFERPORT;
2289
2290/**
2291 * Audio Sniffer port interface.
2292 */
2293typedef struct PDMIAUDIOSNIFFERPORT
2294{
2295 /**
2296 * Enables or disables sniffing. If sniffing is being enabled also sets a flag
2297 * whether the audio must be also left on the host.
2298 *
2299 * @returns VBox status code
2300 * @param pInterface Pointer to this interface.
2301 * @param fEnable 'true' for enable sniffing, 'false' to disable.
2302 * @param fKeepHostAudio Indicates whether host audio should also present
2303 * 'true' means that sound should not be played
2304 * by the audio device.
2305 */
2306 DECLR3CALLBACKMEMBER(int, pfnSetup,(PPDMIAUDIOSNIFFERPORT pInterface, bool fEnable, bool fKeepHostAudio));
2307
2308} PDMIAUDIOSNIFFERPORT;
2309
2310/** Pointer to a Audio Sniffer connector interface. */
2311typedef struct PDMIAUDIOSNIFFERCONNECTOR *PPDMIAUDIOSNIFFERCONNECTOR;
2312
2313/**
2314 * Audio Sniffer connector interface.
2315 * Pair with PDMIAUDIOSNIFFERPORT.
2316 */
2317typedef struct PDMIAUDIOSNIFFERCONNECTOR
2318{
2319 /**
2320 * AudioSniffer device calls this method when audio samples
2321 * are about to be played and sniffing is enabled.
2322 *
2323 * @param pInterface Pointer to this interface.
2324 * @param pvSamples Audio samples buffer.
2325 * @param cSamples How many complete samples are in the buffer.
2326 * @param iSampleHz The sample frequency in Hz.
2327 * @param cChannels Number of channels. 1 for mono, 2 for stereo.
2328 * @param cBits How many bits a sample for a single channel has. Normally 8 or 16.
2329 * @param fUnsigned Whether samples are unsigned values.
2330 * @thread The emulation thread.
2331 */
2332 DECLR3CALLBACKMEMBER(void, pfnAudioSamplesOut,(PPDMIAUDIOSNIFFERCONNECTOR pInterface, void *pvSamples, uint32_t cSamples,
2333 int iSampleHz, int cChannels, int cBits, bool fUnsigned));
2334
2335 /**
2336 * AudioSniffer device calls this method when output volume is changed.
2337 *
2338 * @param pInterface Pointer to this interface.
2339 * @param u16LeftVolume 0..0xFFFF volume level for left channel.
2340 * @param u16RightVolume 0..0xFFFF volume level for right channel.
2341 * @thread The emulation thread.
2342 */
2343 DECLR3CALLBACKMEMBER(void, pfnAudioVolumeOut,(PPDMIAUDIOSNIFFERCONNECTOR pInterface, uint16_t u16LeftVolume, uint16_t u16RightVolume));
2344
2345} PDMIAUDIOSNIFFERCONNECTOR;
2346
2347
2348/**
2349 * Generic status LED core.
2350 * Note that a unit doesn't have to support all the indicators.
2351 */
2352typedef union PDMLEDCORE
2353{
2354 /** 32-bit view. */
2355 uint32_t volatile u32;
2356 /** Bit view. */
2357 struct
2358 {
2359 /** Reading/Receiving indicator. */
2360 uint32_t fReading : 1;
2361 /** Writing/Sending indicator. */
2362 uint32_t fWriting : 1;
2363 /** Busy indicator. */
2364 uint32_t fBusy : 1;
2365 /** Error indicator. */
2366 uint32_t fError : 1;
2367 } s;
2368} PDMLEDCORE;
2369
2370/** LED bit masks for the u32 view.
2371 * @{ */
2372/** Reading/Receiving indicator. */
2373#define PDMLED_READING RT_BIT(0)
2374/** Writing/Sending indicator. */
2375#define PDMLED_WRITING RT_BIT(1)
2376/** Busy indicator. */
2377#define PDMLED_BUSY RT_BIT(2)
2378/** Error indicator. */
2379#define PDMLED_ERROR RT_BIT(3)
2380/** @} */
2381
2382
2383/**
2384 * Generic status LED.
2385 * Note that a unit doesn't have to support all the indicators.
2386 */
2387typedef struct PDMLED
2388{
2389 /** Just a magic for sanity checking. */
2390 uint32_t u32Magic;
2391 uint32_t u32Alignment; /**< structure size alignment. */
2392 /** The actual LED status.
2393 * Only the device is allowed to change this. */
2394 PDMLEDCORE Actual;
2395 /** The asserted LED status which is cleared by the reader.
2396 * The device will assert the bits but never clear them.
2397 * The driver clears them as it sees fit. */
2398 PDMLEDCORE Asserted;
2399} PDMLED;
2400
2401/** Pointer to an LED. */
2402typedef PDMLED *PPDMLED;
2403/** Pointer to a const LED. */
2404typedef const PDMLED *PCPDMLED;
2405
2406#define PDMLED_MAGIC ( 0x11335577 )
2407
2408/** Pointer to an LED ports interface. */
2409typedef struct PDMILEDPORTS *PPDMILEDPORTS;
2410/**
2411 * Interface for exporting LEDs.
2412 */
2413typedef struct PDMILEDPORTS
2414{
2415 /**
2416 * Gets the pointer to the status LED of a unit.
2417 *
2418 * @returns VBox status code.
2419 * @param pInterface Pointer to the interface structure containing the called function pointer.
2420 * @param iLUN The unit which status LED we desire.
2421 * @param ppLed Where to store the LED pointer.
2422 */
2423 DECLR3CALLBACKMEMBER(int, pfnQueryStatusLed,(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed));
2424
2425} PDMILEDPORTS;
2426
2427
2428/** Pointer to an LED connectors interface. */
2429typedef struct PDMILEDCONNECTORS *PPDMILEDCONNECTORS;
2430/**
2431 * Interface for reading LEDs.
2432 */
2433typedef struct PDMILEDCONNECTORS
2434{
2435 /**
2436 * Notification about a unit which have been changed.
2437 *
2438 * The driver must discard any pointers to data owned by
2439 * the unit and requery it.
2440 *
2441 * @param pInterface Pointer to the interface structure containing the called function pointer.
2442 * @param iLUN The unit number.
2443 */
2444 DECLR3CALLBACKMEMBER(void, pfnUnitChanged,(PPDMILEDCONNECTORS pInterface, unsigned iLUN));
2445} PDMILEDCONNECTORS;
2446
2447
2448/** The special status unit number */
2449#define PDM_STATUS_LUN 999
2450
2451
2452#ifdef VBOX_HGCM
2453
2454/** Abstract HGCM command structure. Used only to define a typed pointer. */
2455struct VBOXHGCMCMD;
2456
2457/** Pointer to HGCM command structure. This pointer is unique and identifies
2458 * the command being processed. The pointer is passed to HGCM connector methods,
2459 * and must be passed back to HGCM port when command is completed.
2460 */
2461typedef struct VBOXHGCMCMD *PVBOXHGCMCMD;
2462
2463/** Pointer to a HGCM port interface. */
2464typedef struct PDMIHGCMPORT *PPDMIHGCMPORT;
2465
2466/**
2467 * HGCM port interface. Normally implemented by VMMDev.
2468 */
2469typedef struct PDMIHGCMPORT
2470{
2471 /**
2472 * Notify the guest on a command completion.
2473 *
2474 * @param pInterface Pointer to this interface.
2475 * @param rc The return code (VBox error code).
2476 * @param pCmd A pointer that identifies the completed command.
2477 *
2478 * @returns VBox status code
2479 */
2480 DECLR3CALLBACKMEMBER(void, pfnCompleted,(PPDMIHGCMPORT pInterface, int32_t rc, PVBOXHGCMCMD pCmd));
2481
2482} PDMIHGCMPORT;
2483
2484
2485/** Pointer to a HGCM connector interface. */
2486typedef struct PDMIHGCMCONNECTOR *PPDMIHGCMCONNECTOR;
2487
2488/** Pointer to a HGCM service location structure. */
2489typedef struct HGCMSERVICELOCATION *PHGCMSERVICELOCATION;
2490
2491/**
2492 * HGCM connector interface.
2493 * Pair with PDMIHGCMPORT.
2494 */
2495typedef struct PDMIHGCMCONNECTOR
2496{
2497 /**
2498 * Locate a service and inform it about a client connection.
2499 *
2500 * @param pInterface Pointer to this interface.
2501 * @param pCmd A pointer that identifies the command.
2502 * @param pServiceLocation Pointer to the service location structure.
2503 * @param pu32ClientID Where to store the client id for the connection.
2504 * @return VBox status code.
2505 * @thread The emulation thread.
2506 */
2507 DECLR3CALLBACKMEMBER(int, pfnConnect,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, PHGCMSERVICELOCATION pServiceLocation, uint32_t *pu32ClientID));
2508
2509 /**
2510 * Disconnect from service.
2511 *
2512 * @param pInterface Pointer to this interface.
2513 * @param pCmd A pointer that identifies the command.
2514 * @param u32ClientID The client id returned by the pfnConnect call.
2515 * @return VBox status code.
2516 * @thread The emulation thread.
2517 */
2518 DECLR3CALLBACKMEMBER(int, pfnDisconnect,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID));
2519
2520 /**
2521 * Process a guest issued command.
2522 *
2523 * @param pInterface Pointer to this interface.
2524 * @param pCmd A pointer that identifies the command.
2525 * @param u32ClientID The client id returned by the pfnConnect call.
2526 * @param u32Function Function to be performed by the service.
2527 * @param cParms Number of parameters in the array pointed to by paParams.
2528 * @param paParms Pointer to an array of parameters.
2529 * @return VBox status code.
2530 * @thread The emulation thread.
2531 */
2532 DECLR3CALLBACKMEMBER(int, pfnCall,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID, uint32_t u32Function,
2533 uint32_t cParms, PVBOXHGCMSVCPARM paParms));
2534
2535} PDMIHGCMCONNECTOR;
2536
2537#endif
2538
2539/** @} */
2540
2541__END_DECLS
2542
2543#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