VirtualBox

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

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

pdmifs.h: r=bird: added todos.

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