staging: slicoss Use pci_set_consistent_dma_mask.
authorkirjanov@gmail.com <kirjanov@gmail.com>
Fri, 18 Dec 2009 08:02:09 +0000 (11:02 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 4 Mar 2010 00:42:28 +0000 (16:42 -0800)
Use pci_set_consistent_dma_mask() in the case of 64-bit consistent allocations.

Signed-off-by: Denis Kirjanov <kirjanov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/slicoss/slicoss.c

index aefe3fef7728b7fdbcae77dcf826689cf25c20f8..09a9d759c61264ae29abff16e5ca451c4eca47aa 100644 (file)
@@ -366,6 +366,7 @@ static int __devinit slic_entry_probe(struct pci_dev *pcidev,
        ulong mmio_start = 0;
        ulong mmio_len = 0;
        struct sliccard *card = NULL;
+       int pci_using_dac = 0;
 
        slic_global.dynamic_intagg = dynamic_intagg;
 
@@ -379,16 +380,26 @@ static int __devinit slic_entry_probe(struct pci_dev *pcidev,
                printk(KERN_DEBUG "%s\n", slic_proc_version);
        }
 
-       err = pci_set_dma_mask(pcidev, DMA_BIT_MASK(64));
-       if (err) {
-               err = pci_set_dma_mask(pcidev, DMA_BIT_MASK(32));
-               if (err)
+       if (!pci_set_dma_mask(pcidev, DMA_BIT_MASK(64))) {
+               pci_using_dac = 1;
+               if (pci_set_consistent_dma_mask(pcidev, DMA_BIT_MASK(64))) {
+                       dev_err(&pcidev->dev, "unable to obtain 64-bit DMA for "
+                                       "consistent allocations\n");
                        goto err_out_disable_pci;
+               }
+       } else if (pci_set_dma_mask(pcidev, DMA_BIT_MASK(32))) {
+               pci_using_dac = 0;
+               pci_set_consistent_dma_mask(pcidev, DMA_BIT_MASK(32));
+       } else {
+               dev_err(&pcidev->dev, "no usable DMA configuration\n");
+               goto err_out_disable_pci;
        }
 
        err = pci_request_regions(pcidev, DRV_NAME);
-       if (err)
+       if (err) {
+               dev_err(&pcidev->dev, "can't obtain PCI resources\n");
                goto err_out_disable_pci;
+       }
 
        pci_set_master(pcidev);
 
@@ -404,6 +415,8 @@ static int __devinit slic_entry_probe(struct pci_dev *pcidev,
        adapter = netdev_priv(netdev);
        adapter->netdev = netdev;
        adapter->pcidev = pcidev;
+       if (pci_using_dac)
+               netdev->features |= NETIF_F_HIGHDMA;
 
        mmio_start = pci_resource_start(pcidev, 0);
        mmio_len = pci_resource_len(pcidev, 0);