1 | /** $Id: Builtins.cpp 6597 2008-01-30 12:55:54Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Built-in drivers & devices (part 1)
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2008 innotek GmbH
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 |
|
---|
19 | /*******************************************************************************
|
---|
20 | * Header Files *
|
---|
21 | *******************************************************************************/
|
---|
22 | #define LOG_GROUP LOG_GROUP_DEV
|
---|
23 | #include <VBox/pdm.h>
|
---|
24 | #include <VBox/version.h>
|
---|
25 | #include <VBox/err.h>
|
---|
26 | #include <VBox/usb.h>
|
---|
27 |
|
---|
28 | #include <VBox/log.h>
|
---|
29 | #include <iprt/assert.h>
|
---|
30 |
|
---|
31 | #include "Builtins.h"
|
---|
32 |
|
---|
33 |
|
---|
34 | /*******************************************************************************
|
---|
35 | * Global Variables *
|
---|
36 | *******************************************************************************/
|
---|
37 | const void *g_apvVBoxDDDependencies[] =
|
---|
38 | {
|
---|
39 | NULL,
|
---|
40 | };
|
---|
41 |
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * Register builtin devices.
|
---|
45 | *
|
---|
46 | * @returns VBox status code.
|
---|
47 | * @param pCallbacks Pointer to the callback table.
|
---|
48 | * @param u32Version VBox version number.
|
---|
49 | */
|
---|
50 | extern "C" DECLEXPORT(int) VBoxDevicesRegister(PPDMDEVREGCB pCallbacks, uint32_t u32Version)
|
---|
51 | {
|
---|
52 | LogFlow(("VBoxDevicesRegister: u32Version=%#x\n", u32Version));
|
---|
53 | AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
|
---|
54 | int rc;
|
---|
55 |
|
---|
56 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCI);
|
---|
57 | if (VBOX_FAILURE(rc))
|
---|
58 | return rc;
|
---|
59 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePcArch);
|
---|
60 | if (VBOX_FAILURE(rc))
|
---|
61 | return rc;
|
---|
62 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePcBios);
|
---|
63 | if (VBOX_FAILURE(rc))
|
---|
64 | return rc;
|
---|
65 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePS2KeyboardMouse);
|
---|
66 | if (VBOX_FAILURE(rc))
|
---|
67 | return rc;
|
---|
68 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePIIX3IDE);
|
---|
69 | if (VBOX_FAILURE(rc))
|
---|
70 | return rc;
|
---|
71 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceI8254);
|
---|
72 | if (VBOX_FAILURE(rc))
|
---|
73 | return rc;
|
---|
74 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceI8259);
|
---|
75 | if (VBOX_FAILURE(rc))
|
---|
76 | return rc;
|
---|
77 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceMC146818);
|
---|
78 | if (VBOX_FAILURE(rc))
|
---|
79 | return rc;
|
---|
80 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVga);
|
---|
81 | if (VBOX_FAILURE(rc))
|
---|
82 | return rc;
|
---|
83 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVMMDev);
|
---|
84 | if (VBOX_FAILURE(rc))
|
---|
85 | return rc;
|
---|
86 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCNet);
|
---|
87 | if (VBOX_FAILURE(rc))
|
---|
88 | return rc;
|
---|
89 | #ifdef VBOX_WITH_E1000
|
---|
90 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceE1000);
|
---|
91 | if (VBOX_FAILURE(rc))
|
---|
92 | return rc;
|
---|
93 | #endif
|
---|
94 | #ifdef VBOX_WITH_INIP
|
---|
95 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceINIP);
|
---|
96 | if (VBOX_FAILURE(rc))
|
---|
97 | return rc;
|
---|
98 | #endif
|
---|
99 | #if 0
|
---|
100 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceNE2000);
|
---|
101 | if (VBOX_FAILURE(rc))
|
---|
102 | return rc;
|
---|
103 | #endif
|
---|
104 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceICHAC97);
|
---|
105 | if (VBOX_FAILURE(rc))
|
---|
106 | return rc;
|
---|
107 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSB16);
|
---|
108 | if (VBOX_FAILURE(rc))
|
---|
109 | return rc;
|
---|
110 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAudioSniffer);
|
---|
111 | if (VBOX_FAILURE(rc))
|
---|
112 | return rc;
|
---|
113 | #ifdef VBOX_WITH_USB
|
---|
114 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceOHCI);
|
---|
115 | if (VBOX_FAILURE(rc))
|
---|
116 | return rc;
|
---|
117 | #endif
|
---|
118 | #ifdef VBOX_WITH_EHCI
|
---|
119 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceEHCI);
|
---|
120 | if (VBOX_FAILURE(rc))
|
---|
121 | return rc;
|
---|
122 | #endif
|
---|
123 | #ifdef VBOX_ACPI
|
---|
124 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceACPI);
|
---|
125 | if (VBOX_FAILURE(rc))
|
---|
126 | return rc;
|
---|
127 | #endif
|
---|
128 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceDMA);
|
---|
129 | if (VBOX_FAILURE(rc))
|
---|
130 | return rc;
|
---|
131 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceFloppyController);
|
---|
132 | if (VBOX_FAILURE(rc))
|
---|
133 | return rc;
|
---|
134 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSerialPort);
|
---|
135 | if (VBOX_FAILURE(rc))
|
---|
136 | return rc;
|
---|
137 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceParallelPort);
|
---|
138 | if (VBOX_FAILURE(rc))
|
---|
139 | return rc;
|
---|
140 | #ifdef VBOX_WITH_AHCI
|
---|
141 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAHCI);
|
---|
142 | if (VBOX_FAILURE(rc))
|
---|
143 | return rc;
|
---|
144 | #endif
|
---|
145 |
|
---|
146 | return VINF_SUCCESS;
|
---|
147 | }
|
---|
148 |
|
---|
149 |
|
---|
150 | /**
|
---|
151 | * Register builtin drivers.
|
---|
152 | *
|
---|
153 | * @returns VBox status code.
|
---|
154 | * @param pCallbacks Pointer to the callback table.
|
---|
155 | * @param u32Version VBox version number.
|
---|
156 | */
|
---|
157 | extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_t u32Version)
|
---|
158 | {
|
---|
159 | LogFlow(("VBoxDriversRegister: u32Version=%#x\n", u32Version));
|
---|
160 | AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
|
---|
161 |
|
---|
162 | int rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMouseQueue);
|
---|
163 | if (VBOX_FAILURE(rc))
|
---|
164 | return rc;
|
---|
165 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvKeyboardQueue);
|
---|
166 | if (VBOX_FAILURE(rc))
|
---|
167 | return rc;
|
---|
168 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvBlock);
|
---|
169 | if (VBOX_FAILURE(rc))
|
---|
170 | return rc;
|
---|
171 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVBoxHDD);
|
---|
172 | if (VBOX_FAILURE(rc))
|
---|
173 | return rc;
|
---|
174 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVD);
|
---|
175 | if (VBOX_FAILURE(rc))
|
---|
176 | return rc;
|
---|
177 | #if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS)
|
---|
178 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDVD);
|
---|
179 | if (VBOX_FAILURE(rc))
|
---|
180 | return rc;
|
---|
181 | #endif
|
---|
182 | #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
|
---|
183 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostFloppy);
|
---|
184 | if (VBOX_FAILURE(rc))
|
---|
185 | return rc;
|
---|
186 | #endif
|
---|
187 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMediaISO);
|
---|
188 | if (VBOX_FAILURE(rc))
|
---|
189 | return rc;
|
---|
190 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawImage);
|
---|
191 | if (VBOX_FAILURE(rc))
|
---|
192 | return rc;
|
---|
193 | #ifdef VBOX_WITH_ISCSI
|
---|
194 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvISCSI);
|
---|
195 | if (VBOX_FAILURE(rc))
|
---|
196 | return rc;
|
---|
197 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvISCSITransportTcp);
|
---|
198 | if (VBOX_FAILURE(rc))
|
---|
199 | return rc;
|
---|
200 | #endif
|
---|
201 | #ifndef RT_OS_L4
|
---|
202 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNAT);
|
---|
203 | if (VBOX_FAILURE(rc))
|
---|
204 | return rc;
|
---|
205 | #endif
|
---|
206 | #if defined(RT_OS_L4) || defined(RT_OS_LINUX) || defined(RT_OS_OS2) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS)
|
---|
207 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostInterface);
|
---|
208 | if (VBOX_FAILURE(rc))
|
---|
209 | return rc;
|
---|
210 | #endif
|
---|
211 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvIntNet);
|
---|
212 | if (VBOX_FAILURE(rc))
|
---|
213 | return rc;
|
---|
214 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetSniffer);
|
---|
215 | if (VBOX_FAILURE(rc))
|
---|
216 | return rc;
|
---|
217 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAUDIO);
|
---|
218 | if (VBOX_FAILURE(rc))
|
---|
219 | return rc;
|
---|
220 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvACPI);
|
---|
221 | if (VBOX_FAILURE(rc))
|
---|
222 | return rc;
|
---|
223 |
|
---|
224 | #ifdef VBOX_WITH_USB
|
---|
225 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVUSBRootHub);
|
---|
226 | if (VBOX_FAILURE(rc))
|
---|
227 | return rc;
|
---|
228 | #endif
|
---|
229 |
|
---|
230 | #if !defined(RT_OS_L4)
|
---|
231 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNamedPipe);
|
---|
232 | if (VBOX_FAILURE(rc))
|
---|
233 | return rc;
|
---|
234 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvChar);
|
---|
235 | if (VBOX_FAILURE(rc))
|
---|
236 | return rc;
|
---|
237 | #endif
|
---|
238 |
|
---|
239 | #if defined(RT_OS_LINUX)
|
---|
240 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostParallel);
|
---|
241 | if (VBOX_FAILURE(rc))
|
---|
242 | return rc;
|
---|
243 | #endif
|
---|
244 |
|
---|
245 | #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
|
---|
246 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostSerial);
|
---|
247 | if (VBOX_FAILURE(rc))
|
---|
248 | return rc;
|
---|
249 | #endif
|
---|
250 |
|
---|
251 | #if defined(VBOX_WITH_PDM_ASYNC_COMPLETION)
|
---|
252 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawImageAsync);
|
---|
253 | if (VBOX_FAILURE(rc))
|
---|
254 | return rc;
|
---|
255 |
|
---|
256 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvTransportAsync);
|
---|
257 | if (VBOX_FAILURE(rc))
|
---|
258 | return rc;
|
---|
259 | #endif
|
---|
260 |
|
---|
261 | return VINF_SUCCESS;
|
---|
262 | }
|
---|
263 |
|
---|
264 |
|
---|
265 | #ifdef VBOX_WITH_USB
|
---|
266 | /**
|
---|
267 | * Register builtin USB device.
|
---|
268 | *
|
---|
269 | * @returns VBox status code.
|
---|
270 | * @param pCallbacks Pointer to the callback table.
|
---|
271 | * @param u32Version VBox version number.
|
---|
272 | */
|
---|
273 | extern "C" DECLEXPORT(int) VBoxUsbRegister(PCPDMUSBREGCB pCallbacks, uint32_t u32Version)
|
---|
274 | {
|
---|
275 | int rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbDevProxy);
|
---|
276 | if (VBOX_FAILURE(rc))
|
---|
277 | return rc;
|
---|
278 |
|
---|
279 | return VINF_SUCCESS;
|
---|
280 | }
|
---|
281 | #endif
|
---|
282 |
|
---|