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 | |
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')
-rw-r--r-- | drivers/ata/libata-acpi.c | 41 | ||||
-rw-r--r-- | drivers/ata/pata_amd.c | 3 | ||||
-rw-r--r-- | drivers/ata/pata_via.c | 3 |
3 files changed, 20 insertions, 27 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, |
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c index 3cc27b514654..e71125a4bd9b 100644 --- a/drivers/ata/pata_amd.c +++ b/drivers/ata/pata_amd.c | |||
@@ -272,7 +272,8 @@ static int nv_cable_detect(struct ata_port *ap) | |||
272 | if ((udma & 0xC4) == 0xC4 || (udma & 0xC400) == 0xC400) | 272 | if ((udma & 0xC4) == 0xC4 || (udma & 0xC400) == 0xC400) |
273 | cbl = ATA_CBL_PATA80; | 273 | cbl = ATA_CBL_PATA80; |
274 | /* And a triple check across suspend/resume with ACPI around */ | 274 | /* And a triple check across suspend/resume with ACPI around */ |
275 | if (ata_acpi_cbl_80wire(ap)) | 275 | if (ata_acpi_init_gtm(ap) && |
276 | ata_acpi_cbl_80wire(ap, ata_acpi_init_gtm(ap))) | ||
276 | cbl = ATA_CBL_PATA80; | 277 | cbl = ATA_CBL_PATA80; |
277 | return cbl; | 278 | return cbl; |
278 | } | 279 | } |
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c index 453d72bf2598..39627ab684bf 100644 --- a/drivers/ata/pata_via.c +++ b/drivers/ata/pata_via.c | |||
@@ -185,7 +185,8 @@ static int via_cable_detect(struct ata_port *ap) { | |||
185 | if (ata66 & (0x10100000 >> (16 * ap->port_no))) | 185 | if (ata66 & (0x10100000 >> (16 * ap->port_no))) |
186 | return ATA_CBL_PATA80; | 186 | return ATA_CBL_PATA80; |
187 | /* Check with ACPI so we can spot BIOS reported SATA bridges */ | 187 | /* Check with ACPI so we can spot BIOS reported SATA bridges */ |
188 | if (ata_acpi_cbl_80wire(ap)) | 188 | if (ata_acpi_init_gtm(ap) && |
189 | ata_acpi_cbl_80wire(ap, ata_acpi_init_gtm(ap))) | ||
189 | return ATA_CBL_PATA80; | 190 | return ATA_CBL_PATA80; |
190 | return ATA_CBL_PATA40; | 191 | return ATA_CBL_PATA40; |
191 | } | 192 | } |