Changeset 16745 in vbox for trunk/src/VBox/Devices/Storage
- Timestamp:
- Feb 13, 2009 3:53:00 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevATA.cpp
r16708 r16745 30 30 * The SSM saved state versions. 31 31 */ 32 #define ATA_SAVED_STATE_VERSION 18 32 #define ATA_SAVED_STATE_VERSION 19 33 #define ATA_SAVED_STATE_VERSION_WITH_BOOL_TYPE 18 33 34 #define ATA_SAVED_STATE_VERSION_WITHOUT_FULL_SENSE 16 34 35 #define ATA_SAVED_STATE_VERSION_WITHOUT_EVENT_STATUS 17 … … 422 423 } ATACONTROLLER, *PATACONTROLLER; 423 424 425 typedef 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 424 435 typedef struct PCIATAState { 425 436 PCIDEVICE dev; … … 438 449 /** Flag whether R0 is enabled. */ 439 450 bool fR0Enabled; 440 /** Flag indicating whether PIIX4 or PIIX3 isbeing 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. */ 443 454 } PCIATAState; 444 455 … … 5919 5930 } 5920 5931 } 5921 SSMR3Put Bool(pSSMHandle, pThis->fPIIX4);5932 SSMR3PutU8(pSSMHandle, pThis->u8Type); 5922 5933 5923 5934 return SSMR3PutU32(pSSMHandle, ~0); /* sanity/terminator */ … … 5941 5952 if ( u32Version != ATA_SAVED_STATE_VERSION 5942 5953 && 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) 5944 5956 { 5945 5957 AssertMsgFailed(("u32Version=%d\n", u32Version)); … … 6059 6071 } 6060 6072 } 6061 SSMR3Get Bool(pSSMHandle, &pThis->fPIIX4);6073 SSMR3GetU8(pSSMHandle, &pThis->u8Type); 6062 6074 6063 6075 rc = SSMR3GetU32(pSSMHandle, &u32); … … 6112 6124 * Validate and read configuration. 6113 6125 */ 6114 if (!CFGMR3AreValuesValid(pCfgHandle, "GCEnabled\0IRQDelay\0R0Enabled\0PIIX4\0 "))6126 if (!CFGMR3AreValuesValid(pCfgHandle, "GCEnabled\0IRQDelay\0R0Enabled\0PIIX4\0ICH6\0")) 6115 6127 return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, 6116 6128 N_("PIIX3 configuration error: unknown option specified")); … … 6135 6147 Assert(DelayIRQMillies < 50); 6136 6148 6137 rc = CFGMR3QueryBoolDef(pCfgHandle, "PIIX4", &pThis->fPIIX4, false); 6149 pThis->u8Type = CHIPSET_PIIX3; 6150 bool fPIIX4; 6151 rc = CFGMR3QueryBoolDef(pCfgHandle, "PIIX4", &fPIIX4, false); 6138 6152 if (RT_FAILURE(rc)) 6139 6153 return PDMDEV_SET_ERROR(pDevIns, rc, 6140 6154 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; 6142 6168 6143 6169 /* … … 6150 6176 /* PCI configuration space. */ 6151 6177 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 6162 6206 PCIDevSetCommand( &pThis->dev, PCI_COMMAND_IOACCESS | PCI_COMMAND_MEMACCESS | PCI_COMMAND_BUSMASTER); 6163 6207 PCIDevSetClassProg( &pThis->dev, 0x8a); /* programming interface = PCI_IDE bus master is supported */ … … 6533 6577 #endif /* IN_RING3 */ 6534 6578 #endif /* !VBOX_DEVICE_STRUCT_TESTCASE */ 6535
Note:
See TracChangeset
for help on using the changeset viewer.