1 | /** $Id: Builtins.cpp 6313 2008-01-09 22:26:56Z 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_DeviceAudioSniffer);
|
---|
108 | if (VBOX_FAILURE(rc))
|
---|
109 | return rc;
|
---|
110 | #ifdef VBOX_WITH_USB
|
---|
111 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceOHCI);
|
---|
112 | if (VBOX_FAILURE(rc))
|
---|
113 | return rc;
|
---|
114 | #endif
|
---|
115 | #ifdef VBOX_WITH_EHCI
|
---|
116 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceEHCI);
|
---|
117 | if (VBOX_FAILURE(rc))
|
---|
118 | return rc;
|
---|
119 | #endif
|
---|
120 | #ifdef VBOX_ACPI
|
---|
121 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceACPI);
|
---|
122 | if (VBOX_FAILURE(rc))
|
---|
123 | return rc;
|
---|
124 | #endif
|
---|
125 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceDMA);
|
---|
126 | if (VBOX_FAILURE(rc))
|
---|
127 | return rc;
|
---|
128 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceFloppyController);
|
---|
129 | if (VBOX_FAILURE(rc))
|
---|
130 | return rc;
|
---|
131 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSerialPort);
|
---|
132 | if (VBOX_FAILURE(rc))
|
---|
133 | return rc;
|
---|
134 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceParallelPort);
|
---|
135 | if (VBOX_FAILURE(rc))
|
---|
136 | return rc;
|
---|
137 | #ifdef VBOX_WITH_AHCI
|
---|
138 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAHCI);
|
---|
139 | if (VBOX_FAILURE(rc))
|
---|
140 | return rc;
|
---|
141 | #endif
|
---|
142 |
|
---|
143 | return VINF_SUCCESS;
|
---|
144 | }
|
---|
145 |
|
---|
146 |
|
---|
147 | /**
|
---|
148 | * Register builtin drivers.
|
---|
149 | *
|
---|
150 | * @returns VBox status code.
|
---|
151 | * @param pCallbacks Pointer to the callback table.
|
---|
152 | * @param u32Version VBox version number.
|
---|
153 | */
|
---|
154 | extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_t u32Version)
|
---|
155 | {
|
---|
156 | LogFlow(("VBoxDriversRegister: u32Version=%#x\n", u32Version));
|
---|
157 | AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
|
---|
158 |
|
---|
159 | int rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMouseQueue);
|
---|
160 | if (VBOX_FAILURE(rc))
|
---|
161 | return rc;
|
---|
162 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvKeyboardQueue);
|
---|
163 | if (VBOX_FAILURE(rc))
|
---|
164 | return rc;
|
---|
165 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvBlock);
|
---|
166 | if (VBOX_FAILURE(rc))
|
---|
167 | return rc;
|
---|
168 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVBoxHDD);
|
---|
169 | if (VBOX_FAILURE(rc))
|
---|
170 | return rc;
|
---|
171 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVD);
|
---|
172 | if (VBOX_FAILURE(rc))
|
---|
173 | return rc;
|
---|
174 | #if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS)
|
---|
175 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDVD);
|
---|
176 | if (VBOX_FAILURE(rc))
|
---|
177 | return rc;
|
---|
178 | #endif
|
---|
179 | #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
|
---|
180 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostFloppy);
|
---|
181 | if (VBOX_FAILURE(rc))
|
---|
182 | return rc;
|
---|
183 | #endif
|
---|
184 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMediaISO);
|
---|
185 | if (VBOX_FAILURE(rc))
|
---|
186 | return rc;
|
---|
187 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawImage);
|
---|
188 | if (VBOX_FAILURE(rc))
|
---|
189 | return rc;
|
---|
190 | #ifdef VBOX_WITH_ISCSI
|
---|
191 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvISCSI);
|
---|
192 | if (VBOX_FAILURE(rc))
|
---|
193 | return rc;
|
---|
194 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvISCSITransportTcp);
|
---|
195 | if (VBOX_FAILURE(rc))
|
---|
196 | return rc;
|
---|
197 | #endif
|
---|
198 | #ifndef RT_OS_L4
|
---|
199 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNAT);
|
---|
200 | if (VBOX_FAILURE(rc))
|
---|
201 | return rc;
|
---|
202 | #endif
|
---|
203 | #if defined(RT_OS_L4) || defined(RT_OS_LINUX) || defined(RT_OS_OS2) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS)
|
---|
204 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostInterface);
|
---|
205 | if (VBOX_FAILURE(rc))
|
---|
206 | return rc;
|
---|
207 | #endif
|
---|
208 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvIntNet);
|
---|
209 | if (VBOX_FAILURE(rc))
|
---|
210 | return rc;
|
---|
211 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetSniffer);
|
---|
212 | if (VBOX_FAILURE(rc))
|
---|
213 | return rc;
|
---|
214 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAUDIO);
|
---|
215 | if (VBOX_FAILURE(rc))
|
---|
216 | return rc;
|
---|
217 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvACPI);
|
---|
218 | if (VBOX_FAILURE(rc))
|
---|
219 | return rc;
|
---|
220 |
|
---|
221 | #ifdef VBOX_WITH_USB
|
---|
222 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVUSBRootHub);
|
---|
223 | if (VBOX_FAILURE(rc))
|
---|
224 | return rc;
|
---|
225 | #endif
|
---|
226 |
|
---|
227 | #if !defined(RT_OS_L4)
|
---|
228 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNamedPipe);
|
---|
229 | if (VBOX_FAILURE(rc))
|
---|
230 | return rc;
|
---|
231 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvChar);
|
---|
232 | if (VBOX_FAILURE(rc))
|
---|
233 | return rc;
|
---|
234 | #endif
|
---|
235 |
|
---|
236 | #if defined(RT_OS_LINUX)
|
---|
237 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostParallel);
|
---|
238 | if (VBOX_FAILURE(rc))
|
---|
239 | return rc;
|
---|
240 | #endif
|
---|
241 |
|
---|
242 | #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
|
---|
243 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostSerial);
|
---|
244 | if (VBOX_FAILURE(rc))
|
---|
245 | return rc;
|
---|
246 | #endif
|
---|
247 |
|
---|
248 | #if defined(VBOX_WITH_PDM_ASYNC_COMPLETION)
|
---|
249 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawImageAsync);
|
---|
250 | if (VBOX_FAILURE(rc))
|
---|
251 | return rc;
|
---|
252 |
|
---|
253 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvTransportAsync);
|
---|
254 | if (VBOX_FAILURE(rc))
|
---|
255 | return rc;
|
---|
256 | #endif
|
---|
257 |
|
---|
258 | return VINF_SUCCESS;
|
---|
259 | }
|
---|
260 |
|
---|
261 |
|
---|
262 | #ifdef VBOX_WITH_USB
|
---|
263 | /**
|
---|
264 | * Register builtin USB device.
|
---|
265 | *
|
---|
266 | * @returns VBox status code.
|
---|
267 | * @param pCallbacks Pointer to the callback table.
|
---|
268 | * @param u32Version VBox version number.
|
---|
269 | */
|
---|
270 | extern "C" DECLEXPORT(int) VBoxUsbRegister(PCPDMUSBREGCB pCallbacks, uint32_t u32Version)
|
---|
271 | {
|
---|
272 | int rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbDevProxy);
|
---|
273 | if (VBOX_FAILURE(rc))
|
---|
274 | return rc;
|
---|
275 |
|
---|
276 | return VINF_SUCCESS;
|
---|
277 | }
|
---|
278 | #endif
|
---|
279 |
|
---|