VirtualBox

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

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

HGSMI: post host VBVA commands to display; Video HW Accel: mechanism for passing/processing commands to framebuffer

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

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