Skip to content

Commit

Permalink
ide: relax DMA info validity checking
Browse files Browse the repository at this point in the history
There are some broken devices that report multiple DMA xfer modes
enabled at once (ATA spec doesn't allow it) but otherwise work fine
with DMA so just delete ide_id_dma_bug().

[ As discovered by detective work by Frans and Bart, due to how
  handling of the ID block was handled before commit c419993
  ("ide-iops: only clear DMA words on setting DMA mode") this
  check was always seeing zeros in the fields or other similar
  garbage.  Therefore this check wasn't actually checking anything.
  Now that the tests actually check the real bits, all we see are
  devices that trigger the check yet work perfectly fine, therefore
  killing this useless check is the best thing to do. -DaveM ]

Reported-by: Frans Pop <[email protected]>
Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
bzolnier authored and davem330 committed Jun 24, 2009
1 parent d9ae624 commit 346c17a
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 26 deletions.
21 changes: 0 additions & 21 deletions drivers/ide/ide-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,6 @@ static int ide_tune_dma(ide_drive_t *drive)
if (__ide_dma_bad_drive(drive))
return 0;

if (ide_id_dma_bug(drive))
return 0;

if (hwif->host_flags & IDE_HFLAG_TRUST_BIOS_FOR_DMA)
return config_drive_for_dma(drive);

Expand Down Expand Up @@ -394,24 +391,6 @@ static int ide_dma_check(ide_drive_t *drive)
return -1;
}

int ide_id_dma_bug(ide_drive_t *drive)
{
u16 *id = drive->id;

if (id[ATA_ID_FIELD_VALID] & 4) {
if ((id[ATA_ID_UDMA_MODES] >> 8) &&
(id[ATA_ID_MWDMA_MODES] >> 8))
goto err_out;
} else if ((id[ATA_ID_MWDMA_MODES] >> 8) &&
(id[ATA_ID_SWDMA_MODES] >> 8))
goto err_out;

return 0;
err_out:
printk(KERN_ERR "%s: bad DMA info in identify block\n", drive->name);
return 1;
}

int ide_set_dma(ide_drive_t *drive)
{
int rc;
Expand Down
3 changes: 0 additions & 3 deletions drivers/ide/ide-iops.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,6 @@ int ide_driveid_update(ide_drive_t *drive)

kfree(id);

if ((drive->dev_flags & IDE_DFLAG_USING_DMA) && ide_id_dma_bug(drive))
ide_dma_off(drive);

return 1;
out_err:
if (rc == 2)
Expand Down
2 changes: 0 additions & 2 deletions include/linux/ide.h
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,6 @@ int ide_in_drive_list(u16 *, const struct drive_list_entry *);
#ifdef CONFIG_BLK_DEV_IDEDMA
int ide_dma_good_drive(ide_drive_t *);
int __ide_dma_bad_drive(ide_drive_t *);
int ide_id_dma_bug(ide_drive_t *);

u8 ide_find_dma_mode(ide_drive_t *, u8);

Expand Down Expand Up @@ -1402,7 +1401,6 @@ void ide_dma_lost_irq(ide_drive_t *);
ide_startstop_t ide_dma_timeout_retry(ide_drive_t *, int);

#else
static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; }
static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; }
static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; }
static inline void ide_dma_off_quietly(ide_drive_t *drive) { ; }
Expand Down

0 comments on commit 346c17a

Please sign in to comment.