]> git.hungrycats.org Git - linux/commitdiff
[PATCH] ppc64: iSeries_vio_dev cleanup
authorAndrew Morton <akpm@osdl.org>
Sat, 6 Mar 2004 16:48:32 +0000 (08:48 -0800)
committerJaroslav Kysela <perex@suse.cz>
Sat, 6 Mar 2004 16:48:32 +0000 (08:48 -0800)
From: Stephen Rothwell <sfr@canb.auug.org.au>

This patch declares iSeries_vio_dev in an include file and includes it where
necessary.  It also fixes arch/ppc64/kernel/mf.c to use the generic dma API
with iSeries_vio_dev.

arch/ppc64/kernel/iSeries_iommu.c
arch/ppc64/kernel/mf.c
arch/ppc64/kernel/viopath.c
include/asm-ppc64/iSeries/vio.h

index c62f1094f686f8f12cddfee0c9cdf7ef9ade3608..087bc10169ef6cba6364b25f22c34c2558fb866f 100644 (file)
@@ -43,6 +43,7 @@
 #include <asm/iommu.h>
 #include <asm/pci-bridge.h>
 #include <asm/iSeries/iSeries_pci.h>
+#include <asm/iSeries/vio.h>
 
 #include <asm/machdep.h>
 
@@ -58,11 +59,6 @@ static struct iSeries_Device_Node vio_dev_node  = { .LogicalSlot = 0xFF, .iommu_
 static struct pci_dev _veth_dev = { .sysdata = &veth_dev_node };
 static struct pci_dev _vio_dev  = { .sysdata = &vio_dev_node, .dev.bus = &pci_bus_type  };
 
-/*
- * I wonder what the deal is with these.  Nobody uses them.  Why do they
- * exist? Why do we export them to modules? Why is this comment here, and
- * why didn't I just delete them?
- */
 struct pci_dev *iSeries_veth_dev = &_veth_dev;
 struct device *iSeries_vio_dev = &_vio_dev.dev;
 
index e5ad75052c93850b1de8294853a580d512c1c247..ca5063f9392fdcf2f93e37b6b5970bcd417f43a6 100644 (file)
 #include <asm/iSeries/ItSpCommArea.h>
 #include <asm/iSeries/iSeries_proc.h>
 #include <asm/uaccess.h>
-#include <linux/pci.h>
+#include <linux/dma-mapping.h>
 #include <linux/bcd.h>
-
-extern struct pci_dev *iSeries_vio_dev;
+#include <asm/iSeries/vio.h>
 
 /*
  * This is the structure layout for the Machine Facilites LPAR event
@@ -791,7 +790,8 @@ void mf_setCmdLine(const char *cmdline, int size, u64 side)
 {
        struct VspCmdData myVspCmd;
        dma_addr_t dma_addr = 0;
-       char *page = pci_alloc_consistent(iSeries_vio_dev, size, &dma_addr);
+       char *page = dma_alloc_coherent(iSeries_vio_dev, size, &dma_addr,
+                       GFP_ATOMIC);
 
        if (page == NULL) {
                printk(KERN_ERR "mf.c: couldn't allocate memory to set command line\n");
@@ -809,7 +809,7 @@ void mf_setCmdLine(const char *cmdline, int size, u64 side)
        mb();
        (void)signal_vsp_instruction(&myVspCmd);
 
-       pci_free_consistent(iSeries_vio_dev, size, page, dma_addr);
+       dma_free_coherent(iSeries_vio_dev, size, page, dma_addr);
 }
 
 int mf_getCmdLine(char *cmdline, int *size, u64 side)
@@ -819,8 +819,8 @@ int mf_getCmdLine(char *cmdline, int *size, u64 side)
        int len = *size;
        dma_addr_t dma_addr;
 
-       dma_addr = pci_map_single(iSeries_vio_dev, cmdline, len,
-                       PCI_DMA_FROMDEVICE);
+       dma_addr = dma_map_single(iSeries_vio_dev, cmdline, len,
+                       DMA_FROM_DEVICE);
        memset(cmdline, 0, len);
        memset(&myVspCmd, 0, sizeof(myVspCmd));
        myVspCmd.cmd = 33;
@@ -840,7 +840,7 @@ int mf_getCmdLine(char *cmdline, int *size, u64 side)
 #endif
        }
 
-       pci_unmap_single(iSeries_vio_dev, dma_addr, *size, PCI_DMA_FROMDEVICE);
+       dma_unmap_single(iSeries_vio_dev, dma_addr, *size, DMA_FROM_DEVICE);
 
        return len;
 }
@@ -851,7 +851,8 @@ int mf_setVmlinuxChunk(const char *buffer, int size, int offset, u64 side)
        struct VspCmdData myVspCmd;
        int rc;
        dma_addr_t dma_addr = 0;
-       char *page = pci_alloc_consistent(iSeries_vio_dev, size, &dma_addr);
+       char *page = dma_alloc_coherent(iSeries_vio_dev, size, &dma_addr,
+                       GFP_ATOMIC);
 
        if (page == NULL) {
                printk(KERN_ERR "mf.c: couldn't allocate memory to set vmlinux chunk\n");
@@ -876,7 +877,7 @@ int mf_setVmlinuxChunk(const char *buffer, int size, int offset, u64 side)
                        rc = -ENOMEM;
        }
 
-       pci_free_consistent(iSeries_vio_dev, size, page, dma_addr);
+       dma_free_coherent(iSeries_vio_dev, size, page, dma_addr);
 
        return rc;
 }
@@ -888,8 +889,8 @@ int mf_getVmlinuxChunk(char *buffer, int *size, int offset, u64 side)
        int len = *size;
        dma_addr_t dma_addr;
 
-       dma_addr = pci_map_single(iSeries_vio_dev, buffer, len,
-                       PCI_DMA_FROMDEVICE);
+       dma_addr = dma_map_single(iSeries_vio_dev, buffer, len,
+                       DMA_FROM_DEVICE);
        memset(buffer, 0, len);
        memset(&myVspCmd, 0, sizeof(myVspCmd));
        myVspCmd.cmd = 32;
@@ -907,7 +908,7 @@ int mf_getVmlinuxChunk(char *buffer, int *size, int offset, u64 side)
                        rc = -ENOMEM;
        }
 
-       pci_unmap_single(iSeries_vio_dev, dma_addr, len, PCI_DMA_FROMDEVICE);
+       dma_unmap_single(iSeries_vio_dev, dma_addr, len, DMA_FROM_DEVICE);
 
        return rc;
 }
index 61717d3297c9b1a75d25f9a919740e32133ca9a4..ce718eef15c3da31d0aacc79b9c842426fe27675 100644 (file)
@@ -35,7 +35,6 @@
 #include <linux/vmalloc.h>
 #include <linux/string.h>
 #include <linux/proc_fs.h>
-#include <linux/device.h>
 #include <linux/dma-mapping.h>
 #include <linux/wait.h>
 
@@ -49,8 +48,6 @@
 #include <asm/iSeries/iSeries_proc.h>
 #include <asm/iSeries/vio.h>
 
-extern struct device *iSeries_vio_dev;
-
 /* Status of the path to each other partition in the system.
  * This is overkill, since we will only ever establish connections
  * to our hosting partition and the primary partition on the system.
index f0bb2e91284252972ed601147329b93d33d13a04..abb158e37239314b508d2db20130b2ecd941fb62 100644 (file)
@@ -127,4 +127,8 @@ enum viorc {
        viorc_openRejected = 0x0301
 };
 
+struct device;
+
+extern struct device *iSeries_vio_dev;
+
 #endif /* _ISERIES_VIO_H */