Apply block count maximum according to device capability. If the device supports
LBA48 we can allow a maximum block count of 65535 as we have a 16bit sector count field available. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30254 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -197,13 +197,10 @@ ATAChannel::GetRestrictions(uint8 targetID, bool *isATAPI, bool *noAutoSense,
|
|||||||
// we always indicate ATAPI so we have to emulate fewer commands
|
// we always indicate ATAPI so we have to emulate fewer commands
|
||||||
*isATAPI = true;
|
*isATAPI = true;
|
||||||
*noAutoSense = false;
|
*noAutoSense = false;
|
||||||
|
*maxBlocks = 0x100;
|
||||||
|
|
||||||
if (targetID < fDeviceCount && fDevices[targetID] != NULL
|
if (targetID < fDeviceCount && fDevices[targetID] != NULL)
|
||||||
&& fDevices[targetID]->IsATAPI()) {
|
fDevices[targetID]->GetRestrictions(noAutoSense, maxBlocks);
|
||||||
*noAutoSense = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
*maxBlocks = 255;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -286,6 +286,20 @@ ATADevice::ExecuteIO(ATARequest *request)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ATADevice::GetRestrictions(bool *noAutoSense, uint32 *maxBlocks)
|
||||||
|
{
|
||||||
|
if (IsATAPI())
|
||||||
|
*noAutoSense = true;
|
||||||
|
else {
|
||||||
|
if (fUse48Bits)
|
||||||
|
*maxBlocks = 0xffff;
|
||||||
|
else
|
||||||
|
*maxBlocks = 0x100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
ATADevice::Select()
|
ATADevice::Select()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -190,9 +190,9 @@ ata_channel_added(device_node *parent)
|
|||||||
// maximum number of blocks per transmission:
|
// maximum number of blocks per transmission:
|
||||||
// - ATAPI uses packets, i.e. normal SCSI limits apply
|
// - ATAPI uses packets, i.e. normal SCSI limits apply
|
||||||
// but I'm not sure about controller restrictions
|
// but I'm not sure about controller restrictions
|
||||||
// - ATA allows up to 256 blocks
|
// - ATA allows up to 256 blocks for LBA28 and 65535 for LBA48
|
||||||
// to fix specific drive bugs use ATAChannel::GetRestrictions()
|
// to fix specific drive bugs use ATAChannel::GetRestrictions()
|
||||||
{ B_DMA_MAX_TRANSFER_BLOCKS, B_UINT32_TYPE, { ui32: 255 } },
|
{ B_DMA_MAX_TRANSFER_BLOCKS, B_UINT32_TYPE, { ui32: 0xffff } },
|
||||||
{ ATA_CHANNEL_ID_ITEM, B_UINT32_TYPE, { ui32: channelID } },
|
{ ATA_CHANNEL_ID_ITEM, B_UINT32_TYPE, { ui32: channelID } },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -173,6 +173,9 @@ virtual ~ATADevice();
|
|||||||
status_t ReadCapacity(ATARequest *request);
|
status_t ReadCapacity(ATARequest *request);
|
||||||
virtual status_t ExecuteIO(ATARequest *request);
|
virtual status_t ExecuteIO(ATARequest *request);
|
||||||
|
|
||||||
|
void GetRestrictions(bool *noAutoSense,
|
||||||
|
uint32 *maxBlocks);
|
||||||
|
|
||||||
// ATA stuff
|
// ATA stuff
|
||||||
virtual bool IsATAPI() { return false; };
|
virtual bool IsATAPI() { return false; };
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user