aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/vio.c
diff options
context:
space:
mode:
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