Changeset 64093 in vbox
- Timestamp:
- Sep 29, 2016 3:39:23 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 111048
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmstorageifs.h
r64078 r64093 354 354 355 355 /** 356 * Returns whether the medium should be marked as rotational or not. 357 * 358 * @returns true if non rotating medium. 359 * @returns false if rotating medium. 360 * @param pInterface Pointer to the interface structure containing the called function pointer. 361 * @thread Any thread. 362 */ 363 DECLR3CALLBACKMEMBER(bool, pfnIsNonRotational,(PPDMIMEDIA pInterface)); 364 365 /** 356 366 * Get stored media geometry (physical CHS, PCHS) - BIOS property. 357 367 * This is an optional feature of a media. … … 449 459 } PDMIMEDIA; 450 460 /** PDMIMEDIA interface ID. */ 451 #define PDMIMEDIA_IID " 855b4998-0cd2-45d8-8da3-fe9a47504abb"461 #define PDMIMEDIA_IID "d344aeaa-3ad0-4563-bb03-2733383e9230" 452 462 453 463 -
trunk/src/VBox/Devices/Storage/DevAHCI.cpp
r64087 r64093 373 373 /** First D2H FIS was send. */ 374 374 bool fFirstD2HFisSend; 375 /** Mark the drive as having a non-rotational medium (i.e. as a SSD). */376 bool fNonRotational;377 375 /** Attached device is a CD/DVD drive. */ 378 376 bool fATAPI; … … 392 390 volatile bool fWrkThreadSleeping; 393 391 394 bool afAlignment[ 3];392 bool afAlignment[4]; 395 393 396 394 /** Number of total sectors. */ … … 3085 3083 if ( pAhciPort->fTrimEnabled 3086 3084 || pAhciPort->cbSector != 512 3087 || pAhciPort-> fNonRotational)3085 || pAhciPort->pDrvMedia->pfnIsNonRotational(pAhciPort->pDrvMedia)) 3088 3086 { 3089 3087 p[80] = RT_H2LE_U16(0x1f0); /* support everything up to ATA/ATAPI-8 ACS */ … … 3121 3119 } 3122 3120 3123 if (pAhciPort-> fNonRotational)3121 if (pAhciPort->pDrvMedia->pfnIsNonRotational(pAhciPort->pDrvMedia)) 3124 3122 p[217] = RT_H2LE_U16(1); /* Non-rotational medium */ 3125 3123 … … 7677 7675 } 7678 7676 7679 rc = CFGMR3QueryBoolDef(pCfgNode, "NonRotationalMedium", &pAhciPort->fNonRotational, false);7680 if (RT_FAILURE(rc))7681 return PDMDEV_SET_ERROR(pDevIns, rc,7682 N_("AHCI configuration error: failed to read \"NonRotationalMedium\" as boolean"));7683 7684 7677 rc = CFGMR3QueryU8Def(pCfgNode, "LogicalSectorsPerPhysical", &pAhciPort->cLogSectorsPerPhysicalExp, 0); 7685 7678 if (RT_FAILURE(rc)) -
trunk/src/VBox/Devices/Storage/DevATA.cpp
r63690 r64093 261 261 STAMPROFILE StatFlushes; 262 262 263 /** Mark the drive as having a non-rotational medium (i.e. as a SSD). */264 bool fNonRotational;265 263 /** Enable passing through commands directly to the ATAPI drive. */ 266 264 bool fATAPIPassthrough; … … 1296 1294 if ( s->pDrvMedia->pfnDiscard 1297 1295 || s->cbSector != 512 1298 || s-> fNonRotational)1296 || s->pDrvMedia->pfnIsNonRotational(s->pDrvMedia)) 1299 1297 { 1300 1298 p[80] = RT_H2LE_U16(0x1f0); /* support everything up to ATA/ATAPI-8 ACS */ … … 1339 1337 if (s->pDrvMedia->pfnDiscard) /** @todo Set bit 14 in word 69 too? (Deterministic read after TRIM). */ 1340 1338 p[169] = RT_H2LE_U16(1); /* DATA SET MANAGEMENT command supported. */ 1341 if (s-> fNonRotational)1339 if (s->pDrvMedia->pfnIsNonRotational(s->pDrvMedia)) 1342 1340 p[217] = RT_H2LE_U16(1); /* Non-rotational medium */ 1343 1341 uint32_t uCsum = ataR3Checksum(p, 510); … … 7760 7758 } 7761 7759 7762 rc = CFGMR3QueryBoolDef(pCfgNode, "NonRotationalMedium", &pIf->fNonRotational, false);7763 if (RT_FAILURE(rc))7764 return PDMDEV_SET_ERROR(pDevIns, rc,7765 N_("PIIX3 configuration error: failed to read \"NonRotationalMedium\" as boolean"));7766 7767 7760 /* There are three other identification strings for CD drives used for INQUIRY */ 7768 7761 if (pIf->fATAPI) -
trunk/src/VBox/Devices/Storage/DrvHostBase.cpp
r64019 r64093 288 288 PDRVHOSTBASE pThis = PDMIMEDIA_2_DRVHOSTBASE(pInterface); 289 289 return pThis->fReadOnly; 290 } 291 292 293 /** @interface_method_impl{PDMIMEDIA,pfnIsNonRotational} */ 294 static DECLCALLBACK(bool) drvHostBaseIsNonRotational(PPDMIMEDIA pInterface) 295 { 296 RT_NOREF1(pInterface); 297 return false; 290 298 } 291 299 … … 1874 1882 pThis->IMedia.pfnFlush = drvHostBaseFlush; 1875 1883 pThis->IMedia.pfnIsReadOnly = drvHostBaseIsReadOnly; 1884 pThis->IMedia.pfnIsNonRotational = drvHostBaseIsNonRotational; 1876 1885 pThis->IMedia.pfnGetSize = drvHostBaseGetSize; 1877 1886 pThis->IMedia.pfnGetType = drvHostBaseGetType; -
trunk/src/VBox/Devices/Storage/DrvSCSI.cpp
r64079 r64093 125 125 /** Errors printed in the release log. */ 126 126 unsigned cErrors; 127 /** Mark the drive as having a non-rotational medium (i.e. as a SSD). */128 bool fNonRotational;129 127 /** Medium is readonly */ 130 128 bool fReadonly; … … 377 375 *pfFeatures |= VSCSI_LUN_FEATURE_UNMAP; 378 376 379 if (pThis->fNonRotational) 377 if ( pThis->pDrvMedia 378 && pThis->pDrvMedia->pfnIsNonRotational(pThis->pDrvMedia)) 380 379 *pfFeatures |= VSCSI_LUN_FEATURE_NON_ROTATIONAL; 381 380 … … 1117 1116 * Validate and read configuration. 1118 1117 */ 1119 if (!CFGMR3AreValuesValid(pCfg, " NonRotationalMedium\0Readonly\0"))1118 if (!CFGMR3AreValuesValid(pCfg, "Readonly\0")) 1120 1119 return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, 1121 1120 N_("SCSI configuration error: unknown option specified")); 1122 1123 rc = CFGMR3QueryBoolDef(pCfg, "NonRotationalMedium", &pThis->fNonRotational, false);1124 if (RT_FAILURE(rc))1125 return PDMDRV_SET_ERROR(pDrvIns, rc,1126 N_("SCSI configuration error: failed to read \"NonRotationalMedium\" as boolean"));1127 1121 1128 1122 rc = CFGMR3QueryBoolDef(pCfg, "Readonly", &pThis->fReadonly, false); -
trunk/src/VBox/Devices/Storage/DrvVD.cpp
r64078 r64093 323 323 /** Visible to the BIOS. */ 324 324 bool fBiosVisible; 325 /** Flag whether this medium should be presented as non rotational. */ 326 bool fNonRotational; 325 327 #ifdef VBOX_PERIODIC_FLUSH 326 328 /** HACK: Configuration value for number of bytes written after which to flush. */ … … 2187 2189 } 2188 2190 2191 /** @interface_method_impl{PDMIMEDIA,pfnIsNonRotational} */ 2192 static DECLCALLBACK(bool) drvvdIsNonRotational(PPDMIMEDIA pInterface) 2193 { 2194 LogFlowFunc(("\n")); 2195 PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface); 2196 2197 return pThis->fNonRotational; 2198 } 2199 2189 2200 /** @interface_method_impl{PDMIMEDIA,pfnBiosGetPCHSGeometry} */ 2190 2201 static DECLCALLBACK(int) drvvdBiosGetPCHSGeometry(PPDMIMEDIA pInterface, … … 4354 4365 pThis->IMedia.pfnGetSectorSize = drvvdGetSectorSize; 4355 4366 pThis->IMedia.pfnIsReadOnly = drvvdIsReadOnly; 4367 pThis->IMedia.pfnIsNonRotational = drvvdIsNonRotational; 4356 4368 pThis->IMedia.pfnBiosGetPCHSGeometry = drvvdBiosGetPCHSGeometry; 4357 4369 pThis->IMedia.pfnBiosSetPCHSGeometry = drvvdBiosSetPCHSGeometry; … … 4474 4486 "SkipConsistencyChecks\0" 4475 4487 "Locked\0BIOSVisible\0Cylinders\0Heads\0Sectors\0Mountable\0" 4476 "EmptyDrive\0IoBufMax\0 "4488 "EmptyDrive\0IoBufMax\0NonRotationalMedium\0" 4477 4489 #if defined(VBOX_PERIODIC_FLUSH) || defined(VBOX_IGNORE_FLUSH) 4478 4490 "FlushInterval\0IgnoreFlush\0IgnoreFlushAsync\0" … … 4748 4760 if (RT_FAILURE(rc)) 4749 4761 return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"IoBufMax\" from the config")); 4762 4763 rc = CFGMR3QueryBoolDef(pCfg, "NonRotationalMedium", &pThis->fNonRotational, false); 4764 if (RT_FAILURE(rc)) 4765 return PDMDRV_SET_ERROR(pDrvIns, rc, 4766 N_("DrvVD configuration error: Querying \"NonRotationalMedium\" as boolean failed")); 4750 4767 } 4751 4768 -
trunk/src/VBox/Main/include/ConsoleImpl.h
r63239 r64093 646 646 const char *pcszBwGroup, 647 647 bool fDiscard, 648 bool fNonRotational, 648 649 IMedium *pMedium, 649 650 MachineState_T aMachineState, -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r63998 r64093 265 265 # endif 266 266 #endif 267 268 static const char *const g_apszIDEDrives[4] =269 { "PrimaryMaster", "PrimarySlave", "SecondaryMaster", "SecondarySlave" };270 267 271 268 class ConfigError : public RTCError … … 3925 3922 *ppLunL0 = pLunL0; 3926 3923 3927 PCFGMNODE pCfg = CFGMR3GetChild(pCtlInst, "Config");3928 if (pCfg)3929 {3930 if (!strcmp(pcszDevice, "piix3ide"))3931 {3932 PCFGMNODE pDrive = CFGMR3GetChild(pCfg, g_apszIDEDrives[uLUN]);3933 if (!pDrive)3934 InsertConfigNode(pCfg, g_apszIDEDrives[uLUN], &pDrive);3935 /* Don't use the RemoveConfigValue wrapper above, as we don't3936 * know if the leaf is present or not. */3937 CFGMR3RemoveValue(pDrive, "NonRotationalMedium");3938 InsertConfigInteger(pDrive, "NonRotationalMedium", !!fNonRotational);3939 }3940 else if (!strcmp(pcszDevice, "ahci"))3941 {3942 Utf8Str strPort = Utf8StrFmt("Port%u", uLUN);3943 PCFGMNODE pDrive = CFGMR3GetChild(pCfg, strPort.c_str());3944 if (!pDrive)3945 InsertConfigNode(pCfg, strPort.c_str(), &pDrive);3946 /* Don't use the RemoveConfigValue wrapper above, as we don't3947 * know if the leaf is present or not. */3948 CFGMR3RemoveValue(pDrive, "NonRotationalMedium");3949 InsertConfigInteger(pDrive, "NonRotationalMedium", !!fNonRotational);3950 }3951 }3952 3953 3924 Utf8Str devicePath = Utf8StrFmt("%s/%u/LUN#%u", pcszDevice, uInstance, uLUN); 3954 3925 mapMediumAttachments[devicePath] = pMediumAtt; … … 3958 3929 { 3959 3930 InsertConfigString(pLunL0, "Driver", "SCSI"); 3960 PCFGMNODE pL1Cfg = NULL;3961 InsertConfigNode(pLunL0, "Config", &pL1Cfg);3962 InsertConfigInteger(pL1Cfg, "NonRotationalMedium", !!fNonRotational);3963 3964 3931 InsertConfigNode(pLunL0, "AttachedDriver", &pLunL0); 3965 3932 } … … 4196 4163 strBwGroup.isEmpty() ? NULL : Utf8Str(strBwGroup).c_str(), 4197 4164 !!fDiscard, 4165 !!fNonRotational, 4198 4166 pMedium, 4199 4167 aMachineState, … … 4275 4243 const char *pcszBwGroup, 4276 4244 bool fDiscard, 4245 bool fNonRotational, 4277 4246 IMedium *pMedium, 4278 4247 MachineState_T aMachineState, … … 4464 4433 if (fDiscard) 4465 4434 InsertConfigInteger(pCfg, "Discard", 1); 4435 4436 if (fNonRotational) 4437 InsertConfigInteger(pCfg, "NonRotationalMedium", 1); 4466 4438 4467 4439 /* Pass all custom parameters. */
Note:
See TracChangeset
for help on using the changeset viewer.