diff options
author | Tejun Heo <htejun@gmail.com> | 2007-12-18 02:33:06 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2008-01-23 05:24:12 -0500 |
commit | 021ee9a6da1cfc57f6a6c769c3c898bdd4753108 (patch) | |
tree | bb8c0246ded5a1d99320055343c7d277208fadd8 /drivers/ata/libata-acpi.c | |
parent | a0f79b929acaba10d4780acd2543eff20bf4b5b0 (diff) |
libata: reimplement ata_acpi_cbl_80wire() using ata_acpi_gtm_xfermask()
Reimplement ata_acpi_cbl_80wire() using ata_acpi_gtm_xfermask() and
while at it relocate the function below ata_acpi_gtm_xfermask().
New ata_acpi_cbl_80wire() implementation takes @gtm, in both pata_via
and pata_amd, use the initial GTM value. Both are trying to peek
initial BIOS configuration, so using initial caching value makes
sense. This fixes ACPI part of cable detection in pata_amd which
previously always returned 0 because configuring PIO0 during reset
clears DMA configuration.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-acpi.c')
-rw-r--r-- | drivers/ata/libata-acpi.c | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index a6f1a6b56d8c..9e8ec19260af 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -490,38 +490,29 @@ EXPORT_SYMBOL_GPL(ata_acpi_gtm_xfermask); | |||
490 | /** | 490 | /** |
491 | * ata_acpi_cbl_80wire - Check for 80 wire cable | 491 | * ata_acpi_cbl_80wire - Check for 80 wire cable |
492 | * @ap: Port to check | 492 | * @ap: Port to check |
493 | * @gtm: GTM data to use | ||
493 | * | 494 | * |
494 | * Return 1 if the ACPI mode data for this port indicates the BIOS selected | 495 | * Return 1 if the @gtm indicates the BIOS selected an 80wire mode. |
495 | * an 80wire mode. | ||
496 | */ | 496 | */ |
497 | 497 | int ata_acpi_cbl_80wire(struct ata_port *ap, const struct ata_acpi_gtm *gtm) | |
498 | int ata_acpi_cbl_80wire(struct ata_port *ap) | ||
499 | { | 498 | { |
500 | const struct ata_acpi_gtm *gtm = ata_acpi_init_gtm(ap); | 499 | struct ata_device *dev; |
501 | int valid = 0; | ||
502 | 500 | ||
503 | if (!gtm) | 501 | ata_link_for_each_dev(dev, &ap->link) { |
504 | return 0; | 502 | unsigned long xfer_mask, udma_mask; |
503 | |||
504 | if (!ata_dev_enabled(dev)) | ||
505 | continue; | ||
506 | |||
507 | xfer_mask = ata_acpi_gtm_xfermask(dev, gtm); | ||
508 | ata_unpack_xfermask(xfer_mask, NULL, NULL, &udma_mask); | ||
509 | |||
510 | if (udma_mask & ~ATA_UDMA_MASK_40C) | ||
511 | return 1; | ||
512 | } | ||
505 | 513 | ||
506 | /* Split timing, DMA enabled */ | ||
507 | if ((gtm->flags & 0x11) == 0x11 && gtm->drive[0].dma < 55) | ||
508 | valid |= 1; | ||
509 | if ((gtm->flags & 0x14) == 0x14 && gtm->drive[1].dma < 55) | ||
510 | valid |= 2; | ||
511 | /* Shared timing, DMA enabled */ | ||
512 | if ((gtm->flags & 0x11) == 0x01 && gtm->drive[0].dma < 55) | ||
513 | valid |= 1; | ||
514 | if ((gtm->flags & 0x14) == 0x04 && gtm->drive[0].dma < 55) | ||
515 | valid |= 2; | ||
516 | |||
517 | /* Drive check */ | ||
518 | if ((valid & 1) && ata_dev_enabled(&ap->link.device[0])) | ||
519 | return 1; | ||
520 | if ((valid & 2) && ata_dev_enabled(&ap->link.device[1])) | ||
521 | return 1; | ||
522 | return 0; | 514 | return 0; |
523 | } | 515 | } |
524 | |||
525 | EXPORT_SYMBOL_GPL(ata_acpi_cbl_80wire); | 516 | EXPORT_SYMBOL_GPL(ata_acpi_cbl_80wire); |
526 | 517 | ||
527 | static void ata_acpi_gtf_to_tf(struct ata_device *dev, | 518 | static void ata_acpi_gtf_to_tf(struct ata_device *dev, |