Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e1ddb4b6a2c9b2c72991eb8640ef2f50691ac502
Commit:     e1ddb4b6a2c9b2c72991eb8640ef2f50691ac502
Parent:     6d32d30f55020d766388df7515f771f68c973033
Author:     Alan Cox <[EMAIL PROTECTED]>
AuthorDate: Thu Aug 16 02:33:36 2007 -0400
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Fri Oct 12 14:55:34 2007 -0400

    [libata] add ACPI cable detect API
    
    Combined from two Alan Cox patches:
    
    1) libata: ACPI checks for 80wire cable
    
    We can use the ACPI mode information with several drivers as a hint to
    cable type. If the ACPI mode set by the BIOS is faster than UDMA33 then
    we know the BIOS thinks there are 80wire cables. If it doesn't set such a
    mode or it has no ACPI method then we get no further information and can
    rely on existing approaches
    
    Introduce the function headers needed. Null it out for non ACPI boxes
    
    Signed-off-by: Alan Cox <[EMAIL PROTECTED]>
    
    2) libata: ACPI checks for 80wire cable
    
    Provide actual methods for checking if the ACPI support thinks the cable
    is 80wire, or doesn't know
    
    Signed-off-by: Alan Cox <[EMAIL PROTECTED]>
    
    Combined into a single changeset and
    Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 drivers/ata/libata-acpi.c |   38 ++++++++++++++++++++++++++++++++++++++
 include/linux/libata.h    |    6 ++++++
 2 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index 43af2e0..dc9842e 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -297,6 +297,44 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct 
ata_acpi_gtf **gtf,
 }
 
 /**
+ * ata_acpi_cbl_80wire         -       Check for 80 wire cable
+ * @ap: Port to check
+ *
+ * Return 1 if the ACPI mode data for this port indicates the BIOS selected
+ * an 80wire mode.
+ */
+
+int ata_acpi_cbl_80wire(struct ata_port *ap)
+{
+       struct ata_acpi_gtm gtm;
+       int valid = 0;
+       
+       /* No _GTM data, no information */
+       if (ata_acpi_gtm(ap, &gtm) < 0)
+               return 0;
+               
+       /* Split timing, DMA enabled */
+       if ((gtm.flags & 0x11) == 0x11 && gtm.drive[0].dma < 55)
+               valid |= 1;
+       if ((gtm.flags & 0x14) == 0x14 && gtm.drive[1].dma < 55)
+               valid |= 2;
+       /* Shared timing, DMA enabled */
+       if ((gtm.flags & 0x11) == 0x01 && gtm.drive[0].dma < 55)
+               valid |= 1;
+       if ((gtm.flags & 0x14) == 0x04 && gtm.drive[0].dma < 55)
+               valid |= 2;
+
+       /* Drive check */
+       if ((valid & 1) && ata_dev_enabled(&ap->link.device[0]))
+               return 1;
+       if ((valid & 2) && ata_dev_enabled(&ap->link.device[1]))
+               return 1;
+       return 0;
+}
+
+EXPORT_SYMBOL_GPL(ata_acpi_cbl_80wire);
+
+/**
  * taskfile_load_raw - send taskfile registers to host controller
  * @dev: target ATA device
  * @gtf: raw ATA taskfile register set (0x1f1 - 0x1f7)
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 9295cd5..382898e 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -885,6 +885,12 @@ enum {
                                  ATA_TIMING_CYCLE | ATA_TIMING_UDMA,
 };
 
+/* libata-acpi.c */
+#ifdef CONFIG_ATA_ACPI
+extern int ata_acpi_cbl_80wire(struct ata_port *ap);
+#else
+static inline int ata_acpi_cbl_80wire(struct ata_port *ap) { return 0; }
+#endif
 
 #ifdef CONFIG_PCI
 struct pci_bits {
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to