aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/pseries
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms/pseries')
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index ed102f390689..44a507e6fb34 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -281,30 +281,22 @@ static void iommu_table_setparms(struct pci_controller *phb,
281 * iommu_table_setparms_lpar 281 * iommu_table_setparms_lpar
282 * 282 *
283 * Function: On pSeries LPAR systems, return TCE table info, given a pci bus. 283 * Function: On pSeries LPAR systems, return TCE table info, given a pci bus.
284 *
285 * ToDo: properly interpret the ibm,dma-window property. The definition is:
286 * logical-bus-number (1 word)
287 * phys-address (#address-cells words)
288 * size (#cell-size words)
289 *
290 * Currently we hard code these sizes (more or less).
291 */ 284 */
292static void iommu_table_setparms_lpar(struct pci_controller *phb, 285static void iommu_table_setparms_lpar(struct pci_controller *phb,
293 struct device_node *dn, 286 struct device_node *dn,
294 struct iommu_table *tbl, 287 struct iommu_table *tbl,
295 unsigned int *dma_window) 288 unsigned char *dma_window)
296{ 289{
290 unsigned long offset, size;
291
297 tbl->it_busno = PCI_DN(dn)->bussubno; 292 tbl->it_busno = PCI_DN(dn)->bussubno;
293 of_parse_dma_window(dn, dma_window, &tbl->it_index, &offset, &size);
298 294
299 /* TODO: Parse field size properties properly. */
300 tbl->it_size = (((unsigned long)dma_window[4] << 32) |
301 (unsigned long)dma_window[5]) >> PAGE_SHIFT;
302 tbl->it_offset = (((unsigned long)dma_window[2] << 32) |
303 (unsigned long)dma_window[3]) >> PAGE_SHIFT;
304 tbl->it_base = 0; 295 tbl->it_base = 0;
305 tbl->it_index = dma_window[0];
306 tbl->it_blocksize = 16; 296 tbl->it_blocksize = 16;
307 tbl->it_type = TCE_PCI; 297 tbl->it_type = TCE_PCI;
298 tbl->it_offset = offset >> PAGE_SHIFT;
299 tbl->it_size = size >> PAGE_SHIFT;
308} 300}
309 301
310static void iommu_bus_setup_pSeries(struct pci_bus *bus) 302static void iommu_bus_setup_pSeries(struct pci_bus *bus)
@@ -396,7 +388,7 @@ static void iommu_bus_setup_pSeriesLP(struct pci_bus *bus)
396 struct iommu_table *tbl; 388 struct iommu_table *tbl;
397 struct device_node *dn, *pdn; 389 struct device_node *dn, *pdn;
398 struct pci_dn *ppci; 390 struct pci_dn *ppci;
399 unsigned int *dma_window = NULL; 391 unsigned char *dma_window = NULL;
400 392
401 DBG("iommu_bus_setup_pSeriesLP, bus %p, bus->self %p\n", bus, bus->self); 393 DBG("iommu_bus_setup_pSeriesLP, bus %p, bus->self %p\n", bus, bus->self);
402 394
@@ -404,7 +396,7 @@ static void iommu_bus_setup_pSeriesLP(struct pci_bus *bus)
404 396
405 /* Find nearest ibm,dma-window, walking up the device tree */ 397 /* Find nearest ibm,dma-window, walking up the device tree */
406 for (pdn = dn; pdn != NULL; pdn = pdn->parent) { 398 for (pdn = dn; pdn != NULL; pdn = pdn->parent) {
407 dma_window = (unsigned int *)get_property(pdn, "ibm,dma-window", NULL); 399 dma_window = get_property(pdn, "ibm,dma-window", NULL);
408 if (dma_window != NULL) 400 if (dma_window != NULL)
409 break; 401 break;
410 } 402 }
@@ -498,7 +490,7 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev)
498{ 490{
499 struct device_node *pdn, *dn; 491 struct device_node *pdn, *dn;
500 struct iommu_table *tbl; 492 struct iommu_table *tbl;
501 int *dma_window = NULL; 493 unsigned char *dma_window = NULL;
502 struct pci_dn *pci; 494 struct pci_dn *pci;
503 495
504 DBG("iommu_dev_setup_pSeriesLP, dev %p (%s)\n", dev, pci_name(dev)); 496 DBG("iommu_dev_setup_pSeriesLP, dev %p (%s)\n", dev, pci_name(dev));
@@ -513,8 +505,7 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev)
513 505
514 for (pdn = dn; pdn && PCI_DN(pdn) && !PCI_DN(pdn)->iommu_table; 506 for (pdn = dn; pdn && PCI_DN(pdn) && !PCI_DN(pdn)->iommu_table;
515 pdn = pdn->parent) { 507 pdn = pdn->parent) {
516 dma_window = (unsigned int *) 508 dma_window = get_property(pdn, "ibm,dma-window", NULL);
517 get_property(pdn, "ibm,dma-window", NULL);
518 if (dma_window) 509 if (dma_window)
519 break; 510 break;
520 } 511 }