VirtualBox

Changeset 23530 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Oct 3, 2009 6:02:48 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
53173
Message:

Main: Fix booting from SATA controllers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r23418 r23530  
    656656    Display *pDisplay = pConsole->mDisplay;
    657657    rc = CFGMR3InsertInteger(pCfg,  "Object", (uintptr_t)pDisplay);                 RC_CHECK();
     658
     659
     660    /*
     661     * Firmware.
     662     */
     663#ifdef VBOX_WITH_EFI
     664    Bstr tmpStr1;
     665    hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/UseEFI"), tmpStr1.asOutParam());    H();
     666    BOOL fEfiEnabled = !tmpStr1.isEmpty();
     667
     668    /**
     669     * @todo: VBoxInternal2/UseEFI extradata will go away soon, and we'll
     670     *        just use this code
     671     */
     672    if (!fEfiEnabled)
     673    {
     674      FirmwareType_T eType =  FirmwareType_BIOS;
     675      hrc = pMachine->COMGETTER(FirmwareType)(&eType);                                H();
     676      fEfiEnabled = (eType == FirmwareType_EFI);
     677    }
     678#else
     679    BOOL fEfiEnabled = false;
     680#endif
     681    if (!fEfiEnabled)
     682    {
     683        /*
     684         * PC Bios.
     685         */
     686        rc = CFGMR3InsertNode(pDevices, "pcbios", &pDev);                               RC_CHECK();
     687        rc = CFGMR3InsertNode(pDev,     "0", &pInst);                                   RC_CHECK();
     688        rc = CFGMR3InsertInteger(pInst, "Trusted",              1);     /* boolean */   RC_CHECK();
     689        rc = CFGMR3InsertNode(pInst,    "Config", &pBiosCfg);                           RC_CHECK();
     690        rc = CFGMR3InsertInteger(pBiosCfg,  "RamSize",              cbRam);             RC_CHECK();
     691        rc = CFGMR3InsertInteger(pBiosCfg,  "RamHoleSize",          cbRamHole);         RC_CHECK();
     692        rc = CFGMR3InsertInteger(pBiosCfg,  "NumCPUs",              cCpus);             RC_CHECK();
     693        rc = CFGMR3InsertString(pBiosCfg,   "HardDiskDevice",       "piix3ide");        RC_CHECK();
     694        rc = CFGMR3InsertString(pBiosCfg,   "FloppyDevice",         "i82078");          RC_CHECK();
     695        rc = CFGMR3InsertInteger(pBiosCfg,  "IOAPIC",               fIOAPIC);           RC_CHECK();
     696        rc = CFGMR3InsertInteger(pBiosCfg,  "PXEDebug",             fPXEDebug);         RC_CHECK();
     697        rc = CFGMR3InsertBytes(pBiosCfg,    "UUID", pUuid, sizeof(*pUuid));             RC_CHECK();
     698
     699        DeviceType_T bootDevice;
     700        if (SchemaDefs::MaxBootPosition > 9)
     701        {
     702            AssertMsgFailed (("Too many boot devices %d\n",
     703                              SchemaDefs::MaxBootPosition));
     704            return VERR_INVALID_PARAMETER;
     705        }
     706
     707        for (ULONG pos = 1; pos <= SchemaDefs::MaxBootPosition; ++pos)
     708        {
     709            hrc = pMachine->GetBootOrder(pos, &bootDevice);                             H();
     710
     711            char szParamName[] = "BootDeviceX";
     712            szParamName[sizeof (szParamName) - 2] = ((char (pos - 1)) + '0');
     713
     714            const char *pszBootDevice;
     715            switch (bootDevice)
     716            {
     717                case DeviceType_Null:
     718                    pszBootDevice = "NONE";
     719                    break;
     720                case DeviceType_HardDisk:
     721                    pszBootDevice = "IDE";
     722                    break;
     723                case DeviceType_DVD:
     724                    pszBootDevice = "DVD";
     725                    break;
     726                case DeviceType_Floppy:
     727                    pszBootDevice = "FLOPPY";
     728                    break;
     729                case DeviceType_Network:
     730                    pszBootDevice = "LAN";
     731                    break;
     732                default:
     733                    AssertMsgFailed(("Invalid bootDevice=%d\n", bootDevice));
     734                    return VMSetError(pVM, VERR_INVALID_PARAMETER, RT_SRC_POS,
     735                                      N_("Invalid boot device '%d'"), bootDevice);
     736            }
     737            rc = CFGMR3InsertString(pBiosCfg, szParamName, pszBootDevice);              RC_CHECK();
     738        }
     739    }
     740    else
     741    {
     742        /*
     743         * EFI.
     744         */
     745        rc = CFGMR3InsertNode(pDevices, "efi", &pDev);                              RC_CHECK();
     746        rc = CFGMR3InsertNode(pDev,     "0", &pInst);                               RC_CHECK();
     747        rc = CFGMR3InsertInteger(pInst, "Trusted", 1);              /* boolean */   RC_CHECK();
     748        rc = CFGMR3InsertNode(pInst,    "Config", &pCfg);                           RC_CHECK();
     749        rc = CFGMR3InsertInteger(pCfg,  "RamSize",          cbRam);                 RC_CHECK();
     750        rc = CFGMR3InsertInteger(pCfg,  "RamHoleSize",      cbRamHole);             RC_CHECK();
     751        rc = CFGMR3InsertInteger(pCfg,  "NumCPUs",          cCpus);                 RC_CHECK();
     752    }
    658753
    659754    /*
     
    18091904    }
    18101905
    1811     /*
    1812      * Firmware.
    1813      */
    1814 #ifdef VBOX_WITH_EFI
    1815     Bstr tmpStr1;
    1816     hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/UseEFI"), tmpStr1.asOutParam());    H();
    1817     BOOL fEfiEnabled = !tmpStr1.isEmpty();
    1818 
    1819     /**
    1820      * @todo: VBoxInternal2/UseEFI extradata will go away soon, and we'll
    1821      *        just use this code
    1822      */
    1823     if (!fEfiEnabled)
    1824     {
    1825       FirmwareType_T eType =  FirmwareType_BIOS;
    1826       hrc = pMachine->COMGETTER(FirmwareType)(&eType);                                H();
    1827       fEfiEnabled = (eType == FirmwareType_EFI);
    1828     }
    1829 #else
    1830     BOOL fEfiEnabled = false;
    1831 #endif
    1832     if (!fEfiEnabled)
    1833     {
    1834         /*
    1835          * PC Bios.
    1836          */
    1837         rc = CFGMR3InsertNode(pDevices, "pcbios", &pDev);                               RC_CHECK();
    1838         rc = CFGMR3InsertNode(pDev,     "0", &pInst);                                   RC_CHECK();
    1839         rc = CFGMR3InsertInteger(pInst, "Trusted",              1);     /* boolean */   RC_CHECK();
    1840         rc = CFGMR3InsertNode(pInst,    "Config", &pBiosCfg);                           RC_CHECK();
    1841         rc = CFGMR3InsertInteger(pBiosCfg,  "RamSize",              cbRam);             RC_CHECK();
    1842         rc = CFGMR3InsertInteger(pBiosCfg,  "RamHoleSize",          cbRamHole);         RC_CHECK();
    1843         rc = CFGMR3InsertInteger(pBiosCfg,  "NumCPUs",              cCpus);             RC_CHECK();
    1844         rc = CFGMR3InsertString(pBiosCfg,   "HardDiskDevice",       "piix3ide");        RC_CHECK();
    1845         rc = CFGMR3InsertString(pBiosCfg,   "FloppyDevice",         "i82078");          RC_CHECK();
    1846         rc = CFGMR3InsertInteger(pBiosCfg,  "IOAPIC",               fIOAPIC);           RC_CHECK();
    1847         rc = CFGMR3InsertInteger(pBiosCfg,  "PXEDebug",             fPXEDebug);         RC_CHECK();
    1848         rc = CFGMR3InsertBytes(pBiosCfg,    "UUID", pUuid, sizeof(*pUuid));             RC_CHECK();
    1849 
    1850         DeviceType_T bootDevice;
    1851         if (SchemaDefs::MaxBootPosition > 9)
    1852         {
    1853             AssertMsgFailed (("Too many boot devices %d\n",
    1854                               SchemaDefs::MaxBootPosition));
    1855             return VERR_INVALID_PARAMETER;
    1856         }
    1857 
    1858         for (ULONG pos = 1; pos <= SchemaDefs::MaxBootPosition; ++pos)
    1859         {
    1860             hrc = pMachine->GetBootOrder(pos, &bootDevice);                             H();
    1861 
    1862             char szParamName[] = "BootDeviceX";
    1863             szParamName[sizeof (szParamName) - 2] = ((char (pos - 1)) + '0');
    1864 
    1865             const char *pszBootDevice;
    1866             switch (bootDevice)
    1867             {
    1868                 case DeviceType_Null:
    1869                     pszBootDevice = "NONE";
    1870                     break;
    1871                 case DeviceType_HardDisk:
    1872                     pszBootDevice = "IDE";
    1873                     break;
    1874                 case DeviceType_DVD:
    1875                     pszBootDevice = "DVD";
    1876                     break;
    1877                 case DeviceType_Floppy:
    1878                     pszBootDevice = "FLOPPY";
    1879                     break;
    1880                 case DeviceType_Network:
    1881                     pszBootDevice = "LAN";
    1882                     break;
    1883                 default:
    1884                     AssertMsgFailed(("Invalid bootDevice=%d\n", bootDevice));
    1885                     return VMSetError(pVM, VERR_INVALID_PARAMETER, RT_SRC_POS,
    1886                                       N_("Invalid boot device '%d'"), bootDevice);
    1887             }
    1888             rc = CFGMR3InsertString(pBiosCfg, szParamName, pszBootDevice);              RC_CHECK();
    1889         }
    1890     }
    1891     else
    1892     {
    1893         /*
    1894          * EFI.
    1895          */
    1896         rc = CFGMR3InsertNode(pDevices, "efi", &pDev);                              RC_CHECK();
    1897         rc = CFGMR3InsertNode(pDev,     "0", &pInst);                               RC_CHECK();
    1898         rc = CFGMR3InsertInteger(pInst, "Trusted", 1);              /* boolean */   RC_CHECK();
    1899         rc = CFGMR3InsertNode(pInst,    "Config", &pCfg);                           RC_CHECK();
    1900         rc = CFGMR3InsertInteger(pCfg,  "RamSize",          cbRam);                 RC_CHECK();
    1901         rc = CFGMR3InsertInteger(pCfg,  "RamHoleSize",      cbRamHole);             RC_CHECK();
    1902         rc = CFGMR3InsertInteger(pCfg,  "NumCPUs",          cCpus);                 RC_CHECK();
    1903     }
    1904 
    19051906#undef STR_FREE
    19061907#undef H
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette