diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-05-09 18:01:10 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-05-09 18:01:10 -0400 |
commit | 7f8f48af0861c38c28d4abd550102643e0ea9e6a (patch) | |
tree | 6ec47ace87afbd96cc1144d423854b09d9f21d75 /drivers/ide/ide-iops.c | |
parent | 7662d046df09e80680b77b68de896beab45e675e (diff) |
ide: cable detection fixes (take 2)
Tejun's recent eighty_ninty_three() fix has inspired me to do more thorough
review of the cable detection code...
* print user-friendly warning about limiting the maximum transfer speed
to UDMA33 (and the reason behind it) when 80-wire cable is not detected,
also while at it cleanup eighty_ninty_three() a bit
* use eighty_ninty_three() in ide_ata66_check(), this actually fixes 3 bugs:
- bit 14 (word 93 validity check) == 1 && bit 13 (80-wire cable test) == 1
were used as 80-wire cable present test for CONFIG_IDEDMA_IVB=n case
(please see FIXME comment in eighty_ninty_three() for more details)
- CONFIG_IDEDMA_IVB=y/n cases were interchanged
- check for SATA devices was missing
* remove private cable warnings from pdc_202xx{old,new} drivers now that core
code provides this functionality (plus, in pdc202xx_new case the test could
give false warnings for ATAPI devices because pdc202xx_new driver doesn't
even support ATAPI DMA)
Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-iops.c')
-rw-r--r-- | drivers/ide/ide-iops.c | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index ed6128f6cd98..f0be5f665a0e 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -571,25 +571,40 @@ EXPORT_SYMBOL(ide_wait_stat); | |||
571 | */ | 571 | */ |
572 | u8 eighty_ninty_three (ide_drive_t *drive) | 572 | u8 eighty_ninty_three (ide_drive_t *drive) |
573 | { | 573 | { |
574 | if(HWIF(drive)->udma_four == 0) | 574 | ide_hwif_t *hwif = drive->hwif; |
575 | return 0; | 575 | struct hd_driveid *id = drive->id; |
576 | |||
577 | if (hwif->udma_four == 0) | ||
578 | goto no_80w; | ||
576 | 579 | ||
577 | /* Check for SATA but only if we are ATA5 or higher */ | 580 | /* Check for SATA but only if we are ATA5 or higher */ |
578 | if (drive->id->hw_config == 0 && (drive->id->major_rev_num & 0x7FE0)) | 581 | if (id->hw_config == 0 && (id->major_rev_num & 0x7FE0)) |
579 | return 1; | 582 | return 1; |
580 | if (!(drive->id->hw_config & 0x6000)) | 583 | |
581 | return 0; | ||
582 | #ifndef CONFIG_IDEDMA_IVB | ||
583 | if(!(drive->id->hw_config & 0x4000)) | ||
584 | return 0; | ||
585 | #endif /* CONFIG_IDEDMA_IVB */ | ||
586 | /* | 584 | /* |
587 | * FIXME: | 585 | * FIXME: |
588 | * - change master/slave IDENTIFY order | 586 | * - change master/slave IDENTIFY order |
589 | * - force bit13 (80c cable present) check | 587 | * - force bit13 (80c cable present) check |
590 | * (unless the slave device is pre-ATA3) | 588 | * (unless the slave device is pre-ATA3) |
591 | */ | 589 | */ |
592 | return 1; | 590 | #ifndef CONFIG_IDEDMA_IVB |
591 | if (id->hw_config & 0x4000) | ||
592 | #else | ||
593 | if (id->hw_config & 0x6000) | ||
594 | #endif | ||
595 | return 1; | ||
596 | |||
597 | no_80w: | ||
598 | if (drive->udma33_warned == 1) | ||
599 | return 0; | ||
600 | |||
601 | printk(KERN_WARNING "%s: %s side 80-wire cable detection failed, " | ||
602 | "limiting max speed to UDMA33\n", | ||
603 | drive->name, hwif->udma_four ? "drive" : "host"); | ||
604 | |||
605 | drive->udma33_warned = 1; | ||
606 | |||
607 | return 0; | ||
593 | } | 608 | } |
594 | 609 | ||
595 | int ide_ata66_check (ide_drive_t *drive, ide_task_t *args) | 610 | int ide_ata66_check (ide_drive_t *drive, ide_task_t *args) |
@@ -597,23 +612,13 @@ int ide_ata66_check (ide_drive_t *drive, ide_task_t *args) | |||
597 | if ((args->tfRegister[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) && | 612 | if ((args->tfRegister[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) && |
598 | (args->tfRegister[IDE_SECTOR_OFFSET] > XFER_UDMA_2) && | 613 | (args->tfRegister[IDE_SECTOR_OFFSET] > XFER_UDMA_2) && |
599 | (args->tfRegister[IDE_FEATURE_OFFSET] == SETFEATURES_XFER)) { | 614 | (args->tfRegister[IDE_FEATURE_OFFSET] == SETFEATURES_XFER)) { |
600 | #ifndef CONFIG_IDEDMA_IVB | 615 | if (eighty_ninty_three(drive) == 0) { |
601 | if ((drive->id->hw_config & 0x6000) == 0) { | 616 | printk(KERN_WARNING "%s: UDMA speeds >UDMA33 cannot " |
602 | #else /* !CONFIG_IDEDMA_IVB */ | 617 | "be set\n", drive->name); |
603 | if (((drive->id->hw_config & 0x2000) == 0) || | ||
604 | ((drive->id->hw_config & 0x4000) == 0)) { | ||
605 | #endif /* CONFIG_IDEDMA_IVB */ | ||
606 | printk("%s: Speed warnings UDMA 3/4/5 is not " | ||
607 | "functional.\n", drive->name); | ||
608 | return 1; | ||
609 | } | ||
610 | if (!HWIF(drive)->udma_four) { | ||
611 | printk("%s: Speed warnings UDMA 3/4/5 is not " | ||
612 | "functional.\n", | ||
613 | HWIF(drive)->name); | ||
614 | return 1; | 618 | return 1; |
615 | } | 619 | } |
616 | } | 620 | } |
621 | |||
617 | return 0; | 622 | return 0; |
618 | } | 623 | } |
619 | 624 | ||