VirtualBox

Changeset 16745 in vbox for trunk/src/VBox/Devices/Storage


Ignore:
Timestamp:
Feb 13, 2009 3:53:00 PM (16 years ago)
Author:
vboxsync
Message:

add rudimentary support for ICH6 IDE controller

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DevATA.cpp

    r16708 r16745  
    3030 * The SSM saved state versions.
    3131 */
    32 #define ATA_SAVED_STATE_VERSION 18
     32#define ATA_SAVED_STATE_VERSION 19
     33#define ATA_SAVED_STATE_VERSION_WITH_BOOL_TYPE     18
    3334#define ATA_SAVED_STATE_VERSION_WITHOUT_FULL_SENSE 16
    3435#define ATA_SAVED_STATE_VERSION_WITHOUT_EVENT_STATUS 17
     
    422423} ATACONTROLLER, *PATACONTROLLER;
    423424
     425typedef enum CHIPSET
     426{
     427    /** PIIX3 chipset, must be 0 for saved state compatibility */
     428    CHIPSET_PIIX3 = 0,
     429    /** PIIX4 chipset, must be 1 for saved state compatibility */
     430    CHIPSET_PIIX4 = 1,
     431    /** ICH6 chipset */
     432    CHIPSET_ICH6 = 2
     433} CHIPSET;
     434
    424435typedef struct PCIATAState {
    425436    PCIDEVICE           dev;
     
    438449    /** Flag whether R0 is enabled. */
    439450    bool                fR0Enabled;
    440     /** Flag indicating whether PIIX4 or PIIX3 is being emulated. */
    441     bool                fPIIX4;
    442     bool                Alignment0[HC_ARCH_BITS == 64 ? 5 : 1]; /**< Align the struct size. */
     451    /** Flag indicating chipset being emulated. */
     452    uint8_t             u8Type;
     453    bool                Alignment0[HC_ARCH_BITS == 64 ? 5 : 1 ]; /**< Align the struct size. */
    443454} PCIATAState;
    444455
     
    59195930        }
    59205931    }
    5921     SSMR3PutBool(pSSMHandle, pThis->fPIIX4);
     5932    SSMR3PutU8(pSSMHandle, pThis->u8Type);
    59225933
    59235934    return SSMR3PutU32(pSSMHandle, ~0); /* sanity/terminator */
     
    59415952    if (   u32Version != ATA_SAVED_STATE_VERSION
    59425953        && u32Version != ATA_SAVED_STATE_VERSION_WITHOUT_FULL_SENSE
    5943         && u32Version != ATA_SAVED_STATE_VERSION_WITHOUT_EVENT_STATUS)
     5954        && u32Version != ATA_SAVED_STATE_VERSION_WITHOUT_EVENT_STATUS
     5955        && u32Version != ATA_SAVED_STATE_VERSION_WITH_BOOL_TYPE)
    59445956    {
    59455957        AssertMsgFailed(("u32Version=%d\n", u32Version));
     
    60596071        }
    60606072    }
    6061     SSMR3GetBool(pSSMHandle, &pThis->fPIIX4);
     6073    SSMR3GetU8(pSSMHandle, &pThis->u8Type);
    60626074
    60636075    rc = SSMR3GetU32(pSSMHandle, &u32);
     
    61126124     * Validate and read configuration.
    61136125     */
    6114     if (!CFGMR3AreValuesValid(pCfgHandle, "GCEnabled\0IRQDelay\0R0Enabled\0PIIX4\0"))
     6126    if (!CFGMR3AreValuesValid(pCfgHandle, "GCEnabled\0IRQDelay\0R0Enabled\0PIIX4\0ICH6\0"))
    61156127        return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES,
    61166128                                N_("PIIX3 configuration error: unknown option specified"));
     
    61356147    Assert(DelayIRQMillies < 50);
    61366148
    6137     rc = CFGMR3QueryBoolDef(pCfgHandle, "PIIX4", &pThis->fPIIX4, false);
     6149    pThis->u8Type = CHIPSET_PIIX3;
     6150    bool fPIIX4;
     6151    rc = CFGMR3QueryBoolDef(pCfgHandle, "PIIX4", &fPIIX4, false);
    61386152    if (RT_FAILURE(rc))
    61396153        return PDMDEV_SET_ERROR(pDevIns, rc,
    61406154                                N_("PIIX3 configuration error: failed to read PIIX4 as boolean"));
    6141     Log(("%s: fPIIX4=%d\n", __FUNCTION__, pThis->fPIIX4));
     6155    Log(("%s: fPIIX4=%d\n", __FUNCTION__, fPIIX4));
     6156    if (fPIIX4)
     6157        pThis->u8Type = CHIPSET_PIIX4;
     6158
     6159    /** @todo: Need to implement better IDE chipset configuration mechanism */
     6160    bool fICH6;
     6161    rc = CFGMR3QueryBoolDef(pCfgHandle, "ICH6", &fICH6, false);
     6162    if (RT_FAILURE(rc))
     6163        return PDMDEV_SET_ERROR(pDevIns, rc,
     6164                                N_("PIIX3 configuration error: failed to read ICH6 as boolean"));
     6165    Log(("%s: fICH6=%d\n", __FUNCTION__, fICH6));
     6166    if (fICH6)
     6167        pThis->u8Type = CHIPSET_ICH6;
    61426168
    61436169    /*
     
    61506176    /* PCI configuration space. */
    61516177    PCIDevSetVendorId(&pThis->dev, 0x8086); /* Intel */
    6152     if (pThis->fPIIX4)
    6153     {
    6154         PCIDevSetDeviceId(&pThis->dev, 0x7111); /* PIIX4 IDE */
    6155         PCIDevSetRevisionId(&pThis->dev, 0x01); /* PIIX4E */
    6156         pThis->dev.config[0x48] = 0x00; /* UDMACTL */
    6157         pThis->dev.config[0x4A] = 0x00; /* UDMATIM */
    6158         pThis->dev.config[0x4B] = 0x00;
    6159     }
    6160     else
    6161         PCIDevSetDeviceId(&pThis->dev, 0x7010); /* PIIX3 IDE */
     6178
     6179    /*
     6180     * When adding more IDE chipsets, don't forget to update pci_bios_init_device()
     6181     * as it explicitly checks for PCI id for IDE controllers.
     6182     */
     6183    switch (pThis->u8Type)
     6184    {
     6185        case CHIPSET_ICH6:
     6186            PCIDevSetDeviceId(&pThis->dev, 0x269e); /* ICH6 IDE */
     6187            /** @todo: do we need it? Do we need anything else? */
     6188            pThis->dev.config[0x48] = 0x00; /* UDMACTL */
     6189            pThis->dev.config[0x4A] = 0x00; /* UDMATIM */
     6190            pThis->dev.config[0x4B] = 0x00;
     6191            break;
     6192        case CHIPSET_PIIX4:
     6193            PCIDevSetDeviceId(&pThis->dev, 0x7111); /* PIIX4 IDE */
     6194            PCIDevSetRevisionId(&pThis->dev, 0x01); /* PIIX4E */
     6195            pThis->dev.config[0x48] = 0x00; /* UDMACTL */
     6196            pThis->dev.config[0x4A] = 0x00; /* UDMATIM */
     6197            pThis->dev.config[0x4B] = 0x00;
     6198            break;
     6199        case CHIPSET_PIIX3:
     6200            PCIDevSetDeviceId(&pThis->dev, 0x7010); /* PIIX3 IDE */
     6201            break;
     6202        default:
     6203            AssertMsgFailed(("Unsupported IDE chipset type: %d\n", pThis->u8Type));
     6204    }
     6205
    61626206    PCIDevSetCommand(   &pThis->dev, PCI_COMMAND_IOACCESS | PCI_COMMAND_MEMACCESS | PCI_COMMAND_BUSMASTER);
    61636207    PCIDevSetClassProg( &pThis->dev, 0x8a); /* programming interface = PCI_IDE bus master is supported */
     
    65336577#endif /* IN_RING3 */
    65346578#endif /* !VBOX_DEVICE_STRUCT_TESTCASE */
    6535 
Note: See TracChangeset for help on using the changeset viewer.

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