diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-02-10 00:32:07 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-03-20 04:12:10 -0500 |
commit | 8f6a93a196ba6c569c3e8daa6e81cca7e3ba81b1 (patch) | |
tree | 80d4747608148c56fd8c67baf016ad4fc58610ea /arch/sparc64/kernel/pci_iommu.c | |
parent | 4cce4b7cc56abc3d7b269d09224b8297aad15138 (diff) |
[SPARC64]: Beginnings of SUN4V PCI controller support.
Abstract out IOMMU operations so that we can have a different
set of calls on sun4v, which needs to do things through
hypervisor calls.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/pci_iommu.c')
-rw-r--r-- | arch/sparc64/kernel/pci_iommu.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/arch/sparc64/kernel/pci_iommu.c b/arch/sparc64/kernel/pci_iommu.c index a11910be1013..8e52232f6f31 100644 --- a/arch/sparc64/kernel/pci_iommu.c +++ b/arch/sparc64/kernel/pci_iommu.c | |||
@@ -219,7 +219,7 @@ static inline void iommu_free_ctx(struct pci_iommu *iommu, int ctx) | |||
219 | * DMA for PCI device PDEV. Return non-NULL cpu-side address if | 219 | * DMA for PCI device PDEV. Return non-NULL cpu-side address if |
220 | * successful and set *DMA_ADDRP to the PCI side dma address. | 220 | * successful and set *DMA_ADDRP to the PCI side dma address. |
221 | */ | 221 | */ |
222 | void *pci_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp) | 222 | static void *pci_4u_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp) |
223 | { | 223 | { |
224 | struct pcidev_cookie *pcp; | 224 | struct pcidev_cookie *pcp; |
225 | struct pci_iommu *iommu; | 225 | struct pci_iommu *iommu; |
@@ -267,7 +267,7 @@ void *pci_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_ad | |||
267 | } | 267 | } |
268 | 268 | ||
269 | /* Free and unmap a consistent DMA translation. */ | 269 | /* Free and unmap a consistent DMA translation. */ |
270 | void pci_free_consistent(struct pci_dev *pdev, size_t size, void *cpu, dma_addr_t dvma) | 270 | static void pci_4u_free_consistent(struct pci_dev *pdev, size_t size, void *cpu, dma_addr_t dvma) |
271 | { | 271 | { |
272 | struct pcidev_cookie *pcp; | 272 | struct pcidev_cookie *pcp; |
273 | struct pci_iommu *iommu; | 273 | struct pci_iommu *iommu; |
@@ -294,7 +294,7 @@ void pci_free_consistent(struct pci_dev *pdev, size_t size, void *cpu, dma_addr_ | |||
294 | /* Map a single buffer at PTR of SZ bytes for PCI DMA | 294 | /* Map a single buffer at PTR of SZ bytes for PCI DMA |
295 | * in streaming mode. | 295 | * in streaming mode. |
296 | */ | 296 | */ |
297 | dma_addr_t pci_map_single(struct pci_dev *pdev, void *ptr, size_t sz, int direction) | 297 | static dma_addr_t pci_4u_map_single(struct pci_dev *pdev, void *ptr, size_t sz, int direction) |
298 | { | 298 | { |
299 | struct pcidev_cookie *pcp; | 299 | struct pcidev_cookie *pcp; |
300 | struct pci_iommu *iommu; | 300 | struct pci_iommu *iommu; |
@@ -415,7 +415,7 @@ do_flush_sync: | |||
415 | } | 415 | } |
416 | 416 | ||
417 | /* Unmap a single streaming mode DMA translation. */ | 417 | /* Unmap a single streaming mode DMA translation. */ |
418 | void pci_unmap_single(struct pci_dev *pdev, dma_addr_t bus_addr, size_t sz, int direction) | 418 | static void pci_4u_unmap_single(struct pci_dev *pdev, dma_addr_t bus_addr, size_t sz, int direction) |
419 | { | 419 | { |
420 | struct pcidev_cookie *pcp; | 420 | struct pcidev_cookie *pcp; |
421 | struct pci_iommu *iommu; | 421 | struct pci_iommu *iommu; |
@@ -548,7 +548,7 @@ static inline void fill_sg(iopte_t *iopte, struct scatterlist *sg, | |||
548 | * When making changes here, inspect the assembly output. I was having | 548 | * When making changes here, inspect the assembly output. I was having |
549 | * hard time to kepp this routine out of using stack slots for holding variables. | 549 | * hard time to kepp this routine out of using stack slots for holding variables. |
550 | */ | 550 | */ |
551 | int pci_map_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int direction) | 551 | static int pci_4u_map_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int direction) |
552 | { | 552 | { |
553 | struct pcidev_cookie *pcp; | 553 | struct pcidev_cookie *pcp; |
554 | struct pci_iommu *iommu; | 554 | struct pci_iommu *iommu; |
@@ -635,7 +635,7 @@ bad_no_ctx: | |||
635 | } | 635 | } |
636 | 636 | ||
637 | /* Unmap a set of streaming mode DMA translations. */ | 637 | /* Unmap a set of streaming mode DMA translations. */ |
638 | void pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int direction) | 638 | static void pci_4u_unmap_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int direction) |
639 | { | 639 | { |
640 | struct pcidev_cookie *pcp; | 640 | struct pcidev_cookie *pcp; |
641 | struct pci_iommu *iommu; | 641 | struct pci_iommu *iommu; |
@@ -695,7 +695,7 @@ void pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, | |||
695 | /* Make physical memory consistent for a single | 695 | /* Make physical memory consistent for a single |
696 | * streaming mode DMA translation after a transfer. | 696 | * streaming mode DMA translation after a transfer. |
697 | */ | 697 | */ |
698 | void pci_dma_sync_single_for_cpu(struct pci_dev *pdev, dma_addr_t bus_addr, size_t sz, int direction) | 698 | static void pci_4u_dma_sync_single_for_cpu(struct pci_dev *pdev, dma_addr_t bus_addr, size_t sz, int direction) |
699 | { | 699 | { |
700 | struct pcidev_cookie *pcp; | 700 | struct pcidev_cookie *pcp; |
701 | struct pci_iommu *iommu; | 701 | struct pci_iommu *iommu; |
@@ -735,7 +735,7 @@ void pci_dma_sync_single_for_cpu(struct pci_dev *pdev, dma_addr_t bus_addr, size | |||
735 | /* Make physical memory consistent for a set of streaming | 735 | /* Make physical memory consistent for a set of streaming |
736 | * mode DMA translations after a transfer. | 736 | * mode DMA translations after a transfer. |
737 | */ | 737 | */ |
738 | void pci_dma_sync_sg_for_cpu(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int direction) | 738 | static void pci_4u_dma_sync_sg_for_cpu(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int direction) |
739 | { | 739 | { |
740 | struct pcidev_cookie *pcp; | 740 | struct pcidev_cookie *pcp; |
741 | struct pci_iommu *iommu; | 741 | struct pci_iommu *iommu; |
@@ -776,6 +776,17 @@ void pci_dma_sync_sg_for_cpu(struct pci_dev *pdev, struct scatterlist *sglist, i | |||
776 | spin_unlock_irqrestore(&iommu->lock, flags); | 776 | spin_unlock_irqrestore(&iommu->lock, flags); |
777 | } | 777 | } |
778 | 778 | ||
779 | struct pci_iommu_ops pci_sun4u_iommu_ops = { | ||
780 | .alloc_consistent = pci_4u_alloc_consistent, | ||
781 | .free_consistent = pci_4u_free_consistent, | ||
782 | .map_single = pci_4u_map_single, | ||
783 | .unmap_single = pci_4u_unmap_single, | ||
784 | .map_sg = pci_4u_map_sg, | ||
785 | .unmap_sg = pci_4u_unmap_sg, | ||
786 | .dma_sync_single_for_cpu = pci_4u_dma_sync_single_for_cpu, | ||
787 | .dma_sync_sg_for_cpu = pci_4u_dma_sync_sg_for_cpu, | ||
788 | }; | ||
789 | |||
779 | static void ali_sound_dma_hack(struct pci_dev *pdev, int set_bit) | 790 | static void ali_sound_dma_hack(struct pci_dev *pdev, int set_bit) |
780 | { | 791 | { |
781 | struct pci_dev *ali_isa_bridge; | 792 | struct pci_dev *ali_isa_bridge; |