VirtualBox

Changeset 38694 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Sep 8, 2011 9:44:08 PM (13 years ago)
Author:
vboxsync
Message:

VSCSI: Fix Solaris guests after adding support VPD pages, the device identification page is mandatory. Fix a crash for a read or write with a 0 transfer length

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

Legend:

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

    r38680 r38694  
    6464        rc = vscsiVpdPagePoolInit(&pVScsiLunSbc->VpdPagePool);
    6565
     66    /* Create device identification page - mandatory. */
     67    if (RT_SUCCESS(rc))
     68    {
     69        PVSCSIVPDPAGEDEVID pDevIdPage;
     70
     71        rc = vscsiVpdPagePoolAllocNewPage(&pVScsiLunSbc->VpdPagePool, VSCSI_VPD_DEVID_NUMBER,
     72                                          VSCSI_VPD_DEVID_SIZE, (uint8_t **)&pDevIdPage);
     73        if (RT_SUCCESS(rc))
     74        {
     75            /** @todo: Not conforming to the SPC spec but Solaris needs at least a stub to work. */
     76            pDevIdPage->u5PeripheralDeviceType = SCSI_INQUIRY_DATA_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS;
     77            pDevIdPage->u3PeripheralQualifier  = SCSI_INQUIRY_DATA_PERIPHERAL_QUALIFIER_CONNECTED;
     78            pDevIdPage->u16PageLength          = RT_H2BE_U16(0x0);
     79            cVpdPages++;
     80        }
     81    }
     82
    6683    if (   RT_SUCCESS(rc)
    6784        && (pVScsiLun->fFeatures & VSCSI_LUN_FEATURE_UNMAP))
     
    138155            pVpdPages->u16PageLength          = RT_H2BE_U16(cVpdPages);
    139156
     157            pVpdPages->abVpdPages[idxVpdPage++] = VSCSI_VPD_DEVID_NUMBER;
     158
    140159            if (pVScsiLun->fFeatures & VSCSI_LUN_FEATURE_UNMAP)
    141160            {
     
    479498        {
    480499            rcReq = vscsiLunReqSenseErrorSet(pVScsiLun, pVScsiReq, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_LOGICAL_BLOCK_OOR, 0x00);
     500            vscsiDeviceReqComplete(pVScsiLun->pVScsiDevice, pVScsiReq, rcReq, false, VINF_SUCCESS);
     501        }
     502        else if (!cSectorTransfer)
     503        {
     504            /* A 0 transfer length is not an error. */
     505            rcReq = vscsiLunReqSenseOkSet(pVScsiLun, pVScsiReq);
    481506            vscsiDeviceReqComplete(pVScsiLun->pVScsiDevice, pVScsiReq, rcReq, false, VINF_SUCCESS);
    482507        }
  • trunk/src/VBox/Devices/Storage/VSCSI/VSCSIVpdPages.h

    r38682 r38694  
    1919
    2020#include <iprt/stdint.h>
     21
     22/** VPD device identification page number. */
     23#define VSCSI_VPD_DEVID_NUMBER 0x83
     24/** VPD device identification size. */
     25#define VSCSI_VPD_DEVID_SIZE   4
     26/**
     27 * Device identification VPD page data.
     28 */
     29#pragma pack(1)
     30typedef struct VSCSIVPDPAGEDEVID
     31{
     32    /** Device type. */
     33    unsigned u5PeripheralDeviceType : 5;    /**< 0x00 / 00 */
     34    /** Qualifier. */
     35    unsigned u3PeripheralQualifier  : 3;
     36    /** Page number. */
     37    unsigned u8PageCode             : 8;
     38    /** Page size (Big endian) */
     39    unsigned u16PageLength          : 16;
     40} VSCSIVPDPAGEDEVID;
     41#pragma pack()
     42AssertCompileSize(VSCSIVPDPAGEDEVID, VSCSI_VPD_DEVID_SIZE);
     43typedef VSCSIVPDPAGEDEVID *PVSCSIVPDPAGEDEVID;
     44typedef const VSCSIVPDPAGEDEVID *PCVSCSIVPDPAGEDEVID;
    2145
    2246/** VPD supported VPD pages page number. */
Note: See TracChangeset for help on using the changeset viewer.

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