- Timestamp:
- May 30, 2011 2:47:02 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/manual/en_US/user_AdvancedTopics.xml
r37218 r37264 879 879 specify the desired SATA hard disk port.</para> 880 880 881 <para>The above commands apply to virtual machines with an AHCI (SATA) 882 controller. The commands for virtual machines with an IDE controller 883 are:</para> 884 885 <screen>VBoxManage setextradata "VM name" 886 "VBoxInternal/Devices/piix3ide/0/Config/PrimaryMaster/SerialNumber" "serial" 887 VBoxManage setextradata "VM name" 888 "VBoxInternal/Devices/piix3ide/0/Config/PrimaryMaster/FirmwareRevision" "firmware" 889 VBoxManage setextradata "VM name" 890 "VBoxInternal/Devices/piix3ide/0/Config/PrimaryMaster/ModelNumber" "model"</screen> 891 892 <para>For hard disks it's also possible (experimental!) to mark the drive 893 as having a non-rotational medium with:</para> 894 895 <screen>VBoxManage setextradata "VM name" 896 "VBoxInternal/Devices/ahci/0/Config/Port0/NonRotational" "1"</screen> 897 881 898 <para>Additional three parameters are needed for CD/DVD drives to report 882 899 the vendor product data:</para> -
trunk/src/VBox/Devices/Storage/ATAController.cpp
r36383 r37264 7 7 8 8 /* 9 * Copyright (C) 2006-201 0Oracle Corporation9 * Copyright (C) 2006-2011 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 685 685 { 686 686 uint16_t *p; 687 char aSerial[20];688 int rc;689 RTUUID Uuid;690 687 691 688 Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); 692 689 Assert(s->cbElementaryTransfer == 512); 693 rc = s->pDrvBlock ? s->pDrvBlock->pfnGetUuid(s->pDrvBlock, &Uuid) : RTUuidClear(&Uuid);694 if (RT_FAILURE(rc) || RTUuidIsNull(&Uuid))695 {696 PAHCIATACONTROLLER pCtl = ATADEVSTATE_2_CONTROLLER(s);697 /* Generate a predictable serial for drives which don't have a UUID. */698 RTStrPrintf(aSerial, sizeof(aSerial), "VB%x-%04x%04x",699 s->iLUN + ATADEVSTATE_2_DEVINS(s)->iInstance * 32,700 pCtl->IOPortBase1, pCtl->IOPortBase2);701 }702 else703 RTStrPrintf(aSerial, sizeof(aSerial), "VB%08x-%08x", Uuid.au32[0], Uuid.au32[3]);704 690 705 691 p = (uint16_t *)s->CTXALLSUFF(pbIOBuffer); … … 711 697 p[5] = RT_H2LE_U16(512); 712 698 p[6] = RT_H2LE_U16(s->PCHSGeometry.cSectors); 713 ataPadString((uint8_t *)(p + 10), aSerial, 20); /* serial number */699 ataPadString((uint8_t *)(p + 10), s->pszSerialNumber, ATA_SERIAL_NUMBER_LENGTH); /* serial number */ 714 700 p[20] = RT_H2LE_U16(3); /* XXX: retired, cache type */ 715 701 p[21] = RT_H2LE_U16(512); /* XXX: retired, cache size in sectors */ 716 702 p[22] = RT_H2LE_U16(0); /* ECC bytes per sector */ 717 ataPadString((uint8_t *)(p + 23), "1.0", 8); /* firmware version */718 ataPadString((uint8_t *)(p + 27), "VBOX HARDDISK", 40); /* model */703 ataPadString((uint8_t *)(p + 23), s->pszFirmwareRevision, ATA_FIRMWARE_REVISION_LENGTH); /* firmware version */ 704 ataPadString((uint8_t *)(p + 27), s->pszModelNumber, ATA_MODEL_NUMBER_LENGTH); /* model */ 719 705 #if ATA_MAX_MULT_SECTORS > 1 720 706 p[47] = RT_H2LE_U16(0x8000 | ATA_MAX_MULT_SECTORS); … … 777 763 p[103] = RT_H2LE_U16(s->cTotalSectors >> 48); 778 764 } 765 if (s->fNonRotational) 766 p[217] = RT_H2LE_U16(1); /* Non-rotational medium */ 779 767 uint32_t uCsum = ataChecksum(p, 510); 780 768 p[255] = RT_H2LE_U16(0xa5 | (uCsum << 8)); /* Integrity word */ … … 812 800 { 813 801 uint16_t *p; 814 char aSerial[20];815 RTUUID Uuid;816 int rc;817 802 818 803 Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); 819 804 Assert(s->cbElementaryTransfer == 512); 820 rc = s->pDrvBlock ? s->pDrvBlock->pfnGetUuid(s->pDrvBlock, &Uuid) : RTUuidClear(&Uuid);821 if (RT_FAILURE(rc) || RTUuidIsNull(&Uuid))822 {823 PAHCIATACONTROLLER pCtl = ATADEVSTATE_2_CONTROLLER(s);824 /* Generate a predictable serial for drives which don't have a UUID. */825 RTStrPrintf(aSerial, sizeof(aSerial), "VB%x-%04x%04x",826 s->iLUN + ATADEVSTATE_2_DEVINS(s)->iInstance * 32,827 pCtl->IOPortBase1, pCtl->IOPortBase2);828 }829 else830 RTStrPrintf(aSerial, sizeof(aSerial), "VB%08x-%08x", Uuid.au32[0], Uuid.au32[3]);831 805 832 806 p = (uint16_t *)s->CTXALLSUFF(pbIOBuffer); … … 834 808 /* Removable CDROM, 50us response, 12 byte packets */ 835 809 p[0] = RT_H2LE_U16(2 << 14 | 5 << 8 | 1 << 7 | 2 << 5 | 0 << 0); 836 ataPadString((uint8_t *)(p + 10), aSerial, 20); /* serial number */810 ataPadString((uint8_t *)(p + 10), s->pszSerialNumber, ATA_SERIAL_NUMBER_LENGTH); /* serial number */ 837 811 p[20] = RT_H2LE_U16(3); /* XXX: retired, cache type */ 838 812 p[21] = RT_H2LE_U16(512); /* XXX: retired, cache size in sectors */ 839 ataPadString((uint8_t *)(p + 23), "1.0", 8); /* firmware version */840 ataPadString((uint8_t *)(p + 27), "VBOX CD-ROM", 40); /* model */813 ataPadString((uint8_t *)(p + 23), s->pszFirmwareRevision, ATA_FIRMWARE_REVISION_LENGTH); /* firmware version */ 814 ataPadString((uint8_t *)(p + 27), s->pszModelNumber, ATA_MODEL_NUMBER_LENGTH); /* model */ 841 815 p[49] = RT_H2LE_U16(1 << 11 | 1 << 9 | 1 << 8); /* DMA and LBA supported */ 842 816 p[50] = RT_H2LE_U16(1 << 14); /* No drive specific standby timer minimum */ … … 1910 1884 pbBuf[6] = 0; /* reserved */ 1911 1885 pbBuf[7] = 0; /* reserved */ 1912 ataSCSIPadStr(pbBuf + 8, "VBOX", 8);1913 ataSCSIPadStr(pbBuf + 16, "CD-ROM", 16);1914 ataSCSIPadStr(pbBuf + 32, "1.0", 4);1886 ataSCSIPadStr(pbBuf + 8, s->pszInquiryVendorId, 8); 1887 ataSCSIPadStr(pbBuf + 16, s->pszInquiryProductId, 16); 1888 ataSCSIPadStr(pbBuf + 32, s->pszInquiryRevision, 4); 1915 1889 s->iSourceSink = ATAFN_SS_NULL; 1916 1890 atapiCmdOK(s); … … 5595 5569 unsigned iLUNMaster, PPDMIBASE pDrvBaseMaster, PPDMLED pLedMaster, 5596 5570 PSTAMCOUNTER pStatBytesReadMaster, PSTAMCOUNTER pStatBytesWrittenMaster, 5571 const char *pszSerialNumberMaster, const char *pszFirmwareRevisionMaster, 5572 const char *pszModelNumberMaster, const char *pszInquiryVendorIdMaster, 5573 const char *pszInquiryProductIdMaster, const char *pszInquiryRevisionMaster, 5574 bool fNonRotationalMaster, 5597 5575 unsigned iLUNSlave, PPDMIBASE pDrvBaseSlave, PPDMLED pLedSlave, 5598 5576 PSTAMCOUNTER pStatBytesReadSlave, PSTAMCOUNTER pStatBytesWrittenSlave, 5577 const char *pszSerialNumberSlave, const char *pszFirmwareRevisionSlave, 5578 const char *pszModelNumberSlave, const char *pszInquiryVendorIdSlave, 5579 const char *pszInquiryProductIdSlave, const char *pszInquiryRevisionSlave, 5580 bool fNonRotationalSlave, 5599 5581 uint32_t *pcbSSMState, const char *szName) 5600 5582 { … … 5613 5595 for (uint32_t j = 0; j < RT_ELEMENTS(pCtl->aIfs); j++) 5614 5596 { 5615 pCtl->aIfs[j].iLUN = j == 0 ? iLUNMaster : iLUNSlave; 5616 pCtl->aIfs[j].pDevInsR3 = pDevIns; 5617 pCtl->aIfs[j].pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); 5618 pCtl->aIfs[j].pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 5619 pCtl->aIfs[j].pControllerR3 = pCtl; 5620 pCtl->aIfs[j].pControllerR0 = MMHyperR3ToR0(PDMDevHlpGetVM(pDevIns), pCtl); 5621 pCtl->aIfs[j].pControllerRC = MMHyperR3ToRC(PDMDevHlpGetVM(pDevIns), pCtl); 5622 pCtl->aIfs[j].pLed = j == 0 ? pLedMaster : pLedSlave; 5623 pCtl->aIfs[j].pStatBytesRead = j == 0 ? pStatBytesReadMaster : pStatBytesReadSlave; 5624 pCtl->aIfs[j].pStatBytesWritten = j == 0 ? pStatBytesWrittenMaster : pStatBytesWrittenSlave; 5597 pCtl->aIfs[j].iLUN = j == 0 ? iLUNMaster : iLUNSlave; 5598 pCtl->aIfs[j].pDevInsR3 = pDevIns; 5599 pCtl->aIfs[j].pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); 5600 pCtl->aIfs[j].pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 5601 pCtl->aIfs[j].pControllerR3 = pCtl; 5602 pCtl->aIfs[j].pControllerR0 = MMHyperR3ToR0(PDMDevHlpGetVM(pDevIns), pCtl); 5603 pCtl->aIfs[j].pControllerRC = MMHyperR3ToRC(PDMDevHlpGetVM(pDevIns), pCtl); 5604 pCtl->aIfs[j].pLed = j == 0 ? pLedMaster : pLedSlave; 5605 pCtl->aIfs[j].pStatBytesRead = j == 0 ? pStatBytesReadMaster : pStatBytesReadSlave; 5606 pCtl->aIfs[j].pStatBytesWritten = j == 0 ? pStatBytesWrittenMaster : pStatBytesWrittenSlave; 5607 pCtl->aIfs[j].pszSerialNumber = j == 0 ? pszSerialNumberMaster : pszSerialNumberSlave; 5608 pCtl->aIfs[j].pszFirmwareRevision = j == 0 ? pszFirmwareRevisionMaster : pszFirmwareRevisionSlave; 5609 pCtl->aIfs[j].pszModelNumber = j == 0 ? pszModelNumberMaster : pszModelNumberSlave; 5610 pCtl->aIfs[j].pszInquiryVendorId = j == 0 ? pszInquiryVendorIdMaster : pszInquiryVendorIdSlave; 5611 pCtl->aIfs[j].pszInquiryProductId = j == 0 ? pszInquiryProductIdMaster : pszInquiryProductIdSlave; 5612 pCtl->aIfs[j].pszInquiryRevision = j == 0 ? pszInquiryRevisionMaster : pszInquiryRevisionSlave; 5613 pCtl->aIfs[j].fNonRotational = j == 0 ? fNonRotationalMaster : fNonRotationalSlave; 5625 5614 } 5626 5615 -
trunk/src/VBox/Devices/Storage/ATAController.h
r35346 r37264 5 5 6 6 /* 7 * Copyright (C) 2006-20 08Oracle Corporation7 * Copyright (C) 2006-2011 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 213 213 STAMPROFILE StatFlushes; 214 214 215 /** The serial number to use for IDENTIFY DEVICE commands. */ 216 R3PTRTYPE(const char *) pszSerialNumber; 217 /** The firmware revision to use for IDENTIFY DEVICE commands. */ 218 R3PTRTYPE(const char *) pszFirmwareRevision; 219 /** The model number to use for IDENTIFY DEVICE commands. */ 220 R3PTRTYPE(const char *) pszModelNumber; 221 /** The vendor identification string for SCSI INQUIRY commands. */ 222 R3PTRTYPE(const char *) pszInquiryVendorId; 223 /** The product identification string for SCSI INQUIRY commands. */ 224 R3PTRTYPE(const char *) pszInquiryProductId; 225 /** The revision string for SCSI INQUIRY commands. */ 226 R3PTRTYPE(const char *) pszInquiryRevision; 227 /** Mark the drive as having a non-rotational medium (i.e. as a SSD). */ 228 bool fNonRotational; 215 229 /** Enable passing through commands directly to the ATAPI drive. */ 216 230 bool fATAPIPassthrough; … … 415 429 * @param pDevIns Pointer to the device instance which creates a controller. 416 430 * @param pCtl Pointer to the unitialized ATA controller structure. 431 * @param iLUNMaster Port number of the master device. 417 432 * @param pDrvBaseMaster Pointer to the base driver interface which acts as the master. 433 * @param pLedMaster Pointer to LED state for master device. 434 * @param pStatBytesReadMaster Pointer to statistics structure for reads. 435 * @param pStatBytesWrittenMaster Pointer to statistics structure for writes. 436 * @param pszSerialNumberMaster VPD serial number for master. 437 * @param pszFirmwareRevisionMaster VPD firmware revision for master 438 * @param pszModelNumberMaster VPD model number for master 439 * @param pszInquiryVendorIdMaster VPD vendor ID for master 440 * @param pszInquiryProductIdMaster VPD product ID for master 441 * @param pszInquiryRevisionMaster VPD revision for master 442 * @param fNonRotationalMaster Flag for non-rotational media. 443 * @param iLUNSlave Port number of the slave device. 418 444 * @param pDrvBaseSlave Pointer to the base driver interface which acts as the slave. 445 * @param pLedSlave Pointer to LED state for slave device. 446 * @param pStatBytesReadSlave Pointer to statistics structure for reads. 447 * @param pStatBytesWrittenSlave Pointer to statistics structure for writes. 448 * @param pszSerialNumberSlave VPD serial number for slave. 449 * @param pszFirmwareRevisionSlave VPD firmware revision for slave 450 * @param pszModelNumberSlave VPD model number for slave 451 * @param pszInquiryVendorIdSlave VPD vendor ID for slave 452 * @param pszInquiryProductIdSlave VPD product ID for slave 453 * @param pszInquiryRevisionSlave VPD revision for slave 454 * @param fNonRotationalSlave Flag for non-rotational media. 419 455 * @param pcbSSMState Where to store the size of the device state for loading/saving. 420 456 * @param szName Name of the controller (Used to initialize the critical section). … … 423 459 unsigned iLUNMaster, PPDMIBASE pDrvBaseMaster, PPDMLED pLedMaster, 424 460 PSTAMCOUNTER pStatBytesReadMaster, PSTAMCOUNTER pStatBytesWrittenMaster, 461 const char *pszSerialNumberMaster, const char *pszFirmwareRevisionMaster, 462 const char *pszModelNumberMaster, const char *pszInquiryVendorIdMaster, 463 const char *pszInquiryProductIdMaster, const char *pszInquiryRevisionMaster, 464 bool fNonRotationalMaster, 425 465 unsigned iLUNSlave, PPDMIBASE pDrvBaseSlave, PPDMLED pLedSlave, 426 466 PSTAMCOUNTER pStatBytesReadSlave, PSTAMCOUNTER pStatBytesWrittenSlave, 467 const char *pszSerialNumberSlave, const char *pszFirmwareRevisionSlave, 468 const char *pszModelNumberSlave, const char *pszInquiryVendorIdSlave, 469 const char *pszInquiryProductIdSlave, const char *pszInquiryRevisionSlave, 470 bool fNonRotationalSlave, 427 471 uint32_t *pcbSSMState, const char *szName); 428 472 -
trunk/src/VBox/Devices/Storage/DevAHCI.cpp
r36992 r37264 6 6 7 7 /* 8 * Copyright (C) 2006-20 09Oracle Corporation8 * Copyright (C) 2006-2011 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 412 412 /** First D2H FIS was send. */ 413 413 bool fFirstD2HFisSend; 414 /** Mark the drive as having a non-rotational medium (i.e. as a SSD). */ 415 bool fNonRotational; 414 416 /** Attached device is a CD/DVD drive. */ 415 417 bool fATAPI; … … 3072 3074 p[102] = RT_H2LE_U16(pAhciPort->cTotalSectors >> 32); 3073 3075 p[103] = RT_H2LE_U16(pAhciPort->cTotalSectors >> 48); 3076 if (pAhciPort->fNonRotational) 3077 p[217] = RT_H2LE_U16(1); /* Non-rotational medium */ 3074 3078 3075 3079 /* The following are SATA specific */ … … 7079 7083 7080 7084 /** 7081 * LsiLogicstatus info callback.7085 * AHCI status info callback. 7082 7086 * 7083 7087 * @param pDevIns The device instance. … … 8489 8493 } 8490 8494 8495 rc = CFGMR3QueryBoolDef(pCfgNode, "NonRotationalMedium", &pAhciPort->fNonRotational, false); 8496 if (RT_FAILURE(rc)) 8497 return PDMDEV_SET_ERROR(pDevIns, rc, 8498 N_("PIIX3 configuration error: failed to read \"NonRotationalMedium\" as boolean")); 8499 8491 8500 /* There are three other identification strings for CD drives used for INQUIRY */ 8492 8501 if (pAhciPort->fATAPI) … … 8623 8632 &pThis->ahciPort[iPortMaster].StatBytesRead, 8624 8633 &pThis->ahciPort[iPortMaster].StatBytesWritten, 8634 pThis->ahciPort[iPortMaster].szSerialNumber, 8635 pThis->ahciPort[iPortMaster].szFirmwareRevision, 8636 pThis->ahciPort[iPortMaster].szModelNumber, 8637 pThis->ahciPort[iPortMaster].szInquiryVendorId, 8638 pThis->ahciPort[iPortMaster].szInquiryProductId, 8639 pThis->ahciPort[iPortMaster].szInquiryRevision, 8640 pThis->ahciPort[iPortMaster].fNonRotational, 8625 8641 iPortSlave, pThis->ahciPort[iPortSlave].pDrvBase, 8626 8642 &pThis->ahciPort[iPortSlave].Led, 8627 8643 &pThis->ahciPort[iPortSlave].StatBytesRead, 8628 8644 &pThis->ahciPort[iPortSlave].StatBytesWritten, 8645 pThis->ahciPort[iPortSlave].szSerialNumber, 8646 pThis->ahciPort[iPortSlave].szFirmwareRevision, 8647 pThis->ahciPort[iPortSlave].szModelNumber, 8648 pThis->ahciPort[iPortSlave].szInquiryVendorId, 8649 pThis->ahciPort[iPortSlave].szInquiryProductId, 8650 pThis->ahciPort[iPortSlave].szInquiryRevision, 8651 pThis->ahciPort[iPortSlave].fNonRotational, 8629 8652 &cbSSMState, szName); 8630 8653 if (RT_FAILURE(rc)) -
trunk/src/VBox/Devices/Storage/DevATA.cpp
r36912 r37264 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2011 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 103 103 #define ATA_MEDIA_TYPE_DATA 1 /**< Data CD */ 104 104 #define ATA_MEDIA_TYPE_CDDA 2 /**< CD-DA (audio) CD type */ 105 106 /**107 * Length of the configurable VPD data (without termination)108 */109 #define ATA_SERIAL_NUMBER_LENGTH 20110 #define ATA_FIRMWARE_REVISION_LENGTH 8111 #define ATA_MODEL_NUMBER_LENGTH 40112 #define ATAPI_INQUIRY_VENDOR_ID_LENGTH 8113 #define ATAPI_INQUIRY_PRODUCT_ID_LENGTH 16114 #define ATAPI_INQUIRY_REVISION_LENGTH 4115 105 116 106 /******************************************************************************* … … 257 247 STAMPROFILE StatFlushes; 258 248 249 /** Mark the drive as having a non-rotational medium (i.e. as a SSD). */ 250 bool fNonRotational; 259 251 /** Enable passing through commands directly to the ATAPI drive. */ 260 252 bool fATAPIPassthrough; … … 1246 1238 p[103] = RT_H2LE_U16(s->cTotalSectors >> 48); 1247 1239 } 1240 if (s->fNonRotational) 1241 p[217] = RT_H2LE_U16(1); /* Non-rotational medium */ 1248 1242 uint32_t uCsum = ataChecksum(p, 510); 1249 1243 p[255] = RT_H2LE_U16(0xa5 | (uCsum << 8)); /* Integrity word */ … … 7162 7156 } 7163 7157 7158 rc = CFGMR3QueryBoolDef(pCfgNode, "NonRotationalMedium", &pIf->fNonRotational, false); 7159 if (RT_FAILURE(rc)) 7160 return PDMDEV_SET_ERROR(pDevIns, rc, 7161 N_("PIIX3 configuration error: failed to read \"NonRotationalMedium\" as boolean")); 7162 7164 7163 /* There are three other identification strings for CD drives used for INQUIRY */ 7165 7164 if (pIf->fATAPI) -
trunk/src/VBox/Devices/Storage/ide.h
r28800 r37264 5 5 6 6 /* 7 * Copyright (C) 2006-20 07Oracle Corporation7 * Copyright (C) 2006-2011 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 168 168 | ((((thismode ^ currmode) & 0xf8) == 0) ? 1 << ((currmode & 0x07) + 8) : 0)) 169 169 170 /** 171 * Length of the ATA VPD data (without termination) 172 */ 173 #define ATA_SERIAL_NUMBER_LENGTH 20 174 #define ATA_FIRMWARE_REVISION_LENGTH 8 175 #define ATA_MODEL_NUMBER_LENGTH 40 176 170 177 171 178 /* ATAPI defines */ … … 179 186 #define ATAPI_INT_REASON_TAG_MASK 0xf8 180 187 188 189 /** 190 * Length of the ATAPI VPD data (without termination) 191 * 192 * @todo move to scsi.h 193 */ 194 #define ATAPI_INQUIRY_VENDOR_ID_LENGTH 8 195 #define ATAPI_INQUIRY_PRODUCT_ID_LENGTH 16 196 #define ATAPI_INQUIRY_REVISION_LENGTH 4 197 198 181 199 #if defined(DEBUG) && defined(IN_RING3) 182 200 const char * ATACmdText(uint8_t uCmd);
Note:
See TracChangeset
for help on using the changeset viewer.