VirtualBox

Changeset 5361

Show
Ignore:
Timestamp:
10/17/07 19:11:26 (1 year ago)
Author:
vboxsync
Message:

Added option to emulate PIIX4 IDE controller. Defaults to PIIX4 for new VMs
and to PIIX3 when no setting is present in XML.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/VBox/Devices/Bus/DevPCI.cpp

    r4787 r5361  
    772772    { 
    773773    case 0x0101: 
    774         if (vendor_id == 0x8086 && device_id == 0x7010) { 
    775             /* PIIX3 IDE */ 
     774        if (vendor_id == 0x8086 &&  
     775            (device_id == 0x7010 || device_id == 0x7111)) { 
     776            /* PIIX3 or PIIX4 IDE */ 
    776777            pci_config_writew(d, 0x40, 0x8000); /* enable IDE0 */ 
    777778            pci_config_writew(d, 0x42, 0x8000); /* enable IDE1 */ 
  • trunk/src/VBox/Devices/Storage/DevATA.cpp

    r4787 r5361  
    6969 * The SSM saved state version. 
    7070 */ 
    71 #define ATA_SAVED_STATE_VERSION 15 
     71#define ATA_SAVED_STATE_VERSION 16 
    7272 
    7373/** The maximum number of release log entries per device. */ 
     
    378378    /** Flag whether R0 is enabled. */ 
    379379    bool                fR0Enabled; 
     380    /** Flag indicating whether PIIX4 or PIIX3 is being emulated. */ 
     381    bool                fPIIX4; 
    380382    bool                Alignment0[HC_ARCH_BITS == 64 ? 6 : 2]; /**< Align the struct size. */ 
    381383} PCIATAState; 
     
    57615763        } 
    57625764    } 
     5765    SSMR3PutBool(pSSMHandle, pData->fPIIX4); 
    57635766 
    57645767    return SSMR3PutU32(pSSMHandle, ~0); /* sanity/terminator */ 
     
    58805883        } 
    58815884    } 
     5885    SSMR3GetBool(pSSMHandle, &pData->fPIIX4); 
    58825886 
    58835887    rc = SSMR3GetU32(pSSMHandle, &u32); 
     
    59225926     * Validate and read configuration. 
    59235927     */ 
    5924     if (!CFGMR3AreValuesValid(pCfgHandle, "GCEnabled\0IRQDelay\0R0Enabled\0")) 
     5928    if (!CFGMR3AreValuesValid(pCfgHandle, "GCEnabled\0IRQDelay\0R0Enabled\0PIIX4\0")) 
    59255929        return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, 
    59265930                                N_("PIIX3 configuration error: unknown option specified.")); 
     
    59515955    Assert(DelayIRQMillies < 50); 
    59525956 
     5957    rc = CFGMR3QueryBool(pCfgHandle, "PIIX4", &pData->fPIIX4); 
     5958    if (rc == VERR_CFGM_VALUE_NOT_FOUND) 
     5959        pData->fPIIX4 = false; 
     5960    else if (VBOX_FAILURE(rc)) 
     5961        return PDMDEV_SET_ERROR(pDevIns, rc, 
     5962                                N_("PIIX3 configuration error: failed to read PIIX4 as boolean.")); 
     5963    Log(("%s: fPIIX4=%d\n", __FUNCTION__, pData->fPIIX4)); 
     5964 
    59535965    /* 
    59545966     * Initialize data (most of it anyway). 
     
    59615973    pData->dev.config[0x00] = 0x86; /* Vendor: Intel */ 
    59625974    pData->dev.config[0x01] = 0x80; 
    5963     pData->dev.config[0x02] = 0x10; /* Device: PIIX3 IDE */ 
    5964     pData->dev.config[0x03] = 0x70; 
     5975    if (pData->fPIIX4)  
     5976    { 
     5977        pData->dev.config[0x02] = 0x11; /* Device: PIIX4 IDE */ 
     5978        pData->dev.config[0x03] = 0x71; 
     5979        pData->dev.config[0x08] = 0x01; /* Revision: PIIX4E */ 
     5980        pData->dev.config[0x48] = 0x00; /* UDMACTL */ 
     5981        pData->dev.config[0x4A] = 0x00; /* UDMATIM */ 
     5982        pData->dev.config[0x4B] = 0x00; 
     5983    } 
     5984    else 
     5985    { 
     5986        pData->dev.config[0x02] = 0x10; /* Device: PIIX3 IDE */ 
     5987        pData->dev.config[0x03] = 0x70; 
     5988    } 
    59655989    pData->dev.config[0x04] = PCI_COMMAND_IOACCESS | PCI_COMMAND_MEMACCESS | PCI_COMMAND_BUSMASTER; 
    59665990    pData->dev.config[0x09] = 0x8a; /* programming interface = PCI_IDE bus master is supported */ 
  • trunk/src/VBox/Main/BIOSSettingsImpl.cpp

    r5171 r5361  
    405405} 
    406406 
     407STDMETHODIMP BIOSSettings::COMGETTER(IDEControllerType)(IDEControllerType_T *aControllerType) 
     408{ 
     409    if (!aControllerType) 
     410        return E_POINTER; 
     411 
     412    AutoCaller autoCaller (this); 
     413    CheckComRCReturnRC (autoCaller.rc()); 
     414 
     415    AutoReaderLock alock (this); 
     416 
     417    *aControllerType = mData->mIDEControllerType; 
     418 
     419    return S_OK; 
     420} 
     421 
     422STDMETHODIMP BIOSSettings::COMSETTER(IDEControllerType)(IDEControllerType_T aControllerType) 
     423{ 
     424    AutoCaller autoCaller (this); 
     425    CheckComRCReturnRC (autoCaller.rc()); 
     426 
     427    /* the machine needs to be mutable */ 
     428    Machine::AutoMutableStateDependency adep (mParent); 
     429    CheckComRCReturnRC (adep.rc()); 
     430 
     431    AutoLock alock (this); 
     432 
     433    /* make sure the value is allowed */ 
     434    switch (aControllerType) 
     435    { 
     436        case IDEControllerType_IDEControllerPIIX3: 
     437        case IDEControllerType_IDEControllerPIIX4: 
     438            break; 
     439        default: 
     440            return setError (E_FAIL, 
     441                tr("Invalid IDE controller type '%d'"), 
     442                aControllerType); 
     443    }     
     444 
     445    mData.backup(); 
     446 
     447    mData->mIDEControllerType = aControllerType; 
     448 
     449    return S_OK; 
     450} 
     451 
    407452STDMETHODIMP BIOSSettings::COMGETTER(TimeOffset)(LONG64 *offset) 
    408453{ 
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r5332 r5361  
    174174 
    175175    /* 
     176     * Virtual IDE controller type. 
     177     */ 
     178    IDEControllerType_T controllerType; 
     179    BOOL fPIIX4; 
     180    hrc = biosSettings->COMGETTER(IDEControllerType)(&controllerType);               H(); 
     181    switch (controllerType) 
     182    { 
     183        case IDEControllerType_IDEControllerPIIX3: 
     184            fPIIX4 = FALSE; 
     185            break; 
     186        case IDEControllerType_IDEControllerPIIX4: 
     187            fPIIX4 = TRUE; 
     188            break; 
     189        default: 
     190            AssertMsgFailed(("Invalid IDE controller type '%d'", controllerType)); 
     191            return VERR_INVALID_PARAMETER; 
     192    } 
     193 
     194    /* 
    176195     * PDM config. 
    177196     *  Load drivers in VBoxC.[so|dll] 
     
    553572    rc = CFGMR3InsertInteger(pInst, "PCIFunctionNo",        1);                     RC_CHECK(); 
    554573    rc = CFGMR3InsertNode(pInst,    "Config", &pCfg);                               RC_CHECK(); 
     574    rc = CFGMR3InsertInteger(pCfg,  "PIIX4", fPIIX4);               /* boolean */   RC_CHECK(); 
    555575 
    556576    /* Attach the status driver */ 
  • trunk/src/VBox/Main/MachineImpl.cpp

    r5292 r5361  
    44124412                } 
    44134413            } 
     4414 
     4415            /* IDE controller type (optional, defaults to PIIX3) */ 
     4416            { 
     4417                CFGNODE ideControllerNode = 0; 
     4418                IDEControllerType_T controllerType = IDEControllerType_IDEControllerPIIX3; 
     4419                CFGLDRGetChildNode (biosNode, "IDEController", 0, &ideControllerNode); 
     4420                if (ideControllerNode) 
     4421                { 
     4422                    Bstr IDEControllerType; 
     4423 
     4424                    CFGLDRQueryBSTR (ideControllerNode, "type", IDEControllerType.asOutParam()); 
     4425                    ComAssertBreak (IDEControllerType, rc = E_FAIL); 
     4426 
     4427                    if (IDEControllerType.compare(Bstr("PIIX3")) == 0) 
     4428                        controllerType = IDEControllerType_IDEControllerPIIX3; 
     4429                    else if (IDEControllerType.compare(Bstr("PIIX4")) == 0) 
     4430                        controllerType = IDEControllerType_IDEControllerPIIX4; 
     4431                    else 
     4432                        ComAssertBreak (0, rc = E_FAIL); 
     4433 
     4434                    CFGLDRReleaseNode (ideControllerNode); 
     4435                } 
     4436                mBIOSSettings->COMSETTER(IDEControllerType)(controllerType); 
     4437            } 
     4438 
    44144439        } 
    44154440        while (0); 
     
    63346359            CFGLDRSetBool (pxedebugNode, "enabled", !!fSet); 
    63356360            CFGLDRReleaseNode (pxedebugNode); 
     6361 
     6362            /* IDE controller type */ 
     6363            CFGNODE ideControllerNode = 0; 
     6364            IDEControllerType_T controllerType; 
     6365            CFGLDRCreateChildNode (biosNode, "IDEController", &ideControllerNode); 
     6366            mBIOSSettings->COMGETTER(IDEControllerType)(&controllerType); 
     6367            switch (controllerType) 
     6368            { 
     6369                case IDEControllerType_IDEControllerPIIX3: 
     6370                    CFGLDRSetString (ideControllerNode, "type", "PIIX3"); 
     6371                    break; 
     6372                case IDEControllerType_IDEControllerPIIX4: 
     6373                    CFGLDRSetString (ideControllerNode, "type", "PIIX4"); 
     6374                    break; 
     6375                default: 
     6376                    ComAssertMsgFailedBreak (("Invalid IDE Controller type: %d\n", 
     6377                                              controllerType), rc = E_FAIL); 
     6378            } 
     6379            CFGLDRReleaseNode (ideControllerNode); 
    63366380 
    63376381        } 
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r5292 r5361  
    20422042  </enum> 
    20432043 
     2044  <enum 
     2045     name="IDEControllerType" 
     2046     uuid="445330e3-202a-4dab-854f-ce22e6cb9715" 
     2047     > 
     2048    <const name="InvalidIDEControllerType"       value="0"/> 
     2049    <const name="IDEControllerPIIX3"             value="1"/> 
     2050    <const name="IDEControllerPIIX4"             value="2"/> 
     2051  </enum> 
     2052 
    20442053  <interface 
    20452054     name="IBIOSSettings" extends="$unknown" 
     
    20922101        PXE debug logging flag. If set, VirtualBox will write extensive 
    20932102        PXE trace information to the release log. 
     2103      </desc> 
     2104    </attribute> 
     2105 
     2106    <attribute name="IDEControllerType" type="IDEControllerType"> 
     2107      <desc> 
     2108        Type of the virtual IDE controller. Depending on this value, 
     2109        VirtualBox will provide different virtual IDE hardware 
     2110        devices to the guest. 
    20942111      </desc> 
    20952112    </attribute> 
  • trunk/src/VBox/Main/include/BIOSSettingsImpl.h

    r5171 r5361  
    4343            mPXEDebugEnabled = false; 
    4444            mTimeOffset = 0; 
     45            mIDEControllerType = IDEControllerType_IDEControllerPIIX4; 
    4546        } 
    4647 
     
    5960        } 
    6061 
    61         BOOL               mLogoFadeIn; 
    62         BOOL               mLogoFadeOut; 
    63         ULONG              mLogoDisplayTime; 
    64         Bstr               mLogoImagePath; 
    65         BIOSBootMenuMode_T mBootMenuMode; 
    66         BOOL               mACPIEnabled; 
    67         BOOL               mIOAPICEnabled; 
    68         BOOL               mPXEDebugEnabled; 
    69         LONG64             mTimeOffset; 
     62        BOOL                mLogoFadeIn; 
     63        BOOL                mLogoFadeOut; 
     64        ULONG               mLogoDisplayTime; 
     65        Bstr                mLogoImagePath; 
     66        BIOSBootMenuMode_T  mBootMenuMode; 
     67        BOOL                mACPIEnabled; 
     68        BOOL                mIOAPICEnabled; 
     69        BOOL                mPXEDebugEnabled; 
     70        LONG64              mTimeOffset; 
     71        IDEControllerType_T mIDEControllerType; 
    7072    }; 
    7173 
     
    106108    STDMETHOD(COMGETTER(PXEDebugEnabled))(BOOL *enabled); 
    107109    STDMETHOD(COMSETTER(PXEDebugEnabled))(BOOL enable); 
     110    STDMETHOD(COMGETTER(IDEControllerType))(IDEControllerType_T *controllerType); 
     111    STDMETHOD(COMSETTER(IDEControllerType))(IDEControllerType_T controllerType); 
    108112    STDMETHOD(COMGETTER)(TimeOffset)(LONG64 *offset); 
    109113    STDMETHOD(COMSETTER)(TimeOffset)(LONG64 offset); 
  • trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd

    r5171 r5361  
    189189      <xsd:enumeration value="messageandmenu"/> 
    190190    </xsd:restriction> 
     191</xsd:simpleType> 
     192 
     193<xsd:simpleType name="TIDEControllerType"> 
     194  <xsd:restriction base="xsd:string"> 
     195    <xsd:enumeration value="PIIX3"/> 
     196    <xsd:enumeration value="PIIX4"/> 
     197  </xsd:restriction> 
    191198</xsd:simpleType> 
    192199 
     
    470477      </xsd:complexType> 
    471478    </xsd:element> 
     479    <xsd:element name="IDEController" minOccurs="0"> 
     480      <xsd:complexType> 
     481          <xsd:attribute name="type" use="required" type="TIDEControllerType"/> 
     482      </xsd:complexType> 
     483    </xsd:element> 
    472484  </xsd:all> 
    473485</xsd:complexType> 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy