Commit 300c99e2 authored by Andrew Morton's avatar Andrew Morton Committed by Jaroslav Kysela

[PATCH] ppc64: iSeries_vio_dev cleanup

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.
parent 5af2c131
......@@ -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;
......
......@@ -38,10 +38,9 @@
#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;
}
......
......@@ -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.
......
......@@ -127,4 +127,8 @@ enum viorc {
viorc_openRejected = 0x0301
};
struct device;
extern struct device *iSeries_vio_dev;
#endif /* _ISERIES_VIO_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment