VirtualBox

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

Last change on this file since 23746 was 23185, checked in by vboxsync, 15 years ago

Skip VBVA update if framebufer is being resized.

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