VirtualBox

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

Last change on this file since 16671 was 15475, checked in by vboxsync, 16 years ago

LsiLogic: Linux works! Implemented R0/GC parts and SSM. The LsiLogic controller is now build by default

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