VirtualBox

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

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

VBVA methods in PDMIDISPLAYCONNECTOR.

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