1 | /** @file
|
---|
2 | * PDM - Pluggable Device Manager, Common Definitions & Types. (VMM)
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2007 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_pdmcommon_h
|
---|
31 | #define ___VBox_pdmcommon_h
|
---|
32 |
|
---|
33 | #include <VBox/types.h>
|
---|
34 |
|
---|
35 | /** @defgroup grp_pdm_common Common Definitions & Types
|
---|
36 | * @ingroup grp_pdm
|
---|
37 | *
|
---|
38 | * Not all the types here are "common", they are here to work around header
|
---|
39 | * ordering issues.
|
---|
40 | *
|
---|
41 | * @{
|
---|
42 | */
|
---|
43 |
|
---|
44 | /** Makes a PDM structure version out of an unique magic value and major &
|
---|
45 | * minor version numbers.
|
---|
46 | *
|
---|
47 | * @returns 32-bit structure version number.
|
---|
48 | *
|
---|
49 | * @param uMagic 16-bit magic value. This must be unique.
|
---|
50 | * @param uMajor 12-bit major version number. Structures with different
|
---|
51 | * major numbers are not compatible.
|
---|
52 | * @param uMinor 4-bit minor version number. When only the minor version
|
---|
53 | * differs, the structures will be 100% backwards
|
---|
54 | * compatible.
|
---|
55 | */
|
---|
56 | #define PDM_VERSION_MAKE(uMagic, uMajor, uMinor) \
|
---|
57 | ( ((uint32_t)(uMagic) << 16) | ((uint32_t)((uMajor) & 0xff) << 4) | ((uint32_t)((uMinor) & 0xf) << 0) )
|
---|
58 |
|
---|
59 | /** Checks if @a uVerMagic1 is compatible with @a uVerMagic2.
|
---|
60 | *
|
---|
61 | * @returns true / false.
|
---|
62 | * @param uVerMagic1 Typically the runtime version of the struct. This must
|
---|
63 | * have the same magic and major version as @a uVerMagic2
|
---|
64 | * and the minor version must be greater or equal to that
|
---|
65 | * of @a uVerMagic2.
|
---|
66 | * @param uVerMagic2 Typically the version the code was compiled against.
|
---|
67 | *
|
---|
68 | * @remarks The parameters will be referenced more than once.
|
---|
69 | */
|
---|
70 | #define PDM_VERSION_ARE_COMPATIBLE(uVerMagic1, uVerMagic2) \
|
---|
71 | ( (uVerMagic1) == (uVerMagic2) \
|
---|
72 | || ( (uVerMagic1) >= (uVerMagic2) \
|
---|
73 | && ((uVerMagic1) & UINT32_C(0xfffffff0)) == ((uVerMagic2) & UINT32_C(0xfffffff0)) ) \
|
---|
74 | )
|
---|
75 |
|
---|
76 |
|
---|
77 | /** PDM Attach/Detach Callback Flags.
|
---|
78 | * Used by PDMDeviceAttach, PDMDeviceDetach, PDMDriverAttach, PDMDriverDetach,
|
---|
79 | * FNPDMDEVATTACH, FNPDMDEVDETACH, FNPDMDRVATTACH, FNPDMDRVDETACH and
|
---|
80 | * FNPDMDRVCONSTRUCT.
|
---|
81 | @{ */
|
---|
82 | /** The attach/detach command is not a hotplug event. */
|
---|
83 | #define PDM_TACH_FLAGS_NOT_HOT_PLUG RT_BIT_32(0)
|
---|
84 | /** Indicates that no attach or detach callbacks should be made.
|
---|
85 | * This is mostly for internal use. */
|
---|
86 | #define PDM_TACH_FLAGS_NO_CALLBACKS RT_BIT_32(1)
|
---|
87 | /* @} */
|
---|
88 |
|
---|
89 |
|
---|
90 | /**
|
---|
91 | * Is asynchronous handling of suspend or power off notification completed?
|
---|
92 | *
|
---|
93 | * This is called to check whether the USB device has quiesced. Don't deadlock.
|
---|
94 | * Avoid blocking. Do NOT wait for anything.
|
---|
95 | *
|
---|
96 | * @returns true if done, false if more work to be done.
|
---|
97 | *
|
---|
98 | * @param pUsbIns The USB device instance.
|
---|
99 | *
|
---|
100 | * @thread EMT(0)
|
---|
101 | */
|
---|
102 | typedef DECLCALLBACK(bool) FNPDMUSBASYNCNOTIFY(PPDMUSBINS pUsbIns);
|
---|
103 | /** Pointer to a FNPDMUSBASYNCNOTIFY. */
|
---|
104 | typedef FNPDMUSBASYNCNOTIFY *PFNPDMUSBASYNCNOTIFY;
|
---|
105 |
|
---|
106 | /**
|
---|
107 | * Is asynchronous handling of suspend or power off notification completed?
|
---|
108 | *
|
---|
109 | * This is called to check whether the device has quiesced. Don't deadlock.
|
---|
110 | * Avoid blocking. Do NOT wait for anything.
|
---|
111 | *
|
---|
112 | * @returns true if done, false if more work to be done.
|
---|
113 | *
|
---|
114 | * @param pDevIns The device instance.
|
---|
115 | *
|
---|
116 | * @thread EMT(0)
|
---|
117 | */
|
---|
118 | typedef DECLCALLBACK(bool) FNPDMDEVASYNCNOTIFY(PPDMDEVINS pDevIns);
|
---|
119 | /** Pointer to a FNPDMDEVASYNCNOTIFY. */
|
---|
120 | typedef FNPDMDEVASYNCNOTIFY *PFNPDMDEVASYNCNOTIFY;
|
---|
121 |
|
---|
122 | /**
|
---|
123 | * Is asynchronous handling of suspend or power off notification completed?
|
---|
124 | *
|
---|
125 | * This is called to check whether the driver has quiesced. Don't deadlock.
|
---|
126 | * Avoid blocking. Do NOT wait for anything.
|
---|
127 | *
|
---|
128 | * @returns true if done, false if more work to be done.
|
---|
129 | *
|
---|
130 | * @param pDrvIns The driver instance.
|
---|
131 | *
|
---|
132 | * @thread EMT(0)
|
---|
133 | */
|
---|
134 | typedef DECLCALLBACK(bool) FNPDMDRVASYNCNOTIFY(PPDMDRVINS pDrvIns);
|
---|
135 | /** Pointer to a FNPDMDRVASYNCNOTIFY. */
|
---|
136 | typedef FNPDMDRVASYNCNOTIFY *PFNPDMDRVASYNCNOTIFY;
|
---|
137 |
|
---|
138 | /**
|
---|
139 | * The ring-0 driver request handle.
|
---|
140 | *
|
---|
141 | * @returns VBox status code. PDMDrvHlpCallR0 will return this.
|
---|
142 | * @param pDrvIns The driver instance (the ring-0 mapping).
|
---|
143 | * @param uOperation The operation.
|
---|
144 | * @param u64Arg Optional integer argument for the operation.
|
---|
145 | */
|
---|
146 | typedef DECLCALLBACK(int) FNPDMDRVREQHANDLERR0(PPDMDRVINS pDrvIns, uint32_t uOperation, uint64_t u64Arg);
|
---|
147 | /** Ring-0 pointer to a FNPDMDRVREQHANDLERR0. */
|
---|
148 | typedef R0PTRTYPE(FNPDMDRVREQHANDLERR0 *) PFNPDMDRVREQHANDLERR0;
|
---|
149 |
|
---|
150 | /** @} */
|
---|
151 |
|
---|
152 | #endif
|
---|
153 |
|
---|