1 | /** $Id: Builtins.cpp 240 2007-01-23 14:40:56Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Built-in drivers & devices (part 1)
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006 InnoTek Systemberatung 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 | * If you received this file as part of a commercial VirtualBox
|
---|
18 | * distribution, then only the terms of your commercial VirtualBox
|
---|
19 | * license agreement apply instead of the previous paragraph.
|
---|
20 | */
|
---|
21 |
|
---|
22 |
|
---|
23 | /*******************************************************************************
|
---|
24 | * Header Files *
|
---|
25 | *******************************************************************************/
|
---|
26 | #define LOG_GROUP LOG_GROUP_DEV
|
---|
27 | #include <VBox/pdm.h>
|
---|
28 | #include <VBox/version.h>
|
---|
29 | #include <VBox/err.h>
|
---|
30 | #include <VBox/usb.h>
|
---|
31 |
|
---|
32 | #include <VBox/log.h>
|
---|
33 | #include <iprt/assert.h>
|
---|
34 |
|
---|
35 | #include "Builtins.h"
|
---|
36 |
|
---|
37 |
|
---|
38 | /*******************************************************************************
|
---|
39 | * Global Variables *
|
---|
40 | *******************************************************************************/
|
---|
41 | const void *g_apvVBoxDDDependencies[] =
|
---|
42 | {
|
---|
43 | NULL,
|
---|
44 | };
|
---|
45 |
|
---|
46 |
|
---|
47 | /**
|
---|
48 | * Register builtin devices.
|
---|
49 | *
|
---|
50 | * @returns VBox status code.
|
---|
51 | * @param pCallbacks Pointer to the callback table.
|
---|
52 | * @param u32Version VBox version number.
|
---|
53 | */
|
---|
54 | extern "C" DECLEXPORT(int) VBoxDevicesRegister(PPDMDEVREGCB pCallbacks, uint32_t u32Version)
|
---|
55 | {
|
---|
56 | LogFlow(("VBoxDevicesRegister: u32Version=%#x\n", u32Version));
|
---|
57 | AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
|
---|
58 | int rc;
|
---|
59 |
|
---|
60 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCI);
|
---|
61 | if (VBOX_FAILURE(rc))
|
---|
62 | return rc;
|
---|
63 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePcArch);
|
---|
64 | if (VBOX_FAILURE(rc))
|
---|
65 | return rc;
|
---|
66 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePcBios);
|
---|
67 | if (VBOX_FAILURE(rc))
|
---|
68 | return rc;
|
---|
69 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePS2KeyboardMouse);
|
---|
70 | if (VBOX_FAILURE(rc))
|
---|
71 | return rc;
|
---|
72 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePIIX3IDE);
|
---|
73 | if (VBOX_FAILURE(rc))
|
---|
74 | return rc;
|
---|
75 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceI8254);
|
---|
76 | if (VBOX_FAILURE(rc))
|
---|
77 | return rc;
|
---|
78 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceI8259);
|
---|
79 | if (VBOX_FAILURE(rc))
|
---|
80 | return rc;
|
---|
81 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceMC146818);
|
---|
82 | if (VBOX_FAILURE(rc))
|
---|
83 | return rc;
|
---|
84 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVga);
|
---|
85 | if (VBOX_FAILURE(rc))
|
---|
86 | return rc;
|
---|
87 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVMMDev);
|
---|
88 | if (VBOX_FAILURE(rc))
|
---|
89 | return rc;
|
---|
90 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCNet);
|
---|
91 | if (VBOX_FAILURE(rc))
|
---|
92 | return rc;
|
---|
93 | #if 0
|
---|
94 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceNE2000);
|
---|
95 | if (VBOX_FAILURE(rc))
|
---|
96 | return rc;
|
---|
97 | #endif
|
---|
98 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceICHAC97);
|
---|
99 | if (VBOX_FAILURE(rc))
|
---|
100 | return rc;
|
---|
101 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAudioSniffer);
|
---|
102 | if (VBOX_FAILURE(rc))
|
---|
103 | return rc;
|
---|
104 | #if 0 /** @todo remove this, see #1407. */
|
---|
105 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceUSBBackend);
|
---|
106 | if (VBOX_FAILURE(rc))
|
---|
107 | return rc;
|
---|
108 | #endif
|
---|
109 | #if defined(VBOX_WITH_USB) && (defined(__WIN__) || defined(__LINUX__) || defined(__L4ENV__))
|
---|
110 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceOHCI);
|
---|
111 | if (VBOX_FAILURE(rc))
|
---|
112 | return rc;
|
---|
113 | #endif
|
---|
114 | #ifdef VBOX_ACPI
|
---|
115 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceACPI);
|
---|
116 | if (VBOX_FAILURE(rc))
|
---|
117 | return rc;
|
---|
118 | #endif
|
---|
119 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceDMA);
|
---|
120 | if (VBOX_FAILURE(rc))
|
---|
121 | return rc;
|
---|
122 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceFloppyController);
|
---|
123 | if (VBOX_FAILURE(rc))
|
---|
124 | return rc;
|
---|
125 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSerialPort);
|
---|
126 | if (VBOX_FAILURE(rc))
|
---|
127 | return rc;
|
---|
128 |
|
---|
129 | return VINF_SUCCESS;
|
---|
130 | }
|
---|
131 |
|
---|
132 |
|
---|
133 | /**
|
---|
134 | * Register builtin drivers.
|
---|
135 | *
|
---|
136 | * @returns VBox status code.
|
---|
137 | * @param pCallbacks Pointer to the callback table.
|
---|
138 | * @param u32Version VBox version number.
|
---|
139 | */
|
---|
140 | extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_t u32Version)
|
---|
141 | {
|
---|
142 | LogFlow(("VBoxDriversRegister: u32Version=%#x\n", u32Version));
|
---|
143 | AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
|
---|
144 |
|
---|
145 | int rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMouseQueue);
|
---|
146 | if (VBOX_FAILURE(rc))
|
---|
147 | return rc;
|
---|
148 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvKeyboardQueue);
|
---|
149 | if (VBOX_FAILURE(rc))
|
---|
150 | return rc;
|
---|
151 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvBlock);
|
---|
152 | if (VBOX_FAILURE(rc))
|
---|
153 | return rc;
|
---|
154 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVBoxHDD);
|
---|
155 | if (VBOX_FAILURE(rc))
|
---|
156 | return rc;
|
---|
157 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVmdkHDD);
|
---|
158 | if (VBOX_FAILURE(rc))
|
---|
159 | return rc;
|
---|
160 | #if !defined(__L4ENV__) && !defined(__DARWIN__) && !defined(__OS2__)
|
---|
161 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDVD);
|
---|
162 | if (VBOX_FAILURE(rc))
|
---|
163 | return rc;
|
---|
164 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostFloppy);
|
---|
165 | if (VBOX_FAILURE(rc))
|
---|
166 | return rc;
|
---|
167 | #endif
|
---|
168 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMediaISO);
|
---|
169 | if (VBOX_FAILURE(rc))
|
---|
170 | return rc;
|
---|
171 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawImage);
|
---|
172 | if (VBOX_FAILURE(rc))
|
---|
173 | return rc;
|
---|
174 | #ifdef VBOX_WITH_ISCSI
|
---|
175 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvISCSI);
|
---|
176 | if (VBOX_FAILURE(rc))
|
---|
177 | return rc;
|
---|
178 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvISCSITransportTcp);
|
---|
179 | if (VBOX_FAILURE(rc))
|
---|
180 | return rc;
|
---|
181 | #endif
|
---|
182 | #ifndef __L4ENV__
|
---|
183 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNAT);
|
---|
184 | if (VBOX_FAILURE(rc))
|
---|
185 | return rc;
|
---|
186 | #endif
|
---|
187 | #if !defined(__DARWIN__) && !defined(__OS2__)
|
---|
188 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostInterface);
|
---|
189 | if (VBOX_FAILURE(rc))
|
---|
190 | return rc;
|
---|
191 | #endif
|
---|
192 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvIntNet);
|
---|
193 | if (VBOX_FAILURE(rc))
|
---|
194 | return rc;
|
---|
195 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetSniffer);
|
---|
196 | if (VBOX_FAILURE(rc))
|
---|
197 | return rc;
|
---|
198 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAUDIO);
|
---|
199 | if (VBOX_FAILURE(rc))
|
---|
200 | return rc;
|
---|
201 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvACPI);
|
---|
202 | if (VBOX_FAILURE(rc))
|
---|
203 | return rc;
|
---|
204 |
|
---|
205 | #if defined(VBOX_WITH_USB) && (defined(__WIN__) || defined(__LINUX__) || defined(__L4ENV__))
|
---|
206 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVUSBRootHub);
|
---|
207 | if (VBOX_FAILURE(rc))
|
---|
208 | return rc;
|
---|
209 | #endif
|
---|
210 |
|
---|
211 | return VINF_SUCCESS;
|
---|
212 | }
|
---|
213 |
|
---|