iommu.c (9874777016e06ad2df420237963e81389776cb6d) | iommu.c (bed59275810a55500e885cbdc5c2a0507f13c00e) |
---|---|
1/* 2 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation 3 * 4 * Rewrite, cleanup: 5 * 6 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation 7 * Copyright (C) 2006 Olof Johansson <olof@lixom.net> 8 * --- 228 unchanged lines hidden (view full) --- 237 printk("\tindex = 0x%lx\n", (u64)tbl->it_index); 238 printk("\ttcenum = 0x%lx\n", (u64)tcenum); 239 show_stack(current, (unsigned long *)__get_SP()); 240 } 241 242 return tce_ret; 243} 244 | 1/* 2 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation 3 * 4 * Rewrite, cleanup: 5 * 6 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation 7 * Copyright (C) 2006 Olof Johansson <olof@lixom.net> 8 * --- 228 unchanged lines hidden (view full) --- 237 printk("\tindex = 0x%lx\n", (u64)tbl->it_index); 238 printk("\ttcenum = 0x%lx\n", (u64)tcenum); 239 show_stack(current, (unsigned long *)__get_SP()); 240 } 241 242 return tce_ret; 243} 244 |
245#ifdef CONFIG_PCI |
|
245static void iommu_table_setparms(struct pci_controller *phb, 246 struct device_node *dn, 247 struct iommu_table *tbl) 248{ 249 struct device_node *node; 250 const unsigned long *basep; 251 const u32 *sizep; 252 --- 220 unchanged lines hidden (view full) --- 473 474 if (dn && PCI_DN(dn)) 475 dev->dev.archdata.dma_data = PCI_DN(dn)->iommu_table; 476 else 477 printk(KERN_WARNING "iommu: Device %s has no iommu table\n", 478 pci_name(dev)); 479} 480 | 246static void iommu_table_setparms(struct pci_controller *phb, 247 struct device_node *dn, 248 struct iommu_table *tbl) 249{ 250 struct device_node *node; 251 const unsigned long *basep; 252 const u32 *sizep; 253 --- 220 unchanged lines hidden (view full) --- 474 475 if (dn && PCI_DN(dn)) 476 dev->dev.archdata.dma_data = PCI_DN(dn)->iommu_table; 477 else 478 printk(KERN_WARNING "iommu: Device %s has no iommu table\n", 479 pci_name(dev)); 480} 481 |
481static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node) 482{ 483 int err = NOTIFY_OK; 484 struct device_node *np = node; 485 struct pci_dn *pci = PCI_DN(np); 486 487 switch (action) { 488 case PSERIES_RECONFIG_REMOVE: 489 if (pci && pci->iommu_table && 490 get_property(np, "ibm,dma-window", NULL)) 491 iommu_free_table(np); 492 break; 493 default: 494 err = NOTIFY_DONE; 495 break; 496 } 497 return err; 498} 499 500static struct notifier_block iommu_reconfig_nb = { 501 .notifier_call = iommu_reconfig_notifier, 502}; 503 | |
504static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev) 505{ 506 struct device_node *pdn, *dn; 507 struct iommu_table *tbl; 508 const void *dma_window = NULL; 509 struct pci_dn *pci; 510 511 DBG("pci_dma_dev_setup_pSeriesLP: %s\n", pci_name(dev)); --- 37 unchanged lines hidden (view full) --- 549 iommu_table_setparms_lpar(pci->phb, pdn, tbl, dma_window); 550 551 pci->iommu_table = iommu_init_table(tbl, pci->phb->node); 552 DBG(" created table: %p\n", pci->iommu_table); 553 } 554 555 dev->dev.archdata.dma_data = pci->iommu_table; 556} | 482static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev) 483{ 484 struct device_node *pdn, *dn; 485 struct iommu_table *tbl; 486 const void *dma_window = NULL; 487 struct pci_dn *pci; 488 489 DBG("pci_dma_dev_setup_pSeriesLP: %s\n", pci_name(dev)); --- 37 unchanged lines hidden (view full) --- 527 iommu_table_setparms_lpar(pci->phb, pdn, tbl, dma_window); 528 529 pci->iommu_table = iommu_init_table(tbl, pci->phb->node); 530 DBG(" created table: %p\n", pci->iommu_table); 531 } 532 533 dev->dev.archdata.dma_data = pci->iommu_table; 534} |
535#else /* CONFIG_PCI */ 536#define pci_dma_bus_setup_pSeries NULL 537#define pci_dma_dev_setup_pSeries NULL 538#define pci_dma_bus_setup_pSeriesLP NULL 539#define pci_dma_dev_setup_pSeriesLP NULL 540#endif /* !CONFIG_PCI */ |
|
557 | 541 |
542static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node) 543{ 544 int err = NOTIFY_OK; 545 struct device_node *np = node; 546 struct pci_dn *pci = PCI_DN(np); 547 548 switch (action) { 549 case PSERIES_RECONFIG_REMOVE: 550 if (pci && pci->iommu_table && 551 get_property(np, "ibm,dma-window", NULL)) 552 iommu_free_table(np); 553 break; 554 default: 555 err = NOTIFY_DONE; 556 break; 557 } 558 return err; 559} 560 561static struct notifier_block iommu_reconfig_nb = { 562 .notifier_call = iommu_reconfig_notifier, 563}; 564 |
|
558/* These are called very early. */ 559void iommu_init_early_pSeries(void) 560{ 561 if (of_chosen && get_property(of_chosen, "linux,iommu-off", NULL)) { 562 /* Direct I/O, IOMMU off */ 563 ppc_md.pci_dma_dev_setup = NULL; 564 ppc_md.pci_dma_bus_setup = NULL; 565 set_pci_dma_ops(&dma_direct_ops); --- 28 unchanged lines hidden --- | 565/* These are called very early. */ 566void iommu_init_early_pSeries(void) 567{ 568 if (of_chosen && get_property(of_chosen, "linux,iommu-off", NULL)) { 569 /* Direct I/O, IOMMU off */ 570 ppc_md.pci_dma_dev_setup = NULL; 571 ppc_md.pci_dma_bus_setup = NULL; 572 set_pci_dma_ops(&dma_direct_ops); --- 28 unchanged lines hidden --- |