aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/iseries/iommu.c
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2005-09-28 00:40:40 -0400
committerStephen Rothwell <sfr@canb.auug.org.au>2005-09-28 00:40:40 -0400
commit252e75a51d40757928d692b3d339e66838294b4b (patch)
tree6ae6e08ae69f54320da58ac369cb98bdf097a7c2 /arch/powerpc/platforms/iseries/iommu.c
parentc111d0bda8437d146ccf5101970801fe4ff23ed8 (diff)
ppc64 iSeries: use device_node instead of iSeries_Device_node
There needs to be more cleanup after this. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Diffstat (limited to 'arch/powerpc/platforms/iseries/iommu.c')
-rw-r--r--arch/powerpc/platforms/iseries/iommu.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/arch/powerpc/platforms/iseries/iommu.c b/arch/powerpc/platforms/iseries/iommu.c
index 65c76dd1d3d..9ac735d5b81 100644
--- a/arch/powerpc/platforms/iseries/iommu.c
+++ b/arch/powerpc/platforms/iseries/iommu.c
@@ -89,15 +89,17 @@ static void tce_free_iSeries(struct iommu_table *tbl, long index, long npages)
89 */ 89 */
90static struct iommu_table *iommu_table_find(struct iommu_table * tbl) 90static struct iommu_table *iommu_table_find(struct iommu_table * tbl)
91{ 91{
92 struct iSeries_Device_Node *dp; 92 struct device_node *dp;
93 93
94 list_for_each_entry(dp, &iSeries_Global_Device_List, Device_List) { 94 list_for_each_entry(dp, &iSeries_Global_Device_List, Device_List) {
95 if ((dp->iommu_table != NULL) && 95 struct iommu_table *it = PCI_DN(dp)->iommu_table;
96 (dp->iommu_table->it_type == TCE_PCI) && 96
97 (dp->iommu_table->it_offset == tbl->it_offset) && 97 if ((it != NULL) &&
98 (dp->iommu_table->it_index == tbl->it_index) && 98 (it->it_type == TCE_PCI) &&
99 (dp->iommu_table->it_size == tbl->it_size)) 99 (it->it_offset == tbl->it_offset) &&
100 return dp->iommu_table; 100 (it->it_index == tbl->it_index) &&
101 (it->it_size == tbl->it_size))
102 return it;
101 } 103 }
102 return NULL; 104 return NULL;
103} 105}
@@ -111,7 +113,7 @@ static struct iommu_table *iommu_table_find(struct iommu_table * tbl)
111 * 2. TCE table per Bus. 113 * 2. TCE table per Bus.
112 * 3. TCE Table per IOA. 114 * 3. TCE Table per IOA.
113 */ 115 */
114static void iommu_table_getparms(struct iSeries_Device_Node* dn, 116static void iommu_table_getparms(struct device_node *dn,
115 struct iommu_table* tbl) 117 struct iommu_table* tbl)
116{ 118{
117 struct iommu_table_cb *parms; 119 struct iommu_table_cb *parms;
@@ -123,7 +125,7 @@ static void iommu_table_getparms(struct iSeries_Device_Node* dn,
123 memset(parms, 0, sizeof(*parms)); 125 memset(parms, 0, sizeof(*parms));
124 126
125 parms->itc_busno = ISERIES_BUS(dn); 127 parms->itc_busno = ISERIES_BUS(dn);
126 parms->itc_slotno = dn->LogicalSlot; 128 parms->itc_slotno = PCI_DN(dn)->LogicalSlot;
127 parms->itc_virtbus = 0; 129 parms->itc_virtbus = 0;
128 130
129 HvCallXm_getTceTableParms(ISERIES_HV_ADDR(parms)); 131 HvCallXm_getTceTableParms(ISERIES_HV_ADDR(parms));
@@ -143,18 +145,19 @@ static void iommu_table_getparms(struct iSeries_Device_Node* dn,
143} 145}
144 146
145 147
146void iommu_devnode_init_iSeries(struct iSeries_Device_Node *dn) 148void iommu_devnode_init_iSeries(struct device_node *dn)
147{ 149{
148 struct iommu_table *tbl; 150 struct iommu_table *tbl;
151 struct pci_dn *pdn = PCI_DN(dn);
149 152
150 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL); 153 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
151 154
152 iommu_table_getparms(dn, tbl); 155 iommu_table_getparms(dn, tbl);
153 156
154 /* Look for existing tce table */ 157 /* Look for existing tce table */
155 dn->iommu_table = iommu_table_find(tbl); 158 pdn->iommu_table = iommu_table_find(tbl);
156 if (dn->iommu_table == NULL) 159 if (pdn->iommu_table == NULL)
157 dn->iommu_table = iommu_init_table(tbl); 160 pdn->iommu_table = iommu_init_table(tbl);
158 else 161 else
159 kfree(tbl); 162 kfree(tbl);
160} 163}