Changeset 28106 in vbox for trunk/src/VBox/Main/ConsoleImpl2.cpp
- Timestamp:
- Apr 8, 2010 4:45:59 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 59822
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl2.cpp
r27976 r28106 192 192 193 193 /* 194 * Simple class for storing network boot information. 195 */ 196 struct BootNic { 197 ULONG mInstance; 198 unsigned mPciDev; 199 unsigned mPciFn; 200 ULONG mBootPrio; 201 bool operator < (const BootNic &rhs) const 202 { 203 int lval = mBootPrio ? mBootPrio : INT_MAX; 204 int rval = rhs.mBootPrio ? rhs.mBootPrio : INT_MAX; 205 return lval < rval; /* Zero compares as highest number (lowest prio). */ 206 } 207 }; 208 209 /* 194 210 * VC++ 8 / amd64 has some serious trouble with this function. 195 211 * As a temporary measure, we'll drop global optimizations. … … 1450 1466 rc = CFGMR3InsertNode(pDevices, "virtio-net", &pDevVirtioNet); RC_CHECK(); 1451 1467 #endif /* VBOX_WITH_VIRTIO */ 1468 std::list<BootNic> llNics; 1452 1469 for (ULONG ulInstance = 0; ulInstance < SchemaDefs::NetworkAdapterCount; ++ulInstance) 1453 1470 { … … 1529 1546 } 1530 1547 #endif 1531 /* 1532 * Transfer boot device information to the BIOS.1548 /* 1549 * Collect information needed for network booting and add it to the list. 1533 1550 */ 1534 if (ulInstance == 0) 1535 { 1536 unsigned uBootIdx = 0; 1537 1538 if (pNetBootCfg) /* NetBoot node doesn't exist for EFI! */ 1539 { 1540 PCFGMNODE pNetBtDevCfg; 1541 char achBootIdx[] = "0"; 1542 1543 achBootIdx[0] = '0' + uBootIdx; /* Boot device order. */ 1544 rc = CFGMR3InsertNode(pNetBootCfg, achBootIdx, &pNetBtDevCfg); RC_CHECK(); 1545 rc = CFGMR3InsertInteger(pNetBtDevCfg, "NIC", ulInstance); RC_CHECK(); 1546 rc = CFGMR3InsertInteger(pNetBtDevCfg, "PCIDeviceNo", iPciDeviceNo);RC_CHECK(); 1547 rc = CFGMR3InsertInteger(pNetBtDevCfg, "PCIFunctionNo", 0); RC_CHECK(); 1548 } 1549 } 1551 BootNic nic; 1552 1553 nic.mInstance = ulInstance; 1554 nic.mPciDev = iPciDeviceNo; 1555 nic.mPciFn = 0; 1556 1557 hrc = networkAdapter->COMGETTER(BootPriority)(&nic.mBootPrio); H(); 1558 1559 llNics.push_back(nic); 1550 1560 1551 1561 /* … … 1622 1632 rc = configNetwork(pConsole, pszAdapterName, ulInstance, 0, networkAdapter, 1623 1633 pCfg, pLunL0, pInst, false /*fAttachDetach*/); RC_CHECK(); 1634 } 1635 1636 /* 1637 * Build network boot information and transfer it to the BIOS. 1638 */ 1639 if (pNetBootCfg && !llNics.empty()) /* NetBoot node doesn't exist for EFI! */ 1640 { 1641 llNics.sort(); /* Sort the list by boot priority. */ 1642 1643 PCFGMNODE pNetBtDevCfg; 1644 char achBootIdx[] = "0"; 1645 unsigned uBootIdx = 0; 1646 1647 std::list<BootNic>::iterator it; 1648 1649 for (it = llNics.begin(); it != llNics.end(); ++it) 1650 { 1651 Assert(iter); 1652 1653 /* A NIC with priority 0 is only used if it's first in the list. */ 1654 if (it->mBootPrio == 0 && uBootIdx != 0) 1655 break; 1656 1657 achBootIdx[0] = '0' + uBootIdx++; /* Boot device order. */ 1658 rc = CFGMR3InsertNode(pNetBootCfg, achBootIdx, &pNetBtDevCfg); RC_CHECK(); 1659 rc = CFGMR3InsertInteger(pNetBtDevCfg, "NIC", it->mInstance); RC_CHECK(); 1660 rc = CFGMR3InsertInteger(pNetBtDevCfg, "PCIDeviceNo", it->mPciDev); RC_CHECK(); 1661 rc = CFGMR3InsertInteger(pNetBtDevCfg, "PCIFunctionNo", it->mPciFn);RC_CHECK(); 1662 } 1624 1663 } 1625 1664
Note:
See TracChangeset
for help on using the changeset viewer.