1 | /** $Id: Builtins.cpp 5572 2007-10-31 09:33:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Built-in drivers & devices (part 1)
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 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 as published by the Free Software Foundation,
|
---|
13 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | * 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 | #if 0
|
---|
90 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceNE2000);
|
---|
91 | if (VBOX_FAILURE(rc))
|
---|
92 | return rc;
|
---|
93 | #endif
|
---|
94 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceICHAC97);
|
---|
95 | if (VBOX_FAILURE(rc))
|
---|
96 | return rc;
|
---|
97 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAudioSniffer);
|
---|
98 | if (VBOX_FAILURE(rc))
|
---|
99 | return rc;
|
---|
100 | #ifdef VBOX_WITH_USB
|
---|
101 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceOHCI);
|
---|
102 | if (VBOX_FAILURE(rc))
|
---|
103 | return rc;
|
---|
104 | #endif
|
---|
105 | #ifdef VBOX_WITH_EHCI
|
---|
106 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceEHCI);
|
---|
107 | if (VBOX_FAILURE(rc))
|
---|
108 | return rc;
|
---|
109 | #endif
|
---|
110 | #ifdef VBOX_ACPI
|
---|
111 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceACPI);
|
---|
112 | if (VBOX_FAILURE(rc))
|
---|
113 | return rc;
|
---|
114 | #endif
|
---|
115 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceDMA);
|
---|
116 | if (VBOX_FAILURE(rc))
|
---|
117 | return rc;
|
---|
118 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceFloppyController);
|
---|
119 | if (VBOX_FAILURE(rc))
|
---|
120 | return rc;
|
---|
121 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSerialPort);
|
---|
122 | if (VBOX_FAILURE(rc))
|
---|
123 | return rc;
|
---|
124 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceParallelPort);
|
---|
125 | if (VBOX_FAILURE(rc))
|
---|
126 | return rc;
|
---|
127 | #ifdef VBOX_WITH_AHCI
|
---|
128 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAHCI);
|
---|
129 | if (VBOX_FAILURE(rc))
|
---|
130 | return rc;
|
---|
131 | #endif
|
---|
132 |
|
---|
133 | return VINF_SUCCESS;
|
---|
134 | }
|
---|
135 |
|
---|
136 |
|
---|
137 | /**
|
---|
138 | * Register builtin drivers.
|
---|
139 | *
|
---|
140 | * @returns VBox status code.
|
---|
141 | * @param pCallbacks Pointer to the callback table.
|
---|
142 | * @param u32Version VBox version number.
|
---|
143 | */
|
---|
144 | extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_t u32Version)
|
---|
145 | {
|
---|
146 | LogFlow(("VBoxDriversRegister: u32Version=%#x\n", u32Version));
|
---|
147 | AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
|
---|
148 |
|
---|
149 | int rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMouseQueue);
|
---|
150 | if (VBOX_FAILURE(rc))
|
---|
151 | return rc;
|
---|
152 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvKeyboardQueue);
|
---|
153 | if (VBOX_FAILURE(rc))
|
---|
154 | return rc;
|
---|
155 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvBlock);
|
---|
156 | if (VBOX_FAILURE(rc))
|
---|
157 | return rc;
|
---|
158 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVBoxHDD);
|
---|
159 | if (VBOX_FAILURE(rc))
|
---|
160 | return rc;
|
---|
161 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVD);
|
---|
162 | if (VBOX_FAILURE(rc))
|
---|
163 | return rc;
|
---|
164 | #ifndef RT_OS_L4
|
---|
165 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVmdkHDD);
|
---|
166 | if (VBOX_FAILURE(rc))
|
---|
167 | return rc;
|
---|
168 | #endif
|
---|
169 | #if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS)
|
---|
170 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDVD);
|
---|
171 | if (VBOX_FAILURE(rc))
|
---|
172 | return rc;
|
---|
173 | #endif
|
---|
174 | #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
|
---|
175 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostFloppy);
|
---|
176 | if (VBOX_FAILURE(rc))
|
---|
177 | return rc;
|
---|
178 | #endif
|
---|
179 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMediaISO);
|
---|
180 | if (VBOX_FAILURE(rc))
|
---|
181 | return rc;
|
---|
182 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawImage);
|
---|
183 | if (VBOX_FAILURE(rc))
|
---|
184 | return rc;
|
---|
185 | #if defined(RT_OS_WINDOWS) || defined(RT_OS_LINUX)
|
---|
186 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostHDD);
|
---|
187 | if (VBOX_FAILURE(rc))
|
---|
188 | return rc;
|
---|
189 | #endif
|
---|
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 | return VINF_SUCCESS;
|
---|
249 | }
|
---|
250 |
|
---|
251 |
|
---|
252 | #ifdef VBOX_WITH_USB
|
---|
253 | /**
|
---|
254 | * Register builtin USB device.
|
---|
255 | *
|
---|
256 | * @returns VBox status code.
|
---|
257 | * @param pCallbacks Pointer to the callback table.
|
---|
258 | * @param u32Version VBox version number.
|
---|
259 | */
|
---|
260 | extern "C" DECLEXPORT(int) VBoxUsbRegister(PCPDMUSBREGCB pCallbacks, uint32_t u32Version)
|
---|
261 | {
|
---|
262 | int rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbDevProxy);
|
---|
263 | if (VBOX_FAILURE(rc))
|
---|
264 | return rc;
|
---|
265 |
|
---|
266 | return VINF_SUCCESS;
|
---|
267 | }
|
---|
268 | #endif
|
---|
269 |
|
---|