aboutsummaryrefslogtreecommitdiff
path: root/arch/powerpc/kernel/vio.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2006-05-18 18:06:37 +1000
committerPaul Mackerras <paulus@samba.org>2006-05-19 15:02:23 +1000
commit4c76e0bcdeac27b45d55955f073a97ff8452a42f (patch)
tree9a274ffdfb1159012c10b7367e8d09207fbd28d0 /arch/powerpc/kernel/vio.c
parentd4ad66faecc4dd9f3db14e0b013741a6f867b089 (diff)
[PATCH] powerpc: pseries: Use generic dma-window parsing function
Change the pseries iommu init code to use the new of_parse_dma_window() to parse the ibm,dma-window and ibm,my-dma-window properties of pci and virtual device nodes. Also, clean up vio_build_iommu_table() a little. Tested on pseries, with both vio and pci devices. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/vio.c')
-rw-r--r--arch/powerpc/kernel/vio.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index ac5c7bf907f..2cda65b8171 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -77,36 +77,28 @@ static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
} else
#endif
{
- unsigned int *dma_window;
- struct iommu_table *newTceTable;
- unsigned long offset;
- int dma_window_property_size;
-
- dma_window = (unsigned int *)get_property(
- dev->dev.platform_data, "ibm,my-dma-window",
- &dma_window_property_size);
+ unsigned char *dma_window;
+ struct iommu_table *tbl;
+ unsigned long offset, size;
+
+ dma_window = get_property(dev->dev.platform_data,
+ "ibm,my-dma-window", NULL);
if (!dma_window)
return NULL;
- newTceTable = kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
+ tbl = kmalloc(sizeof(*tbl), GFP_KERNEL);
- /*
- * There should be some code to extract the phys-encoded
- * offset using prom_n_addr_cells(). However, according to
- * a comment on earlier versions, it's always zero, so we
- * don't bother
- */
- offset = dma_window[1] >> PAGE_SHIFT;
+ of_parse_dma_window(dev->dev.platform_data, dma_window,
+ &tbl->it_index, &offset, &size);
/* TCE table size - measured in tce entries */
- newTceTable->it_size = dma_window[4] >> PAGE_SHIFT;
+ tbl->it_size = size >> PAGE_SHIFT;
/* offset for VIO should always be 0 */
- newTceTable->it_offset = offset;
- newTceTable->it_busno = 0;
- newTceTable->it_index = (unsigned long)dma_window[0];
- newTceTable->it_type = TCE_VB;
+ tbl->it_offset = offset >> PAGE_SHIFT;
+ tbl->it_busno = 0;
+ tbl->it_type = TCE_VB;
- return iommu_init_table(newTceTable);
+ return iommu_init_table(tbl);
}
}