Beispiel #1
0
// ----------------------------------------------------------------------------
// Function: ConfigLBA48
//     This is a helper function which is called after the IDENTIFY_DEVICE
//     command has been successfully executed.  It parses the results
//     of the IDENTIFY_DEVICE command to determine if 48-bit LBA is supported
//     by the device.
//
// Parameters:
//     None
// ----------------------------------------------------------------------------
void CST202T_SATA::ConfigLBA48(void)
{
    PIDENTIFY_DATA6 pId = (PIDENTIFY_DATA6)&m_Id;

    // Word 87 (CommandSetFeatureDefault):
    //         bit 14 is set and bit 15 is cleared if config data
    //         in word 86 (CommandSetFeatureEnabled2) is valid.
    // Note that this is only valid for non-ATAPI devices
    if ( !IsAtapiDevice() &&
         (pId->CommandSetFeatureDefault & (1 << 14)) &&
         !(pId->CommandSetFeatureDefault & (1 << 15)) &&
         (pId->CommandSetFeatureEnabled2 & (1 << 10)) )
        {
        DEBUGMSG(ZONE_INIT, (TEXT("Atapi!CST202T_SATA::ConfigLBA48> Device supports 48-bit LBA\r\n")));
        DEBUGMSG(ZONE_INIT, (TEXT("Atapi!CST202T_SATA::ConfigLBA48> Max LBA Address = 0x%08x%08x"), pId->lMaxLBAAddress[1], pId->lMaxLBAAddress[0]));

        m_fUseLBA48 = TRUE;

        // The CE file system currently supports a maximum of 32-bit sector addresses,
        // so we only use the lower DWORD of lMaxLBAAdress.
        m_DiskInfo.di_total_sectors = pId->lMaxLBAAddress[0];

        // CDisk::Identify has determined whether or not the device supports multi-sector transfers
        // Update read/write command to use [READ|WRITE] [SECTORS|MULTIPLE] EXT
        if (m_bReadCommand == ATA_CMD_READ)
            {
            m_bReadCommand = ATA_CMD_READ_SECTOR_EXT;
            m_bWriteCommand = ATA_CMD_WRITE_SECTOR_EXT;
            }
        else // CDisk::Identify has determined that the devce supports multi-sector transfers
            {
            m_bReadCommand = ATA_CMD_READ_MULTIPLE_EXT;
            m_bWriteCommand = ATA_CMD_WRITE_MULTIPLE_EXT;
            }

        m_bDMAReadCommand = ATA_CMD_READ_DMA_EXT;
        m_bDMAWriteCommand = ATA_CMD_WRITE_DMA_EXT;
        }
}
Beispiel #2
0
DWORD
CPCIDiskAndCD::MainIoctl(
    PIOREQ pIOReq
    )
{
    DWORD dwError;

    DEBUGMSG(ZONE_IOCTL, (_T(
        "Atapi!CPCIDiskAndCD::MainIoctl> IOCTL(0x%x), device(%d)\r\n"
        ),pIOReq->dwCode, m_dwDeviceId));

    dwError = CPCIDisk::MainIoctl(pIOReq);

    if (dwError == ERROR_NOT_SUPPORTED) {

        switch(pIOReq->dwCode) {

            // supported ATAPI commands
            case IOCTL_CDROM_READ_SG:
            case IOCTL_CDROM_TEST_UNIT_READY:
            case IOCTL_CDROM_DISC_INFO:
            case IOCTL_CDROM_EJECT_MEDIA:
            case IOCTL_CDROM_LOAD_MEDIA:

            // supported DVD commands
            case IOCTL_DVD_START_SESSION:
            case IOCTL_DVD_READ_KEY:
            case IOCTL_DVD_END_SESSION:
            case IOCTL_DVD_SEND_KEY:
            case IOCTL_DVD_GET_REGION:

            // supported audio commands
            case IOCTL_CDROM_READ_TOC:
            case IOCTL_CDROM_GET_CONTROL:
            case IOCTL_CDROM_PLAY_AUDIO_MSF:
            case IOCTL_CDROM_SEEK_AUDIO_MSF:
            case IOCTL_CDROM_STOP_AUDIO:
            case IOCTL_CDROM_PAUSE_AUDIO:
            case IOCTL_CDROM_RESUME_AUDIO:
            case IOCTL_CDROM_GET_VOLUME:
            case IOCTL_CDROM_SET_VOLUME:
            case IOCTL_CDROM_READ_Q_CHANNEL:
            case IOCTL_CDROM_GET_LAST_SESSION:
            case IOCTL_CDROM_RAW_READ:
            case IOCTL_CDROM_DISK_TYPE:
            case IOCTL_CDROM_SCAN_AUDIO:
            case IOCTL_CDROM_ISSUE_INQUIRY:

                if (IsAtapiDevice()) {
                    dwError = AtapiIoctl(pIOReq);
                }
                else {
                    dwError = ERROR_INVALID_OPERATION;
                }
                break;

            default:
                dwError = ERROR_NOT_SUPPORTED;
                break;
        }
    }

    return dwError;
}