Commit 86865771 authored by Michael Ellerman's avatar Michael Ellerman Committed by Paul Mackerras

[POWERPC] Split out the IOMMU logic from cell_dma_dev_setup()

Split the IOMMU logic out from cell_dma_dev_setup() into a separate
function.  If we're not using dma_direct_ops or dma_iommu_ops we don't
know what the hell's going on, so BUG.
Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 7fc67afc
...@@ -507,17 +507,12 @@ static struct cbe_iommu *cell_iommu_for_node(int nid) ...@@ -507,17 +507,12 @@ static struct cbe_iommu *cell_iommu_for_node(int nid)
static unsigned long cell_dma_direct_offset; static unsigned long cell_dma_direct_offset;
static void cell_dma_dev_setup(struct device *dev) static void cell_dma_dev_setup_iommu(struct device *dev)
{ {
struct iommu_window *window; struct iommu_window *window;
struct cbe_iommu *iommu; struct cbe_iommu *iommu;
struct dev_archdata *archdata = &dev->archdata; struct dev_archdata *archdata = &dev->archdata;
if (get_pci_dma_ops() == &dma_direct_ops) {
archdata->dma_data = (void *)cell_dma_direct_offset;
return;
}
/* Current implementation uses the first window available in that /* Current implementation uses the first window available in that
* node's iommu. We -might- do something smarter later though it may * node's iommu. We -might- do something smarter later though it may
* never be necessary * never be necessary
...@@ -534,6 +529,18 @@ static void cell_dma_dev_setup(struct device *dev) ...@@ -534,6 +529,18 @@ static void cell_dma_dev_setup(struct device *dev)
archdata->dma_data = &window->table; archdata->dma_data = &window->table;
} }
static void cell_dma_dev_setup(struct device *dev)
{
struct dev_archdata *archdata = &dev->archdata;
if (get_pci_dma_ops() == &dma_iommu_ops)
cell_dma_dev_setup_iommu(dev);
else if (get_pci_dma_ops() == &dma_direct_ops)
archdata->dma_data = (void *)cell_dma_direct_offset;
else
BUG();
}
static void cell_pci_dma_dev_setup(struct pci_dev *dev) static void cell_pci_dma_dev_setup(struct pci_dev *dev)
{ {
cell_dma_dev_setup(&dev->dev); cell_dma_dev_setup(&dev->dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment