pata_cypress: add a module option to disable BM-DMA
authorChristoph Hellwig <hch@lst.de>
Wed, 16 Jun 2021 13:46:53 +0000 (15:46 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 16 Jun 2021 14:52:38 +0000 (08:52 -0600)
Multiple users report that they need to disable DMA on this driver,
so provide an option to do so without affecting all of libata.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://lore.kernel.org/r/20210616134658.1471835-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/ata/pata_cypress.c

index e1486fe..5b3a7a8 100644 (file)
@@ -41,6 +41,10 @@ enum {
        CY82_INDEX_TIMEOUT      = 0x32
 };
 
+static bool enable_dma = true;
+module_param(enable_dma, bool, 0);
+MODULE_PARM_DESC(enable_dma, "Enable bus master DMA operations");
+
 /**
  *     cy82c693_set_piomode    -       set initial PIO mode data
  *     @ap: ATA interface
@@ -124,14 +128,16 @@ static struct ata_port_operations cy82c693_port_ops = {
 
 static int cy82c693_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 {
-       static const struct ata_port_info info = {
+       static struct ata_port_info info = {
                .flags = ATA_FLAG_SLAVE_POSS,
                .pio_mask = ATA_PIO4,
-               .mwdma_mask = ATA_MWDMA2,
                .port_ops = &cy82c693_port_ops
        };
        const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info };
 
+       if (enable_dma)
+               info.mwdma_mask = ATA_MWDMA2;
+
        /* Devfn 1 is the ATA primary. The secondary is magic and on devfn2.
           For the moment we don't handle the secondary. FIXME */