aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2007-10-02 12:38:26 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-12 14:55:45 -0400
commitb3a706014e56b1356e7b275fd25b833c63175bf0 (patch)
tree1595a67c8b09f9222c4d59f466acca681a56a02c /drivers/ata
parent7100819f5f9b99eb7c7dd5597f293388a405bf7b (diff)
libata: Add a drivers/ide style DMA disable
This is useful when debugging, handling problem systems, or for distributions just to get the system installed so it can be sorted out later. This is a bit smarter than the old IDE one and lets you do libata.dma=0 Disable all PATA DMA like old IDE libata.dma=1 Disk DMA only libata.dma=2 ATAPI DMA only libata.dma=4 CF DMA only (or combinations thereof - 0,1,3 being the useful ones I suspect) (I've split CF as it seems to be a seperate case of pain and suffering different to the others and caused by assorted PIO wired adapters etc) Signed-off-by: Alan Cox <alan@redhat.com> [edited to work on SATA too, changing name from 'pata_dma' to 'dma'] Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/libata-core.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 5532a6564d05..1501d63db2cb 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -97,6 +97,10 @@ static int ata_ignore_hpa = 0;
97module_param_named(ignore_hpa, ata_ignore_hpa, int, 0644); 97module_param_named(ignore_hpa, ata_ignore_hpa, int, 0644);
98MODULE_PARM_DESC(ignore_hpa, "Ignore HPA limit (0=keep BIOS limits, 1=ignore limits, using full disk)"); 98MODULE_PARM_DESC(ignore_hpa, "Ignore HPA limit (0=keep BIOS limits, 1=ignore limits, using full disk)");
99 99
100static int libata_dma_mask = ATA_DMA_MASK_ATA|ATA_DMA_MASK_ATAPI|ATA_DMA_MASK_CFA;
101module_param_named(dma, libata_dma_mask, int, 0444);
102MODULE_PARM_DESC(dma, "DMA enable/disable (0x1==ATA, 0x2==ATAPI, 0x4==CF)");
103
100static int ata_probe_timeout = ATA_TMOUT_INTERNAL / HZ; 104static int ata_probe_timeout = ATA_TMOUT_INTERNAL / HZ;
101module_param(ata_probe_timeout, int, 0444); 105module_param(ata_probe_timeout, int, 0444);
102MODULE_PARM_DESC(ata_probe_timeout, "Set ATA probing timeout (seconds)"); 106MODULE_PARM_DESC(ata_probe_timeout, "Set ATA probing timeout (seconds)");
@@ -2917,14 +2921,27 @@ int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev)
2917 /* step 1: calculate xfer_mask */ 2921 /* step 1: calculate xfer_mask */
2918 ata_link_for_each_dev(dev, link) { 2922 ata_link_for_each_dev(dev, link) {
2919 unsigned int pio_mask, dma_mask; 2923 unsigned int pio_mask, dma_mask;
2924 unsigned int mode_mask;
2920 2925
2921 if (!ata_dev_enabled(dev)) 2926 if (!ata_dev_enabled(dev))
2922 continue; 2927 continue;
2923 2928
2929 mode_mask = ATA_DMA_MASK_ATA;
2930 if (dev->class == ATA_DEV_ATAPI)
2931 mode_mask = ATA_DMA_MASK_ATAPI;
2932 else if (ata_id_is_cfa(dev->id))
2933 mode_mask = ATA_DMA_MASK_CFA;
2934
2924 ata_dev_xfermask(dev); 2935 ata_dev_xfermask(dev);
2925 2936
2926 pio_mask = ata_pack_xfermask(dev->pio_mask, 0, 0); 2937 pio_mask = ata_pack_xfermask(dev->pio_mask, 0, 0);
2927 dma_mask = ata_pack_xfermask(0, dev->mwdma_mask, dev->udma_mask); 2938 dma_mask = ata_pack_xfermask(0, dev->mwdma_mask, dev->udma_mask);
2939
2940 if (libata_dma_mask & mode_mask)
2941 dma_mask = ata_pack_xfermask(0, dev->mwdma_mask, dev->udma_mask);
2942 else
2943 dma_mask = 0;
2944
2928 dev->pio_mode = ata_xfer_mask2mode(pio_mask); 2945 dev->pio_mode = ata_xfer_mask2mode(pio_mask);
2929 dev->dma_mode = ata_xfer_mask2mode(dma_mask); 2946 dev->dma_mode = ata_xfer_mask2mode(dma_mask);
2930 2947