aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-09-15 15:17:28 -0400
committerJeff Garzik <jgarzik@redhat.com>2009-10-06 00:26:27 -0400
commit110f66d25c33c2259b1125255fa7063ab07b8340 (patch)
tree2d524b3f27aa168eb01cbb007c2bfa195bea42f4 /drivers/ata
parentfa5b561c4ea170caf9759109acc2e961a7e83bea (diff)
libata: make gtf_filter per-dev
Add ->gtf_filter to ata_device and set it to ata_acpi_gtf_filter when initializing ata_link. This is to allow quirks which apply different gtf filters. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/libata-acpi.c17
-rw-r--r--drivers/ata/libata-core.c3
-rw-r--r--drivers/ata/libata.h2
3 files changed, 14 insertions, 8 deletions
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index 960c6a7caa83..b0882cddfd4c 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -20,7 +20,7 @@
20 20
21#include <acpi/acpi_bus.h> 21#include <acpi/acpi_bus.h>
22 22
23static unsigned int ata_acpi_gtf_filter = ATA_ACPI_FILTER_DEFAULT; 23unsigned int ata_acpi_gtf_filter = ATA_ACPI_FILTER_DEFAULT;
24module_param_named(acpi_gtf_filter, ata_acpi_gtf_filter, int, 0644); 24module_param_named(acpi_gtf_filter, ata_acpi_gtf_filter, int, 0644);
25MODULE_PARM_DESC(acpi_gtf_filter, "filter mask for ACPI _GTF commands, set to filter out (0x1=set xfermode, 0x2=lock/freeze lock, 0x4=DIPM, 0x8=FPDMA non-zero offset, 0x10=FPDMA DMA Setup FIS auto-activate)"); 25MODULE_PARM_DESC(acpi_gtf_filter, "filter mask for ACPI _GTF commands, set to filter out (0x1=set xfermode, 0x2=lock/freeze lock, 0x4=DIPM, 0x8=FPDMA non-zero offset, 0x10=FPDMA DMA Setup FIS auto-activate)");
26 26
@@ -603,10 +603,11 @@ static void ata_acpi_gtf_to_tf(struct ata_device *dev,
603 tf->command = gtf->tf[6]; /* 0x1f7 */ 603 tf->command = gtf->tf[6]; /* 0x1f7 */
604} 604}
605 605
606static int ata_acpi_filter_tf(const struct ata_taskfile *tf, 606static int ata_acpi_filter_tf(struct ata_device *dev,
607 const struct ata_taskfile *tf,
607 const struct ata_taskfile *ptf) 608 const struct ata_taskfile *ptf)
608{ 609{
609 if (ata_acpi_gtf_filter & ATA_ACPI_FILTER_SETXFER) { 610 if (dev->gtf_filter & ATA_ACPI_FILTER_SETXFER) {
610 /* libata doesn't use ACPI to configure transfer mode. 611 /* libata doesn't use ACPI to configure transfer mode.
611 * It will only confuse device configuration. Skip. 612 * It will only confuse device configuration. Skip.
612 */ 613 */
@@ -615,7 +616,7 @@ static int ata_acpi_filter_tf(const struct ata_taskfile *tf,
615 return 1; 616 return 1;
616 } 617 }
617 618
618 if (ata_acpi_gtf_filter & ATA_ACPI_FILTER_LOCK) { 619 if (dev->gtf_filter & ATA_ACPI_FILTER_LOCK) {
619 /* BIOS writers, sorry but we don't wanna lock 620 /* BIOS writers, sorry but we don't wanna lock
620 * features unless the user explicitly said so. 621 * features unless the user explicitly said so.
621 */ 622 */
@@ -640,18 +641,18 @@ static int ata_acpi_filter_tf(const struct ata_taskfile *tf,
640 if (tf->command == ATA_CMD_SET_FEATURES && 641 if (tf->command == ATA_CMD_SET_FEATURES &&
641 tf->feature == SETFEATURES_SATA_ENABLE) { 642 tf->feature == SETFEATURES_SATA_ENABLE) {
642 /* inhibit enabling DIPM */ 643 /* inhibit enabling DIPM */
643 if (ata_acpi_gtf_filter & ATA_ACPI_FILTER_DIPM && 644 if (dev->gtf_filter & ATA_ACPI_FILTER_DIPM &&
644 tf->nsect == SATA_DIPM) 645 tf->nsect == SATA_DIPM)
645 return 1; 646 return 1;
646 647
647 /* inhibit FPDMA non-zero offset */ 648 /* inhibit FPDMA non-zero offset */
648 if (ata_acpi_gtf_filter & ATA_ACPI_FILTER_FPDMA_OFFSET && 649 if (dev->gtf_filter & ATA_ACPI_FILTER_FPDMA_OFFSET &&
649 (tf->nsect == SATA_FPDMA_OFFSET || 650 (tf->nsect == SATA_FPDMA_OFFSET ||
650 tf->nsect == SATA_FPDMA_IN_ORDER)) 651 tf->nsect == SATA_FPDMA_IN_ORDER))
651 return 1; 652 return 1;
652 653
653 /* inhibit FPDMA auto activation */ 654 /* inhibit FPDMA auto activation */
654 if (ata_acpi_gtf_filter & ATA_ACPI_FILTER_FPDMA_AA && 655 if (dev->gtf_filter & ATA_ACPI_FILTER_FPDMA_AA &&
655 tf->nsect == SATA_FPDMA_AA) 656 tf->nsect == SATA_FPDMA_AA)
656 return 1; 657 return 1;
657 } 658 }
@@ -705,7 +706,7 @@ static int ata_acpi_run_tf(struct ata_device *dev,
705 pptf = &ptf; 706 pptf = &ptf;
706 } 707 }
707 708
708 if (!ata_acpi_filter_tf(&tf, pptf)) { 709 if (!ata_acpi_filter_tf(dev, &tf, pptf)) {
709 rtf = tf; 710 rtf = tf;
710 err_mask = ata_exec_internal(dev, &rtf, NULL, 711 err_mask = ata_exec_internal(dev, &rtf, NULL,
711 DMA_NONE, NULL, 0, 0); 712 DMA_NONE, NULL, 0, 0);
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 0ddaf43d68c6..b525a0981348 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5591,6 +5591,9 @@ void ata_link_init(struct ata_port *ap, struct ata_link *link, int pmp)
5591 5591
5592 dev->link = link; 5592 dev->link = link;
5593 dev->devno = dev - link->device; 5593 dev->devno = dev - link->device;
5594#ifdef CONFIG_ATA_ACPI
5595 dev->gtf_filter = ata_acpi_gtf_filter;
5596#endif
5594 ata_dev_init(dev); 5597 ata_dev_init(dev);
5595 } 5598 }
5596} 5599}
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index be8e2628f82c..823e63096362 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -118,6 +118,8 @@ extern void ata_lpm_schedule(struct ata_port *ap, enum link_pm);
118 118
119/* libata-acpi.c */ 119/* libata-acpi.c */
120#ifdef CONFIG_ATA_ACPI 120#ifdef CONFIG_ATA_ACPI
121extern unsigned int ata_acpi_gtf_filter;
122
121extern void ata_acpi_associate_sata_port(struct ata_port *ap); 123extern void ata_acpi_associate_sata_port(struct ata_port *ap);
122extern void ata_acpi_associate(struct ata_host *host); 124extern void ata_acpi_associate(struct ata_host *host);
123extern void ata_acpi_dissociate(struct ata_host *host); 125extern void ata_acpi_dissociate(struct ata_host *host);