Changeset 24172 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Oct 29, 2009 5:48:16 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 54111
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevAHCI.cpp
r24096 r24172 97 97 * Length of the configurable VPD data (without termination) 98 98 */ 99 #define AHCI_SERIAL_NUMBER_LENGTH 20 100 #define AHCI_FIRMWARE_REVISION_LENGTH 8 101 #define AHCI_MODEL_NUMBER_LENGTH 40 99 #define AHCI_SERIAL_NUMBER_LENGTH 20 100 #define AHCI_FIRMWARE_REVISION_LENGTH 8 101 #define AHCI_MODEL_NUMBER_LENGTH 40 102 #define AHCI_ATAPI_INQUIRY_VENDOR_ID_LENGTH 8 103 #define AHCI_ATAPI_INQUIRY_PRODUCT_ID_LENGTH 16 104 #define AHCI_ATAPI_INQUIRY_REVISION_LENGTH 4 102 105 103 106 /* Command Header. */ … … 437 440 R3PTRTYPE(PAHCIPORTTASKSTATE) aCachedTasks[AHCI_NR_COMMAND_SLOTS]; 438 441 442 uint32_t u32Alignment5; 443 439 444 /** Release statistics: number of DMA commands. */ 440 445 STAMCOUNTER StatDMA; … … 468 473 /** The model number to use for IDENTIFY DEVICE commands. */ 469 474 char szModelNumber[AHCI_MODEL_NUMBER_LENGTH+1]; /** < one extra byte for termination */ 470 471 #if HC_ARCH_BITS == 64 472 uint32_t Alignment5; 473 #endif 475 /** The vendor identification string for SCSI INQUIRY commands. */ 476 char szInquiryVendorId[AHCI_ATAPI_INQUIRY_VENDOR_ID_LENGTH+1]; 477 /** The product identification string for SCSI INQUIRY commands. */ 478 char szInquiryProductId[AHCI_ATAPI_INQUIRY_PRODUCT_ID_LENGTH+1]; 479 /** The revision string for SCSI INQUIRY commands. */ 480 char szInquiryRevision[AHCI_ATAPI_INQUIRY_REVISION_LENGTH+1]; 481 482 uint32_t Alignment6; 474 483 475 484 } AHCIPort, *PAHCIPort; … … 2894 2903 { 2895 2904 uint16_t p[256]; 2896 char aSerial[20];2897 2905 RTUUID Uuid; 2898 2906 int rc; 2899 2900 rc = pAhciPort->pDrvBlock ? pAhciPort->pDrvBlock->pfnGetUuid(pAhciPort->pDrvBlock, &Uuid) : RTUuidClear(&Uuid);2901 if (RT_FAILURE(rc) || RTUuidIsNull(&Uuid))2902 {2903 /* Generate a predictable serial for drives which don't have a UUID. */2904 RTStrPrintf(aSerial, sizeof(aSerial), "VB%x-1a2b3c4d",2905 pAhciPort->iLUN);2906 }2907 else2908 RTStrPrintf(aSerial, sizeof(aSerial), "VB%08x-%08x", Uuid.au32[0], Uuid.au32[3]);2909 2907 2910 2908 memset(p, 0, 512); 2911 2909 /* Removable CDROM, 50us response, 12 byte packets */ 2912 2910 p[0] = RT_H2LE_U16(2 << 14 | 5 << 8 | 1 << 7 | 2 << 5 | 0 << 0); 2913 ataPadString((uint8_t *)(p + 10), aSerial, 20); /* serial number */2911 ataPadString((uint8_t *)(p + 10), pAhciPort->szSerialNumber, AHCI_SERIAL_NUMBER_LENGTH); /* serial number */ 2914 2912 p[20] = RT_H2LE_U16(3); /* XXX: retired, cache type */ 2915 2913 p[21] = RT_H2LE_U16(512); /* XXX: retired, cache size in sectors */ 2916 ataPadString((uint8_t *)(p + 23), "1.0", 8); /* firmware version */2917 ataPadString((uint8_t *)(p + 27), "VBOX CD-ROM", 40); /* model */2914 ataPadString((uint8_t *)(p + 23), pAhciPort->szFirmwareRevision, AHCI_FIRMWARE_REVISION_LENGTH); /* firmware version */ 2915 ataPadString((uint8_t *)(p + 27), pAhciPort->szModelNumber, AHCI_MODEL_NUMBER_LENGTH); /* model */ 2918 2916 p[49] = RT_H2LE_U16(1 << 11 | 1 << 9 | 1 << 8); /* DMA and LBA supported */ 2919 2917 p[50] = RT_H2LE_U16(1 << 14); /* No drive specific standby timer minimum */ … … 3071 3069 aBuf[6] = 0; /* reserved */ 3072 3070 aBuf[7] = 0; /* reserved */ 3073 ataSCSIPadStr(aBuf + 8, "VBOX", 8);3074 ataSCSIPadStr(aBuf + 16, "CD-ROM", 16);3075 ataSCSIPadStr(aBuf + 32, "1.0", 4);3071 ataSCSIPadStr(aBuf + 8, pAhciPort->szInquiryVendorId, 8); 3072 ataSCSIPadStr(aBuf + 16, pAhciPort->szInquiryProductId, 16); 3073 ataSCSIPadStr(aBuf + 32, pAhciPort->szInquiryRevision, 4); 3076 3074 3077 3075 /* Copy the buffer in to the scatter gather list. */ … … 6756 6754 6757 6755 rc = CFGMR3QueryStringDef(pCfgNode, "ModelNumber", pAhciPort->szModelNumber, sizeof(pAhciPort->szModelNumber), 6758 "VBOX HARDDISK");6756 pAhciPort->fATAPI ? "VBOX CD-ROM" : "VBOX HARDDISK"); 6759 6757 if (RT_FAILURE(rc)) 6760 6758 { … … 6764 6762 return PDMDEV_SET_ERROR(pDevIns, rc, 6765 6763 N_("AHCI configuration error: failed to read \"ModelNumber\" as string")); 6764 } 6765 6766 /* There are three other identification strings for CD drives used for INQUIRY */ 6767 if (pAhciPort->fATAPI) 6768 { 6769 rc = CFGMR3QueryStringDef(pCfgNode, "ATAPIVendorId", pAhciPort->szInquiryVendorId, sizeof(pAhciPort->szInquiryVendorId), 6770 "VBOX"); 6771 if (RT_FAILURE(rc)) 6772 { 6773 if (rc == VERR_CFGM_NOT_ENOUGH_SPACE) 6774 return PDMDEV_SET_ERROR(pDevIns, VERR_INVALID_PARAMETER, 6775 N_("PIIX3 configuration error: \"ATAPIVendorId\" is longer than 16 bytes")); 6776 return PDMDEV_SET_ERROR(pDevIns, rc, 6777 N_("PIIX3 configuration error: failed to read \"ATAPIVendorId\" as string")); 6778 } 6779 6780 rc = CFGMR3QueryStringDef(pCfgNode, "ATAPIProductId", pAhciPort->szInquiryProductId, sizeof(pAhciPort->szInquiryProductId), 6781 "CD-ROM"); 6782 if (RT_FAILURE(rc)) 6783 { 6784 if (rc == VERR_CFGM_NOT_ENOUGH_SPACE) 6785 return PDMDEV_SET_ERROR(pDevIns, VERR_INVALID_PARAMETER, 6786 N_("PIIX3 configuration error: \"ATAPIProductId\" is longer than 16 bytes")); 6787 return PDMDEV_SET_ERROR(pDevIns, rc, 6788 N_("PIIX3 configuration error: failed to read \"ATAPIProductId\" as string")); 6789 } 6790 6791 rc = CFGMR3QueryStringDef(pCfgNode, "ATAPIRevision", pAhciPort->szInquiryRevision, sizeof(pAhciPort->szInquiryRevision), 6792 "1.0"); 6793 if (RT_FAILURE(rc)) 6794 { 6795 if (rc == VERR_CFGM_NOT_ENOUGH_SPACE) 6796 return PDMDEV_SET_ERROR(pDevIns, VERR_INVALID_PARAMETER, 6797 N_("PIIX3 configuration error: \"ATAPIRevision\" is longer than 4 bytes")); 6798 return PDMDEV_SET_ERROR(pDevIns, rc, 6799 N_("PIIX3 configuration error: failed to read \"ATAPIRevision\" as string")); 6800 } 6766 6801 } 6767 6802 -
trunk/src/VBox/Devices/testcase/tstDeviceStructSizeGC.cpp
r24169 r24172 1195 1195 GEN_CHECK_OFF(AHCIPort, szModelNumber); 1196 1196 GEN_CHECK_OFF(AHCIPort, szModelNumber[AHCI_MODEL_NUMBER_LENGTH]); /* One additional byte for the termination.*/ 1197 GEN_CHECK_OFF(AHCIPort, szInquiryVendorId[AHCI_ATAPI_INQUIRY_VENDOR_ID_LENGTH]); 1198 GEN_CHECK_OFF(AHCIPort, szInquiryProductId); 1199 GEN_CHECK_OFF(AHCIPort, szInquiryProductId[AHCI_ATAPI_INQUIRY_PRODUCT_ID_LENGTH]); 1200 GEN_CHECK_OFF(AHCIPort, szInquiryRevision); 1201 GEN_CHECK_OFF(AHCIPort, szInquiryRevision[AHCI_ATAPI_INQUIRY_REVISION_LENGTH]); 1197 1202 1198 1203 GEN_CHECK_SIZE(AHCI);
Note:
See TracChangeset
for help on using the changeset viewer.