From 15a3e0690bc0b4075dc4c43929248843313fc810 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Thu, 16 Aug 2007 02:33:36 -0400 Subject: [PATCH] --- yaml --- r: 68078 b: refs/heads/master c: e1ddb4b6a2c9b2c72991eb8640ef2f50691ac502 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/ata/libata-acpi.c | 38 +++++++++++++++++++++++++++++++++ trunk/include/linux/libata.h | 6 ++++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 26637f00359e..59032ccd0bf0 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 6d32d30f55020d766388df7515f771f68c973033 +refs/heads/master: e1ddb4b6a2c9b2c72991eb8640ef2f50691ac502 diff --git a/trunk/drivers/ata/libata-acpi.c b/trunk/drivers/ata/libata-acpi.c index 43af2e06d446..dc9842ec6f06 100644 --- a/trunk/drivers/ata/libata-acpi.c +++ b/trunk/drivers/ata/libata-acpi.c @@ -296,6 +296,44 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf, return rc; } +/** + * 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, >m) < 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 diff --git a/trunk/include/linux/libata.h b/trunk/include/linux/libata.h index 9295cd541ffc..382898ef6545 100644 --- a/trunk/include/linux/libata.h +++ b/trunk/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 {