VirtualBox

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

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

Use request packets instead of the fifo implementation

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