aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/vio.c
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2007-10-11 00:55:02 -0400
committerPaul Mackerras <paulus@samba.org>2007-10-11 06:40:46 -0400
commitdd9b67ab37d57da67840276d28957498512d4dd8 (patch)
treee6a682d889537700f9d75c5c7c7cc6ac26873441 /arch/powerpc/kernel/vio.c
parent1670b2b2716b98541765da94be1332ad5c314b7a (diff)
[POWERPC] Remove more iSeries-specific stuff from vio.c
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/vio.c')
-rw-r--r--arch/powerpc/kernel/vio.c78
1 files changed, 25 insertions, 53 deletions
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index eaf7f6992a2f..b7c9e44ef180 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -48,61 +48,33 @@ static struct vio_dev vio_bus_device = { /* fake "parent" device */
48 .dev.bus = &vio_bus_type, 48 .dev.bus = &vio_bus_type,
49}; 49};
50 50
51#ifdef CONFIG_PPC_ISERIES
52static struct iommu_table veth_iommu_table;
53struct iommu_table vio_iommu_table;
54
55static void __init iommu_vio_init(void)
56{
57 iommu_table_getparms_iSeries(255, 0, 0xff, &veth_iommu_table);
58 veth_iommu_table.it_size /= 2;
59 vio_iommu_table = veth_iommu_table;
60 vio_iommu_table.it_offset += veth_iommu_table.it_size;
61
62 if (!iommu_init_table(&veth_iommu_table, -1))
63 printk("Virtual Bus VETH TCE table failed.\n");
64 if (!iommu_init_table(&vio_iommu_table, -1))
65 printk("Virtual Bus VIO TCE table failed.\n");
66}
67#else
68static void __init iommu_vio_init(void)
69{
70}
71#endif
72
73static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev) 51static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
74{ 52{
75#ifdef CONFIG_PPC_ISERIES 53 const unsigned char *dma_window;
76 if (firmware_has_feature(FW_FEATURE_ISERIES)) { 54 struct iommu_table *tbl;
77 if (strcmp(dev->type, "network") == 0) 55 unsigned long offset, size;
78 return &veth_iommu_table; 56
79 return &vio_iommu_table; 57 if (firmware_has_feature(FW_FEATURE_ISERIES))
80 } else 58 return vio_build_iommu_table_iseries(dev);
81#endif 59
82 { 60 dma_window = of_get_property(dev->dev.archdata.of_node,
83 const unsigned char *dma_window; 61 "ibm,my-dma-window", NULL);
84 struct iommu_table *tbl; 62 if (!dma_window)
85 unsigned long offset, size; 63 return NULL;
86 64
87 dma_window = of_get_property(dev->dev.archdata.of_node, 65 tbl = kmalloc(sizeof(*tbl), GFP_KERNEL);
88 "ibm,my-dma-window", NULL); 66
89 if (!dma_window) 67 of_parse_dma_window(dev->dev.archdata.of_node, dma_window,
90 return NULL; 68 &tbl->it_index, &offset, &size);
91 69
92 tbl = kmalloc(sizeof(*tbl), GFP_KERNEL); 70 /* TCE table size - measured in tce entries */
93 71 tbl->it_size = size >> IOMMU_PAGE_SHIFT;
94 of_parse_dma_window(dev->dev.archdata.of_node, dma_window, 72 /* offset for VIO should always be 0 */
95 &tbl->it_index, &offset, &size); 73 tbl->it_offset = offset >> IOMMU_PAGE_SHIFT;
96 74 tbl->it_busno = 0;
97 /* TCE table size - measured in tce entries */ 75 tbl->it_type = TCE_VB;
98 tbl->it_size = size >> IOMMU_PAGE_SHIFT; 76
99 /* offset for VIO should always be 0 */ 77 return iommu_init_table(tbl, -1);
100 tbl->it_offset = offset >> IOMMU_PAGE_SHIFT;
101 tbl->it_busno = 0;
102 tbl->it_type = TCE_VB;
103
104 return iommu_init_table(tbl, -1);
105 }
106} 78}
107 79
108/** 80/**