Changeset 43750 in vbox
- Timestamp:
- Oct 26, 2012 7:25:05 AM (12 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 2 edited
-
Devices/PC/DevPcBios.cpp (modified) (2 diffs)
-
Main/src-client/ConsoleImpl2.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevPcBios.cpp
r43712 r43750 943 943 "HardDiskDevice\0" 944 944 "SataHardDiskDevice\0" 945 "Sata PrimaryMasterLUN\0"946 "Sata PrimarySlaveLUN\0"947 "Sata SecondaryMasterLUN\0"948 "Sata SecondarySlaveLUN\0"945 "SataLUN1\0" 946 "SataLUN2\0" 947 "SataLUN3\0" 948 "SataLUN4\0" 949 949 "FloppyDevice\0" 950 950 "DelayBoot\0" … … 1057 1057 { 1058 1058 static const char * const s_apszSataDisks[] = 1059 { "Sata PrimaryMasterLUN", "SataPrimarySlaveLUN", "SataSecondaryMasterLUN", "SataSecondarySlaveLUN" };1059 { "SataLUN1", "SataLUN2", "SataLUN3", "SataLUN4" }; 1060 1060 Assert(RT_ELEMENTS(s_apszSataDisks) == RT_ELEMENTS(pThis->iSataHDLUN)); 1061 1061 for (unsigned i = 0; i < RT_ELEMENTS(pThis->iSataHDLUN); i++) -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r43350 r43750 464 464 throw ConfigError("CFGMR3RemoveValue", vrc, pcszName); 465 465 } 466 /** Helper that finds out the next SATA port used 467 */ 468 static int GetNextUsedSataPort(int aSataPortUsed[30], int iBaseVal, int iSize) 469 { 470 int iNextPortUsed = 30; 471 for (size_t j = 0; j < iSize; ++j) 472 { 473 if(aSataPortUsed[j] > iBaseVal && 474 aSataPortUsed[j] <= iNextPortUsed) 475 iNextPortUsed = aSataPortUsed[j]; 476 } 477 return iNextPortUsed; 478 } 466 479 467 480 #ifdef VBOX_WITH_PCI_PASSTHROUGH … … 1613 1626 if (!BusMgr->hasPCIDevice("ahci", 1)) 1614 1627 { 1628 #define MAX_SATA_LUN_COUNT 4 1629 #define MAX_SATA_PORTS 30 1630 1631 static const char * const s_apszBiosConfig[4] = 1632 { "SataLUN1", "SataLUN2", "SataLUN3", "SataLUN4" }; 1633 1634 int iPortNum = 0; 1635 uint32_t u32PortLUN[MAX_SATA_LUN_COUNT]; 1636 uint32_t u32PortUsed[MAX_SATA_PORTS]; 1637 uint32_t u32HDSataPortCount = 0; 1638 uint32_t u32MaxPortCount = MAX_SATA_LUN_COUNT; 1639 uint32_t u32NumAttachments = 0; 1640 DeviceType_T lType; 1641 com::SafeIfaceArray<IMediumAttachment> atts; 1642 1643 /* init to max value */ 1644 u32PortLUN[0] = MAX_SATA_PORTS; 1645 1615 1646 if (pBiosCfg) 1616 1647 { 1617 1648 InsertConfigString(pBiosCfg, "SataHardDiskDevice", "ahci"); 1618 1649 } 1650 1651 1652 hrc = pMachine->GetMediumAttachmentsOfController(controllerName.raw(), 1653 ComSafeArrayAsOutParam(atts)); H(); 1654 u32NumAttachments = atts.size(); 1655 if (u32NumAttachments > MAX_SATA_PORTS) 1656 { 1657 LogRel(("Number of Sata Port Attachments > Max=%d.\n", u32NumAttachments)); 1658 u32NumAttachments = MAX_SATA_PORTS; 1659 } 1660 1661 /* find the relavant ports i.e Sata ports to which 1662 * HD is attached. 1663 */ 1664 for (size_t j = 0; j < u32NumAttachments; ++j) 1665 { 1666 IMediumAttachment *pMediumAtt = atts[j]; 1667 hrc = pMediumAtt->COMGETTER(Port)(&iPortNum); H(); 1668 if(SUCCEEDED(hrc)) 1669 hrc = pMediumAtt->COMGETTER(Type)(&lType); H(); 1670 if(SUCCEEDED(hrc) && lType == DeviceType_HardDisk) 1671 { 1672 /* find min port number used for HD */ 1673 if(iPortNum < u32PortLUN[0]) 1674 u32PortLUN[0] = iPortNum; 1675 u32PortUsed[u32HDSataPortCount++] = iPortNum; 1676 LogFlowFunc(("HD Sata port Count=%d\n", u32HDSataPortCount)); 1677 } 1678 } 1679 1680 1681 /* Pick only the top 4 used HD Sata Ports as CMOS doesn't have space 1682 * to save details for every 30 ports 1683 */ 1684 if (u32HDSataPortCount < MAX_SATA_LUN_COUNT) 1685 u32MaxPortCount = u32HDSataPortCount; 1686 for (size_t i = 1; i < u32MaxPortCount; i++) 1687 u32PortLUN[i] = GetNextUsedSataPort(u32PortUsed, 1688 u32PortLUN[i-1], 1689 u32HDSataPortCount); 1690 if (pBiosCfg) 1691 for (j = 0; j < u32MaxPortCount; j++) 1692 { 1693 InsertConfigInteger(pBiosCfg, s_apszBiosConfig[j], u32PortLUN[j]); 1694 LogFlowFunc(("Top %d ports = %s, %d\n", j, s_apszBiosConfig[j], u32PortLUN[j])); 1695 } 1619 1696 } 1620 1697
Note:
See TracChangeset
for help on using the changeset viewer.

