VirtualBox

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

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

Document alignment restrictions for offset and size parameters in the interface and VBoxHDD-new API

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 99.9 KB
Line 
1/** @file
2 * PDM - Pluggable Device Manager, Interfaces.
3 */
4
5/*
6 * Copyright (C) 2006-2008 Sun Microsystems, Inc.
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 *
25 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
26 * Clara, CA 95054 USA or visit http://www.sun.com if you need
27 * additional information or have any questions.
28 */
29
30#ifndef ___VBox_pdmifs_h
31#define ___VBox_pdmifs_h
32
33#include <VBox/types.h>
34#include <VBox/hgcmsvc.h>
35
36__BEGIN_DECLS
37
38/** @defgroup grp_pdm_interfaces The PDM Interface Definitions
39 * @ingroup grp_pdm
40 * @{
41 */
42
43/**
44 * Driver interface identficators.
45 *
46 * @remark All interfaces have to be declared here. There is no such thing as
47 * private interface identifiers since they must be unique.
48 *
49 * That said, interface structures and other stuff can be put elsewhere,
50 * actually, it is best if this file is not flooded with structures that
51 * could be put closer to home.
52 */
53typedef enum PDMINTERFACE
54{
55 /** PDMIBASE - The interface everyone supports. */
56 PDMINTERFACE_BASE = 1,
57 /** PDMIMOUSEPORT - The mouse port interface. (Down) Coupled with PDMINTERFACE_MOUSE_CONNECTOR. */
58 PDMINTERFACE_MOUSE_PORT,
59 /** PDMIMOUSECONNECTOR - The mouse connector interface. (Up) Coupled with PDMINTERFACE_MOUSE_PORT. */
60 PDMINTERFACE_MOUSE_CONNECTOR,
61 /** PDMIKEYBOARDPORT - The keyboard port interface. (Down) Coupled with PDMINTERFACE_KEYBOARD_CONNECTOR. */
62 PDMINTERFACE_KEYBOARD_PORT,
63 /** PDMIKEYBOARDCONNECTOR - The keyboard connector interface. (Up) Coupled with PDMINTERFACE_KEYBOARD_PORT. */
64 PDMINTERFACE_KEYBOARD_CONNECTOR,
65 /** PDMIDISPLAYPORT - The display port interface. (Down) Coupled with PDMINTERFACE_DISPLAY_CONNECTOR. */
66 PDMINTERFACE_DISPLAY_PORT,
67 /** PDMIDISPLAYCONNECTOR - The display connector interface. (Up) Coupled with PDMINTERFACE_DISPLAY_PORT. */
68 PDMINTERFACE_DISPLAY_CONNECTOR,
69 /** PDMICHARPORT - The char notify interface. (Down) Coupled with PDMINTERFACE_CHAR. */
70 PDMINTERFACE_CHAR_PORT,
71 /** PDMICHAR - The char driver interface. (Up) Coupled with PDMINTERFACE_CHAR_PORT. */
72 PDMINTERFACE_CHAR,
73 /** PDMISTREAM - The stream driver interface (Up) No coupling.
74 * Used by a char driver to implement PDMINTERFACE_CHAR. */
75 PDMINTERFACE_STREAM,
76 /** PDMIBLOCKPORT - The block notify interface (Down) Coupled with PDMINTERFACE_BLOCK. */
77 PDMINTERFACE_BLOCK_PORT,
78 /** PDMIBLOCK - The block driver interface (Up) Coupled with PDMINTERFACE_BLOCK_PORT. */
79 PDMINTERFACE_BLOCK,
80 /** PDMIBLOCKBIOS - The block bios interface. (External) */
81 PDMINTERFACE_BLOCK_BIOS,
82 /** PDMIMOUNTNOTIFY - The mountable notification interface. (Down) Coupled with PDMINTERFACE_MOUNT. */
83 PDMINTERFACE_MOUNT_NOTIFY,
84 /** PDMIMOUNT - The mountable interface. (Up) Coupled with PDMINTERFACE_MOUNT_NOTIFY. */
85 PDMINTERFACE_MOUNT,
86 /** PDMIMEDIA - The media interface. (Up) No coupling.
87 * Used by a block unit driver to implement PDMINTERFACE_BLOCK and PDMINTERFACE_BLOCK_BIOS. */
88 PDMINTERFACE_MEDIA,
89 /** PDMIISCSITRANSPORT - The iSCSI transport interface (Up) No coupling.
90 * used by the iSCSI media driver. */
91 PDMINTERFACE_ISCSITRANSPORT,
92 /** PDMIISCSITRANSPORTASYNC - The asynchronous iSCSI interface (Up) Couple with PDMINTERFACE_ISCSITRANSPORT.
93 * extension used by the iSCSI media driver. */
94 PDMINTERFACE_ISCSITRANSPORTASYNC,
95 /** PDMIISCSITRANSPORTASYNCPORT - The asynchronous iSCSI interface (Down) Couple with PDMINTERFACE_ISCSITRANSPORTASYNC.
96 * notify port used by the iSCSI media driver. */
97 PDMINTERFACE_ISCSITRANSPORTASYNCPORT,
98 /** PDMIMEDIAASYNC - Async version of the media interface (Down) Coupled with PDMINTERFACE_MEDIA_ASYNC_PORT. */
99 PDMINTERFACE_MEDIA_ASYNC,
100 /** PDMIMEDIAASYNCPORT - Async version of the media interface (Up) Coupled with PDMINTERFACE_MEDIA_ASYNC. */
101 PDMINTERFACE_MEDIA_ASYNC_PORT,
102 /** PDMIBLOCKASYNC - Async version of the block interface (Down) Coupled with PDMINTERFACE_BLOCK_ASYNC_PORT. */
103 PDMINTERFACE_BLOCK_ASYNC,
104 /** PDMIBLOCKASYNCPORT - Async version of the block interface (Up) Coupled with PDMINTERFACE_BLOCK_ASYNC. */
105 PDMINTERFACE_BLOCK_ASYNC_PORT,
106 /** 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. The offset must be aligned to a sector boundary.
604 * @param pvBuf Where to store the read bits.
605 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary.
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. The offset must be aligned to a sector boundary.
616 * @param pvBuf Where to store the write bits.
617 * @param cbWrite Number of bytes to write. Must be aligned to a sector boundary.
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 *pabSense, size_t cbSense, 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. The offset must be aligned to a sector boundary.
819 * @param pvBuf Where to store the read bits.
820 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary.
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. The offset must be aligned to a sector boundary.
831 * @param pvBuf Where to store the write bits.
832 * @param cbWrite Number of bytes to write. Must be aligned to a sector boundary.
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.c
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. Must be aligned to a sector boundary.
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. The offset must be aligned to a sector boundary.
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. Must be aligned to a sector boundary.
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. Must be aligned to a sector boundary.
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. Must be aligned to a sector boundary.
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. Must be aligned to a sector boundary.
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. Must be aligned to a sector boundary.
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
1754 /**
1755 * Check if the guest entered the ACPI mode.
1756 *
1757 * @returns VBox status code
1758 * @param pInterface Pointer to the interface structure containing the called function pointer.
1759 * @param pfEnabled Is set to true if the guest entered the ACPI mode, false otherwise.
1760 */
1761 DECLR3CALLBACKMEMBER(int, pfnGetGuestEnteredACPIMode,(PPDMIACPIPORT pInterface, bool *pfEntered));
1762} PDMIACPIPORT;
1763
1764/** Pointer to an ACPI connector interface. */
1765typedef struct PDMIACPICONNECTOR *PPDMIACPICONNECTOR;
1766/**
1767 * ACPI connector interface.
1768 */
1769typedef struct PDMIACPICONNECTOR
1770{
1771 /**
1772 * Get the current power source 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 penmPowerSource Pointer to the power source result variable.
1777 */
1778 DECLR3CALLBACKMEMBER(int, pfnQueryPowerSource,(PPDMIACPICONNECTOR, PPDMACPIPOWERSOURCE penmPowerSource));
1779
1780 /**
1781 * Query the current battery status of the host system.
1782 *
1783 * @returns VBox status code?
1784 * @param pInterface Pointer to the interface structure containing the called function pointer.
1785 * @param pfPresent Is set to true if battery is present, false otherwise.
1786 * @param penmRemainingCapacity Pointer to the battery remaining capacity (0 - 100 or 255 for unknown).
1787 * @param penmBatteryState Pointer to the battery status.
1788 * @param pu32PresentRate Pointer to the present rate (0..1000 of the total capacity).
1789 */
1790 DECLR3CALLBACKMEMBER(int, pfnQueryBatteryStatus,(PPDMIACPICONNECTOR, bool *pfPresent, PPDMACPIBATCAPACITY penmRemainingCapacity,
1791 PPDMACPIBATSTATE penmBatteryState, uint32_t *pu32PresentRate));
1792} PDMIACPICONNECTOR;
1793
1794
1795/** Pointer to a VMMDevice port interface. */
1796typedef struct PDMIVMMDEVPORT *PPDMIVMMDEVPORT;
1797/**
1798 * VMMDevice port interface.
1799 */
1800typedef struct PDMIVMMDEVPORT
1801{
1802 /**
1803 * Return the current absolute mouse position in pixels
1804 *
1805 * @returns VBox status code
1806 * @param pAbsX Pointer of result value, can be NULL
1807 * @param pAbsY Pointer of result value, can be NULL
1808 */
1809 DECLR3CALLBACKMEMBER(int, pfnQueryAbsoluteMouse,(PPDMIVMMDEVPORT pInterface, uint32_t *pAbsX, uint32_t *pAbsY));
1810
1811 /**
1812 * Set the new absolute mouse position in pixels
1813 *
1814 * @returns VBox status code
1815 * @param absX New absolute X position
1816 * @param absY New absolute Y position
1817 */
1818 DECLR3CALLBACKMEMBER(int, pfnSetAbsoluteMouse,(PPDMIVMMDEVPORT pInterface, uint32_t absX, uint32_t absY));
1819
1820 /**
1821 * Return the current mouse capability flags
1822 *
1823 * @returns VBox status code
1824 * @param pCapabilities Pointer of result value
1825 */
1826 DECLR3CALLBACKMEMBER(int, pfnQueryMouseCapabilities,(PPDMIVMMDEVPORT pInterface, uint32_t *pCapabilities));
1827
1828 /**
1829 * Set the current mouse capability flag (host side)
1830 *
1831 * @returns VBox status code
1832 * @param capabilities Capability mask
1833 */
1834 DECLR3CALLBACKMEMBER(int, pfnSetMouseCapabilities,(PPDMIVMMDEVPORT pInterface, uint32_t capabilities));
1835
1836 /**
1837 * Issue a display resolution change request.
1838 *
1839 * Note that there can only one request in the queue and that in case the guest does
1840 * not process it, issuing another request will overwrite the previous.
1841 *
1842 * @returns VBox status code
1843 * @param cx Horizontal pixel resolution (0 = do not change).
1844 * @param cy Vertical pixel resolution (0 = do not change).
1845 * @param cBits Bits per pixel (0 = do not change).
1846 * @param display The display index.
1847 */
1848 DECLR3CALLBACKMEMBER(int, pfnRequestDisplayChange,(PPDMIVMMDEVPORT pInterface, uint32_t cx, uint32_t cy, uint32_t cBits, uint32_t display));
1849
1850 /**
1851 * Pass credentials to guest.
1852 *
1853 * Note that there can only be one set of credentials and the guest may or may not
1854 * query them and may do whatever it wants with them.
1855 *
1856 * @returns VBox status code
1857 * @param pszUsername User name, may be empty (UTF-8)
1858 * @param pszPassword Password, may be empty (UTF-8)
1859 * @param pszDomain Domain name, may be empty (UTF-8)
1860 * @param fFlags Bitflags
1861 */
1862 DECLR3CALLBACKMEMBER(int, pfnSetCredentials,(PPDMIVMMDEVPORT pInterface, const char *pszUsername,
1863 const char *pszPassword, const char *pszDomain,
1864 uint32_t fFlags));
1865
1866 /**
1867 * Notify the driver about a VBVA status change.
1868 *
1869 * @returns Nothing. Because it is informational callback.
1870 * @param fEnabled Current VBVA status.
1871 */
1872 DECLR3CALLBACKMEMBER(void, pfnVBVAChange, (PPDMIVMMDEVPORT pInterface, bool fEnabled));
1873
1874 /**
1875 * Issue a seamless mode change request.
1876 *
1877 * Note that there can only one request in the queue and that in case the guest does
1878 * not process it, issuing another request will overwrite the previous.
1879 *
1880 * @returns VBox status code
1881 * @param fEnabled Seamless mode enabled or not
1882 */
1883 DECLR3CALLBACKMEMBER(int, pfnRequestSeamlessChange,(PPDMIVMMDEVPORT pInterface, bool fEnabled));
1884
1885 /**
1886 * Issue a memory balloon change request.
1887 *
1888 * Note that there can only one request in the queue and that in case the guest does
1889 * not process it, issuing another request will overwrite the previous.
1890 *
1891 * @returns VBox status code
1892 * @param ulBalloonSize Balloon size in megabytes
1893 */
1894 DECLR3CALLBACKMEMBER(int, pfnSetMemoryBalloon,(PPDMIVMMDEVPORT pInterface, uint32_t ulBalloonSize));
1895
1896 /**
1897 * Issue a statistcs interval change request.
1898 *
1899 * Note that there can only one request in the queue and that in case the guest does
1900 * not process it, issuing another request will overwrite the previous.
1901 *
1902 * @returns VBox status code
1903 * @param ulStatInterval Statistics query interval in seconds (0=disable)
1904 */
1905 DECLR3CALLBACKMEMBER(int, pfnSetStatisticsInterval,(PPDMIVMMDEVPORT pInterface, uint32_t ulStatInterval));
1906
1907 /**
1908 * Notify the guest about a VRDP status change.
1909 *
1910 * @returns VBox status code
1911 * @param fVRDPEnabled Current VRDP status.
1912 * @param u32VRDPExperienceLevel Which visual effects to be disabled in the guest.
1913 */
1914 DECLR3CALLBACKMEMBER(int, pfnVRDPChange, (PPDMIVMMDEVPORT pInterface, bool fVRDPEnabled, uint32_t u32VRDPExperienceLevel));
1915
1916} PDMIVMMDEVPORT;
1917
1918/** Forward declaration of the video accelerator command memory. */
1919struct _VBVAMEMORY;
1920/** Forward declaration of the guest information structure. */
1921struct VBoxGuestInfo;
1922/** Forward declaration of the guest statistics structure */
1923struct VBoxGuestStatistics;
1924/** Pointer to video accelerator command memory. */
1925typedef struct _VBVAMEMORY *PVBVAMEMORY;
1926
1927/** Pointer to a VMMDev connector interface. */
1928typedef struct PDMIVMMDEVCONNECTOR *PPDMIVMMDEVCONNECTOR;
1929/**
1930 * VMMDev connector interface.
1931 * Pair with PDMIVMMDEVPORT.
1932 */
1933typedef struct PDMIVMMDEVCONNECTOR
1934{
1935 /**
1936 * Report guest OS version.
1937 * Called whenever the Additions issue a guest version report request.
1938 *
1939 * @param pInterface Pointer to this interface.
1940 * @param pGuestInfo Pointer to guest information structure
1941 * @thread The emulation thread.
1942 */
1943 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestVersion,(PPDMIVMMDEVCONNECTOR pInterface, struct VBoxGuestInfo *pGuestInfo));
1944
1945 /**
1946 * Update the guest additions capabilities.
1947 * This is called when the guest additions capabilities change. The new capabilities
1948 * are given and the connector should update its internal state.
1949 *
1950 * @param pInterface Pointer to this interface.
1951 * @param newCapabilities New capabilities.
1952 * @thread The emulation thread.
1953 */
1954 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestCapabilities,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities));
1955
1956 /**
1957 * Update the mouse capabilities.
1958 * This is called when the mouse capabilities change. The new capabilities
1959 * are given and the connector should update its internal state.
1960 *
1961 * @param pInterface Pointer to this interface.
1962 * @param newCapabilities New capabilities.
1963 * @thread The emulation thread.
1964 */
1965 DECLR3CALLBACKMEMBER(void, pfnUpdateMouseCapabilities,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities));
1966
1967 /**
1968 * Update the pointer shape.
1969 * This is called when the mouse pointer shape changes. The new shape
1970 * is passed as a caller allocated buffer that will be freed after returning
1971 *
1972 * @param pInterface Pointer to this interface.
1973 * @param fVisible Visibility indicator (if false, the other parameters are undefined).
1974 * @param fAlpha Flag whether alpha channel is being passed.
1975 * @param xHot Pointer hot spot x coordinate.
1976 * @param yHot Pointer hot spot y coordinate.
1977 * @param x Pointer new x coordinate on screen.
1978 * @param y Pointer new y coordinate on screen.
1979 * @param cx Pointer width in pixels.
1980 * @param cy Pointer height in pixels.
1981 * @param cbScanline Size of one scanline in bytes.
1982 * @param pvShape New shape buffer.
1983 * @thread The emulation thread.
1984 */
1985 DECLR3CALLBACKMEMBER(void, pfnUpdatePointerShape,(PPDMIVMMDEVCONNECTOR pInterface, bool fVisible, bool fAlpha,
1986 uint32_t xHot, uint32_t yHot,
1987 uint32_t cx, uint32_t cy,
1988 void *pvShape));
1989
1990 /**
1991 * Enable or disable video acceleration on behalf of guest.
1992 *
1993 * @param pInterface Pointer to this interface.
1994 * @param fEnable Whether to enable acceleration.
1995 * @param pVbvaMemory Video accelerator memory.
1996
1997 * @return VBox rc. VINF_SUCCESS if VBVA was enabled.
1998 * @thread The emulation thread.
1999 */
2000 DECLR3CALLBACKMEMBER(int, pfnVideoAccelEnable,(PPDMIVMMDEVCONNECTOR pInterface, bool fEnable, PVBVAMEMORY pVbvaMemory));
2001
2002 /**
2003 * Force video queue processing.
2004 *
2005 * @param pInterface Pointer to this interface.
2006 * @thread The emulation thread.
2007 */
2008 DECLR3CALLBACKMEMBER(void, pfnVideoAccelFlush,(PPDMIVMMDEVCONNECTOR pInterface));
2009
2010 /**
2011 * Return whether the given video mode is supported/wanted by the host.
2012 *
2013 * @returns VBox status code
2014 * @param pInterface Pointer to this interface.
2015 * @param cy Video mode horizontal resolution in pixels.
2016 * @param cx Video mode vertical resolution in pixels.
2017 * @param cBits Video mode bits per pixel.
2018 * @param pfSupported Where to put the indicator for whether this mode is supported. (output)
2019 * @thread The emulation thread.
2020 */
2021 DECLR3CALLBACKMEMBER(int, pfnVideoModeSupported,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t cx, uint32_t cy, uint32_t cBits, bool *pfSupported));
2022
2023 /**
2024 * Queries by how many pixels the height should be reduced when calculating video modes
2025 *
2026 * @returns VBox status code
2027 * @param pInterface Pointer to this interface.
2028 * @param pcyReduction Pointer to the result value.
2029 * @thread The emulation thread.
2030 */
2031 DECLR3CALLBACKMEMBER(int, pfnGetHeightReduction,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcyReduction));
2032
2033 /**
2034 * Informs about a credentials judgement result from the guest.
2035 *
2036 * @returns VBox status code
2037 * @param pInterface Pointer to this interface.
2038 * @param fFlags Judgement result flags.
2039 * @thread The emulation thread.
2040 */
2041 DECLR3CALLBACKMEMBER(int, pfnSetCredentialsJudgementResult,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t fFlags));
2042
2043 /**
2044 * Set the visible region of the display
2045 *
2046 * @returns VBox status code.
2047 * @param pInterface Pointer to this interface.
2048 * @param cRect Number of rectangles in pRect
2049 * @param pRect Rectangle array
2050 * @thread The emulation thread.
2051 */
2052 DECLR3CALLBACKMEMBER(int, pfnSetVisibleRegion,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t cRect, PRTRECT pRect));
2053
2054 /**
2055 * Query the visible region of the display
2056 *
2057 * @returns VBox status code.
2058 * @param pInterface Pointer to this interface.
2059 * @param pcRect Number of rectangles in pRect
2060 * @param pRect Rectangle array (set to NULL to query the number of rectangles)
2061 * @thread The emulation thread.
2062 */
2063 DECLR3CALLBACKMEMBER(int, pfnQueryVisibleRegion,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcRect, PRTRECT pRect));
2064
2065 /**
2066 * Request the statistics interval
2067 *
2068 * @returns VBox status code.
2069 * @param pInterface Pointer to this interface.
2070 * @param pulInterval Pointer to interval in seconds
2071 * @thread The emulation thread.
2072 */
2073 DECLR3CALLBACKMEMBER(int, pfnQueryStatisticsInterval,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pulInterval));
2074
2075 /**
2076 * Report new guest statistics
2077 *
2078 * @returns VBox status code.
2079 * @param pInterface Pointer to this interface.
2080 * @param pGuestStats Guest statistics
2081 * @thread The emulation thread.
2082 */
2083 DECLR3CALLBACKMEMBER(int, pfnReportStatistics,(PPDMIVMMDEVCONNECTOR pInterface, struct VBoxGuestStatistics *pGuestStats));
2084
2085 /**
2086 * Inflate or deflate the memory balloon
2087 *
2088 * @returns VBox status code.
2089 * @param pInterface Pointer to this interface.
2090 * @param fInflate Inflate or deflate
2091 * @param cPages Number of physical pages (must be 256 as we allocate in 1 MB chunks)
2092 * @param aPhysPage Array of physical page addresses
2093 * @thread The emulation thread.
2094 */
2095 DECLR3CALLBACKMEMBER(int, pfnChangeMemoryBalloon, (PPDMIVMMDEVCONNECTOR pInterface, bool fInflate, uint32_t cPages, RTGCPHYS *aPhysPage));
2096
2097} PDMIVMMDEVCONNECTOR;
2098
2099
2100/** Pointer to a network port interface */
2101typedef struct PDMINETWORKPORT *PPDMINETWORKPORT;
2102/**
2103 * Network port interface.
2104 */
2105typedef struct PDMINETWORKPORT
2106{
2107 /**
2108 * Wait until there is space for receiving data. We do not care how much space is available
2109 * because pfnReceive() will re-check and notify the guest if necessary.
2110 *
2111 * This function must be called before the pfnRecieve() method is called.
2112 *
2113 * @returns VBox status code. VINF_SUCCESS means there is at least one receive descriptor available.
2114 * @param pInterface Pointer to the interface structure containing the called function pointer.
2115 * @param cMillies Number of milliseconds to wait. 0 means return immediately.
2116 */
2117 DECLR3CALLBACKMEMBER(int, pfnWaitReceiveAvail,(PPDMINETWORKPORT pInterface, unsigned cMillies));
2118
2119 /**
2120 * Receive data from the network.
2121 *
2122 * @returns VBox status code.
2123 * @param pInterface Pointer to the interface structure containing the called function pointer.
2124 * @param pvBuf The available data.
2125 * @param cb Number of bytes available in the buffer.
2126 * @thread EMT
2127 */
2128 DECLR3CALLBACKMEMBER(int, pfnReceive,(PPDMINETWORKPORT pInterface, const void *pvBuf, size_t cb));
2129
2130} PDMINETWORKPORT;
2131
2132
2133/**
2134 * Network link state.
2135 */
2136typedef enum PDMNETWORKLINKSTATE
2137{
2138 /** Invalid state. */
2139 PDMNETWORKLINKSTATE_INVALID = 0,
2140 /** The link is up. */
2141 PDMNETWORKLINKSTATE_UP,
2142 /** The link is down. */
2143 PDMNETWORKLINKSTATE_DOWN,
2144 /** The link is temporarily down while resuming. */
2145 PDMNETWORKLINKSTATE_DOWN_RESUME
2146} PDMNETWORKLINKSTATE;
2147
2148
2149/** Pointer to a network connector interface */
2150typedef struct PDMINETWORKCONNECTOR *PPDMINETWORKCONNECTOR;
2151/**
2152 * Network connector interface.
2153 */
2154typedef struct PDMINETWORKCONNECTOR
2155{
2156 /**
2157 * Send data to the network.
2158 *
2159 * @returns VBox status code.
2160 * @param pInterface Pointer to the interface structure containing the called function pointer.
2161 * @param pvBuf Data to send.
2162 * @param cb Number of bytes to send.
2163 * @thread EMT
2164 */
2165 DECLR3CALLBACKMEMBER(int, pfnSend,(PPDMINETWORKCONNECTOR pInterface, const void *pvBuf, size_t cb));
2166
2167 /**
2168 * Set promiscuous mode.
2169 *
2170 * This is called when the promiscuous mode is set. This means that there doesn't have
2171 * to be a mode change when it's called.
2172 *
2173 * @param pInterface Pointer to the interface structure containing the called function pointer.
2174 * @param fPromiscuous Set if the adaptor is now in promiscuous mode. Clear if it is not.
2175 * @thread EMT
2176 */
2177 DECLR3CALLBACKMEMBER(void, pfnSetPromiscuousMode,(PPDMINETWORKCONNECTOR pInterface, bool fPromiscuous));
2178
2179 /**
2180 * Notification on link status changes.
2181 *
2182 * @param pInterface Pointer to the interface structure containing the called function pointer.
2183 * @param enmLinkState The new link state.
2184 * @thread EMT
2185 */
2186 DECLR3CALLBACKMEMBER(void, pfnNotifyLinkChanged,(PPDMINETWORKCONNECTOR pInterface, PDMNETWORKLINKSTATE enmLinkState));
2187
2188 /** @todo Add a callback that informs the driver chain about MAC address changes if we ever implement that. */
2189
2190} PDMINETWORKCONNECTOR;
2191
2192
2193/** Pointer to a network config port interface */
2194typedef struct PDMINETWORKCONFIG *PPDMINETWORKCONFIG;
2195/**
2196 * Network config port interface.
2197 */
2198typedef struct PDMINETWORKCONFIG
2199{
2200 /**
2201 * Gets the current Media Access Control (MAC) address.
2202 *
2203 * @returns VBox status code.
2204 * @param pInterface Pointer to the interface structure containing the called function pointer.
2205 * @param pMac Where to store the MAC address.
2206 * @thread EMT
2207 */
2208 DECLR3CALLBACKMEMBER(int, pfnGetMac,(PPDMINETWORKCONFIG pInterface, PRTMAC pMac));
2209
2210 /**
2211 * Gets the new link state.
2212 *
2213 * @returns The current link state.
2214 * @param pInterface Pointer to the interface structure containing the called function pointer.
2215 * @thread EMT
2216 */
2217 DECLR3CALLBACKMEMBER(PDMNETWORKLINKSTATE, pfnGetLinkState,(PPDMINETWORKCONFIG pInterface));
2218
2219 /**
2220 * Sets the new link state.
2221 *
2222 * @returns VBox status code.
2223 * @param pInterface Pointer to the interface structure containing the called function pointer.
2224 * @param enmState The new link state
2225 * @thread EMT
2226 */
2227 DECLR3CALLBACKMEMBER(int, pfnSetLinkState,(PPDMINETWORKCONFIG pInterface, PDMNETWORKLINKSTATE enmState));
2228
2229} PDMINETWORKCONFIG;
2230
2231
2232/** Pointer to a network connector interface */
2233typedef struct PDMIAUDIOCONNECTOR *PPDMIAUDIOCONNECTOR;
2234/**
2235 * Audio connector interface.
2236 */
2237typedef struct PDMIAUDIOCONNECTOR
2238{
2239 DECLR3CALLBACKMEMBER(void, pfnRun,(PPDMIAUDIOCONNECTOR pInterface));
2240
2241/* DECLR3CALLBACKMEMBER(int, pfnSetRecordSource,(PPDMIAUDIOINCONNECTOR pInterface, AUDIORECSOURCE)); */
2242
2243} PDMIAUDIOCONNECTOR;
2244
2245
2246/** @todo r=bird: the two following interfaces are hacks to work around the missing audio driver
2247 * interface. This should be addressed rather than making more temporary hacks. */
2248
2249/** Pointer to a Audio Sniffer Device port interface. */
2250typedef struct PDMIAUDIOSNIFFERPORT *PPDMIAUDIOSNIFFERPORT;
2251
2252/**
2253 * Audio Sniffer port interface.
2254 */
2255typedef struct PDMIAUDIOSNIFFERPORT
2256{
2257 /**
2258 * Enables or disables sniffing. If sniffing is being enabled also sets a flag
2259 * whether the audio must be also left on the host.
2260 *
2261 * @returns VBox status code
2262 * @param pInterface Pointer to this interface.
2263 * @param fEnable 'true' for enable sniffing, 'false' to disable.
2264 * @param fKeepHostAudio Indicates whether host audio should also present
2265 * 'true' means that sound should not be played
2266 * by the audio device.
2267 */
2268 DECLR3CALLBACKMEMBER(int, pfnSetup,(PPDMIAUDIOSNIFFERPORT pInterface, bool fEnable, bool fKeepHostAudio));
2269
2270} PDMIAUDIOSNIFFERPORT;
2271
2272/** Pointer to a Audio Sniffer connector interface. */
2273typedef struct PDMIAUDIOSNIFFERCONNECTOR *PPDMIAUDIOSNIFFERCONNECTOR;
2274
2275/**
2276 * Audio Sniffer connector interface.
2277 * Pair with PDMIAUDIOSNIFFERPORT.
2278 */
2279typedef struct PDMIAUDIOSNIFFERCONNECTOR
2280{
2281 /**
2282 * AudioSniffer device calls this method when audio samples
2283 * are about to be played and sniffing is enabled.
2284 *
2285 * @param pInterface Pointer to this interface.
2286 * @param pvSamples Audio samples buffer.
2287 * @param cSamples How many complete samples are in the buffer.
2288 * @param iSampleHz The sample frequency in Hz.
2289 * @param cChannels Number of channels. 1 for mono, 2 for stereo.
2290 * @param cBits How many bits a sample for a single channel has. Normally 8 or 16.
2291 * @param fUnsigned Whether samples are unsigned values.
2292 * @thread The emulation thread.
2293 */
2294 DECLR3CALLBACKMEMBER(void, pfnAudioSamplesOut,(PPDMIAUDIOSNIFFERCONNECTOR pInterface, void *pvSamples, uint32_t cSamples,
2295 int iSampleHz, int cChannels, int cBits, bool fUnsigned));
2296
2297 /**
2298 * AudioSniffer device calls this method when output volume is changed.
2299 *
2300 * @param pInterface Pointer to this interface.
2301 * @param u16LeftVolume 0..0xFFFF volume level for left channel.
2302 * @param u16RightVolume 0..0xFFFF volume level for right channel.
2303 * @thread The emulation thread.
2304 */
2305 DECLR3CALLBACKMEMBER(void, pfnAudioVolumeOut,(PPDMIAUDIOSNIFFERCONNECTOR pInterface, uint16_t u16LeftVolume, uint16_t u16RightVolume));
2306
2307} PDMIAUDIOSNIFFERCONNECTOR;
2308
2309
2310/**
2311 * Generic status LED core.
2312 * Note that a unit doesn't have to support all the indicators.
2313 */
2314typedef union PDMLEDCORE
2315{
2316 /** 32-bit view. */
2317 uint32_t volatile u32;
2318 /** Bit view. */
2319 struct
2320 {
2321 /** Reading/Receiving indicator. */
2322 uint32_t fReading : 1;
2323 /** Writing/Sending indicator. */
2324 uint32_t fWriting : 1;
2325 /** Busy indicator. */
2326 uint32_t fBusy : 1;
2327 /** Error indicator. */
2328 uint32_t fError : 1;
2329 } s;
2330} PDMLEDCORE;
2331
2332/** LED bit masks for the u32 view.
2333 * @{ */
2334/** Reading/Receiving indicator. */
2335#define PDMLED_READING RT_BIT(0)
2336/** Writing/Sending indicator. */
2337#define PDMLED_WRITING RT_BIT(1)
2338/** Busy indicator. */
2339#define PDMLED_BUSY RT_BIT(2)
2340/** Error indicator. */
2341#define PDMLED_ERROR RT_BIT(3)
2342/** @} */
2343
2344
2345/**
2346 * Generic status LED.
2347 * Note that a unit doesn't have to support all the indicators.
2348 */
2349typedef struct PDMLED
2350{
2351 /** Just a magic for sanity checking. */
2352 uint32_t u32Magic;
2353 uint32_t u32Alignment; /**< structure size alignment. */
2354 /** The actual LED status.
2355 * Only the device is allowed to change this. */
2356 PDMLEDCORE Actual;
2357 /** The asserted LED status which is cleared by the reader.
2358 * The device will assert the bits but never clear them.
2359 * The driver clears them as it sees fit. */
2360 PDMLEDCORE Asserted;
2361} PDMLED;
2362
2363/** Pointer to an LED. */
2364typedef PDMLED *PPDMLED;
2365/** Pointer to a const LED. */
2366typedef const PDMLED *PCPDMLED;
2367
2368#define PDMLED_MAGIC ( 0x11335577 )
2369
2370/** Pointer to an LED ports interface. */
2371typedef struct PDMILEDPORTS *PPDMILEDPORTS;
2372/**
2373 * Interface for exporting LEDs.
2374 */
2375typedef struct PDMILEDPORTS
2376{
2377 /**
2378 * Gets the pointer to the status LED of a unit.
2379 *
2380 * @returns VBox status code.
2381 * @param pInterface Pointer to the interface structure containing the called function pointer.
2382 * @param iLUN The unit which status LED we desire.
2383 * @param ppLed Where to store the LED pointer.
2384 */
2385 DECLR3CALLBACKMEMBER(int, pfnQueryStatusLed,(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed));
2386
2387} PDMILEDPORTS;
2388
2389
2390/** Pointer to an LED connectors interface. */
2391typedef struct PDMILEDCONNECTORS *PPDMILEDCONNECTORS;
2392/**
2393 * Interface for reading LEDs.
2394 */
2395typedef struct PDMILEDCONNECTORS
2396{
2397 /**
2398 * Notification about a unit which have been changed.
2399 *
2400 * The driver must discard any pointers to data owned by
2401 * the unit and requery it.
2402 *
2403 * @param pInterface Pointer to the interface structure containing the called function pointer.
2404 * @param iLUN The unit number.
2405 */
2406 DECLR3CALLBACKMEMBER(void, pfnUnitChanged,(PPDMILEDCONNECTORS pInterface, unsigned iLUN));
2407} PDMILEDCONNECTORS;
2408
2409
2410/** The special status unit number */
2411#define PDM_STATUS_LUN 999
2412
2413
2414#ifdef VBOX_WITH_HGCM
2415
2416/** Abstract HGCM command structure. Used only to define a typed pointer. */
2417struct VBOXHGCMCMD;
2418
2419/** Pointer to HGCM command structure. This pointer is unique and identifies
2420 * the command being processed. The pointer is passed to HGCM connector methods,
2421 * and must be passed back to HGCM port when command is completed.
2422 */
2423typedef struct VBOXHGCMCMD *PVBOXHGCMCMD;
2424
2425/** Pointer to a HGCM port interface. */
2426typedef struct PDMIHGCMPORT *PPDMIHGCMPORT;
2427
2428/**
2429 * HGCM port interface. Normally implemented by VMMDev.
2430 */
2431typedef struct PDMIHGCMPORT
2432{
2433 /**
2434 * Notify the guest on a command completion.
2435 *
2436 * @param pInterface Pointer to this interface.
2437 * @param rc The return code (VBox error code).
2438 * @param pCmd A pointer that identifies the completed command.
2439 *
2440 * @returns VBox status code
2441 */
2442 DECLR3CALLBACKMEMBER(void, pfnCompleted,(PPDMIHGCMPORT pInterface, int32_t rc, PVBOXHGCMCMD pCmd));
2443
2444} PDMIHGCMPORT;
2445
2446
2447/** Pointer to a HGCM connector interface. */
2448typedef struct PDMIHGCMCONNECTOR *PPDMIHGCMCONNECTOR;
2449
2450/** Pointer to a HGCM service location structure. */
2451typedef struct HGCMSERVICELOCATION *PHGCMSERVICELOCATION;
2452
2453/**
2454 * HGCM connector interface.
2455 * Pair with PDMIHGCMPORT.
2456 */
2457typedef struct PDMIHGCMCONNECTOR
2458{
2459 /**
2460 * Locate a service and inform it about a client connection.
2461 *
2462 * @param pInterface Pointer to this interface.
2463 * @param pCmd A pointer that identifies the command.
2464 * @param pServiceLocation Pointer to the service location structure.
2465 * @param pu32ClientID Where to store the client id for the connection.
2466 * @return VBox status code.
2467 * @thread The emulation thread.
2468 */
2469 DECLR3CALLBACKMEMBER(int, pfnConnect,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, PHGCMSERVICELOCATION pServiceLocation, uint32_t *pu32ClientID));
2470
2471 /**
2472 * Disconnect from service.
2473 *
2474 * @param pInterface Pointer to this interface.
2475 * @param pCmd A pointer that identifies the command.
2476 * @param u32ClientID The client id returned by the pfnConnect call.
2477 * @return VBox status code.
2478 * @thread The emulation thread.
2479 */
2480 DECLR3CALLBACKMEMBER(int, pfnDisconnect,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID));
2481
2482 /**
2483 * Process a guest issued command.
2484 *
2485 * @param pInterface Pointer to this interface.
2486 * @param pCmd A pointer that identifies the command.
2487 * @param u32ClientID The client id returned by the pfnConnect call.
2488 * @param u32Function Function to be performed by the service.
2489 * @param cParms Number of parameters in the array pointed to by paParams.
2490 * @param paParms Pointer to an array of parameters.
2491 * @return VBox status code.
2492 * @thread The emulation thread.
2493 */
2494 DECLR3CALLBACKMEMBER(int, pfnCall,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID, uint32_t u32Function,
2495 uint32_t cParms, PVBOXHGCMSVCPARM paParms));
2496
2497} PDMIHGCMCONNECTOR;
2498
2499#endif
2500
2501/**
2502 * Data direction.
2503 */
2504typedef enum PDMSCSIREQUESTTXDIR
2505{
2506 PDMSCSIREQUESTTXDIR_UNKNOWN = 0,
2507 PDMSCSIREQUESTTXDIR_FROM_DEVICE,
2508 PDMSCSIREQUESTTXDIR_TO_DEVICE,
2509 PDMSCSIREQUESTTXDIR_NONE
2510 /** @todo r=bird: 32-bit type size blowup? */
2511} PDMSCSIREQUESTTXDIR;
2512
2513/**
2514 * SCSI request structure.
2515 */
2516typedef struct PDMSCSIREQUEST
2517{
2518 /** The logical unit. */
2519 uint32_t uLogicalUnit;
2520 /** Direction of the data flow. */
2521 uint32_t uDataDirection; /**< @todo r=bird: why isn't this PDMSCSIREQUESTTXDIR? */
2522 /** Size of the SCSI CDB. */
2523 uint32_t cbCDB;
2524 /** Pointer to the SCSI CDB. */
2525 uint8_t *paCDB; /**< @todo r=bird: array what? pbCDB perhaps? */
2526 /** Overall size of all scatter gather list elements
2527 * for data transfer if any. */
2528 uint32_t cbScatterGather;
2529 /** Number of elements in the scatter gather list. */
2530 uint32_t cScatterGatherEntries;
2531 /** Pointer to the head of the scatter gather list. */
2532 PPDMDATASEG paScatterGatherHead;
2533 /** Size of the sense buffer. */
2534 uint32_t cbSenseBuffer;
2535 /** Pointer to the sense buffer. *
2536 * Current assumption that the sense buffer is not scattered. */
2537 uint8_t *pu8SenseBuffer; /**< @todo r=bird: pbSenseBuffer is simpler */
2538 /** Opaque user data for use by the device. Left untouched by everything else! */
2539 void *pvUser;
2540} PDMSCSIREQUEST, *PPDMSCSIREQUEST;
2541/** Pointer to a const SCSI request structure. */
2542typedef const PDMSCSIREQUEST *PCSCSIREQUEST;
2543
2544/** Pointer to a SCSI port interface. */
2545typedef struct PDMISCSIPORT *PPDMISCSIPORT;
2546
2547/**
2548 * SCSI port interface.
2549 * Pair with PDMISCSICONNECTOR.
2550 */
2551typedef struct PDMISCSIPORT
2552{
2553
2554 /**
2555 * Notify the device on request completion.
2556 *
2557 * @returns VBox status code.
2558 * @param pInterface Pointer to this interface.
2559 * @param pSCSIRequest Pointer to the finished SCSI request.
2560 */
2561 DECLR3CALLBACKMEMBER(int, pfnSCSIRequestCompleted, (PPDMISCSIPORT pInterface, PPDMSCSIREQUEST pSCSIRequest));
2562
2563} PDMISCSIPORT;
2564
2565/** Pointer to a SCSI connector interface. */
2566typedef struct PDMISCSICONNECTOR *PPDMISCSICONNECTOR;
2567
2568/**
2569 * SCSI connector interface.
2570 * Pair with PDMISCSIPORT.
2571 */
2572typedef struct PDMISCSICONNECTOR
2573{
2574
2575 /**
2576 * Submits a SCSI request for execution.
2577 *
2578 * @returns VBox status code.
2579 * @param pInterface Pointer to this interface.
2580 * @param pSCSIRequest Pointer to the SCSI request to execute.
2581 * @remark pfnSetSimultaneousRequestsMax must be called before this function can be used.
2582 */
2583 DECLR3CALLBACKMEMBER(int, pfnSCSIRequestSend, (PPDMISCSICONNECTOR pInterface, PPDMSCSIREQUEST pSCSIRequest));
2584
2585} PDMISCSICONNECTOR;
2586/** @} */
2587
2588__END_DECLS
2589
2590#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