aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ata/libata-acpi.c38
-rw-r--r--include/linux/libata.h6
2 files changed, 44 insertions, 0 deletions
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index 43af2e06d44..dc9842ec6f0 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,
297} 297}
298 298
299/** 299/**
300 * ata_acpi_cbl_80wire - Check for 80 wire cable
301 * @ap: Port to check
302 *
303 * Return 1 if the ACPI mode data for this port indicates the BIOS selected
304 * an 80wire mode.
305 */
306
307int ata_acpi_cbl_80wire(struct ata_port *ap)
308{
309 struct ata_acpi_gtm gtm;
310 int valid = 0;
311
312 /* No _GTM data, no information */
313 if (ata_acpi_gtm(ap, &gtm) < 0)
314 return 0;
315
316 /* Split timing, DMA enabled */
317 if ((gtm.flags & 0x11) == 0x11 && gtm.drive[0].dma < 55)
318 valid |= 1;
319 if ((gtm.flags & 0x14) == 0x14 && gtm.drive[1].dma < 55)
320 valid |= 2;
321 /* Shared timing, DMA enabled */
322 if ((gtm.flags & 0x11) == 0x01 && gtm.drive[0].dma < 55)
323 valid |= 1;
324 if ((gtm.flags & 0x14) == 0x04 && gtm.drive[0].dma < 55)
325 valid |= 2;
326
327 /* Drive check */
328 if ((valid & 1) && ata_dev_enabled(&ap->link.device[0]))
329 return 1;
330 if ((valid & 2) && ata_dev_enabled(&ap->link.device[1]))
331 return 1;
332 return 0;
333}
334
335EXPORT_SYMBOL_GPL(ata_acpi_cbl_80wire);
336
337/**
300 * taskfile_load_raw - send taskfile registers to host controller 338 * taskfile_load_raw - send taskfile registers to host controller
301 * @dev: target ATA device 339 * @dev: target ATA device
302 * @gtf: raw ATA taskfile register set (0x1f1 - 0x1f7) 340 * @gtf: raw ATA taskfile register set (0x1f1 - 0x1f7)
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 9295cd541ff..382898ef654 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -885,6 +885,12 @@ enum {
885 ATA_TIMING_CYCLE | ATA_TIMING_UDMA, 885 ATA_TIMING_CYCLE | ATA_TIMING_UDMA,
886}; 886};
887 887
888/* libata-acpi.c */
889#ifdef CONFIG_ATA_ACPI
890extern int ata_acpi_cbl_80wire(struct ata_port *ap);
891#else
892static inline int ata_acpi_cbl_80wire(struct ata_port *ap) { return 0; }
893#endif
888 894
889#ifdef CONFIG_PCI 895#ifdef CONFIG_PCI
890struct pci_bits { 896struct pci_bits {