patch-2.3.47 linux/drivers/block/ide-dma.c

Next file: linux/drivers/block/ide-probe.c
Previous file: linux/drivers/block/icside.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.46/linux/drivers/block/ide-dma.c linux/drivers/block/ide-dma.c
@@ -214,6 +214,10 @@
 	struct scatterlist *sg = hwif->sg_table;
 	int nents = 0;
 
+	if (rq->cmd == READ)
+		hwif->sg_dma_direction = PCI_DMA_FROMDEVICE;
+	else
+		hwif->sg_dma_direction = PCI_DMA_TODEVICE;
 	bh = rq->bh;
 	do {
 		unsigned char *virt_addr = bh->b_data;
@@ -230,7 +234,7 @@
 		nents++;
 	} while (bh != NULL);
 
-	return pci_map_sg(hwif->pci_dev, sg, nents);
+	return pci_map_sg(hwif->pci_dev, sg, nents, hwif->sg_dma_direction);
 }
 
 /*
@@ -265,7 +269,8 @@
 				printk("%s: DMA table too small\n", drive->name);
 				pci_unmap_sg(HWIF(drive)->pci_dev,
 					     HWIF(drive)->sg_table,
-					     HWIF(drive)->sg_nents);
+					     HWIF(drive)->sg_nents,
+					     HWIF(drive)->sg_dma_direction);
 				return 0; /* revert to PIO for this request */
 			} else {
 				u32 xcount, bcount = 0x10000 - (cur_addr & 0xffff);
@@ -301,7 +306,7 @@
 	struct scatterlist *sg = HWIF(drive)->sg_table;
 	int nents = HWIF(drive)->sg_nents;
 
-	pci_unmap_sg(dev, sg, nents);
+	pci_unmap_sg(dev, sg, nents, HWIF(drive)->sg_dma_direction);
 }
 
 /*

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)