aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-scsi.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2009-04-09 12:31:17 -0400
committerJeff Garzik <jgarzik@redhat.com>2009-04-16 15:28:23 -0400
commite3cf95dd6d352954b663d2934110d6e30af2406d (patch)
treef3245e91c30e0c1e12a169af637373a8b5ff670a /drivers/ata/libata-scsi.c
parent62afe5d744047df8ff15a369f4c1ebad71c937d4 (diff)
ata: Report 16/32bit PIO as best we can
The legacy old IDE ioctl API for this is a bit primitive so we try and map stuff sensibly onto it. - Set PIO over DMA devices to report 32bit - Add ability to change the PIO32 settings if the controller permits it - Add that functionality into the sff drivers - Add that functionality into the VLB legacy driver - Turn on the 32bit PIO on the ninja32 and add support there Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/libata-scsi.c')
-rw-r--r--drivers/ata/libata-scsi.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index b9747fa59e54..2733b0c90b75 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -647,23 +647,45 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg)
647 return rc; 647 return rc;
648} 648}
649 649
650static int ata_ioc32(struct ata_port *ap)
651{
652 if (ap->flags & ATA_FLAG_PIO_DMA)
653 return 1;
654 if (ap->pflags & ATA_PFLAG_PIO32)
655 return 1;
656 return 0;
657}
658
650int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *scsidev, 659int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *scsidev,
651 int cmd, void __user *arg) 660 int cmd, void __user *arg)
652{ 661{
653 int val = -EINVAL, rc = -EINVAL; 662 int val = -EINVAL, rc = -EINVAL;
663 unsigned long flags;
654 664
655 switch (cmd) { 665 switch (cmd) {
656 case ATA_IOC_GET_IO32: 666 case ATA_IOC_GET_IO32:
657 val = 0; 667 spin_lock_irqsave(ap->lock, flags);
668 val = ata_ioc32(ap);
669 spin_unlock_irqrestore(ap->lock, flags);
658 if (copy_to_user(arg, &val, 1)) 670 if (copy_to_user(arg, &val, 1))
659 return -EFAULT; 671 return -EFAULT;
660 return 0; 672 return 0;
661 673
662 case ATA_IOC_SET_IO32: 674 case ATA_IOC_SET_IO32:
663 val = (unsigned long) arg; 675 val = (unsigned long) arg;
664 if (val != 0) 676 rc = 0;
665 return -EINVAL; 677 spin_lock_irqsave(ap->lock, flags);
666 return 0; 678 if (ap->pflags & ATA_PFLAG_PIO32CHANGE) {
679 if (val)
680 ap->pflags |= ATA_PFLAG_PIO32;
681 else
682 ap->pflags &= ~ATA_PFLAG_PIO32;
683 } else {
684 if (val != ata_ioc32(ap))
685 rc = -EINVAL;
686 }
687 spin_unlock_irqrestore(ap->lock, flags);
688 return rc;
667 689
668 case HDIO_GET_IDENTITY: 690 case HDIO_GET_IDENTITY:
669 return ata_get_identity(ap, scsidev, arg); 691 return ata_get_identity(ap, scsidev, arg);