mirror of https://gitee.com/openkylin/linux.git
libata: Be a bit more slack about early devices
We have a certain number of 'ATA' emulations often on CF or other flash devices that are at best "loosely based" on the CF 1.1 standard. These devices report themselves as disk but don't support the ATA minimal command set only the CF 1.1 set. Relax the PIO checking for devices reporting ATA rev 0, or no iordy support, or CFA. Rework the code a bit as it was already messy and this made it quite ugly. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
This commit is contained in:
parent
f792068e43
commit
b93fda1235
|
@ -3132,16 +3132,21 @@ static int ata_dev_set_mode(struct ata_device *dev)
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
/* Old CFA may refuse this command, which is just fine */
|
if (dev->xfer_shift == ATA_SHIFT_PIO) {
|
||||||
if (dev->xfer_shift == ATA_SHIFT_PIO && ata_id_is_cfa(dev->id))
|
/* Old CFA may refuse this command, which is just fine */
|
||||||
ign_dev_err = 1;
|
if (ata_id_is_cfa(dev->id))
|
||||||
|
ign_dev_err = 1;
|
||||||
/* Some very old devices and some bad newer ones fail any kind of
|
/* Catch several broken garbage emulations plus some pre
|
||||||
SET_XFERMODE request but support PIO0-2 timings and no IORDY */
|
ATA devices */
|
||||||
if (dev->xfer_shift == ATA_SHIFT_PIO && !ata_id_has_iordy(dev->id) &&
|
if (ata_id_major_version(dev->id) == 0 &&
|
||||||
dev->pio_mode <= XFER_PIO_2)
|
dev->pio_mode <= XFER_PIO_2)
|
||||||
ign_dev_err = 1;
|
ign_dev_err = 1;
|
||||||
|
/* Some very old devices and some bad newer ones fail
|
||||||
|
any kind of SET_XFERMODE request but support PIO0-2
|
||||||
|
timings and no IORDY */
|
||||||
|
if (!ata_id_has_iordy(dev->id) && dev->pio_mode <= XFER_PIO_2)
|
||||||
|
ign_dev_err = 1;
|
||||||
|
}
|
||||||
/* Early MWDMA devices do DMA but don't allow DMA mode setting.
|
/* Early MWDMA devices do DMA but don't allow DMA mode setting.
|
||||||
Don't fail an MWDMA0 set IFF the device indicates it is in MWDMA0 */
|
Don't fail an MWDMA0 set IFF the device indicates it is in MWDMA0 */
|
||||||
if (dev->xfer_shift == ATA_SHIFT_MWDMA &&
|
if (dev->xfer_shift == ATA_SHIFT_MWDMA &&
|
||||||
|
|
Loading…
Reference in New Issue