VirtualBox

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

Last change on this file since 6156 was 6156, checked in by vboxsync, 17 years ago

implemented the ACPI sleep button

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