aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/libata.h
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-12-15 01:05:02 -0500
committerJeff Garzik <jeff@garzik.org>2007-12-17 20:33:14 -0500
commitc05e6ff035c1b25d17364a685432b33937d3dc23 (patch)
tree08c9171d024b6659b29a4f9f7d95318430b75b6a /include/linux/libata.h
parent562f0c2d771ee7be6b37fe015f94a929f8056120 (diff)
libata-acpi: implement and use ata_acpi_init_gtm()
_GTM fetches currently configured transfer mode while _STM configures controller according to _GTM parameter and prepares transfer mode configuration TFs for _GTF. In many cases _GTM and _STM implementations are quite brittle and can't cope with configuration changed by libata. libata does not depend on ATA ACPI to configure devices. The only reason libata performs _GTM and _STM are to make _GTF evaluation succeed and libata also doesn't care about how _GTF TFs configure transfer mode. It overrides that configuration anyway, so from libata's POV, it doesn't matter what value is feeded to _STM as long as evaluation succeeds for _STM and following _GTF. This patch adds dev->__acpi_init_gtm and store initial _GTM values on host initialization before modified by reset and mode configuration. If the field is valid, ata_acpi_init_gtm() returns pointer to the saved _GTM structure; otherwise, NULL. This saved value is used for _STM during resume and peek at BIOS/firmware programmed initial timing for later use. The accessor is there to make building w/o ACPI easy as dev->__acpi_init doesn't exist if ACPI is not enabled. On driver detach, the initial BIOS configuration is restored by executing _STM with the initial _GTM values such that the next driver can also use the initial BIOS configured values. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'include/linux/libata.h')
-rw-r--r--include/linux/libata.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 3784af395576..ba84d8a37545 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -211,7 +211,7 @@ enum {
211 211
212 ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */ 212 ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */
213 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */ 213 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */
214 ATA_PFLAG_GTM_VALID = (1 << 19), /* acpi_gtm data valid */ 214 ATA_PFLAG_INIT_GTM_VALID = (1 << 19), /* initial gtm data valid */
215 215
216 /* struct ata_queued_cmd flags */ 216 /* struct ata_queued_cmd flags */
217 ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */ 217 ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */
@@ -653,7 +653,7 @@ struct ata_port {
653 653
654#ifdef CONFIG_ATA_ACPI 654#ifdef CONFIG_ATA_ACPI
655 acpi_handle acpi_handle; 655 acpi_handle acpi_handle;
656 struct ata_acpi_gtm acpi_gtm; 656 struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */
657#endif 657#endif
658 u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */ 658 u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */
659}; 659};
@@ -939,10 +939,20 @@ enum {
939 939
940/* libata-acpi.c */ 940/* libata-acpi.c */
941#ifdef CONFIG_ATA_ACPI 941#ifdef CONFIG_ATA_ACPI
942static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap)
943{
944 if (ap->pflags & ATA_PFLAG_INIT_GTM_VALID)
945 return &ap->__acpi_init_gtm;
946 return NULL;
947}
942extern int ata_acpi_cbl_80wire(struct ata_port *ap); 948extern int ata_acpi_cbl_80wire(struct ata_port *ap);
943int ata_acpi_stm(struct ata_port *ap, const struct ata_acpi_gtm *stm); 949int ata_acpi_stm(struct ata_port *ap, const struct ata_acpi_gtm *stm);
944int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *stm); 950int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *stm);
945#else 951#else
952static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap)
953{
954 return NULL;
955}
946static inline int ata_acpi_cbl_80wire(struct ata_port *ap) { return 0; } 956static inline int ata_acpi_cbl_80wire(struct ata_port *ap) { return 0; }
947#endif 957#endif
948 958