VirtualBox

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

Last change on this file since 22457 was 22412, checked in by vboxsync, 16 years ago

HGSMI/VBVA updates

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette