#include <linux/ide.h>
 #include <linux/delay.h>
 #include <linux/scatterlist.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/io.h>
 #include <asm/irq.h>
  *     @drive: the drive to build the DMA table for
  *     @rq: the request holding the sg list
  *
- *     Perform the PCI mapping magic necessary to access the source or
- *     target buffers of a request via PCI DMA. The lower layers of the
+ *     Perform the DMA mapping magic necessary to access the source or
+ *     target buffers of a request via DMA.  The lower layers of the
  *     kernel provide the necessary cache management so that we can
- *     operate in a portable fashion
+ *     operate in a portable fashion.
  */
 
 int ide_build_sglist(ide_drive_t *drive, struct request *rq)
 {
        ide_hwif_t *hwif = HWIF(drive);
-       struct pci_dev *pdev = to_pci_dev(hwif->dev);
        struct scatterlist *sg = hwif->sg_table;
 
        ide_map_sg(drive, rq);
 
        if (rq_data_dir(rq) == READ)
-               hwif->sg_dma_direction = PCI_DMA_FROMDEVICE;
+               hwif->sg_dma_direction = DMA_FROM_DEVICE;
        else
-               hwif->sg_dma_direction = PCI_DMA_TODEVICE;
+               hwif->sg_dma_direction = DMA_TO_DEVICE;
 
-       return pci_map_sg(pdev, sg, hwif->sg_nents, hwif->sg_dma_direction);
+       return dma_map_sg(hwif->dev, sg, hwif->sg_nents,
+                         hwif->sg_dma_direction);
 }
 
 EXPORT_SYMBOL_GPL(ide_build_sglist);
 void ide_destroy_dmatable (ide_drive_t *drive)
 {
        ide_hwif_t *hwif = drive->hwif;
-       struct pci_dev *pdev = to_pci_dev(hwif->dev);
 
-       pci_unmap_sg(pdev, hwif->sg_table, hwif->sg_nents,
+       dma_unmap_sg(hwif->dev, hwif->sg_table, hwif->sg_nents,
                     hwif->sg_dma_direction);
 }