VirtualBox

Changeset 24172 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Oct 29, 2009 5:48:16 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
54111
Message:

AHCI: Add additional VPD keys

Location:
trunk/src/VBox/Devices
Files:
2 edited

Legend:

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

    r24096 r24172  
    9797 * Length of the configurable VPD data (without termination)
    9898 */
    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
    102105
    103106/* Command Header. */
     
    437440    R3PTRTYPE(PAHCIPORTTASKSTATE)   aCachedTasks[AHCI_NR_COMMAND_SLOTS];
    438441
     442    uint32_t                        u32Alignment5;
     443
    439444    /** Release statistics: number of DMA commands. */
    440445    STAMCOUNTER                     StatDMA;
     
    468473    /** The model number to use for IDENTIFY DEVICE commands. */
    469474    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;
    474483
    475484} AHCIPort, *PAHCIPort;
     
    28942903{
    28952904    uint16_t p[256];
    2896     char aSerial[20];
    28972905    RTUUID Uuid;
    28982906    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     else
    2908         RTStrPrintf(aSerial, sizeof(aSerial), "VB%08x-%08x", Uuid.au32[0], Uuid.au32[3]);
    29092907
    29102908    memset(p, 0, 512);
    29112909    /* Removable CDROM, 50us response, 12 byte packets */
    29122910    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 */
    29142912    p[20] = RT_H2LE_U16(3); /* XXX: retired, cache type */
    29152913    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 */
    29182916    p[49] = RT_H2LE_U16(1 << 11 | 1 << 9 | 1 << 8); /* DMA and LBA supported */
    29192917    p[50] = RT_H2LE_U16(1 << 14);  /* No drive specific standby timer minimum */
     
    30713069    aBuf[6] = 0; /* reserved */
    30723070    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);
    30763074
    30773075    /* Copy the buffer in to the scatter gather list. */
     
    67566754
    67576755            rc = CFGMR3QueryStringDef(pCfgNode, "ModelNumber", pAhciPort->szModelNumber, sizeof(pAhciPort->szModelNumber),
    6758                                       "VBOX HARDDISK");
     6756                                      pAhciPort->fATAPI ? "VBOX CD-ROM" : "VBOX HARDDISK");
    67596757            if (RT_FAILURE(rc))
    67606758            {
     
    67646762                return PDMDEV_SET_ERROR(pDevIns, rc,
    67656763                            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                }
    67666801            }
    67676802
  • trunk/src/VBox/Devices/testcase/tstDeviceStructSizeGC.cpp

    r24169 r24172  
    11951195    GEN_CHECK_OFF(AHCIPort, szModelNumber);
    11961196    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]);
    11971202
    11981203    GEN_CHECK_SIZE(AHCI);
Note: See TracChangeset for help on using the changeset viewer.

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