From 34efecafb4b0e0d304001589c1494e3a5b5badcf Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 21 Mar 2006 15:59:57 +0000 Subject: [PATCH] --- yaml --- r: 22383 b: refs/heads/master c: d33d44facc8673388979297c9836b4bf590f7388 h: refs/heads/master i: 22381: 11b71cda1691a572704f2bc9fa25f1a8a94f07c5 22379: 2c0681f04bc814bccee50cb5855b7d8f11590bfb 22375: 266ab63e2b5be1316868ee8669ddc5b1aa814be6 22367: c3f4585106d37ad5b38d2e3d807b07b0c7512d96 v: v3 --- [refs] | 2 +- trunk/drivers/scsi/libata-bmdma.c | 36 +++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 7e930e29ea49..8f4eccc1f581 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 41bbc8bf1ab0e3e7cda1a0334176a9aa3986cd30 +refs/heads/master: d33d44facc8673388979297c9836b4bf590f7388 diff --git a/trunk/drivers/scsi/libata-bmdma.c b/trunk/drivers/scsi/libata-bmdma.c index a89e44b21f4d..999725ca8d09 100644 --- a/trunk/drivers/scsi/libata-bmdma.c +++ b/trunk/drivers/scsi/libata-bmdma.c @@ -700,5 +700,41 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, return rc; } +/** + * ata_pci_clear_simplex - attempt to kick device out of simplex + * @pdev: PCI device + * + * Some PCI ATA devices report simplex mode but in fact can be told to + * enter non simplex mode. This implements the neccessary logic to + * perform the task on such devices. Calling it on other devices will + * have -undefined- behaviour. + */ + +int ata_pci_clear_simplex(struct pci_dev *pdev) +{ + unsigned long bmdma = pci_resource_start(pdev, 4); + u8 simplex; + + if (bmdma == 0) + return -ENOENT; + + simplex = inb(bmdma + 0x02); + outb(simplex & 0x60, bmdma + 0x02); + simplex = inb(bmdma + 0x02); + if (simplex & 0x80) + return -EOPNOTSUPP; + return 0; +} + +unsigned long ata_pci_default_filter(const struct ata_port *ap, struct ata_device *adev, unsigned long xfer_mask) +{ + /* Filter out DMA modes if the device has been configured by + the BIOS as PIO only */ + + if (ap->ioaddr.bmdma_addr == 0) + xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); + return xfer_mask; +} + #endif /* CONFIG_PCI */