VirtualBox

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

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

PDM: upgrade mouse device to an MS IntelliMouse Explorer (five buttons and tilt wheel) - forgotten file

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 99.7 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, uint32_t x, uint32_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} PDMICHARPORT;
1449
1450
1451/** Pointer to a char interface. */
1452typedef struct PDMICHAR *PPDMICHAR;
1453/**
1454 * Char interface.
1455 * Pair with PDMICHARPORT.
1456 */
1457typedef struct PDMICHAR
1458{
1459 /**
1460 * Write bits.
1461 *
1462 * @returns VBox status code.
1463 * @param pInterface Pointer to the interface structure containing the called function pointer.
1464 * @param pvBuf Where to store the write bits.
1465 * @param cbWrite Number of bytes to write.
1466 * @thread Any thread.
1467 */
1468 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMICHAR pInterface, const void *pvBuf, size_t cbWrite));
1469
1470 /**
1471 * Set device parameters.
1472 *
1473 * @returns VBox status code.
1474 * @param pInterface Pointer to the interface structure containing the called function pointer.
1475 * @param Bps Speed of the serial connection. (bits per second)
1476 * @param chParity Parity method: 'E' - even, 'O' - odd, 'N' - none.
1477 * @param cDataBits Number of data bits.
1478 * @param cStopBits Number of stop bits.
1479 * @thread Any thread.
1480 */
1481 DECLR3CALLBACKMEMBER(int, pfnSetParameters,(PPDMICHAR pInterface, unsigned Bps, char chParity, unsigned cDataBits, unsigned cStopBits));
1482
1483 /**
1484 * Set the state of the modem lines.
1485 *
1486 * @returns VBox status code.
1487 * @param pInterface Pointer to the interface structure containing the called function pointer.
1488 * @param fRequestToSend Set to true to make the Request to Send line active otherwise to 0.
1489 * @param fDataTerminalReady Set to true to make the Data Terminal Ready line active otherwise 0.
1490 * @thread Any thread.
1491 */
1492 DECLR3CALLBACKMEMBER(int, pfnSetModemLines,(PPDMICHAR pInterface, bool fRequestToSend, bool fDataTerminalReady));
1493
1494} PDMICHAR;
1495
1496
1497/** Pointer to a stream interface. */
1498typedef struct PDMISTREAM *PPDMISTREAM;
1499/**
1500 * Stream interface.
1501 * Makes up the foundation for PDMICHAR.
1502 */
1503typedef struct PDMISTREAM
1504{
1505 /**
1506 * Read bits.
1507 *
1508 * @returns VBox status code.
1509 * @param pInterface Pointer to the interface structure containing the called function pointer.
1510 * @param pvBuf Where to store the read bits.
1511 * @param cbRead Number of bytes to read/bytes actually read.
1512 * @thread Any thread.
1513 */
1514 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMISTREAM pInterface, void *pvBuf, size_t *cbRead));
1515
1516 /**
1517 * Write bits.
1518 *
1519 * @returns VBox status code.
1520 * @param pInterface Pointer to the interface structure containing the called function pointer.
1521 * @param pvBuf Where to store the write bits.
1522 * @param cbWrite Number of bytes to write/bytes actually written.
1523 * @thread Any thread.
1524 */
1525 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMISTREAM pInterface, const void *pvBuf, size_t *cbWrite));
1526} PDMISTREAM;
1527
1528
1529/** Mode of the parallel port */
1530typedef enum PDMPARALLELPORTMODE
1531{
1532 PDM_PARALLEL_PORT_MODE_COMPAT,
1533 PDM_PARALLEL_PORT_MODE_EPP,
1534 PDM_PARALLEL_PORT_MODE_ECP
1535} PDMPARALLELPORTMODE;
1536
1537/** Pointer to a host parallel port interface. */
1538typedef struct PDMIHOSTPARALLELPORT *PPDMIHOSTPARALLELPORT;
1539/**
1540 * Host parallel port interface.
1541 * Pair with PDMIHOSTPARALLELCONNECTOR.
1542 */
1543typedef struct PDMIHOSTPARALLELPORT
1544{
1545 /**
1546 * Deliver data read to the device/driver.
1547 *
1548 * @returns VBox status code.
1549 * @param pInterface Pointer to the interface structure containing the called function pointer.
1550 * @param pvBuf Where the read bits are stored.
1551 * @param pcbRead Number of bytes available for reading/having been read.
1552 * @thread Any thread.
1553 */
1554 DECLR3CALLBACKMEMBER(int, pfnNotifyRead,(PPDMIHOSTPARALLELPORT pInterface, const void *pvBuf, size_t *pcbRead));
1555
1556 /**
1557 * Notify device/driver that an interrupt has occured.
1558 *
1559 * @returns VBox status code.
1560 * @param pInterface Pointer to the interface structure containing the called function pointer.
1561 * @thread Any thread.
1562 */
1563 DECLR3CALLBACKMEMBER(int, pfnNotifyInterrupt,(PPDMIHOSTPARALLELPORT pInterface));
1564} PDMIHOSTPARALLELPORT;
1565
1566
1567
1568/** Pointer to a Host Parallel connector interface. */
1569typedef struct PDMIHOSTPARALLELCONNECTOR *PPDMIHOSTPARALLELCONNECTOR;
1570/**
1571 * Host parallel connector interface
1572 * Pair with PDMIHOSTPARALLELPORT.
1573 */
1574typedef struct PDMIHOSTPARALLELCONNECTOR
1575{
1576 /**
1577 * Write bits.
1578 *
1579 * @returns VBox status code.
1580 * @param pInterface Pointer to the interface structure containing the called function pointer.
1581 * @param pvBuf Where to store the write bits.
1582 * @param pcbWrite Number of bytes to write/bytes actually written.
1583 * @thread Any thread.
1584 */
1585 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIHOSTPARALLELCONNECTOR pInterface, const void *pvBuf, size_t *pcbWrite));
1586
1587 /**
1588 * Read bits.
1589 *
1590 * @returns VBox status code.
1591 * @param pInterface Pointer to the interface structure containing the called function pointer.
1592 * @param pvBuf Where to store the read bits.
1593 * @param pcbRead Number of bytes to read/bytes actually read.
1594 * @thread Any thread.
1595 */
1596 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIHOSTPARALLELCONNECTOR pInterface, void *pvBuf, size_t *pcbRead));
1597
1598 /**
1599 * Write control register bits.
1600 *
1601 * @returns VBox status code.
1602 * @param pInterface Pointer to the interface structure containing the called function pointer.
1603 * @param fReg The new control register value.
1604 * @thread Any thread.
1605 */
1606 DECLR3CALLBACKMEMBER(int, pfnWriteControl,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t fReg));
1607
1608 /**
1609 * Read control register bits.
1610 *
1611 * @returns VBox status code.
1612 * @param pInterface Pointer to the interface structure containing the called function pointer.
1613 * @param pfReg Where to store the control register bits.
1614 * @thread Any thread.
1615 */
1616 DECLR3CALLBACKMEMBER(int, pfnReadControl,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t *pfReg));
1617
1618 /**
1619 * Read status register bits.
1620 *
1621 * @returns VBox status code.
1622 * @param pInterface Pointer to the interface structure containing the called function pointer.
1623 * @param pfReg Where to store the status register bits.
1624 * @thread Any thread.
1625 */
1626 DECLR3CALLBACKMEMBER(int, pfnReadStatus,(PPDMIHOSTPARALLELCONNECTOR pInterface, uint8_t *pfReg));
1627
1628 /**
1629 * Set mode of the host parallel port.
1630 *
1631 * @returns VBox status code.
1632 * @param pInterface Pointer to the interface structure containing the called function pointer.
1633 * @param enmMode The mode of the host parallel port.
1634 * @thread Any thread.
1635 */
1636 DECLR3CALLBACKMEMBER(int, pfnSetMode,(PPDMIHOSTPARALLELCONNECTOR pInterface, PDMPARALLELPORTMODE enmMode));
1637} PDMIHOSTPARALLELCONNECTOR;
1638
1639
1640/** ACPI power source identifier */
1641typedef enum PDMACPIPOWERSOURCE
1642{
1643 PDM_ACPI_POWER_SOURCE_UNKNOWN = 0,
1644 PDM_ACPI_POWER_SOURCE_OUTLET,
1645 PDM_ACPI_POWER_SOURCE_BATTERY
1646} PDMACPIPOWERSOURCE;
1647/** Pointer to ACPI battery state. */
1648typedef PDMACPIPOWERSOURCE *PPDMACPIPOWERSOURCE;
1649
1650/** ACPI battey capacity */
1651typedef enum PDMACPIBATCAPACITY
1652{
1653 PDM_ACPI_BAT_CAPACITY_MIN = 0,
1654 PDM_ACPI_BAT_CAPACITY_MAX = 100,
1655 PDM_ACPI_BAT_CAPACITY_UNKNOWN = 255
1656} PDMACPIBATCAPACITY;
1657/** Pointer to ACPI battery capacity. */
1658typedef PDMACPIBATCAPACITY *PPDMACPIBATCAPACITY;
1659
1660/** ACPI battery state. See ACPI 3.0 spec '_BST (Battery Status)' */
1661typedef enum PDMACPIBATSTATE
1662{
1663 PDM_ACPI_BAT_STATE_CHARGED = 0x00,
1664 PDM_ACPI_BAT_STATE_DISCHARGING = 0x01,
1665 PDM_ACPI_BAT_STATE_CHARGING = 0x02,
1666 PDM_ACPI_BAT_STATE_CRITICAL = 0x04
1667} PDMACPIBATSTATE;
1668/** Pointer to ACPI battery state. */
1669typedef PDMACPIBATSTATE *PPDMACPIBATSTATE;
1670
1671/** Pointer to an ACPI port interface. */
1672typedef struct PDMIACPIPORT *PPDMIACPIPORT;
1673/**
1674 * ACPI port interface.
1675 */
1676typedef struct PDMIACPIPORT
1677{
1678 /**
1679 * Send an ACPI power off event.
1680 *
1681 * @returns VBox status code
1682 * @param pInterface Pointer to the interface structure containing the called function pointer.
1683 */
1684 DECLR3CALLBACKMEMBER(int, pfnPowerButtonPress,(PPDMIACPIPORT pInterface));
1685
1686 /**
1687 * Send an ACPI sleep button event.
1688 *
1689 * @returns VBox status code
1690 * @param pInterface Pointer to the interface structure containing the called function pointer.
1691 */
1692 DECLR3CALLBACKMEMBER(int, pfnSleepButtonPress,(PPDMIACPIPORT pInterface));
1693
1694 /**
1695 * Check if the last power button event was handled by the guest.
1696 *
1697 * @returns VBox status code
1698 * @param pInterface Pointer to the interface structure containing the called function pointer.
1699 * @param pfHandled Is set to true if the last power button event was handled, false otherwise.
1700 */
1701 DECLR3CALLBACKMEMBER(int, pfnGetPowerButtonHandled,(PPDMIACPIPORT pInterface, bool *pfHandled));
1702
1703 /**
1704 * Check if the guest entered the ACPI mode.
1705 *
1706 * @returns VBox status code
1707 * @param pInterface Pointer to the interface structure containing the called function pointer.
1708 * @param pfEnabled Is set to true if the guest entered the ACPI mode, false otherwise.
1709 */
1710 DECLR3CALLBACKMEMBER(int, pfnGetGuestEnteredACPIMode,(PPDMIACPIPORT pInterface, bool *pfEntered));
1711} PDMIACPIPORT;
1712
1713/** Pointer to an ACPI connector interface. */
1714typedef struct PDMIACPICONNECTOR *PPDMIACPICONNECTOR;
1715/**
1716 * ACPI connector interface.
1717 */
1718typedef struct PDMIACPICONNECTOR
1719{
1720 /**
1721 * Get the current power source of the host system.
1722 *
1723 * @returns VBox status code
1724 * @param pInterface Pointer to the interface structure containing the called function pointer.
1725 * @param penmPowerSource Pointer to the power source result variable.
1726 */
1727 DECLR3CALLBACKMEMBER(int, pfnQueryPowerSource,(PPDMIACPICONNECTOR, PPDMACPIPOWERSOURCE penmPowerSource));
1728
1729 /**
1730 * Query the current battery status of the host system.
1731 *
1732 * @returns VBox status code?
1733 * @param pInterface Pointer to the interface structure containing the called function pointer.
1734 * @param pfPresent Is set to true if battery is present, false otherwise.
1735 * @param penmRemainingCapacity Pointer to the battery remaining capacity (0 - 100 or 255 for unknown).
1736 * @param penmBatteryState Pointer to the battery status.
1737 * @param pu32PresentRate Pointer to the present rate (0..1000 of the total capacity).
1738 */
1739 DECLR3CALLBACKMEMBER(int, pfnQueryBatteryStatus,(PPDMIACPICONNECTOR, bool *pfPresent, PPDMACPIBATCAPACITY penmRemainingCapacity,
1740 PPDMACPIBATSTATE penmBatteryState, uint32_t *pu32PresentRate));
1741} PDMIACPICONNECTOR;
1742
1743
1744/** Pointer to a VMMDevice port interface. */
1745typedef struct PDMIVMMDEVPORT *PPDMIVMMDEVPORT;
1746/**
1747 * VMMDevice port interface.
1748 */
1749typedef struct PDMIVMMDEVPORT
1750{
1751 /**
1752 * Return the current absolute mouse position in pixels
1753 *
1754 * @returns VBox status code
1755 * @param pAbsX Pointer of result value, can be NULL
1756 * @param pAbsY Pointer of result value, can be NULL
1757 */
1758 DECLR3CALLBACKMEMBER(int, pfnQueryAbsoluteMouse,(PPDMIVMMDEVPORT pInterface, uint32_t *pAbsX, uint32_t *pAbsY));
1759
1760 /**
1761 * Set the new absolute mouse position in pixels
1762 *
1763 * @returns VBox status code
1764 * @param absX New absolute X position
1765 * @param absY New absolute Y position
1766 */
1767 DECLR3CALLBACKMEMBER(int, pfnSetAbsoluteMouse,(PPDMIVMMDEVPORT pInterface, uint32_t absX, uint32_t absY));
1768
1769 /**
1770 * Return the current mouse capability flags
1771 *
1772 * @returns VBox status code
1773 * @param pCapabilities Pointer of result value
1774 */
1775 DECLR3CALLBACKMEMBER(int, pfnQueryMouseCapabilities,(PPDMIVMMDEVPORT pInterface, uint32_t *pCapabilities));
1776
1777 /**
1778 * Set the current mouse capability flag (host side)
1779 *
1780 * @returns VBox status code
1781 * @param capabilities Capability mask
1782 */
1783 DECLR3CALLBACKMEMBER(int, pfnSetMouseCapabilities,(PPDMIVMMDEVPORT pInterface, uint32_t capabilities));
1784
1785 /**
1786 * Issue a display resolution change request.
1787 *
1788 * Note that there can only one request in the queue and that in case the guest does
1789 * not process it, issuing another request will overwrite the previous.
1790 *
1791 * @returns VBox status code
1792 * @param cx Horizontal pixel resolution (0 = do not change).
1793 * @param cy Vertical pixel resolution (0 = do not change).
1794 * @param cBits Bits per pixel (0 = do not change).
1795 * @param display The display index.
1796 */
1797 DECLR3CALLBACKMEMBER(int, pfnRequestDisplayChange,(PPDMIVMMDEVPORT pInterface, uint32_t cx, uint32_t cy, uint32_t cBits, uint32_t display));
1798
1799 /**
1800 * Pass credentials to guest.
1801 *
1802 * Note that there can only be one set of credentials and the guest may or may not
1803 * query them and may do whatever it wants with them.
1804 *
1805 * @returns VBox status code.
1806 * @param pszUsername User name, may be empty (UTF-8).
1807 * @param pszPassword Password, may be empty (UTF-8).
1808 * @param pszDomain Domain name, may be empty (UTF-8).
1809 * @param fFlags VMMDEV_SETCREDENTIALS_*.
1810 */
1811 DECLR3CALLBACKMEMBER(int, pfnSetCredentials,(PPDMIVMMDEVPORT pInterface, const char *pszUsername,
1812 const char *pszPassword, const char *pszDomain,
1813 uint32_t fFlags));
1814
1815 /**
1816 * Notify the driver about a VBVA status change.
1817 *
1818 * @returns Nothing. Because it is informational callback.
1819 * @param fEnabled Current VBVA status.
1820 */
1821 DECLR3CALLBACKMEMBER(void, pfnVBVAChange, (PPDMIVMMDEVPORT pInterface, bool fEnabled));
1822
1823 /**
1824 * Issue a seamless mode change request.
1825 *
1826 * Note that there can only one request in the queue and that in case the guest does
1827 * not process it, issuing another request will overwrite the previous.
1828 *
1829 * @returns VBox status code
1830 * @param fEnabled Seamless mode enabled or not
1831 */
1832 DECLR3CALLBACKMEMBER(int, pfnRequestSeamlessChange,(PPDMIVMMDEVPORT pInterface, bool fEnabled));
1833
1834 /**
1835 * Issue a memory balloon change request.
1836 *
1837 * Note that there can only one request in the queue and that in case the guest does
1838 * not process it, issuing another request will overwrite the previous.
1839 *
1840 * @returns VBox status code
1841 * @param ulBalloonSize Balloon size in megabytes
1842 */
1843 DECLR3CALLBACKMEMBER(int, pfnSetMemoryBalloon,(PPDMIVMMDEVPORT pInterface, uint32_t ulBalloonSize));
1844
1845 /**
1846 * Issue a statistcs interval change request.
1847 *
1848 * Note that there can only one request in the queue and that in case the guest does
1849 * not process it, issuing another request will overwrite the previous.
1850 *
1851 * @returns VBox status code
1852 * @param ulStatInterval Statistics query interval in seconds (0=disable)
1853 */
1854 DECLR3CALLBACKMEMBER(int, pfnSetStatisticsInterval,(PPDMIVMMDEVPORT pInterface, uint32_t ulStatInterval));
1855
1856 /**
1857 * Notify the guest about a VRDP status change.
1858 *
1859 * @returns VBox status code
1860 * @param fVRDPEnabled Current VRDP status.
1861 * @param u32VRDPExperienceLevel Which visual effects to be disabled in the guest.
1862 */
1863 DECLR3CALLBACKMEMBER(int, pfnVRDPChange, (PPDMIVMMDEVPORT pInterface, bool fVRDPEnabled, uint32_t u32VRDPExperienceLevel));
1864
1865} PDMIVMMDEVPORT;
1866
1867/** @name Flags for PDMIVMMDEVPORT::pfnSetCredentials.
1868 * @{ */
1869/** The guest should perform a logon with the credentials. */
1870#define VMMDEV_SETCREDENTIALS_GUESTLOGON RT_BIT(0)
1871/** The guest should prevent local logons. */
1872#define VMMDEV_SETCREDENTIALS_NOLOCALLOGON RT_BIT(1)
1873/** The guest should verify the credentials. */
1874#define VMMDEV_SETCREDENTIALS_JUDGE RT_BIT(15)
1875/** @} */
1876
1877
1878/** Forward declaration of the video accelerator command memory. */
1879struct VBVAMEMORY;
1880/** Forward declaration of the guest information structure. */
1881struct VBoxGuestInfo;
1882/** Forward declaration of the guest statistics structure */
1883struct VBoxGuestStatistics;
1884/** Pointer to video accelerator command memory. */
1885typedef struct VBVAMEMORY *PVBVAMEMORY;
1886
1887/** Pointer to a VMMDev connector interface. */
1888typedef struct PDMIVMMDEVCONNECTOR *PPDMIVMMDEVCONNECTOR;
1889/**
1890 * VMMDev connector interface.
1891 * Pair with PDMIVMMDEVPORT.
1892 */
1893typedef struct PDMIVMMDEVCONNECTOR
1894{
1895 /**
1896 * Report guest OS version.
1897 * Called whenever the Additions issue a guest version report request.
1898 *
1899 * @param pInterface Pointer to this interface.
1900 * @param pGuestInfo Pointer to guest information structure
1901 * @thread The emulation thread.
1902 */
1903 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestVersion,(PPDMIVMMDEVCONNECTOR pInterface, struct VBoxGuestInfo *pGuestInfo));
1904
1905 /**
1906 * Update the guest additions capabilities.
1907 * This is called when the guest additions capabilities change. The new capabilities
1908 * are given and the connector should update its internal state.
1909 *
1910 * @param pInterface Pointer to this interface.
1911 * @param newCapabilities New capabilities.
1912 * @thread The emulation thread.
1913 */
1914 DECLR3CALLBACKMEMBER(void, pfnUpdateGuestCapabilities,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities));
1915
1916 /**
1917 * Update the mouse capabilities.
1918 * This is called when the mouse capabilities change. The new capabilities
1919 * are given and the connector should update its internal state.
1920 *
1921 * @param pInterface Pointer to this interface.
1922 * @param newCapabilities New capabilities.
1923 * @thread The emulation thread.
1924 */
1925 DECLR3CALLBACKMEMBER(void, pfnUpdateMouseCapabilities,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities));
1926
1927 /**
1928 * Update the pointer shape.
1929 * This is called when the mouse pointer shape changes. The new shape
1930 * is passed as a caller allocated buffer that will be freed after returning
1931 *
1932 * @param pInterface Pointer to this interface.
1933 * @param fVisible Visibility indicator (if false, the other parameters are undefined).
1934 * @param fAlpha Flag whether alpha channel is being passed.
1935 * @param xHot Pointer hot spot x coordinate.
1936 * @param yHot Pointer hot spot y coordinate.
1937 * @param x Pointer new x coordinate on screen.
1938 * @param y Pointer new y coordinate on screen.
1939 * @param cx Pointer width in pixels.
1940 * @param cy Pointer height in pixels.
1941 * @param cbScanline Size of one scanline in bytes.
1942 * @param pvShape New shape buffer.
1943 * @thread The emulation thread.
1944 */
1945 DECLR3CALLBACKMEMBER(void, pfnUpdatePointerShape,(PPDMIVMMDEVCONNECTOR pInterface, bool fVisible, bool fAlpha,
1946 uint32_t xHot, uint32_t yHot,
1947 uint32_t cx, uint32_t cy,
1948 void *pvShape));
1949
1950 /**
1951 * Enable or disable video acceleration on behalf of guest.
1952 *
1953 * @param pInterface Pointer to this interface.
1954 * @param fEnable Whether to enable acceleration.
1955 * @param pVbvaMemory Video accelerator memory.
1956
1957 * @return VBox rc. VINF_SUCCESS if VBVA was enabled.
1958 * @thread The emulation thread.
1959 */
1960 DECLR3CALLBACKMEMBER(int, pfnVideoAccelEnable,(PPDMIVMMDEVCONNECTOR pInterface, bool fEnable, PVBVAMEMORY pVbvaMemory));
1961
1962 /**
1963 * Force video queue processing.
1964 *
1965 * @param pInterface Pointer to this interface.
1966 * @thread The emulation thread.
1967 */
1968 DECLR3CALLBACKMEMBER(void, pfnVideoAccelFlush,(PPDMIVMMDEVCONNECTOR pInterface));
1969
1970 /**
1971 * Return whether the given video mode is supported/wanted by the host.
1972 *
1973 * @returns VBox status code
1974 * @param pInterface Pointer to this interface.
1975 * @param cy Video mode horizontal resolution in pixels.
1976 * @param cx Video mode vertical resolution in pixels.
1977 * @param cBits Video mode bits per pixel.
1978 * @param pfSupported Where to put the indicator for whether this mode is supported. (output)
1979 * @thread The emulation thread.
1980 */
1981 DECLR3CALLBACKMEMBER(int, pfnVideoModeSupported,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t cx, uint32_t cy, uint32_t cBits, bool *pfSupported));
1982
1983 /**
1984 * Queries by how many pixels the height should be reduced when calculating video modes
1985 *
1986 * @returns VBox status code
1987 * @param pInterface Pointer to this interface.
1988 * @param pcyReduction Pointer to the result value.
1989 * @thread The emulation thread.
1990 */
1991 DECLR3CALLBACKMEMBER(int, pfnGetHeightReduction,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcyReduction));
1992
1993 /**
1994 * Informs about a credentials judgement result from the guest.
1995 *
1996 * @returns VBox status code
1997 * @param pInterface Pointer to this interface.
1998 * @param fFlags Judgement result flags.
1999 * @thread The emulation thread.
2000 */
2001 DECLR3CALLBACKMEMBER(int, pfnSetCredentialsJudgementResult,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t fFlags));
2002
2003 /**
2004 * Set the visible region of the display
2005 *
2006 * @returns VBox status code.
2007 * @param pInterface Pointer to this interface.
2008 * @param cRect Number of rectangles in pRect
2009 * @param pRect Rectangle array
2010 * @thread The emulation thread.
2011 */
2012 DECLR3CALLBACKMEMBER(int, pfnSetVisibleRegion,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t cRect, PRTRECT pRect));
2013
2014 /**
2015 * Query the visible region of the display
2016 *
2017 * @returns VBox status code.
2018 * @param pInterface Pointer to this interface.
2019 * @param pcRect Number of rectangles in pRect
2020 * @param pRect Rectangle array (set to NULL to query the number of rectangles)
2021 * @thread The emulation thread.
2022 */
2023 DECLR3CALLBACKMEMBER(int, pfnQueryVisibleRegion,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcRect, PRTRECT pRect));
2024
2025 /**
2026 * Request the statistics interval
2027 *
2028 * @returns VBox status code.
2029 * @param pInterface Pointer to this interface.
2030 * @param pulInterval Pointer to interval in seconds
2031 * @thread The emulation thread.
2032 */
2033 DECLR3CALLBACKMEMBER(int, pfnQueryStatisticsInterval,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pulInterval));
2034
2035 /**
2036 * Report new guest statistics
2037 *
2038 * @returns VBox status code.
2039 * @param pInterface Pointer to this interface.
2040 * @param pGuestStats Guest statistics
2041 * @thread The emulation thread.
2042 */
2043 DECLR3CALLBACKMEMBER(int, pfnReportStatistics,(PPDMIVMMDEVCONNECTOR pInterface, struct VBoxGuestStatistics *pGuestStats));
2044
2045 /**
2046 * Inflate or deflate the memory balloon
2047 *
2048 * @returns VBox status code.
2049 * @param pInterface Pointer to this interface.
2050 * @param fInflate Inflate or deflate
2051 * @param cPages Number of physical pages (must be 256 as we allocate in 1 MB chunks)
2052 * @param aPhysPage Array of physical page addresses
2053 * @thread The emulation thread.
2054 */
2055 DECLR3CALLBACKMEMBER(int, pfnChangeMemoryBalloon, (PPDMIVMMDEVCONNECTOR pInterface, bool fInflate, uint32_t cPages, RTGCPHYS *aPhysPage));
2056
2057} PDMIVMMDEVCONNECTOR;
2058
2059
2060/** Pointer to a network port interface */
2061typedef struct PDMINETWORKPORT *PPDMINETWORKPORT;
2062/**
2063 * Network port interface.
2064 */
2065typedef struct PDMINETWORKPORT
2066{
2067 /**
2068 * Wait until there is space for receiving data. We do not care how much space is available
2069 * because pfnReceive() will re-check and notify the guest if necessary.
2070 *
2071 * This function must be called before the pfnRecieve() method is called.
2072 *
2073 * @returns VBox status code. VINF_SUCCESS means there is at least one receive descriptor available.
2074 * @param pInterface Pointer to the interface structure containing the called function pointer.
2075 * @param cMillies Number of milliseconds to wait. 0 means return immediately.
2076 */
2077 DECLR3CALLBACKMEMBER(int, pfnWaitReceiveAvail,(PPDMINETWORKPORT pInterface, unsigned cMillies));
2078
2079 /**
2080 * Receive data from the network.
2081 *
2082 * @returns VBox status code.
2083 * @param pInterface Pointer to the interface structure containing the called function pointer.
2084 * @param pvBuf The available data.
2085 * @param cb Number of bytes available in the buffer.
2086 * @thread EMT
2087 */
2088 DECLR3CALLBACKMEMBER(int, pfnReceive,(PPDMINETWORKPORT pInterface, const void *pvBuf, size_t cb));
2089
2090} PDMINETWORKPORT;
2091
2092
2093/**
2094 * Network link state.
2095 */
2096typedef enum PDMNETWORKLINKSTATE
2097{
2098 /** Invalid state. */
2099 PDMNETWORKLINKSTATE_INVALID = 0,
2100 /** The link is up. */
2101 PDMNETWORKLINKSTATE_UP,
2102 /** The link is down. */
2103 PDMNETWORKLINKSTATE_DOWN,
2104 /** The link is temporarily down while resuming. */
2105 PDMNETWORKLINKSTATE_DOWN_RESUME
2106} PDMNETWORKLINKSTATE;
2107
2108
2109/** Pointer to a network connector interface */
2110typedef struct PDMINETWORKCONNECTOR *PPDMINETWORKCONNECTOR;
2111/**
2112 * Network connector interface.
2113 */
2114typedef struct PDMINETWORKCONNECTOR
2115{
2116 /**
2117 * Send data to the network.
2118 *
2119 * @returns VBox status code.
2120 * @param pInterface Pointer to the interface structure containing the called function pointer.
2121 * @param pvBuf Data to send.
2122 * @param cb Number of bytes to send.
2123 * @thread EMT
2124 */
2125 DECLR3CALLBACKMEMBER(int, pfnSend,(PPDMINETWORKCONNECTOR pInterface, const void *pvBuf, size_t cb));
2126
2127 /**
2128 * Set promiscuous mode.
2129 *
2130 * This is called when the promiscuous mode is set. This means that there doesn't have
2131 * to be a mode change when it's called.
2132 *
2133 * @param pInterface Pointer to the interface structure containing the called function pointer.
2134 * @param fPromiscuous Set if the adaptor is now in promiscuous mode. Clear if it is not.
2135 * @thread EMT
2136 */
2137 DECLR3CALLBACKMEMBER(void, pfnSetPromiscuousMode,(PPDMINETWORKCONNECTOR pInterface, bool fPromiscuous));
2138
2139 /**
2140 * Notification on link status changes.
2141 *
2142 * @param pInterface Pointer to the interface structure containing the called function pointer.
2143 * @param enmLinkState The new link state.
2144 * @thread EMT
2145 */
2146 DECLR3CALLBACKMEMBER(void, pfnNotifyLinkChanged,(PPDMINETWORKCONNECTOR pInterface, PDMNETWORKLINKSTATE enmLinkState));
2147
2148 /** @todo Add a callback that informs the driver chain about MAC address changes if we ever implement that. */
2149
2150} PDMINETWORKCONNECTOR;
2151
2152
2153/** Pointer to a network config port interface */
2154typedef struct PDMINETWORKCONFIG *PPDMINETWORKCONFIG;
2155/**
2156 * Network config port interface.
2157 */
2158typedef struct PDMINETWORKCONFIG
2159{
2160 /**
2161 * Gets the current Media Access Control (MAC) address.
2162 *
2163 * @returns VBox status code.
2164 * @param pInterface Pointer to the interface structure containing the called function pointer.
2165 * @param pMac Where to store the MAC address.
2166 * @thread EMT
2167 */
2168 DECLR3CALLBACKMEMBER(int, pfnGetMac,(PPDMINETWORKCONFIG pInterface, PRTMAC pMac));
2169
2170 /**
2171 * Gets the new link state.
2172 *
2173 * @returns The current link state.
2174 * @param pInterface Pointer to the interface structure containing the called function pointer.
2175 * @thread EMT
2176 */
2177 DECLR3CALLBACKMEMBER(PDMNETWORKLINKSTATE, pfnGetLinkState,(PPDMINETWORKCONFIG pInterface));
2178
2179 /**
2180 * Sets the new link state.
2181 *
2182 * @returns VBox status code.
2183 * @param pInterface Pointer to the interface structure containing the called function pointer.
2184 * @param enmState The new link state
2185 * @thread EMT
2186 */
2187 DECLR3CALLBACKMEMBER(int, pfnSetLinkState,(PPDMINETWORKCONFIG pInterface, PDMNETWORKLINKSTATE enmState));
2188
2189} PDMINETWORKCONFIG;
2190
2191
2192/** Pointer to a network connector interface */
2193typedef struct PDMIAUDIOCONNECTOR *PPDMIAUDIOCONNECTOR;
2194/**
2195 * Audio connector interface.
2196 */
2197typedef struct PDMIAUDIOCONNECTOR
2198{
2199 DECLR3CALLBACKMEMBER(void, pfnRun,(PPDMIAUDIOCONNECTOR pInterface));
2200
2201/* DECLR3CALLBACKMEMBER(int, pfnSetRecordSource,(PPDMIAUDIOINCONNECTOR pInterface, AUDIORECSOURCE)); */
2202
2203} PDMIAUDIOCONNECTOR;
2204
2205
2206/** @todo r=bird: the two following interfaces are hacks to work around the missing audio driver
2207 * interface. This should be addressed rather than making more temporary hacks. */
2208
2209/** Pointer to a Audio Sniffer Device port interface. */
2210typedef struct PDMIAUDIOSNIFFERPORT *PPDMIAUDIOSNIFFERPORT;
2211
2212/**
2213 * Audio Sniffer port interface.
2214 */
2215typedef struct PDMIAUDIOSNIFFERPORT
2216{
2217 /**
2218 * Enables or disables sniffing. If sniffing is being enabled also sets a flag
2219 * whether the audio must be also left on the host.
2220 *
2221 * @returns VBox status code
2222 * @param pInterface Pointer to this interface.
2223 * @param fEnable 'true' for enable sniffing, 'false' to disable.
2224 * @param fKeepHostAudio Indicates whether host audio should also present
2225 * 'true' means that sound should not be played
2226 * by the audio device.
2227 */
2228 DECLR3CALLBACKMEMBER(int, pfnSetup,(PPDMIAUDIOSNIFFERPORT pInterface, bool fEnable, bool fKeepHostAudio));
2229
2230} PDMIAUDIOSNIFFERPORT;
2231
2232/** Pointer to a Audio Sniffer connector interface. */
2233typedef struct PDMIAUDIOSNIFFERCONNECTOR *PPDMIAUDIOSNIFFERCONNECTOR;
2234
2235/**
2236 * Audio Sniffer connector interface.
2237 * Pair with PDMIAUDIOSNIFFERPORT.
2238 */
2239typedef struct PDMIAUDIOSNIFFERCONNECTOR
2240{
2241 /**
2242 * AudioSniffer device calls this method when audio samples
2243 * are about to be played and sniffing is enabled.
2244 *
2245 * @param pInterface Pointer to this interface.
2246 * @param pvSamples Audio samples buffer.
2247 * @param cSamples How many complete samples are in the buffer.
2248 * @param iSampleHz The sample frequency in Hz.
2249 * @param cChannels Number of channels. 1 for mono, 2 for stereo.
2250 * @param cBits How many bits a sample for a single channel has. Normally 8 or 16.
2251 * @param fUnsigned Whether samples are unsigned values.
2252 * @thread The emulation thread.
2253 */
2254 DECLR3CALLBACKMEMBER(void, pfnAudioSamplesOut,(PPDMIAUDIOSNIFFERCONNECTOR pInterface, void *pvSamples, uint32_t cSamples,
2255 int iSampleHz, int cChannels, int cBits, bool fUnsigned));
2256
2257 /**
2258 * AudioSniffer device calls this method when output volume is changed.
2259 *
2260 * @param pInterface Pointer to this interface.
2261 * @param u16LeftVolume 0..0xFFFF volume level for left channel.
2262 * @param u16RightVolume 0..0xFFFF volume level for right channel.
2263 * @thread The emulation thread.
2264 */
2265 DECLR3CALLBACKMEMBER(void, pfnAudioVolumeOut,(PPDMIAUDIOSNIFFERCONNECTOR pInterface, uint16_t u16LeftVolume, uint16_t u16RightVolume));
2266
2267} PDMIAUDIOSNIFFERCONNECTOR;
2268
2269
2270/**
2271 * Generic status LED core.
2272 * Note that a unit doesn't have to support all the indicators.
2273 */
2274typedef union PDMLEDCORE
2275{
2276 /** 32-bit view. */
2277 uint32_t volatile u32;
2278 /** Bit view. */
2279 struct
2280 {
2281 /** Reading/Receiving indicator. */
2282 uint32_t fReading : 1;
2283 /** Writing/Sending indicator. */
2284 uint32_t fWriting : 1;
2285 /** Busy indicator. */
2286 uint32_t fBusy : 1;
2287 /** Error indicator. */
2288 uint32_t fError : 1;
2289 } s;
2290} PDMLEDCORE;
2291
2292/** LED bit masks for the u32 view.
2293 * @{ */
2294/** Reading/Receiving indicator. */
2295#define PDMLED_READING RT_BIT(0)
2296/** Writing/Sending indicator. */
2297#define PDMLED_WRITING RT_BIT(1)
2298/** Busy indicator. */
2299#define PDMLED_BUSY RT_BIT(2)
2300/** Error indicator. */
2301#define PDMLED_ERROR RT_BIT(3)
2302/** @} */
2303
2304
2305/**
2306 * Generic status LED.
2307 * Note that a unit doesn't have to support all the indicators.
2308 */
2309typedef struct PDMLED
2310{
2311 /** Just a magic for sanity checking. */
2312 uint32_t u32Magic;
2313 uint32_t u32Alignment; /**< structure size alignment. */
2314 /** The actual LED status.
2315 * Only the device is allowed to change this. */
2316 PDMLEDCORE Actual;
2317 /** The asserted LED status which is cleared by the reader.
2318 * The device will assert the bits but never clear them.
2319 * The driver clears them as it sees fit. */
2320 PDMLEDCORE Asserted;
2321} PDMLED;
2322
2323/** Pointer to an LED. */
2324typedef PDMLED *PPDMLED;
2325/** Pointer to a const LED. */
2326typedef const PDMLED *PCPDMLED;
2327
2328#define PDMLED_MAGIC ( 0x11335577 )
2329
2330/** Pointer to an LED ports interface. */
2331typedef struct PDMILEDPORTS *PPDMILEDPORTS;
2332/**
2333 * Interface for exporting LEDs.
2334 */
2335typedef struct PDMILEDPORTS
2336{
2337 /**
2338 * Gets the pointer to the status LED of a unit.
2339 *
2340 * @returns VBox status code.
2341 * @param pInterface Pointer to the interface structure containing the called function pointer.
2342 * @param iLUN The unit which status LED we desire.
2343 * @param ppLed Where to store the LED pointer.
2344 */
2345 DECLR3CALLBACKMEMBER(int, pfnQueryStatusLed,(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed));
2346
2347} PDMILEDPORTS;
2348
2349
2350/** Pointer to an LED connectors interface. */
2351typedef struct PDMILEDCONNECTORS *PPDMILEDCONNECTORS;
2352/**
2353 * Interface for reading LEDs.
2354 */
2355typedef struct PDMILEDCONNECTORS
2356{
2357 /**
2358 * Notification about a unit which have been changed.
2359 *
2360 * The driver must discard any pointers to data owned by
2361 * the unit and requery it.
2362 *
2363 * @param pInterface Pointer to the interface structure containing the called function pointer.
2364 * @param iLUN The unit number.
2365 */
2366 DECLR3CALLBACKMEMBER(void, pfnUnitChanged,(PPDMILEDCONNECTORS pInterface, unsigned iLUN));
2367} PDMILEDCONNECTORS;
2368
2369
2370/** The special status unit number */
2371#define PDM_STATUS_LUN 999
2372
2373
2374#ifdef VBOX_WITH_HGCM
2375
2376/** Abstract HGCM command structure. Used only to define a typed pointer. */
2377struct VBOXHGCMCMD;
2378
2379/** Pointer to HGCM command structure. This pointer is unique and identifies
2380 * the command being processed. The pointer is passed to HGCM connector methods,
2381 * and must be passed back to HGCM port when command is completed.
2382 */
2383typedef struct VBOXHGCMCMD *PVBOXHGCMCMD;
2384
2385/** Pointer to a HGCM port interface. */
2386typedef struct PDMIHGCMPORT *PPDMIHGCMPORT;
2387
2388/**
2389 * HGCM port interface. Normally implemented by VMMDev.
2390 */
2391typedef struct PDMIHGCMPORT
2392{
2393 /**
2394 * Notify the guest on a command completion.
2395 *
2396 * @param pInterface Pointer to this interface.
2397 * @param rc The return code (VBox error code).
2398 * @param pCmd A pointer that identifies the completed command.
2399 *
2400 * @returns VBox status code
2401 */
2402 DECLR3CALLBACKMEMBER(void, pfnCompleted,(PPDMIHGCMPORT pInterface, int32_t rc, PVBOXHGCMCMD pCmd));
2403
2404} PDMIHGCMPORT;
2405
2406
2407/** Pointer to a HGCM connector interface. */
2408typedef struct PDMIHGCMCONNECTOR *PPDMIHGCMCONNECTOR;
2409
2410/** Pointer to a HGCM service location structure. */
2411typedef struct HGCMSERVICELOCATION *PHGCMSERVICELOCATION;
2412
2413/**
2414 * HGCM connector interface.
2415 * Pair with PDMIHGCMPORT.
2416 */
2417typedef struct PDMIHGCMCONNECTOR
2418{
2419 /**
2420 * Locate a service and inform it about a client connection.
2421 *
2422 * @param pInterface Pointer to this interface.
2423 * @param pCmd A pointer that identifies the command.
2424 * @param pServiceLocation Pointer to the service location structure.
2425 * @param pu32ClientID Where to store the client id for the connection.
2426 * @return VBox status code.
2427 * @thread The emulation thread.
2428 */
2429 DECLR3CALLBACKMEMBER(int, pfnConnect,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, PHGCMSERVICELOCATION pServiceLocation, uint32_t *pu32ClientID));
2430
2431 /**
2432 * Disconnect from service.
2433 *
2434 * @param pInterface Pointer to this interface.
2435 * @param pCmd A pointer that identifies the command.
2436 * @param u32ClientID The client id returned by the pfnConnect call.
2437 * @return VBox status code.
2438 * @thread The emulation thread.
2439 */
2440 DECLR3CALLBACKMEMBER(int, pfnDisconnect,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID));
2441
2442 /**
2443 * Process a guest issued command.
2444 *
2445 * @param pInterface Pointer to this interface.
2446 * @param pCmd A pointer that identifies the command.
2447 * @param u32ClientID The client id returned by the pfnConnect call.
2448 * @param u32Function Function to be performed by the service.
2449 * @param cParms Number of parameters in the array pointed to by paParams.
2450 * @param paParms Pointer to an array of parameters.
2451 * @return VBox status code.
2452 * @thread The emulation thread.
2453 */
2454 DECLR3CALLBACKMEMBER(int, pfnCall,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID, uint32_t u32Function,
2455 uint32_t cParms, PVBOXHGCMSVCPARM paParms));
2456
2457} PDMIHGCMCONNECTOR;
2458
2459#endif
2460
2461/**
2462 * Data direction.
2463 */
2464typedef enum PDMSCSIREQUESTTXDIR
2465{
2466 PDMSCSIREQUESTTXDIR_UNKNOWN = 0x00,
2467 PDMSCSIREQUESTTXDIR_FROM_DEVICE = 0x01,
2468 PDMSCSIREQUESTTXDIR_TO_DEVICE = 0x02,
2469 PDMSCSIREQUESTTXDIR_NONE = 0x03,
2470 PDMSCSIREQUESTTXDIR_32BIT_HACK = 0x7fffffff
2471} PDMSCSIREQUESTTXDIR;
2472
2473/**
2474 * SCSI request structure.
2475 */
2476typedef struct PDMSCSIREQUEST
2477{
2478 /** The logical unit. */
2479 uint32_t uLogicalUnit;
2480 /** Direction of the data flow. */
2481 PDMSCSIREQUESTTXDIR uDataDirection;
2482 /** Size of the SCSI CDB. */
2483 uint32_t cbCDB;
2484 /** Pointer to the SCSI CDB. */
2485 uint8_t *pbCDB;
2486 /** Overall size of all scatter gather list elements
2487 * for data transfer if any. */
2488 uint32_t cbScatterGather;
2489 /** Number of elements in the scatter gather list. */
2490 uint32_t cScatterGatherEntries;
2491 /** Pointer to the head of the scatter gather list. */
2492 PPDMDATASEG paScatterGatherHead;
2493 /** Size of the sense buffer. */
2494 uint32_t cbSenseBuffer;
2495 /** Pointer to the sense buffer. *
2496 * Current assumption that the sense buffer is not scattered. */
2497 uint8_t *pbSenseBuffer;
2498 /** Opaque user data for use by the device. Left untouched by everything else! */
2499 void *pvUser;
2500} PDMSCSIREQUEST, *PPDMSCSIREQUEST;
2501/** Pointer to a const SCSI request structure. */
2502typedef const PDMSCSIREQUEST *PCSCSIREQUEST;
2503
2504/** Pointer to a SCSI port interface. */
2505typedef struct PDMISCSIPORT *PPDMISCSIPORT;
2506
2507/**
2508 * SCSI port interface.
2509 * Pair with PDMISCSICONNECTOR.
2510 */
2511typedef struct PDMISCSIPORT
2512{
2513
2514 /**
2515 * Notify the device on request completion.
2516 *
2517 * @returns VBox status code.
2518 * @param pInterface Pointer to this interface.
2519 * @param pSCSIRequest Pointer to the finished SCSI request.
2520 * @param rcCompletion SCSI_STATUS_* code for the completed request.
2521 */
2522 DECLR3CALLBACKMEMBER(int, pfnSCSIRequestCompleted, (PPDMISCSIPORT pInterface, PPDMSCSIREQUEST pSCSIRequest, int rcCompletion));
2523
2524} PDMISCSIPORT;
2525
2526/** Pointer to a SCSI connector interface. */
2527typedef struct PDMISCSICONNECTOR *PPDMISCSICONNECTOR;
2528
2529/**
2530 * SCSI connector interface.
2531 * Pair with PDMISCSIPORT.
2532 */
2533typedef struct PDMISCSICONNECTOR
2534{
2535
2536 /**
2537 * Submits a SCSI request for execution.
2538 *
2539 * @returns VBox status code.
2540 * @param pInterface Pointer to this interface.
2541 * @param pSCSIRequest Pointer to the SCSI request to execute.
2542 */
2543 DECLR3CALLBACKMEMBER(int, pfnSCSIRequestSend, (PPDMISCSICONNECTOR pInterface, PPDMSCSIREQUEST pSCSIRequest));
2544
2545} PDMISCSICONNECTOR;
2546
2547typedef struct PDMDDISPLAYVBVACALLBACKS *PPDMDDISPLAYVBVACALLBACKS;
2548/**
2549 * Display VBVA callbacks.
2550 */
2551typedef struct PDMDDISPLAYVBVACALLBACKS
2552{
2553
2554 /**
2555 * Informs guest about completion of processing the given Video HW Acceleration
2556 * command, does not wait for the guest to process the command.
2557 *
2558 * @returns ???
2559 * @param pInterface Pointer to this interface.
2560 * @param pCmd The Video HW Acceleration Command that was
2561 * completed.
2562 * @todo r=bird: if asynch mean asyncronous; then
2563 * s/pfnVHWACommandCompleteAsynch/pfnVHWACommandCompleteAsync/;
2564 * fi
2565 */
2566 DECLR3CALLBACKMEMBER(int, pfnVHWACommandCompleteAsynch, (PPDMDDISPLAYVBVACALLBACKS pInterface, PVBOXVHWACMD pCmd));
2567
2568} PDMDDISPLAYVBVACALLBACKS;
2569
2570/** @} */
2571
2572RT_C_DECLS_END
2573
2574#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