VirtualBox

Changeset 7556 in vbox


Ignore:
Timestamp:
Mar 25, 2008 4:05:17 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
29037
Message:

AHCI/Main/VBoxManage: Add configuration parameter to set the number of ports on the sata controller. FreeBSD cannot handle more than 8 and would crash otherwise. Also adds the previously forgotten BIOS configuration parameters for booting from SATA

Location:
trunk/src/VBox
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp

    r7525 r7556  
    412412#ifdef VBOX_WITH_AHCI
    413413        RTPrintf("                            [-sata on|off]\n"
     414                 "                            [-sataportcount <1-30>]\n"
    414415                 "                            [-sataport<1-30> none|<uuid>|<filename>]\n"
    415416                 "                            [-sataideemulation hda|hdb|hdc|hdd <1-30>]\n");
     
    37373738    ULONG guestStatInterval = (ULONG)-1;
    37383739    int   fSataEnabled = -1;
     3740    int   sataPortCount = -1;
    37393741    int   sataBootDevices[4] = {-1,-1,-1,-1};
    37403742
     
    43604362            else
    43614363                return errorArgument("Invalid -usb argument '%s'", argv[i]);
     4364        }
     4365        else if (strcmp(argv[i], "-sataportcount") == 0)
     4366        {
     4367            unsigned n;
     4368
     4369            if (argc <= i + 1)
     4370            {
     4371                return errorArgument("Missing arguments to '%s'", argv[i]);
     4372            }
     4373            i++;
     4374
     4375            n = parseNum(argv[i], 30, "SATA");
     4376            if (!n)
     4377                return 1;
     4378            sataPortCount = n;
    43624379        }
    43634380        else if (strncmp(argv[i], "-sataport", 9) == 0)
     
    54525469        }
    54535470
     5471        if (sataPortCount != -1)
     5472        {
     5473            ComPtr<ISATAController> SataCtl;
     5474            CHECK_ERROR(machine, COMGETTER(SATAController)(SataCtl.asOutParam()));
     5475            if (SUCCEEDED(rc))
     5476            {
     5477                CHECK_ERROR(SataCtl, COMSETTER(PortCount)(sataPortCount));
     5478            }
     5479        }
     5480
    54545481        /* commit changes */
    54555482        CHECK_ERROR(machine, SaveSettings());
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r7525 r7556  
    225225    PCFGMNODE pIdeInst = NULL;      /* /Devices/piix3ide/0/ */
    226226    PCFGMNODE pSataInst = NULL;     /* /Devices/ahci/0/ */
     227        PCFGMNODE pBiosCfg = NULL;      /* /Devices/pcbios/0/Config/ */
    227228
    228229    rc = CFGMR3InsertNode(pRoot, "Devices", &pDevices);                             RC_CHECK();
     
    242243    rc = CFGMR3InsertNode(pDev,     "0", &pInst);                                   RC_CHECK();
    243244    rc = CFGMR3InsertInteger(pInst, "Trusted",              1);     /* boolean */   RC_CHECK();
    244     rc = CFGMR3InsertNode(pInst,    "Config", &pCfg);                               RC_CHECK();
    245     rc = CFGMR3InsertInteger(pCfg,  "RamSize",              cRamMBs * _1M);         RC_CHECK();
    246     rc = CFGMR3InsertString(pCfg,   "HardDiskDevice",       "piix3ide");            RC_CHECK();
    247     rc = CFGMR3InsertString(pCfg,   "FloppyDevice",         "i82078");              RC_CHECK();
    248     rc = CFGMR3InsertInteger(pCfg,  "IOAPIC",               fIOAPIC);               RC_CHECK();
    249     rc = CFGMR3InsertInteger(pCfg,  "PXEDebug",             fPXEDebug);             RC_CHECK();
    250     rc = CFGMR3InsertBytes(pCfg,    "UUID", pUuid, sizeof(*pUuid));                 RC_CHECK();
     245    rc = CFGMR3InsertNode(pInst,    "Config", &pBiosCfg);                           RC_CHECK();
     246    rc = CFGMR3InsertInteger(pBiosCfg,  "RamSize",              cRamMBs * _1M);     RC_CHECK();
     247    rc = CFGMR3InsertString(pBiosCfg,   "HardDiskDevice",       "piix3ide");        RC_CHECK();
     248    rc = CFGMR3InsertString(pBiosCfg,   "FloppyDevice",         "i82078");          RC_CHECK();
     249    rc = CFGMR3InsertInteger(pBiosCfg,  "IOAPIC",               fIOAPIC);           RC_CHECK();
     250    rc = CFGMR3InsertInteger(pBiosCfg,  "PXEDebug",             fPXEDebug);         RC_CHECK();
     251    rc = CFGMR3InsertBytes(pBiosCfg,    "UUID", pUuid, sizeof(*pUuid));             RC_CHECK();
    251252
    252253    DeviceType_T bootDevice;
     
    287288                return VERR_INVALID_PARAMETER;
    288289        }
    289         rc = CFGMR3InsertString(pCfg, szParamName, pszBootDevice);                 RC_CHECK();
     290        rc = CFGMR3InsertString(pBiosCfg, szParamName, pszBootDevice);              RC_CHECK();
    290291    }
    291292
     
    295296    BOOL fFadeIn;
    296297    hrc = biosSettings->COMGETTER(LogoFadeIn)(&fFadeIn);                            H();
    297     rc = CFGMR3InsertInteger(pCfg,  "FadeIn",  fFadeIn ? 1 : 0);                    RC_CHECK();
     298    rc = CFGMR3InsertInteger(pBiosCfg,  "FadeIn",  fFadeIn ? 1 : 0);                RC_CHECK();
    298299    BOOL fFadeOut;
    299300    hrc = biosSettings->COMGETTER(LogoFadeOut)(&fFadeOut);                          H();
    300     rc = CFGMR3InsertInteger(pCfg,  "FadeOut", fFadeOut ? 1: 0);                    RC_CHECK();
     301    rc = CFGMR3InsertInteger(pBiosCfg,  "FadeOut", fFadeOut ? 1: 0);                RC_CHECK();
    301302    ULONG logoDisplayTime;
    302303    hrc = biosSettings->COMGETTER(LogoDisplayTime)(&logoDisplayTime);               H();
    303     rc = CFGMR3InsertInteger(pCfg,  "LogoTime", logoDisplayTime);                   RC_CHECK();
     304    rc = CFGMR3InsertInteger(pBiosCfg,  "LogoTime", logoDisplayTime);               RC_CHECK();
    304305    Bstr logoImagePath;
    305306    hrc = biosSettings->COMGETTER(LogoImagePath)(logoImagePath.asOutParam());       H();
    306     rc = CFGMR3InsertString(pCfg,   "LogoFile", logoImagePath ? Utf8Str(logoImagePath) : ""); RC_CHECK();
     307    rc = CFGMR3InsertString(pBiosCfg,   "LogoFile", logoImagePath ? Utf8Str(logoImagePath) : ""); RC_CHECK();
    307308
    308309    /*
     
    323324            value = 2;
    324325    }
    325     rc = CFGMR3InsertInteger(pCfg, "ShowBootMenu", value);                          RC_CHECK();
     326    rc = CFGMR3InsertInteger(pBiosCfg, "ShowBootMenu", value);                      RC_CHECK();
    326327
    327328    /*
     
    604605        if (enabled)
    605606        {
     607            ULONG nrPorts = 0;
     608
    606609            rc = CFGMR3InsertNode(pDevices, "ahci", &pDev);                             RC_CHECK();
    607610            rc = CFGMR3InsertNode(pDev,     "0", &pSataInst);                           RC_CHECK();
     
    613616            rc = CFGMR3InsertNode(pSataInst,    "Config", &pCfg);                       RC_CHECK();
    614617
     618            hrc = sataController->COMGETTER(PortCount)(&nrPorts);                       H();
     619            rc = CFGMR3InsertInteger(pCfg, "PortCount", nrPorts);                       RC_CHECK();
     620
     621            /* Needed configuration values for the bios. */
     622            rc = CFGMR3InsertString(pBiosCfg, "SataHardDiskDevice", "ahci");            RC_CHECK();
     623
    615624            for (uint32_t i = 0; i < 4; i++)
    616625            {
    617626                const char *g_apszConfig[] =
    618627                    { "PrimaryMaster", "PrimarySlave", "SecondaryMaster", "SecondarySlave" };
     628                const char *g_apszBiosConfig[] =
     629                    { "SataPrimaryMasterLUN", "SataPrimarySlaveLUN", "SataSecondaryMasterLUN", "SataSecondarySlaveLUN" };
    619630                LONG aPortNumber;
    620631
    621632                hrc = sataController->GetIDEEmulationPort(i, &aPortNumber);             H();
    622633                rc = CFGMR3InsertInteger(pCfg, g_apszConfig[i], aPortNumber);           RC_CHECK();
    623             }
     634                rc = CFGMR3InsertInteger(pBiosCfg, g_apszBiosConfig[i], aPortNumber);   RC_CHECK();
     635            }
     636
    624637        }
    625638    }
  • trunk/src/VBox/Main/SATAControllerImpl.cpp

    r7457 r7556  
    212212}
    213213
    214 // ISATAController methods
    215 /////////////////////////////////////////////////////////////////////////////
    216 
    217 STDMETHODIMP SATAController::GetIDEEmulationPort(LONG DevicePosition, LONG *aPortNumber)
    218 {
    219     if (!aPortNumber)
     214STDMETHODIMP SATAController::COMGETTER(PortCount) (ULONG *aPortCount)
     215{
     216    if (!aPortCount)
    220217        return E_POINTER;
    221218
     
    223220    CheckComRCReturnRC (autoCaller.rc());
    224221
    225     switch (DevicePosition)
    226     {
    227         case 0:
    228             *aPortNumber = mData->mPortIde0Master;
    229             break;
    230         case 1:
    231             *aPortNumber = mData->mPortIde0Slave;
    232             break;
    233         case 2:
    234             *aPortNumber = mData->mPortIde1Master;
    235             break;
    236         case 3:
    237             *aPortNumber = mData->mPortIde1Slave;
    238             break;
    239         default:
    240             return E_INVALIDARG;
    241     }
    242 
    243     return S_OK;
    244 }
    245 
    246 STDMETHODIMP SATAController::SetIDEEmulationPort(LONG DevicePosition, LONG aPortNumber)
    247 {
     222    AutoReaderLock alock (this);
     223
     224    *aPortCount = mData->mPortCount;
     225
     226    return S_OK;
     227}
     228
     229
     230STDMETHODIMP SATAController::COMSETTER(PortCount) (ULONG aPortCount)
     231{
     232    LogFlowThisFunc (("aPortCount=%u\n", aPortCount));
     233
    248234    AutoCaller autoCaller (this);
    249235    CheckComRCReturnRC (autoCaller.rc());
     
    252238    Machine::AutoMutableStateDependency adep (mParent);
    253239    CheckComRCReturnRC (adep.rc());
     240
     241    AutoLock alock (this);
     242
     243    if (mData->mPortCount != aPortCount)
     244    {
     245        mData.backup();
     246        mData->mPortCount = aPortCount;
     247
     248        /* leave the lock for safety */
     249        alock.leave();
     250
     251        mParent->onSATAControllerChange();
     252    }
     253
     254    return S_OK;
     255}
     256
     257// ISATAController methods
     258/////////////////////////////////////////////////////////////////////////////
     259
     260STDMETHODIMP SATAController::GetIDEEmulationPort(LONG DevicePosition, LONG *aPortNumber)
     261{
     262    if (!aPortNumber)
     263        return E_POINTER;
     264
     265    AutoCaller autoCaller (this);
     266    CheckComRCReturnRC (autoCaller.rc());
     267
     268    switch (DevicePosition)
     269    {
     270        case 0:
     271            *aPortNumber = mData->mPortIde0Master;
     272            break;
     273        case 1:
     274            *aPortNumber = mData->mPortIde0Slave;
     275            break;
     276        case 2:
     277            *aPortNumber = mData->mPortIde1Master;
     278            break;
     279        case 3:
     280            *aPortNumber = mData->mPortIde1Slave;
     281            break;
     282        default:
     283            return E_INVALIDARG;
     284    }
     285
     286    return S_OK;
     287}
     288
     289STDMETHODIMP SATAController::SetIDEEmulationPort(LONG DevicePosition, LONG aPortNumber)
     290{
     291    AutoCaller autoCaller (this);
     292    CheckComRCReturnRC (autoCaller.rc());
     293
     294    /* the machine needs to be mutable */
     295    Machine::AutoMutableStateDependency adep (mParent);
     296    CheckComRCReturnRC (adep.rc());
    254297    AutoLock alock (this);
    255298
     
    274317    return S_OK;
    275318}
    276 
    277319
    278320// public methods only for internal purposes
     
    304346    mData->mEnabled = controller.value <bool> ("enabled");
    305347
     348    /* number of useable ports */
     349    mData->mPortCount = controller.valueOr <ULONG> ("PortCount", 30);
     350
    306351    /* ide emulation settings (optional, default to 0,1,2,3 respectively) */
    307352    mData->mPortIde0Master = controller.value <ULONG> ("IDE0MasterEmulationPort");
     
    340385    /* enabled */
    341386    controller.setValue <bool> ("enabled", !!mData->mEnabled);
     387
     388    /* number of useable ports */
     389    controller.setValue <ULONG> ("PortCount", mData->mPortCount);
    342390
    343391    /* ide emulation settings */
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r7525 r7556  
    97759775    </attribute>
    97769776
     9777    <attribute name="portCount" type="unsigned long">
     9778      <desc>
     9779        The number of usable ports on the sata controller.
     9780        It ranges from 1 to 30.
     9781      </desc>
     9782    </attribute>
     9783
    97779784    <method name="GetIDEEmulationPort">
    97789785      <desc>Gets the corresponding port number which is emulated as an IDE device.</desc>
  • trunk/src/VBox/Main/include/SATAControllerImpl.h

    r7442 r7556  
    3939        /* Constructor. */
    4040        Data() : mEnabled (FALSE),
     41                 mPortCount (30),
    4142                 mPortIde0Master (0),
    4243                 mPortIde0Slave (1),
     
    4748        {
    4849            return this == &that || ((mEnabled == that.mEnabled) &&
     50                    (mPortCount      == mPortCount) &&
    4951                    (mPortIde0Master == that.mPortIde0Master) &&
    5052                    (mPortIde0Slave  == that.mPortIde0Slave)  &&
     
    5557        /** Enabled indicator. */
    5658        BOOL  mEnabled;
     59        /** Number of usable ports. */
     60        ULONG mPortCount;
    5761        /** Port which acts as primary master for ide emulation. */
    5862        ULONG mPortIde0Master;
     
    9498    STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled);
    9599    STDMETHOD(COMSETTER(Enabled)) (BOOL aEnabled);
     100    STDMETHOD(COMGETTER(PortCount)) (ULONG *aPortCount);
     101    STDMETHOD(COMSETTER(PortCount)) (ULONG aPortCount);
    96102
    97103    // ISATAController methods
  • trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd

    r7466 r7556  
    650650<xsd:complexType name="TSATAController">
    651651  <xsd:attribute name="enabled" type="xsd:boolean" use="required"/>
    652   <xsd:attribute name="IDE0MasterEmulationPort" type="xsd:unsignedInt" default="0"/>
    653   <xsd:attribute name="IDE0SlaveEmulationPort" type="xsd:unsignedInt" default="1"/>
    654   <xsd:attribute name="IDE1MasterEmulationPort" type="xsd:unsignedInt" default="2"/>
    655   <xsd:attribute name="IDE1SlaveEmulationPort" type="xsd:unsignedInt" default="3"/>
     652  <xsd:attribute name="IDE0MasterEmulationPort"    type="xsd:unsignedInt" default="0"/>
     653  <xsd:attribute name="IDE0SlaveEmulationPort"     type="xsd:unsignedInt" default="1"/>
     654  <xsd:attribute name="IDE1MasterEmulationPort"    type="xsd:unsignedInt" default="2"/>
     655  <xsd:attribute name="IDE1SlaveEmulationPort"     type="xsd:unsignedInt" default="3"/>
     656  <xsd:attribute name="PortCount"                  type="xsd:unsignedInt" default="30"/>
    656657</xsd:complexType>
    657658
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