mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 19:26:25 +00:00
ide: identify data word 53 bit 1 doesn't cover words 62 and 63 (take 3)
The IDE code assumed for years that the bit 1 of the identify data word 53 also covers the validity of the SW/MW DMA information in words 62 and 63, but it has always covered only words 64 thru 70, with words 62 and 63 being defined in the original ATA spec, not in ATA-2... This fix however should only concern *very* old hard disks and rather old CF cards... Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This commit is contained in:
parent
985232e388
commit
8d64fcd935
4 changed files with 19 additions and 26 deletions
|
@ -92,8 +92,7 @@ static u8 cs5530_udma_filter(ide_drive_t *drive)
|
||||||
if ((mateid[ATA_ID_FIELD_VALID] & 4) &&
|
if ((mateid[ATA_ID_FIELD_VALID] & 4) &&
|
||||||
(mateid[ATA_ID_UDMA_MODES] & 7))
|
(mateid[ATA_ID_UDMA_MODES] & 7))
|
||||||
goto out;
|
goto out;
|
||||||
if ((mateid[ATA_ID_FIELD_VALID] & 2) &&
|
if (mateid[ATA_ID_MWDMA_MODES] & 7)
|
||||||
(mateid[ATA_ID_MWDMA_MODES] & 7))
|
|
||||||
mask = 0;
|
mask = 0;
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
|
|
|
@ -38,10 +38,9 @@ int config_drive_for_dma(ide_drive_t *drive)
|
||||||
* Enable DMA on any drive that has mode2 DMA
|
* Enable DMA on any drive that has mode2 DMA
|
||||||
* (multi or single) enabled
|
* (multi or single) enabled
|
||||||
*/
|
*/
|
||||||
if (id[ATA_ID_FIELD_VALID] & 2) /* regular DMA */
|
if ((id[ATA_ID_MWDMA_MODES] & 0x404) == 0x404 ||
|
||||||
if ((id[ATA_ID_MWDMA_MODES] & 0x404) == 0x404 ||
|
(id[ATA_ID_SWDMA_MODES] & 0x404) == 0x404)
|
||||||
(id[ATA_ID_SWDMA_MODES] & 0x404) == 0x404)
|
return 1;
|
||||||
return 1;
|
|
||||||
|
|
||||||
/* Consult the list of known "good" drives */
|
/* Consult the list of known "good" drives */
|
||||||
if (ide_dma_good_drive(drive))
|
if (ide_dma_good_drive(drive))
|
||||||
|
|
|
@ -245,12 +245,11 @@ static unsigned int ide_get_mode_mask(ide_drive_t *drive, u8 base, u8 req_mode)
|
||||||
case XFER_UDMA_0:
|
case XFER_UDMA_0:
|
||||||
if ((id[ATA_ID_FIELD_VALID] & 4) == 0)
|
if ((id[ATA_ID_FIELD_VALID] & 4) == 0)
|
||||||
break;
|
break;
|
||||||
|
mask = id[ATA_ID_UDMA_MODES];
|
||||||
if (port_ops && port_ops->udma_filter)
|
if (port_ops && port_ops->udma_filter)
|
||||||
mask = port_ops->udma_filter(drive);
|
mask &= port_ops->udma_filter(drive);
|
||||||
else
|
else
|
||||||
mask = hwif->ultra_mask;
|
mask &= hwif->ultra_mask;
|
||||||
mask &= id[ATA_ID_UDMA_MODES];
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* avoid false cable warning from eighty_ninty_three()
|
* avoid false cable warning from eighty_ninty_three()
|
||||||
|
@ -261,18 +260,15 @@ static unsigned int ide_get_mode_mask(ide_drive_t *drive, u8 base, u8 req_mode)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XFER_MW_DMA_0:
|
case XFER_MW_DMA_0:
|
||||||
if ((id[ATA_ID_FIELD_VALID] & 2) == 0)
|
mask = id[ATA_ID_MWDMA_MODES];
|
||||||
break;
|
|
||||||
if (port_ops && port_ops->mdma_filter)
|
if (port_ops && port_ops->mdma_filter)
|
||||||
mask = port_ops->mdma_filter(drive);
|
mask &= port_ops->mdma_filter(drive);
|
||||||
else
|
else
|
||||||
mask = hwif->mwdma_mask;
|
mask &= hwif->mwdma_mask;
|
||||||
mask &= id[ATA_ID_MWDMA_MODES];
|
|
||||||
break;
|
break;
|
||||||
case XFER_SW_DMA_0:
|
case XFER_SW_DMA_0:
|
||||||
if (id[ATA_ID_FIELD_VALID] & 2) {
|
mask = id[ATA_ID_SWDMA_MODES];
|
||||||
mask = id[ATA_ID_SWDMA_MODES] & hwif->swdma_mask;
|
if (!(mask & ATA_SWDMA2) && (id[ATA_ID_OLD_DMA_MODES] >> 8)) {
|
||||||
} else if (id[ATA_ID_OLD_DMA_MODES] >> 8) {
|
|
||||||
u8 mode = id[ATA_ID_OLD_DMA_MODES] >> 8;
|
u8 mode = id[ATA_ID_OLD_DMA_MODES] >> 8;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -280,8 +276,9 @@ static unsigned int ide_get_mode_mask(ide_drive_t *drive, u8 base, u8 req_mode)
|
||||||
* (the maximum allowed mode is XFER_SW_DMA_2)
|
* (the maximum allowed mode is XFER_SW_DMA_2)
|
||||||
*/
|
*/
|
||||||
if (mode <= 2)
|
if (mode <= 2)
|
||||||
mask = ((2 << mode) - 1) & hwif->swdma_mask;
|
mask = (2 << mode) - 1;
|
||||||
}
|
}
|
||||||
|
mask &= hwif->swdma_mask;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
BUG();
|
BUG();
|
||||||
|
@ -398,11 +395,10 @@ int ide_id_dma_bug(ide_drive_t *drive)
|
||||||
if ((id[ATA_ID_UDMA_MODES] >> 8) &&
|
if ((id[ATA_ID_UDMA_MODES] >> 8) &&
|
||||||
(id[ATA_ID_MWDMA_MODES] >> 8))
|
(id[ATA_ID_MWDMA_MODES] >> 8))
|
||||||
goto err_out;
|
goto err_out;
|
||||||
} else if (id[ATA_ID_FIELD_VALID] & 2) {
|
} else if ((id[ATA_ID_MWDMA_MODES] >> 8) &&
|
||||||
if ((id[ATA_ID_MWDMA_MODES] >> 8) &&
|
(id[ATA_ID_SWDMA_MODES] >> 8))
|
||||||
(id[ATA_ID_SWDMA_MODES] >> 8))
|
goto err_out;
|
||||||
goto err_out;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
err_out:
|
err_out:
|
||||||
printk(KERN_ERR "%s: bad DMA info in identify block\n", drive->name);
|
printk(KERN_ERR "%s: bad DMA info in identify block\n", drive->name);
|
||||||
|
|
|
@ -115,8 +115,7 @@ static u8 sc1200_udma_filter(ide_drive_t *drive)
|
||||||
if ((mateid[ATA_ID_FIELD_VALID] & 4) &&
|
if ((mateid[ATA_ID_FIELD_VALID] & 4) &&
|
||||||
(mateid[ATA_ID_UDMA_MODES] & 7))
|
(mateid[ATA_ID_UDMA_MODES] & 7))
|
||||||
goto out;
|
goto out;
|
||||||
if ((mateid[ATA_ID_FIELD_VALID] & 2) &&
|
if (mateid[ATA_ID_MWDMA_MODES] & 7)
|
||||||
(mateid[ATA_ID_MWDMA_MODES] & 7))
|
|
||||||
mask = 0;
|
mask = 0;
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
|
|
Loading…
Reference in a new issue