patch-2.3.41 linux/include/asm-sparc64/floppy.h

Next file: linux/include/asm-sparc64/io.h
Previous file: linux/include/asm-sparc64/dma.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.40/linux/include/asm-sparc64/floppy.h linux/include/asm-sparc64/floppy.h
@@ -270,7 +270,10 @@
 #include <asm/ns87303.h>
 
 static struct linux_ebus_dma *sun_pci_fd_ebus_dma;
+static struct pci_dev *sun_pci_ebus_dev;
 static int sun_pci_broken_drive = -1;
+static unsigned int sun_pci_dma_addr = -1U;
+static int sun_pci_dma_len;
 
 extern void floppy_interrupt(int irq, void *dev_id, struct pt_regs *regs);
 
@@ -363,6 +366,11 @@
 			writel(dcsr, &sun_pci_fd_ebus_dma->dcsr);
 		}
 	}
+	if (sun_pci_dma_addr != -1U)
+		pci_unmap_single(sun_pci_ebus_dev,
+				 sun_pci_dma_addr,
+				 sun_pci_dma_len);
+	sun_pci_dma_addr = -1U;
 }
 
 static void sun_pci_fd_set_dma_mode(int mode)
@@ -389,12 +397,17 @@
 
 static void sun_pci_fd_set_dma_count(int length)
 {
+	sun_pci_dma_len = length;
 	writel(length, &sun_pci_fd_ebus_dma->dbcr);
 }
 
 static void sun_pci_fd_set_dma_addr(char *buffer)
 {
-	unsigned int addr = virt_to_bus(buffer);
+	unsigned int addr;
+
+	addr = sun_pci_dma_addr = pci_map_single(sun_pci_ebus_dev,
+						 buffer,
+						 sun_pci_dma_len);
 	writel(addr, &sun_pci_fd_ebus_dma->dacr);
 }
 
@@ -598,6 +611,8 @@
 		 */
 		auxio_reg = edev->resource[2].start;
 		writel(readl(auxio_reg)|0x2, auxio_reg);
+
+		sun_pci_ebus_dev = ebus->self;
 
 		sun_pci_fd_ebus_dma = (struct linux_ebus_dma *)
 			edev->resource[1].start;

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