Changeset 37813 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Jul 7, 2011 9:59:23 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r37794 r37813 457 457 458 458 #ifdef VBOX_WITH_PCI_PASSTHROUGH 459 static HRESULT attachRawPciDevices(BusAssignmentManager* BusMgr,460 PCFGMNODE pDevices,461 Console* pConsole)459 HRESULT Console::attachRawPciDevices(PVM pVM, 460 BusAssignmentManager *BusMgr, 461 PCFGMNODE pDevices) 462 462 { 463 463 HRESULT hrc = S_OK; … … 465 465 466 466 SafeIfaceArray<IPciDeviceAttachment> assignments; 467 ComPtr<IMachine> aMachine = pConsole->machine();467 ComPtr<IMachine> aMachine = machine(); 468 468 469 469 hrc = aMachine->COMGETTER(PciDeviceAssignments)(ComSafeArrayAsOutParam(assignments)); 470 470 if (hrc != S_OK) 471 471 return hrc; 472 473 /* 474 * PCI passthrough is only available if the proper ExtPack is installed. 475 * 476 * Note. Configuring PCI passthrough here and providing messages about 477 * the missing extpack isn't exactly clean, but it is a necessary evil 478 * to patch over legacy compatability issues introduced by the new 479 * distribution model. 480 */ 481 # ifdef VBOX_WITH_EXTPACK 482 static const char *s_pszPciRawExtPackName = "Oracle VM VirtualBox Extension Pack"; 483 if (!mptrExtPackManager->isExtPackUsable(s_pszPciRawExtPackName)) 484 { 485 /* Always fatal! */ 486 return VMSetError(pVM, VERR_NOT_FOUND, RT_SRC_POS, 487 N_("Implementation of the PCI passthrough framework not found!\n" 488 "The VM cannot be started. To fix this problem, either " 489 "install the '%s' or disable PCI passthrough via VBoxManage"), 490 s_pszPciRawExtPackName); 491 } 492 # endif 472 493 473 494 PCFGMNODE pBridges = CFGMR3GetChild(pDevices, "ich9pcibridge"); … … 569 590 InsertConfigString(pLunL1, "Driver", "MainPciRaw"); 570 591 InsertConfigNode(pLunL1, "Config", &pCfg); 571 PciRawDev* pMainDev = new PciRawDev( pConsole);592 PciRawDev* pMainDev = new PciRawDev(this); 572 593 InsertConfigInteger(pCfg, "Object", (uintptr_t)pMainDev); 573 594 } … … 670 691 */ 671 692 ComPtr<IVirtualBox> virtualBox; 672 hrc = pMachine->COMGETTER(Parent)(virtualBox.asOutParam()); H();693 hrc = pMachine->COMGETTER(Parent)(virtualBox.asOutParam()); H(); 673 694 674 695 ComPtr<IHost> host; 675 hrc = virtualBox->COMGETTER(Host)(host.asOutParam()); H();696 hrc = virtualBox->COMGETTER(Host)(host.asOutParam()); H(); 676 697 677 698 ComPtr<ISystemProperties> systemProperties; 678 hrc = virtualBox->COMGETTER(SystemProperties)(systemProperties.asOutParam()); H();699 hrc = virtualBox->COMGETTER(SystemProperties)(systemProperties.asOutParam()); H(); 679 700 680 701 ComPtr<IBIOSSettings> biosSettings; 681 hrc = pMachine->COMGETTER(BIOSSettings)(biosSettings.asOutParam()); H();682 683 hrc = pMachine->COMGETTER(HardwareUUID)(bstr.asOutParam()); H();702 hrc = pMachine->COMGETTER(BIOSSettings)(biosSettings.asOutParam()); H(); 703 704 hrc = pMachine->COMGETTER(HardwareUUID)(bstr.asOutParam()); H(); 684 705 RTUUID HardwareUuid; 685 706 rc = RTUuidFromUtf16(&HardwareUuid, bstr.raw()); … … 687 708 688 709 ULONG cRamMBs; 689 hrc = pMachine->COMGETTER(MemorySize)(&cRamMBs); H();710 hrc = pMachine->COMGETTER(MemorySize)(&cRamMBs); H(); 690 711 #if 0 /* enable to play with lots of memory. */ 691 712 if (RTEnvExist("VBOX_RAM_SIZE")) … … 698 719 699 720 ChipsetType_T chipsetType; 700 hrc = pMachine->COMGETTER(ChipsetType)(&chipsetType); H();721 hrc = pMachine->COMGETTER(ChipsetType)(&chipsetType); H(); 701 722 if (chipsetType == ChipsetType_ICH9) 702 723 { … … 711 732 712 733 ULONG cCpus = 1; 713 hrc = pMachine->COMGETTER(CPUCount)(&cCpus); H();734 hrc = pMachine->COMGETTER(CPUCount)(&cCpus); H(); 714 735 715 736 ULONG ulCpuExecutionCap = 100; 716 hrc = pMachine->COMGETTER(CPUExecutionCap)(&ulCpuExecutionCap); H();737 hrc = pMachine->COMGETTER(CPUExecutionCap)(&ulCpuExecutionCap); H(); 717 738 718 739 Bstr osTypeId; 719 hrc = pMachine->COMGETTER(OSTypeId)(osTypeId.asOutParam()); H();740 hrc = pMachine->COMGETTER(OSTypeId)(osTypeId.asOutParam()); H(); 720 741 721 742 BOOL fIOAPIC; 722 hrc = biosSettings->COMGETTER(IOAPICEnabled)(&fIOAPIC); H();743 hrc = biosSettings->COMGETTER(IOAPICEnabled)(&fIOAPIC); H(); 723 744 724 745 ComPtr<IGuestOSType> guestOSType; 725 hrc = virtualBox->GetGuestOSType(osTypeId.raw(), guestOSType.asOutParam()); H();746 hrc = virtualBox->GetGuestOSType(osTypeId.raw(), guestOSType.asOutParam()); H(); 726 747 727 748 Bstr guestTypeFamilyId; 728 hrc = guestOSType->COMGETTER(FamilyId)(guestTypeFamilyId.asOutParam()); H();749 hrc = guestOSType->COMGETTER(FamilyId)(guestTypeFamilyId.asOutParam()); H(); 729 750 BOOL fOsXGuest = guestTypeFamilyId == Bstr("MacOS"); 730 751 … … 1074 1095 InsertConfigNode(pDev, "0", &pInst); 1075 1096 InsertConfigInteger(pInst, "Trusted", 1); /* boolean */ 1076 hrc = BusMgr->assignPciDevice("ich9pcibridge", pInst); 1097 hrc = BusMgr->assignPciDevice("ich9pcibridge", pInst); H(); 1077 1098 1078 1099 InsertConfigNode(pDev, "1", &pInst); 1079 1100 InsertConfigInteger(pInst, "Trusted", 1); /* boolean */ 1080 hrc = BusMgr->assignPciDevice("ich9pcibridge", pInst); 1101 hrc = BusMgr->assignPciDevice("ich9pcibridge", pInst); H(); 1081 1102 1082 1103 #ifdef VBOX_WITH_PCI_PASSTHROUGH 1083 1104 /* Add PCI passthrough devices */ 1084 hrc = attachRawPciDevices( BusMgr, pDevices, this);H();1105 hrc = attachRawPciDevices(pVM, BusMgr, pDevices); H(); 1085 1106 #endif 1086 1107 } … … 1138 1159 InsertConfigNode(pDevices, "lpc", &pDev); 1139 1160 InsertConfigNode(pDev, "0", &pInst); 1140 hrc = BusMgr->assignPciDevice("lpc", pInst); H();1161 hrc = BusMgr->assignPciDevice("lpc", pInst); H(); 1141 1162 InsertConfigInteger(pInst, "Trusted", 1); /* boolean */ 1142 1163 } … … 1234 1255 InsertConfigInteger(pInst, "Trusted", 1); /* boolean */ 1235 1256 1236 hrc = BusMgr->assignPciDevice("vga", pInst); H();1257 hrc = BusMgr->assignPciDevice("vga", pInst); H(); 1237 1258 InsertConfigNode(pInst, "Config", &pCfg); 1238 1259 ULONG cVRamMBs; … … 1505 1526 case StorageControllerType_LsiLogic: 1506 1527 { 1507 hrc = BusMgr->assignPciDevice("lsilogic", pCtlInst); 1528 hrc = BusMgr->assignPciDevice("lsilogic", pCtlInst); H(); 1508 1529 1509 1530 InsertConfigInteger(pCfg, "Bootable", fBootable); … … 1511 1532 /* Attach the status driver */ 1512 1533 Assert(cLedScsi >= 16); 1513 attachStatusDriver(pCtlInst, &mapStorageLeds[iLedScsi], 0, 15, &mapMediumAttachments, pszCtrlDev, ulInstance); 1534 attachStatusDriver(pCtlInst, &mapStorageLeds[iLedScsi], 0, 15, 1535 &mapMediumAttachments, pszCtrlDev, ulInstance); 1514 1536 paLedDevType = &maStorageDevType[iLedScsi]; 1515 1537 break; … … 1518 1540 case StorageControllerType_BusLogic: 1519 1541 { 1520 hrc = BusMgr->assignPciDevice("buslogic", pCtlInst); 1542 hrc = BusMgr->assignPciDevice("buslogic", pCtlInst); H(); 1521 1543 1522 1544 InsertConfigInteger(pCfg, "Bootable", fBootable); … … 1524 1546 /* Attach the status driver */ 1525 1547 Assert(cLedScsi >= 16); 1526 attachStatusDriver(pCtlInst, &mapStorageLeds[iLedScsi], 0, 15, &mapMediumAttachments, pszCtrlDev, ulInstance); 1548 attachStatusDriver(pCtlInst, &mapStorageLeds[iLedScsi], 0, 15, 1549 &mapMediumAttachments, pszCtrlDev, ulInstance); 1527 1550 paLedDevType = &maStorageDevType[iLedScsi]; 1528 1551 break; … … 1531 1554 case StorageControllerType_IntelAhci: 1532 1555 { 1533 hrc = BusMgr->assignPciDevice("ahci", pCtlInst); 1556 hrc = BusMgr->assignPciDevice("ahci", pCtlInst); H(); 1534 1557 1535 1558 ULONG cPorts = 0; … … 1554 1577 1555 1578 LONG lPortNumber = -1; 1556 hrc = ctrls[i]->GetIDEEmulationPort(j, &lPortNumber); 1579 hrc = ctrls[i]->GetIDEEmulationPort(j, &lPortNumber); H(); 1557 1580 InsertConfigInteger(pCfg, s_apszConfig[j], lPortNumber); 1558 1581 if (pBiosCfg) … … 1563 1586 /* Attach the status driver */ 1564 1587 AssertRelease(cPorts <= cLedSata); 1565 attachStatusDriver(pCtlInst, &mapStorageLeds[iLedSata], 0, cPorts - 1, &mapMediumAttachments, pszCtrlDev, ulInstance); 1588 attachStatusDriver(pCtlInst, &mapStorageLeds[iLedSata], 0, cPorts - 1, 1589 &mapMediumAttachments, pszCtrlDev, ulInstance); 1566 1590 paLedDevType = &maStorageDevType[iLedSata]; 1567 1591 break; … … 1575 1599 * IDE (update this when the main interface changes) 1576 1600 */ 1577 hrc = BusMgr->assignPciDevice("piix3ide", pCtlInst); 1601 hrc = BusMgr->assignPciDevice("piix3ide", pCtlInst); H(); 1578 1602 InsertConfigString(pCfg, "Type", controllerString(enmCtrlType)); 1579 1603 /* Attach the status driver */ 1580 1604 Assert(cLedIde >= 4); 1581 attachStatusDriver(pCtlInst, &mapStorageLeds[iLedIde], 0, 3, &mapMediumAttachments, pszCtrlDev, ulInstance); 1605 attachStatusDriver(pCtlInst, &mapStorageLeds[iLedIde], 0, 3, 1606 &mapMediumAttachments, pszCtrlDev, ulInstance); 1582 1607 paLedDevType = &maStorageDevType[iLedIde]; 1583 1608 … … 1602 1627 /* Attach the status driver */ 1603 1628 Assert(cLedFloppy >= 2); 1604 attachStatusDriver(pCtlInst, &mapStorageLeds[iLedFloppy], 0, 1, &mapMediumAttachments, pszCtrlDev, ulInstance); 1629 attachStatusDriver(pCtlInst, &mapStorageLeds[iLedFloppy], 0, 1, 1630 &mapMediumAttachments, pszCtrlDev, ulInstance); 1605 1631 paLedDevType = &maStorageDevType[iLedFloppy]; 1606 1632 break; … … 1609 1635 case StorageControllerType_LsiLogicSas: 1610 1636 { 1611 hrc = BusMgr->assignPciDevice("lsilogicsas", pCtlInst); 1637 hrc = BusMgr->assignPciDevice("lsilogicsas", pCtlInst); H(); 1612 1638 1613 1639 InsertConfigString(pCfg, "ControllerType", "SAS1068"); … … 1616 1642 /* Attach the status driver */ 1617 1643 Assert(cLedSas >= 8); 1618 attachStatusDriver(pCtlInst, &mapStorageLeds[iLedSas], 0, 7, &mapMediumAttachments, pszCtrlDev, ulInstance); 1644 attachStatusDriver(pCtlInst, &mapStorageLeds[iLedSas], 0, 7, 1645 &mapMediumAttachments, pszCtrlDev, ulInstance); 1619 1646 paLedDevType = &maStorageDevType[iLedSas]; 1620 1647 break; … … 1628 1655 com::SafeIfaceArray<IMediumAttachment> atts; 1629 1656 hrc = pMachine->GetMediumAttachmentsOfController(controllerName.raw(), 1630 ComSafeArrayAsOutParam(atts)); H();1657 ComSafeArrayAsOutParam(atts)); H(); 1631 1658 1632 1659 /* Builtin I/O cache - per device setting. */ 1633 1660 BOOL fBuiltinIoCache = true; 1634 hrc = pMachine->COMGETTER(IoCacheEnabled)(&fBuiltinIoCache); 1661 hrc = pMachine->COMGETTER(IoCacheEnabled)(&fBuiltinIoCache); H(); 1635 1662 1636 1663 … … 1757 1784 #endif 1758 1785 PciBusAddress PciAddr = PciBusAddress(0, iPciDeviceNo, 0); 1759 hrc = BusMgr->assignPciDevice(pszAdapterName, pInst, PciAddr); 1786 hrc = BusMgr->assignPciDevice(pszAdapterName, pInst, PciAddr); H(); 1760 1787 1761 1788 InsertConfigNode(pInst, "Config", &pCfg); … … 1990 2017 InsertConfigNode(pInst, "Config", &pCfg); 1991 2018 InsertConfigInteger(pInst, "Trusted", 1); /* boolean */ 1992 hrc = BusMgr->assignPciDevice("VMMDev", pInst); H();2019 hrc = BusMgr->assignPciDevice("VMMDev", pInst); H(); 1993 2020 1994 2021 Bstr hwVersion; … … 1998 2025 InsertConfigInteger(pCfg, "HeapEnabled", 0); 1999 2026 Bstr snapshotFolder; 2000 hrc = pMachine->COMGETTER(SnapshotFolder)(snapshotFolder.asOutParam()); H();2027 hrc = pMachine->COMGETTER(SnapshotFolder)(snapshotFolder.asOutParam()); H(); 2001 2028 InsertConfigString(pCfg, "GuestCoreDumpDir", snapshotFolder); 2002 2029 … … 2047 2074 InsertConfigNode(pDev, "0", &pInst); 2048 2075 InsertConfigInteger(pInst, "Trusted", 1); /* boolean */ 2049 hrc = BusMgr->assignPciDevice("ichac97", pInst); 2076 hrc = BusMgr->assignPciDevice("ichac97", pInst); H(); 2050 2077 InsertConfigNode(pInst, "Config", &pCfg); 2051 2078 break; … … 2071 2098 InsertConfigNode(pDev, "0", &pInst); 2072 2099 InsertConfigInteger(pInst, "Trusted", 1); /* boolean */ 2073 hrc = BusMgr->assignPciDevice("hda", pInst); 2100 hrc = BusMgr->assignPciDevice("hda", pInst); H(); 2074 2101 InsertConfigNode(pInst, "Config", &pCfg); 2075 2102 } … … 3224 3251 // would be to discard the VM state... 3225 3252 MediumState_T mediumState; 3226 hrc = pMedium->RefreshState(&mediumState); H();3253 hrc = pMedium->RefreshState(&mediumState); H(); 3227 3254 if (mediumState == MediumState_Inaccessible) 3228 3255 { 3229 3256 Bstr loc; 3230 hrc = pMedium->COMGETTER(Location)(loc.asOutParam()); H();3257 hrc = pMedium->COMGETTER(Location)(loc.asOutParam()); H(); 3231 3258 setVMRuntimeErrorCallbackF(VMR3GetVM(mpUVM), 3232 3259 this, … … 3390 3417 hrc = pMedium->GetProperties(NULL, 3391 3418 ComSafeArrayAsOutParam(aNames), 3392 ComSafeArrayAsOutParam(aValues)); H();3419 ComSafeArrayAsOutParam(aValues)); H(); 3393 3420 3394 3421 if (aNames.size() != 0) … … 3488 3515 3489 3516 ComPtr<IVirtualBox> virtualBox; 3490 hrc = pMachine->COMGETTER(Parent)(virtualBox.asOutParam()); H();3517 hrc = pMachine->COMGETTER(Parent)(virtualBox.asOutParam()); H(); 3491 3518 3492 3519 ComPtr<IHost> host; 3493 hrc = virtualBox->COMGETTER(Host)(host.asOutParam()); H();3520 hrc = virtualBox->COMGETTER(Host)(host.asOutParam()); H(); 3494 3521 3495 3522 BOOL fSniffer; 3496 hrc = aNetworkAdapter->COMGETTER(TraceEnabled)(&fSniffer); H();3523 hrc = aNetworkAdapter->COMGETTER(TraceEnabled)(&fSniffer); H(); 3497 3524 3498 3525 NetworkAdapterPromiscModePolicy_T enmPromiscModePolicy; 3499 hrc = aNetworkAdapter->COMGETTER(PromiscModePolicy)(&enmPromiscModePolicy); H();3526 hrc = aNetworkAdapter->COMGETTER(PromiscModePolicy)(&enmPromiscModePolicy); H(); 3500 3527 const char *pszPromiscuousGuestPolicy; 3501 3528 switch (enmPromiscModePolicy) … … 3797 3824 // * the attachment), calling Detach here will cause a deadlock. 3798 3825 // * See #4750. 3799 // * hrc = aNetworkAdapter->Detach(); H();3826 // * hrc = aNetworkAdapter->Detach(); H(); 3800 3827 // */ 3801 3828 // return VMSetError(pVM, VERR_INTERNAL_ERROR, RT_SRC_POS,
Note:
See TracChangeset
for help on using the changeset viewer.