VirtualBox

source: vbox/trunk/include/VBox/pdmcommon.h@ 32190

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

PDM: Added PDMDevHlpCallR0 and PDMDEV_VALIDATE_CONFIG_RETURN.

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