aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/vio.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2006-05-18 04:06:37 -0400
committerPaul Mackerras <paulus@samba.org>2006-05-19 01:02:23 -0400
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 ac5c7bf907f5..2cda65b8171b 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)
77 } else 77 } else
78#endif 78#endif
79 { 79 {
80 unsigned int *dma_window; 80 unsigned char *dma_window;
81 struct iommu_table *newTceTable; 81 struct iommu_table *tbl;
82 unsigned long offset; 82 unsigned long offset, size;
83 int dma_window_property_size; 83
84 84 dma_window = get_property(dev->dev.platform_data,
85 dma_window = (unsigned int *)get_property( 85 "ibm,my-dma-window", NULL);
86 dev->dev.platform_data, "ibm,my-dma-window",
87 &dma_window_property_size);
88 if (!dma_window) 86 if (!dma_window)
89 return NULL; 87 return NULL;
90 88
91 newTceTable = kmalloc(sizeof(struct iommu_table), GFP_KERNEL); 89 tbl = kmalloc(sizeof(*tbl), GFP_KERNEL);
92 90
93 /* 91 of_parse_dma_window(dev->dev.platform_data, dma_window,
94 * There should be some code to extract the phys-encoded 92 &tbl->it_index, &offset, &size);
95 * offset using prom_n_addr_cells(). However, according to
96 * a comment on earlier versions, it's always zero, so we
97 * don't bother
98 */
99 offset = dma_window[1] >> PAGE_SHIFT;
100 93
101 /* TCE table size - measured in tce entries */ 94 /* TCE table size - measured in tce entries */
102 newTceTable->it_size = dma_window[4] >> PAGE_SHIFT; 95 tbl->it_size = size >> PAGE_SHIFT;
103 /* offset for VIO should always be 0 */ 96 /* offset for VIO should always be 0 */
104 newTceTable->it_offset = offset; 97 tbl->it_offset = offset >> PAGE_SHIFT;
105 newTceTable->it_busno = 0; 98 tbl->it_busno = 0;
106 newTceTable->it_index = (unsigned long)dma_window[0]; 99 tbl->it_type = TCE_VB;
107 newTceTable->it_type = TCE_VB;
108 100
109 return iommu_init_table(newTceTable); 101 return iommu_init_table(tbl);
110 } 102 }
111} 103}
112 104