powerpc: Change archdata dma_data to a union
Sometimes this is used to hold a simple offset, and sometimes it is used to hold a pointer. This patch changes it to a union containing void * and dma_addr_t. get/set accessors are also provided, because it was getting a bit ugly to get to the actual data. Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:
committed by
Benjamin Herrenschmidt
parent
1cebd7a0f6
commit
738ef42e32
@@ -77,7 +77,7 @@ static void __init celleb_init_direct_mapping(void)
|
||||
static void celleb_dma_dev_setup(struct device *dev)
|
||||
{
|
||||
dev->archdata.dma_ops = get_pci_dma_ops();
|
||||
dev->archdata.dma_data = (void *)celleb_dma_direct_offset;
|
||||
set_dma_offset(dev, celleb_dma_direct_offset);
|
||||
}
|
||||
|
||||
static void celleb_pci_dma_dev_setup(struct pci_dev *pdev)
|
||||
|
||||
@@ -657,15 +657,13 @@ static void cell_dma_dev_setup_fixed(struct device *dev);
|
||||
|
||||
static void cell_dma_dev_setup(struct device *dev)
|
||||
{
|
||||
struct dev_archdata *archdata = &dev->archdata;
|
||||
|
||||
/* Order is important here, these are not mutually exclusive */
|
||||
if (get_dma_ops(dev) == &dma_iommu_fixed_ops)
|
||||
cell_dma_dev_setup_fixed(dev);
|
||||
else if (get_pci_dma_ops() == &dma_iommu_ops)
|
||||
archdata->dma_data = cell_get_iommu_table(dev);
|
||||
set_iommu_table_base(dev, cell_get_iommu_table(dev));
|
||||
else if (get_pci_dma_ops() == &dma_direct_ops)
|
||||
archdata->dma_data = (void *)cell_dma_direct_offset;
|
||||
set_dma_offset(dev, cell_dma_direct_offset);
|
||||
else
|
||||
BUG();
|
||||
}
|
||||
@@ -973,11 +971,10 @@ static int dma_set_mask_and_switch(struct device *dev, u64 dma_mask)
|
||||
|
||||
static void cell_dma_dev_setup_fixed(struct device *dev)
|
||||
{
|
||||
struct dev_archdata *archdata = &dev->archdata;
|
||||
u64 addr;
|
||||
|
||||
addr = cell_iommu_get_fixed_address(dev) + dma_iommu_fixed_base;
|
||||
archdata->dma_data = (void *)addr;
|
||||
set_dma_offset(dev, addr);
|
||||
|
||||
dev_dbg(dev, "iommu: fixed addr = %llx\n", addr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user