1 | /** @file
|
---|
2 | * PDM - Pluggable Device Manager, Common Definitions & Types.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2015 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef ___VBox_vmm_pdmcommon_h
|
---|
27 | #define ___VBox_vmm_pdmcommon_h
|
---|
28 |
|
---|
29 | #include <VBox/types.h>
|
---|
30 |
|
---|
31 |
|
---|
32 | /** @defgroup grp_pdm_common Common Definitions & Types
|
---|
33 | * @ingroup grp_pdm
|
---|
34 | *
|
---|
35 | * Not all the types here are "common", they are here to work around header
|
---|
36 | * ordering issues.
|
---|
37 | *
|
---|
38 | * @{
|
---|
39 | */
|
---|
40 |
|
---|
41 | /** Makes a PDM structure version out of an unique magic value and major &
|
---|
42 | * minor version numbers.
|
---|
43 | *
|
---|
44 | * @returns 32-bit structure version number.
|
---|
45 | *
|
---|
46 | * @param uMagic 16-bit magic value. This must be unique.
|
---|
47 | * @param uMajor 12-bit major version number. Structures with different
|
---|
48 | * major numbers are not compatible.
|
---|
49 | * @param uMinor 4-bit minor version number. When only the minor version
|
---|
50 | * differs, the structures will be 100% backwards
|
---|
51 | * compatible.
|
---|
52 | */
|
---|
53 | #define PDM_VERSION_MAKE(uMagic, uMajor, uMinor) \
|
---|
54 | ( ((uint32_t)(uMagic) << 16) | ((uint32_t)((uMajor) & 0xff) << 4) | ((uint32_t)((uMinor) & 0xf) << 0) )
|
---|
55 |
|
---|
56 | /** Checks if @a uVerMagic1 is compatible with @a uVerMagic2.
|
---|
57 | *
|
---|
58 | * @returns true / false.
|
---|
59 | * @param uVerMagic1 Typically the runtime version of the struct. This must
|
---|
60 | * have the same magic and major version as @a uVerMagic2
|
---|
61 | * and the minor version must be greater or equal to that
|
---|
62 | * of @a uVerMagic2.
|
---|
63 | * @param uVerMagic2 Typically the version the code was compiled against.
|
---|
64 | *
|
---|
65 | * @remarks The parameters will be referenced more than once.
|
---|
66 | */
|
---|
67 | #define PDM_VERSION_ARE_COMPATIBLE(uVerMagic1, uVerMagic2) \
|
---|
68 | ( (uVerMagic1) == (uVerMagic2) \
|
---|
69 | || ( (uVerMagic1) >= (uVerMagic2) \
|
---|
70 | && ((uVerMagic1) & UINT32_C(0xfffffff0)) == ((uVerMagic2) & UINT32_C(0xfffffff0)) ) \
|
---|
71 | )
|
---|
72 |
|
---|
73 |
|
---|
74 | /** PDM Attach/Detach Callback Flags.
|
---|
75 | * Used by PDMDeviceAttach, PDMDeviceDetach, PDMDriverAttach, PDMDriverDetach,
|
---|
76 | * FNPDMDEVATTACH, FNPDMDEVDETACH, FNPDMDRVATTACH, FNPDMDRVDETACH and
|
---|
77 | * FNPDMDRVCONSTRUCT.
|
---|
78 | @{ */
|
---|
79 | /** The attach/detach command is not a hotplug event. */
|
---|
80 | #define PDM_TACH_FLAGS_NOT_HOT_PLUG RT_BIT_32(0)
|
---|
81 | /** Indicates that no attach or detach callbacks should be made.
|
---|
82 | * This is mostly for internal use. */
|
---|
83 | #define PDM_TACH_FLAGS_NO_CALLBACKS RT_BIT_32(1)
|
---|
84 | /* @} */
|
---|
85 |
|
---|
86 |
|
---|
87 | /**
|
---|
88 | * Is asynchronous handling of suspend or power off notification completed?
|
---|
89 | *
|
---|
90 | * This is called to check whether the USB device has quiesced. Don't deadlock.
|
---|
91 | * Avoid blocking. Do NOT wait for anything.
|
---|
92 | *
|
---|
93 | * @returns true if done, false if more work to be done.
|
---|
94 | *
|
---|
95 | * @param pUsbIns The USB device instance.
|
---|
96 | *
|
---|
97 | * @thread EMT(0)
|
---|
98 | */
|
---|
99 | typedef DECLCALLBACK(bool) FNPDMUSBASYNCNOTIFY(PPDMUSBINS pUsbIns);
|
---|
100 | /** Pointer to a FNPDMUSBASYNCNOTIFY. */
|
---|
101 | typedef FNPDMUSBASYNCNOTIFY *PFNPDMUSBASYNCNOTIFY;
|
---|
102 |
|
---|
103 | /**
|
---|
104 | * Is asynchronous handling of suspend or power off notification completed?
|
---|
105 | *
|
---|
106 | * This is called to check whether the device has quiesced. Don't deadlock.
|
---|
107 | * Avoid blocking. Do NOT wait for anything.
|
---|
108 | *
|
---|
109 | * @returns true if done, false if more work to be done.
|
---|
110 | *
|
---|
111 | * @param pDevIns The device instance.
|
---|
112 | * @remarks The caller will enter the device critical section.
|
---|
113 | * @thread EMT(0)
|
---|
114 | */
|
---|
115 | typedef DECLCALLBACK(bool) FNPDMDEVASYNCNOTIFY(PPDMDEVINS pDevIns);
|
---|
116 | /** Pointer to a FNPDMDEVASYNCNOTIFY. */
|
---|
117 | typedef FNPDMDEVASYNCNOTIFY *PFNPDMDEVASYNCNOTIFY;
|
---|
118 |
|
---|
119 | /**
|
---|
120 | * Is asynchronous handling of suspend or power off notification completed?
|
---|
121 | *
|
---|
122 | * This is called to check whether the driver has quiesced. Don't deadlock.
|
---|
123 | * Avoid blocking. Do NOT wait for anything.
|
---|
124 | *
|
---|
125 | * @returns true if done, false if more work to be done.
|
---|
126 | *
|
---|
127 | * @param pDrvIns The driver instance.
|
---|
128 | *
|
---|
129 | * @thread EMT(0)
|
---|
130 | */
|
---|
131 | typedef DECLCALLBACK(bool) FNPDMDRVASYNCNOTIFY(PPDMDRVINS pDrvIns);
|
---|
132 | /** Pointer to a FNPDMDRVASYNCNOTIFY. */
|
---|
133 | typedef FNPDMDRVASYNCNOTIFY *PFNPDMDRVASYNCNOTIFY;
|
---|
134 |
|
---|
135 |
|
---|
136 | /**
|
---|
137 | * The ring-0 driver request handler.
|
---|
138 | *
|
---|
139 | * @returns VBox status code. PDMDevHlpCallR0 will return this.
|
---|
140 | * @param pDevIns The device instance (the ring-0 mapping).
|
---|
141 | * @param uOperation The operation.
|
---|
142 | * @param u64Arg Optional integer argument for the operation.
|
---|
143 | */
|
---|
144 | typedef DECLCALLBACK(int) FNPDMDEVREQHANDLERR0(PPDMDEVINS pDevIns, uint32_t uOperation, uint64_t u64Arg);
|
---|
145 | /** Ring-0 pointer to a FNPDMDEVREQHANDLERR0. */
|
---|
146 | typedef R0PTRTYPE(FNPDMDEVREQHANDLERR0 *) PFNPDMDEVREQHANDLERR0;
|
---|
147 |
|
---|
148 | /**
|
---|
149 | * The ring-0 driver request handler.
|
---|
150 | *
|
---|
151 | * @returns VBox status code. PDMDrvHlpCallR0 will return this.
|
---|
152 | * @param pDrvIns The driver instance (the ring-0 mapping).
|
---|
153 | * @param uOperation The operation.
|
---|
154 | * @param u64Arg Optional integer argument for the operation.
|
---|
155 | */
|
---|
156 | typedef DECLCALLBACK(int) FNPDMDRVREQHANDLERR0(PPDMDRVINS pDrvIns, uint32_t uOperation, uint64_t u64Arg);
|
---|
157 | /** Ring-0 pointer to a FNPDMDRVREQHANDLERR0. */
|
---|
158 | typedef R0PTRTYPE(FNPDMDRVREQHANDLERR0 *) PFNPDMDRVREQHANDLERR0;
|
---|
159 |
|
---|
160 |
|
---|
161 | /** @} */
|
---|
162 |
|
---|
163 | #endif
|
---|
164 |
|
---|