Changeset 33690 in vbox
- Timestamp:
- Nov 2, 2010 2:02:19 PM (14 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/BusAssignmentManager.cpp
r33688 r33690 24 24 25 25 #include <map> 26 #include <vector> 26 27 27 28 struct BusAssignmentManager::State … … 35 36 ::strncpy(szDevName, pszName, sizeof(szDevName)); 36 37 } 38 39 bool operator<(const PciDeviceRecord &a) const 40 { 41 return ::strcmp(szDevName, a.szDevName) < 0; 42 } 43 44 bool operator==(const PciDeviceRecord &a) const 45 { 46 return ::strcmp(szDevName, a.szDevName) == 0; 47 } 37 48 }; 38 49 39 typedef std::map <PciBusAddress, PciDeviceRecord > PciMap; 50 typedef std::map <PciBusAddress,PciDeviceRecord > PciMap; 51 typedef std::vector<PciBusAddress> PciAddrList; 52 typedef std::map <PciDeviceRecord,PciAddrList > ReversePciMap; 40 53 41 54 volatile int32_t cRefCnt; 42 55 ChipsetType_T mChipsetType; 43 56 PciMap mPciMap; 57 ReversePciMap mReversePciMap; 44 58 45 59 State() … … 54 68 HRESULT autoAssign(const char* pszName, PciBusAddress& Address); 55 69 bool checkAvailable(PciBusAddress& Address); 70 bool findPciAddress(const char* pszDevName, int iInstance, PciBusAddress& Address); 56 71 }; 57 72 … … 65 80 HRESULT BusAssignmentManager::State::record(const char* pszName, PciBusAddress& Address) 66 81 { 67 mPciMap.insert(PciMap::value_type(Address, PciDeviceRecord(pszName))); 68 return S_OK; 82 PciDeviceRecord devRec(pszName); 83 84 /* Remember address -> device mapping */ 85 mPciMap.insert(PciMap::value_type(Address, devRec)); 86 87 ReversePciMap::iterator it = mReversePciMap.find(devRec); 88 if (it == mReversePciMap.end()) 89 { 90 mReversePciMap.insert(ReversePciMap::value_type(devRec, PciAddrList())); 91 it = mReversePciMap.find(devRec); 92 } 93 94 /* Remember device name -> addresses mapping */ 95 it->second.push_back(Address); 96 97 return S_OK; 98 } 99 100 bool BusAssignmentManager::State::findPciAddress(const char* pszDevName, int iInstance, PciBusAddress& Address) 101 { 102 PciDeviceRecord devRec(pszDevName); 103 104 ReversePciMap::iterator it = mReversePciMap.find(devRec); 105 if (it == mReversePciMap.end()) 106 return false; 107 108 if (iInstance >= (int)it->second.size()) 109 return false; 110 111 Address = it->second[iInstance]; 112 return true; 69 113 } 70 114 … … 176 220 return S_OK; 177 221 } 222 223 224 bool BusAssignmentManager::findPciAddress(const char* pszDevName, int iInstance, PciBusAddress& Address) 225 { 226 return pState->findPciAddress(pszDevName, iInstance, Address); 227 } -
trunk/src/VBox/Main/ConsoleImpl2.cpp
r33687 r33690 966 966 InsertConfigNode(pDevices, "lpc", &pDev); 967 967 InsertConfigNode(pDev, "0", &pInst); 968 #if 0 969 PciAddr = PciBusAddress(0, 31, 0); 970 hrc = BusMgr->assignPciDevice("lpc", pInst); H(); 971 #endif 968 972 InsertConfigInteger(pInst, "Trusted", 1); /* boolean */ 969 973 } … … 2307 2311 if (fOsXGuest && fAudioEnabled) 2308 2312 { 2309 /** @todo: don't hardcode */ 2310 uint32_t u32AudioPciAddr = (5 << 16) | 0; 2311 InsertConfigInteger(pCfg, "AudioPciAddress", u32AudioPciAddr); 2313 PciBusAddress Address; 2314 if (BusMgr->findPciAddress("hda", 0, Address)) 2315 { 2316 uint32_t u32AudioPciAddr = (Address.iDevice << 16) | Address.iFn; 2317 InsertConfigInteger(pCfg, "AudioPciAddress", u32AudioPciAddr); 2318 } 2312 2319 } 2313 2320 InsertConfigInteger(pCfg, "IocPciAddress", u32IocPciAddress); -
trunk/src/VBox/Main/include/BusAssignmentManager.h
r33687 r33690 49 49 if (iBus < a.iBus) 50 50 return true; 51 51 52 52 if (iBus > a.iBus) 53 53 return false; … … 55 55 if (iDevice < a.iDevice) 56 56 return true; 57 57 58 58 if (iDevice > a.iDevice) 59 59 return false; … … 61 61 if (iFn < a.iFn) 62 62 return true; 63 63 64 64 if (iFn > a.iFn) 65 65 return false; … … 110 110 return assignPciDevice(pszDevName, pCfg, Address, false); 111 111 } 112 virtual bool findPciAddress(const char* pszDevName, int iInstance, PciBusAddress& Address); 112 113 }; 113 114
Note:
See TracChangeset
for help on using the changeset viewer.