diff options
author | Becky Bruce <beckyb@kernel.crashing.org> | 2009-09-21 04:26:35 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-09-24 01:31:43 -0400 |
commit | 738ef42e32fe95553a424c04016b936c9f6c9afb (patch) | |
tree | f45f21a92eacbb22bd3223c5ac725473c6ec1d72 /arch/powerpc/platforms | |
parent | 1cebd7a0f62804ca24f7b7b35e8105000b9e879a (diff) |
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>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r-- | arch/powerpc/platforms/cell/beat_iommu.c | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/iommu.c | 9 | ||||
-rw-r--r-- | arch/powerpc/platforms/iseries/iommu.c | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/pasemi/iommu.c | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/iommu.c | 8 |
5 files changed, 10 insertions, 13 deletions
diff --git a/arch/powerpc/platforms/cell/beat_iommu.c b/arch/powerpc/platforms/cell/beat_iommu.c index 93b0efddd658..39d361c5c6d2 100644 --- a/arch/powerpc/platforms/cell/beat_iommu.c +++ b/arch/powerpc/platforms/cell/beat_iommu.c | |||
@@ -77,7 +77,7 @@ static void __init celleb_init_direct_mapping(void) | |||
77 | static void celleb_dma_dev_setup(struct device *dev) | 77 | static void celleb_dma_dev_setup(struct device *dev) |
78 | { | 78 | { |
79 | dev->archdata.dma_ops = get_pci_dma_ops(); | 79 | dev->archdata.dma_ops = get_pci_dma_ops(); |
80 | dev->archdata.dma_data = (void *)celleb_dma_direct_offset; | 80 | set_dma_offset(dev, celleb_dma_direct_offset); |
81 | } | 81 | } |
82 | 82 | ||
83 | static void celleb_pci_dma_dev_setup(struct pci_dev *pdev) | 83 | static void celleb_pci_dma_dev_setup(struct pci_dev *pdev) |
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c index 416db17eb18f..ca5bfdfe47f2 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c | |||
@@ -657,15 +657,13 @@ static void cell_dma_dev_setup_fixed(struct device *dev); | |||
657 | 657 | ||
658 | static void cell_dma_dev_setup(struct device *dev) | 658 | static void cell_dma_dev_setup(struct device *dev) |
659 | { | 659 | { |
660 | struct dev_archdata *archdata = &dev->archdata; | ||
661 | |||
662 | /* Order is important here, these are not mutually exclusive */ | 660 | /* Order is important here, these are not mutually exclusive */ |
663 | if (get_dma_ops(dev) == &dma_iommu_fixed_ops) | 661 | if (get_dma_ops(dev) == &dma_iommu_fixed_ops) |
664 | cell_dma_dev_setup_fixed(dev); | 662 | cell_dma_dev_setup_fixed(dev); |
665 | else if (get_pci_dma_ops() == &dma_iommu_ops) | 663 | else if (get_pci_dma_ops() == &dma_iommu_ops) |
666 | archdata->dma_data = cell_get_iommu_table(dev); | 664 | set_iommu_table_base(dev, cell_get_iommu_table(dev)); |
667 | else if (get_pci_dma_ops() == &dma_direct_ops) | 665 | else if (get_pci_dma_ops() == &dma_direct_ops) |
668 | archdata->dma_data = (void *)cell_dma_direct_offset; | 666 | set_dma_offset(dev, cell_dma_direct_offset); |
669 | else | 667 | else |
670 | BUG(); | 668 | BUG(); |
671 | } | 669 | } |
@@ -973,11 +971,10 @@ static int dma_set_mask_and_switch(struct device *dev, u64 dma_mask) | |||
973 | 971 | ||
974 | static void cell_dma_dev_setup_fixed(struct device *dev) | 972 | static void cell_dma_dev_setup_fixed(struct device *dev) |
975 | { | 973 | { |
976 | struct dev_archdata *archdata = &dev->archdata; | ||
977 | u64 addr; | 974 | u64 addr; |
978 | 975 | ||
979 | addr = cell_iommu_get_fixed_address(dev) + dma_iommu_fixed_base; | 976 | addr = cell_iommu_get_fixed_address(dev) + dma_iommu_fixed_base; |
980 | archdata->dma_data = (void *)addr; | 977 | set_dma_offset(dev, addr); |
981 | 978 | ||
982 | dev_dbg(dev, "iommu: fixed addr = %llx\n", addr); | 979 | dev_dbg(dev, "iommu: fixed addr = %llx\n", addr); |
983 | } | 980 | } |
diff --git a/arch/powerpc/platforms/iseries/iommu.c b/arch/powerpc/platforms/iseries/iommu.c index 6c1e1011959e..9d53cb481a7c 100644 --- a/arch/powerpc/platforms/iseries/iommu.c +++ b/arch/powerpc/platforms/iseries/iommu.c | |||
@@ -193,7 +193,7 @@ static void pci_dma_dev_setup_iseries(struct pci_dev *pdev) | |||
193 | pdn->iommu_table = iommu_init_table(tbl, -1); | 193 | pdn->iommu_table = iommu_init_table(tbl, -1); |
194 | else | 194 | else |
195 | kfree(tbl); | 195 | kfree(tbl); |
196 | pdev->dev.archdata.dma_data = pdn->iommu_table; | 196 | set_iommu_table_base(&pdev->dev, pdn->iommu_table); |
197 | } | 197 | } |
198 | #else | 198 | #else |
199 | #define pci_dma_dev_setup_iseries NULL | 199 | #define pci_dma_dev_setup_iseries NULL |
diff --git a/arch/powerpc/platforms/pasemi/iommu.c b/arch/powerpc/platforms/pasemi/iommu.c index a0ff03a3d8da..7b1d608ea3c8 100644 --- a/arch/powerpc/platforms/pasemi/iommu.c +++ b/arch/powerpc/platforms/pasemi/iommu.c | |||
@@ -189,7 +189,7 @@ static void pci_dma_dev_setup_pasemi(struct pci_dev *dev) | |||
189 | } | 189 | } |
190 | #endif | 190 | #endif |
191 | 191 | ||
192 | dev->dev.archdata.dma_data = &iommu_table_iobmap; | 192 | set_iommu_table_base(&dev->dev, &iommu_table_iobmap); |
193 | } | 193 | } |
194 | 194 | ||
195 | static void pci_dma_bus_setup_null(struct pci_bus *b) { } | 195 | static void pci_dma_bus_setup_null(struct pci_bus *b) { } |
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c index 661c8e02bcba..1a0000a4b6d6 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c | |||
@@ -482,7 +482,7 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev *dev) | |||
482 | phb->node); | 482 | phb->node); |
483 | iommu_table_setparms(phb, dn, tbl); | 483 | iommu_table_setparms(phb, dn, tbl); |
484 | PCI_DN(dn)->iommu_table = iommu_init_table(tbl, phb->node); | 484 | PCI_DN(dn)->iommu_table = iommu_init_table(tbl, phb->node); |
485 | dev->dev.archdata.dma_data = PCI_DN(dn)->iommu_table; | 485 | set_iommu_table_base(&dev->dev, PCI_DN(dn)->iommu_table); |
486 | return; | 486 | return; |
487 | } | 487 | } |
488 | 488 | ||
@@ -494,7 +494,7 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev *dev) | |||
494 | dn = dn->parent; | 494 | dn = dn->parent; |
495 | 495 | ||
496 | if (dn && PCI_DN(dn)) | 496 | if (dn && PCI_DN(dn)) |
497 | dev->dev.archdata.dma_data = PCI_DN(dn)->iommu_table; | 497 | set_iommu_table_base(&dev->dev, PCI_DN(dn)->iommu_table); |
498 | else | 498 | else |
499 | printk(KERN_WARNING "iommu: Device %s has no iommu table\n", | 499 | printk(KERN_WARNING "iommu: Device %s has no iommu table\n", |
500 | pci_name(dev)); | 500 | pci_name(dev)); |
@@ -538,7 +538,7 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev) | |||
538 | */ | 538 | */ |
539 | if (dma_window == NULL || pdn->parent == NULL) { | 539 | if (dma_window == NULL || pdn->parent == NULL) { |
540 | pr_debug(" no dma window for device, linking to parent\n"); | 540 | pr_debug(" no dma window for device, linking to parent\n"); |
541 | dev->dev.archdata.dma_data = PCI_DN(pdn)->iommu_table; | 541 | set_iommu_table_base(&dev->dev, PCI_DN(pdn)->iommu_table); |
542 | return; | 542 | return; |
543 | } | 543 | } |
544 | 544 | ||
@@ -554,7 +554,7 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev) | |||
554 | pr_debug(" found DMA window, table: %p\n", pci->iommu_table); | 554 | pr_debug(" found DMA window, table: %p\n", pci->iommu_table); |
555 | } | 555 | } |
556 | 556 | ||
557 | dev->dev.archdata.dma_data = pci->iommu_table; | 557 | set_iommu_table_base(&dev->dev, pci->iommu_table); |
558 | } | 558 | } |
559 | #else /* CONFIG_PCI */ | 559 | #else /* CONFIG_PCI */ |
560 | #define pci_dma_bus_setup_pSeries NULL | 560 | #define pci_dma_bus_setup_pSeries NULL |