diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ata/libata-acpi.c | 62 |
1 files changed, 27 insertions, 35 deletions
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index 9e5fc5d75b2e..b3aeca368774 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -94,6 +94,9 @@ static void ata_acpi_associate_ide_port(struct ata_port *ap) | |||
94 | 94 | ||
95 | dev->acpi_handle = acpi_get_child(ap->acpi_handle, i); | 95 | dev->acpi_handle = acpi_get_child(ap->acpi_handle, i); |
96 | } | 96 | } |
97 | |||
98 | if (ata_acpi_gtm(ap, &ap->__acpi_init_gtm) == 0) | ||
99 | ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; | ||
97 | } | 100 | } |
98 | 101 | ||
99 | static void ata_acpi_handle_hotplug(struct ata_port *ap, struct kobject *kobj, | 102 | static void ata_acpi_handle_hotplug(struct ata_port *ap, struct kobject *kobj, |
@@ -199,7 +202,18 @@ void ata_acpi_associate(struct ata_host *host) | |||
199 | */ | 202 | */ |
200 | void ata_acpi_dissociate(struct ata_host *host) | 203 | void ata_acpi_dissociate(struct ata_host *host) |
201 | { | 204 | { |
202 | /* nada */ | 205 | int i; |
206 | |||
207 | /* Restore initial _GTM values so that driver which attaches | ||
208 | * afterward can use them too. | ||
209 | */ | ||
210 | for (i = 0; i < host->n_ports; i++) { | ||
211 | struct ata_port *ap = host->ports[i]; | ||
212 | const struct ata_acpi_gtm *gtm = ata_acpi_init_gtm(ap); | ||
213 | |||
214 | if (ap->acpi_handle && gtm) | ||
215 | ata_acpi_stm(ap, gtm); | ||
216 | } | ||
203 | } | 217 | } |
204 | 218 | ||
205 | /** | 219 | /** |
@@ -409,22 +423,21 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf, | |||
409 | 423 | ||
410 | int ata_acpi_cbl_80wire(struct ata_port *ap) | 424 | int ata_acpi_cbl_80wire(struct ata_port *ap) |
411 | { | 425 | { |
412 | struct ata_acpi_gtm gtm; | 426 | const struct ata_acpi_gtm *gtm = ata_acpi_init_gtm(ap); |
413 | int valid = 0; | 427 | int valid = 0; |
414 | 428 | ||
415 | /* No _GTM data, no information */ | 429 | if (!gtm) |
416 | if (ata_acpi_gtm(ap, >m) < 0) | ||
417 | return 0; | 430 | return 0; |
418 | 431 | ||
419 | /* Split timing, DMA enabled */ | 432 | /* Split timing, DMA enabled */ |
420 | if ((gtm.flags & 0x11) == 0x11 && gtm.drive[0].dma < 55) | 433 | if ((gtm->flags & 0x11) == 0x11 && gtm->drive[0].dma < 55) |
421 | valid |= 1; | 434 | valid |= 1; |
422 | if ((gtm.flags & 0x14) == 0x14 && gtm.drive[1].dma < 55) | 435 | if ((gtm->flags & 0x14) == 0x14 && gtm->drive[1].dma < 55) |
423 | valid |= 2; | 436 | valid |= 2; |
424 | /* Shared timing, DMA enabled */ | 437 | /* Shared timing, DMA enabled */ |
425 | if ((gtm.flags & 0x11) == 0x01 && gtm.drive[0].dma < 55) | 438 | if ((gtm->flags & 0x11) == 0x01 && gtm->drive[0].dma < 55) |
426 | valid |= 1; | 439 | valid |= 1; |
427 | if ((gtm.flags & 0x14) == 0x04 && gtm.drive[0].dma < 55) | 440 | if ((gtm->flags & 0x14) == 0x04 && gtm->drive[0].dma < 55) |
428 | valid |= 2; | 441 | valid |= 2; |
429 | 442 | ||
430 | /* Drive check */ | 443 | /* Drive check */ |
@@ -612,27 +625,8 @@ static int ata_acpi_push_id(struct ata_device *dev) | |||
612 | */ | 625 | */ |
613 | int ata_acpi_on_suspend(struct ata_port *ap) | 626 | int ata_acpi_on_suspend(struct ata_port *ap) |
614 | { | 627 | { |
615 | unsigned long flags; | 628 | /* nada */ |
616 | int rc; | 629 | return 0; |
617 | |||
618 | /* proceed iff per-port acpi_handle is valid */ | ||
619 | if (!ap->acpi_handle) | ||
620 | return 0; | ||
621 | BUG_ON(ap->flags & ATA_FLAG_ACPI_SATA); | ||
622 | |||
623 | /* store timing parameters */ | ||
624 | rc = ata_acpi_gtm(ap, &ap->acpi_gtm); | ||
625 | |||
626 | spin_lock_irqsave(ap->lock, flags); | ||
627 | if (rc == 0) | ||
628 | ap->pflags |= ATA_PFLAG_GTM_VALID; | ||
629 | else | ||
630 | ap->pflags &= ~ATA_PFLAG_GTM_VALID; | ||
631 | spin_unlock_irqrestore(ap->lock, flags); | ||
632 | |||
633 | if (rc == -ENOENT) | ||
634 | rc = 0; | ||
635 | return rc; | ||
636 | } | 630 | } |
637 | 631 | ||
638 | /** | 632 | /** |
@@ -647,14 +641,12 @@ int ata_acpi_on_suspend(struct ata_port *ap) | |||
647 | */ | 641 | */ |
648 | void ata_acpi_on_resume(struct ata_port *ap) | 642 | void ata_acpi_on_resume(struct ata_port *ap) |
649 | { | 643 | { |
644 | const struct ata_acpi_gtm *gtm = ata_acpi_init_gtm(ap); | ||
650 | struct ata_device *dev; | 645 | struct ata_device *dev; |
651 | 646 | ||
652 | if (ap->acpi_handle && (ap->pflags & ATA_PFLAG_GTM_VALID)) { | 647 | /* restore timing parameters */ |
653 | BUG_ON(ap->flags & ATA_FLAG_ACPI_SATA); | 648 | if (ap->acpi_handle && gtm) |
654 | 649 | ata_acpi_stm(ap, gtm); | |
655 | /* restore timing parameters */ | ||
656 | ata_acpi_stm(ap, &ap->acpi_gtm); | ||
657 | } | ||
658 | 650 | ||
659 | /* schedule _GTF */ | 651 | /* schedule _GTF */ |
660 | ata_link_for_each_dev(dev, &ap->link) | 652 | ata_link_for_each_dev(dev, &ap->link) |