[12646] | 1 | /* $Id: Builtins.cpp 32471 2010-09-14 10:26:07Z vboxsync $ */
|
---|
[1] | 2 | /** @file
|
---|
| 3 | * Built-in drivers & devices (part 1)
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[28800] | 7 | * Copyright (C) 2006-2010 Oracle Corporation
|
---|
[1] | 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
|
---|
[5999] | 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.
|
---|
[1] | 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 | {
|
---|
[19183] | 39 | #ifdef VBOX_WITH_EFI
|
---|
| 40 | &g_abEfiThunkBinary[0],
|
---|
| 41 | #endif
|
---|
[1] | 42 | NULL,
|
---|
| 43 | };
|
---|
| 44 |
|
---|
| 45 |
|
---|
| 46 | /**
|
---|
| 47 | * Register builtin devices.
|
---|
| 48 | *
|
---|
| 49 | * @returns VBox status code.
|
---|
| 50 | * @param pCallbacks Pointer to the callback table.
|
---|
| 51 | * @param u32Version VBox version number.
|
---|
| 52 | */
|
---|
| 53 | extern "C" DECLEXPORT(int) VBoxDevicesRegister(PPDMDEVREGCB pCallbacks, uint32_t u32Version)
|
---|
| 54 | {
|
---|
| 55 | LogFlow(("VBoxDevicesRegister: u32Version=%#x\n", u32Version));
|
---|
| 56 | AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
|
---|
| 57 | int rc;
|
---|
| 58 |
|
---|
| 59 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCI);
|
---|
[11266] | 60 | if (RT_FAILURE(rc))
|
---|
[1] | 61 | return rc;
|
---|
[32342] | 62 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePciIch9);
|
---|
| 63 | if (RT_FAILURE(rc))
|
---|
| 64 | return rc;
|
---|
[1] | 65 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePcArch);
|
---|
[11266] | 66 | if (RT_FAILURE(rc))
|
---|
[1] | 67 | return rc;
|
---|
| 68 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePcBios);
|
---|
[11266] | 69 | if (RT_FAILURE(rc))
|
---|
[1] | 70 | return rc;
|
---|
| 71 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePS2KeyboardMouse);
|
---|
[11266] | 72 | if (RT_FAILURE(rc))
|
---|
[1] | 73 | return rc;
|
---|
| 74 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePIIX3IDE);
|
---|
[11266] | 75 | if (RT_FAILURE(rc))
|
---|
[1] | 76 | return rc;
|
---|
| 77 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceI8254);
|
---|
[11266] | 78 | if (RT_FAILURE(rc))
|
---|
[1] | 79 | return rc;
|
---|
| 80 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceI8259);
|
---|
[11266] | 81 | if (RT_FAILURE(rc))
|
---|
[1] | 82 | return rc;
|
---|
[15963] | 83 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceHPET);
|
---|
| 84 | if (RT_FAILURE(rc))
|
---|
| 85 | return rc;
|
---|
[16559] | 86 | #ifdef VBOX_WITH_EFI
|
---|
| 87 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceEFI);
|
---|
| 88 | if (RT_FAILURE(rc))
|
---|
| 89 | return rc;
|
---|
| 90 | #endif
|
---|
[1] | 91 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceMC146818);
|
---|
[11266] | 92 | if (RT_FAILURE(rc))
|
---|
[1] | 93 | return rc;
|
---|
| 94 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVga);
|
---|
[11266] | 95 | if (RT_FAILURE(rc))
|
---|
[1] | 96 | return rc;
|
---|
| 97 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVMMDev);
|
---|
[11266] | 98 | if (RT_FAILURE(rc))
|
---|
[1] | 99 | return rc;
|
---|
| 100 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCNet);
|
---|
[11266] | 101 | if (RT_FAILURE(rc))
|
---|
[1] | 102 | return rc;
|
---|
[5755] | 103 | #ifdef VBOX_WITH_E1000
|
---|
| 104 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceE1000);
|
---|
[11266] | 105 | if (RT_FAILURE(rc))
|
---|
[5755] | 106 | return rc;
|
---|
| 107 | #endif
|
---|
[22866] | 108 | #ifdef VBOX_WITH_VIRTIO
|
---|
| 109 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVirtioNet);
|
---|
| 110 | if (RT_FAILURE(rc))
|
---|
| 111 | return rc;
|
---|
| 112 | #endif
|
---|
[5849] | 113 | #ifdef VBOX_WITH_INIP
|
---|
| 114 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceINIP);
|
---|
[11266] | 115 | if (RT_FAILURE(rc))
|
---|
[5849] | 116 | return rc;
|
---|
| 117 | #endif
|
---|
[1] | 118 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceICHAC97);
|
---|
[11266] | 119 | if (RT_FAILURE(rc))
|
---|
[1] | 120 | return rc;
|
---|
[6597] | 121 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSB16);
|
---|
[11266] | 122 | if (RT_FAILURE(rc))
|
---|
[6597] | 123 | return rc;
|
---|
[30906] | 124 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceICH6_HDA);
|
---|
[30866] | 125 | if (RT_FAILURE(rc))
|
---|
| 126 | return rc;
|
---|
[1] | 127 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAudioSniffer);
|
---|
[11266] | 128 | if (RT_FAILURE(rc))
|
---|
[1] | 129 | return rc;
|
---|
[26951] | 130 | #ifdef VBOX_WITH_VUSB
|
---|
[1] | 131 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceOHCI);
|
---|
[11266] | 132 | if (RT_FAILURE(rc))
|
---|
[1] | 133 | return rc;
|
---|
| 134 | #endif
|
---|
[5572] | 135 | #ifdef VBOX_WITH_EHCI
|
---|
| 136 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceEHCI);
|
---|
[11266] | 137 | if (RT_FAILURE(rc))
|
---|
[5572] | 138 | return rc;
|
---|
| 139 | #endif
|
---|
[1] | 140 | #ifdef VBOX_ACPI
|
---|
| 141 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceACPI);
|
---|
[11266] | 142 | if (RT_FAILURE(rc))
|
---|
[1] | 143 | return rc;
|
---|
| 144 | #endif
|
---|
| 145 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceDMA);
|
---|
[11266] | 146 | if (RT_FAILURE(rc))
|
---|
[1] | 147 | return rc;
|
---|
| 148 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceFloppyController);
|
---|
[11266] | 149 | if (RT_FAILURE(rc))
|
---|
[1] | 150 | return rc;
|
---|
| 151 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSerialPort);
|
---|
[11266] | 152 | if (RT_FAILURE(rc))
|
---|
[1] | 153 | return rc;
|
---|
[3648] | 154 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceParallelPort);
|
---|
[11266] | 155 | if (RT_FAILURE(rc))
|
---|
[3648] | 156 | return rc;
|
---|
[5380] | 157 | #ifdef VBOX_WITH_AHCI
|
---|
| 158 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAHCI);
|
---|
[11266] | 159 | if (RT_FAILURE(rc))
|
---|
[5380] | 160 | return rc;
|
---|
| 161 | #endif
|
---|
[11410] | 162 | #ifdef VBOX_WITH_BUSLOGIC
|
---|
| 163 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceBusLogic);
|
---|
[13835] | 164 | if (RT_FAILURE(rc))
|
---|
[11410] | 165 | return rc;
|
---|
| 166 | #endif
|
---|
[13189] | 167 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCIBridge);
|
---|
[13835] | 168 | if (RT_FAILURE(rc))
|
---|
[13189] | 169 | return rc;
|
---|
[32342] | 170 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePciIch9Bridge);
|
---|
| 171 | if (RT_FAILURE(rc))
|
---|
| 172 | return rc;
|
---|
[14438] | 173 | #ifdef VBOX_WITH_LSILOGIC
|
---|
| 174 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLsiLogicSCSI);
|
---|
[26176] | 175 | if (RT_FAILURE(rc))
|
---|
[14438] | 176 | return rc;
|
---|
[29326] | 177 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceLsiLogicSAS);
|
---|
| 178 | if (RT_FAILURE(rc))
|
---|
| 179 | return rc;
|
---|
[14438] | 180 | #endif
|
---|
[1] | 181 |
|
---|
| 182 | return VINF_SUCCESS;
|
---|
| 183 | }
|
---|
| 184 |
|
---|
| 185 |
|
---|
| 186 | /**
|
---|
| 187 | * Register builtin drivers.
|
---|
| 188 | *
|
---|
| 189 | * @returns VBox status code.
|
---|
| 190 | * @param pCallbacks Pointer to the callback table.
|
---|
| 191 | * @param u32Version VBox version number.
|
---|
| 192 | */
|
---|
| 193 | extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_t u32Version)
|
---|
| 194 | {
|
---|
| 195 | LogFlow(("VBoxDriversRegister: u32Version=%#x\n", u32Version));
|
---|
| 196 | AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION));
|
---|
| 197 |
|
---|
| 198 | int rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMouseQueue);
|
---|
[11266] | 199 | if (RT_FAILURE(rc))
|
---|
[1] | 200 | return rc;
|
---|
| 201 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvKeyboardQueue);
|
---|
[11266] | 202 | if (RT_FAILURE(rc))
|
---|
[1] | 203 | return rc;
|
---|
| 204 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvBlock);
|
---|
[11266] | 205 | if (RT_FAILURE(rc))
|
---|
[1] | 206 | return rc;
|
---|
[2358] | 207 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVD);
|
---|
[11266] | 208 | if (RT_FAILURE(rc))
|
---|
[240] | 209 | return rc;
|
---|
[19968] | 210 | #if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
|
---|
[1] | 211 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDVD);
|
---|
[11266] | 212 | if (RT_FAILURE(rc))
|
---|
[1] | 213 | return rc;
|
---|
[1965] | 214 | #endif
|
---|
[3666] | 215 | #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
|
---|
[1] | 216 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostFloppy);
|
---|
[11266] | 217 | if (RT_FAILURE(rc))
|
---|
[1] | 218 | return rc;
|
---|
| 219 | #endif
|
---|
| 220 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMediaISO);
|
---|
[11266] | 221 | if (RT_FAILURE(rc))
|
---|
[1] | 222 | return rc;
|
---|
| 223 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawImage);
|
---|
[11266] | 224 | if (RT_FAILURE(rc))
|
---|
[1] | 225 | return rc;
|
---|
[19351] | 226 | #ifndef RT_OS_L4
|
---|
[1] | 227 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNAT);
|
---|
[11266] | 228 | if (RT_FAILURE(rc))
|
---|
[1] | 229 | return rc;
|
---|
| 230 | #endif
|
---|
[22396] | 231 | #if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
|
---|
[1] | 232 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostInterface);
|
---|
[11266] | 233 | if (RT_FAILURE(rc))
|
---|
[1] | 234 | return rc;
|
---|
| 235 | #endif
|
---|
[28406] | 236 | #ifdef VBOX_WITH_VDE
|
---|
| 237 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVDE);
|
---|
| 238 | if (RT_FAILURE(rc))
|
---|
| 239 | return rc;
|
---|
| 240 | #endif
|
---|
[1] | 241 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvIntNet);
|
---|
[11266] | 242 | if (RT_FAILURE(rc))
|
---|
[1] | 243 | return rc;
|
---|
[28427] | 244 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvDedicatedNic);
|
---|
| 245 | if (RT_FAILURE(rc))
|
---|
| 246 | return rc;
|
---|
[1] | 247 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetSniffer);
|
---|
[11266] | 248 | if (RT_FAILURE(rc))
|
---|
[1] | 249 | return rc;
|
---|
| 250 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAUDIO);
|
---|
[11266] | 251 | if (RT_FAILURE(rc))
|
---|
[1] | 252 | return rc;
|
---|
| 253 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvACPI);
|
---|
[11266] | 254 | if (RT_FAILURE(rc))
|
---|
[1] | 255 | return rc;
|
---|
[25817] | 256 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAcpiCpu);
|
---|
| 257 | if (RT_FAILURE(rc))
|
---|
| 258 | return rc;
|
---|
[1] | 259 |
|
---|
[26951] | 260 | #ifdef VBOX_WITH_VUSB
|
---|
[1] | 261 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVUSBRootHub);
|
---|
[11266] | 262 | if (RT_FAILURE(rc))
|
---|
[1] | 263 | return rc;
|
---|
| 264 | #endif
|
---|
| 265 |
|
---|
[3670] | 266 | #if !defined(RT_OS_L4)
|
---|
[1763] | 267 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNamedPipe);
|
---|
[11266] | 268 | if (RT_FAILURE(rc))
|
---|
[1476] | 269 | return rc;
|
---|
[19624] | 270 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawFile);
|
---|
| 271 | if (RT_FAILURE(rc))
|
---|
| 272 | return rc;
|
---|
[1763] | 273 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvChar);
|
---|
[11266] | 274 | if (RT_FAILURE(rc))
|
---|
[1476] | 275 | return rc;
|
---|
[1497] | 276 | #endif
|
---|
[1476] | 277 |
|
---|
[3666] | 278 | #if defined(RT_OS_LINUX)
|
---|
[3648] | 279 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostParallel);
|
---|
[11266] | 280 | if (RT_FAILURE(rc))
|
---|
[3648] | 281 | return rc;
|
---|
[4275] | 282 | #endif
|
---|
[4144] | 283 |
|
---|
[22876] | 284 | #if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(RT_OS_FREEBSD)
|
---|
[4144] | 285 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostSerial);
|
---|
[11266] | 286 | if (RT_FAILURE(rc))
|
---|
[4144] | 287 | return rc;
|
---|
[3648] | 288 | #endif
|
---|
| 289 |
|
---|
[12565] | 290 | #ifdef VBOX_WITH_SCSI
|
---|
[11502] | 291 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvSCSI);
|
---|
[13835] | 292 | if (RT_FAILURE(rc))
|
---|
[11502] | 293 | return rc;
|
---|
[12559] | 294 |
|
---|
[26112] | 295 | # if defined(RT_OS_LINUX)
|
---|
[12559] | 296 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvSCSIHost);
|
---|
[13835] | 297 | if (RT_FAILURE(rc))
|
---|
[12559] | 298 | return rc;
|
---|
[26112] | 299 | # endif
|
---|
[27558] | 300 |
|
---|
[27559] | 301 | #endif
|
---|
| 302 |
|
---|
| 303 | #ifdef VBOX_WITH_DRV_DISK_INTEGRITY
|
---|
[27558] | 304 | rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvDiskIntegrity);
|
---|
| 305 | if (RT_FAILURE(rc))
|
---|
| 306 | return rc;
|
---|
[11502] | 307 | #endif
|
---|
[6313] | 308 |
|
---|
[1] | 309 | return VINF_SUCCESS;
|
---|
| 310 | }
|
---|
| 311 |
|
---|
[3853] | 312 |
|
---|
| 313 | /**
|
---|
| 314 | * Register builtin USB device.
|
---|
| 315 | *
|
---|
| 316 | * @returns VBox status code.
|
---|
| 317 | * @param pCallbacks Pointer to the callback table.
|
---|
| 318 | * @param u32Version VBox version number.
|
---|
| 319 | */
|
---|
[3855] | 320 | extern "C" DECLEXPORT(int) VBoxUsbRegister(PCPDMUSBREGCB pCallbacks, uint32_t u32Version)
|
---|
[3853] | 321 | {
|
---|
[26951] | 322 | int rc = VINF_SUCCESS;
|
---|
| 323 |
|
---|
| 324 | #ifdef VBOX_WITH_USB
|
---|
| 325 | rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbDevProxy);
|
---|
[11266] | 326 | if (RT_FAILURE(rc))
|
---|
[3853] | 327 | return rc;
|
---|
| 328 |
|
---|
[26112] | 329 | # ifdef VBOX_WITH_SCSI
|
---|
| 330 | rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbMsd);
|
---|
| 331 | if (RT_FAILURE(rc))
|
---|
| 332 | return rc;
|
---|
| 333 | # endif
|
---|
[26951] | 334 | #endif
|
---|
[26112] | 335 |
|
---|
[26951] | 336 | #ifdef VBOX_WITH_VUSB
|
---|
[26473] | 337 | rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbHidKbd);
|
---|
| 338 | if (RT_FAILURE(rc))
|
---|
| 339 | return rc;
|
---|
| 340 |
|
---|
| 341 | rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbHidMou);
|
---|
| 342 | if (RT_FAILURE(rc))
|
---|
| 343 | return rc;
|
---|
[26951] | 344 | #endif
|
---|
[26473] | 345 |
|
---|
[26951] | 346 | return rc;
|
---|
[3853] | 347 | }
|
---|
[26112] | 348 |
|
---|