diff options
Diffstat (limited to 'arch/sparc64/kernel/pci_iommu.c')
-rw-r--r-- | arch/sparc64/kernel/pci_iommu.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/arch/sparc64/kernel/pci_iommu.c b/arch/sparc64/kernel/pci_iommu.c index a11910be1013..8efbc139769d 100644 --- a/arch/sparc64/kernel/pci_iommu.c +++ b/arch/sparc64/kernel/pci_iommu.c | |||
@@ -139,12 +139,11 @@ void pci_iommu_table_init(struct pci_iommu *iommu, int tsbsize, u32 dma_offset, | |||
139 | /* Allocate and initialize the free area map. */ | 139 | /* Allocate and initialize the free area map. */ |
140 | sz = num_tsb_entries / 8; | 140 | sz = num_tsb_entries / 8; |
141 | sz = (sz + 7UL) & ~7UL; | 141 | sz = (sz + 7UL) & ~7UL; |
142 | iommu->arena.map = kmalloc(sz, GFP_KERNEL); | 142 | iommu->arena.map = kzalloc(sz, GFP_KERNEL); |
143 | if (!iommu->arena.map) { | 143 | if (!iommu->arena.map) { |
144 | prom_printf("PCI_IOMMU: Error, kmalloc(arena.map) failed.\n"); | 144 | prom_printf("PCI_IOMMU: Error, kmalloc(arena.map) failed.\n"); |
145 | prom_halt(); | 145 | prom_halt(); |
146 | } | 146 | } |
147 | memset(iommu->arena.map, 0, sz); | ||
148 | iommu->arena.limit = num_tsb_entries; | 147 | iommu->arena.limit = num_tsb_entries; |
149 | 148 | ||
150 | /* Allocate and initialize the dummy page which we | 149 | /* Allocate and initialize the dummy page which we |
@@ -219,7 +218,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 | 218 | * DMA for PCI device PDEV. Return non-NULL cpu-side address if |
220 | * successful and set *DMA_ADDRP to the PCI side dma address. | 219 | * successful and set *DMA_ADDRP to the PCI side dma address. |
221 | */ | 220 | */ |
222 | void *pci_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp) | 221 | static void *pci_4u_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp) |
223 | { | 222 | { |
224 | struct pcidev_cookie *pcp; | 223 | struct pcidev_cookie *pcp; |
225 | struct pci_iommu *iommu; | 224 | struct pci_iommu *iommu; |
@@ -267,7 +266,7 @@ void *pci_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_ad | |||
267 | } | 266 | } |
268 | 267 | ||
269 | /* Free and unmap a consistent DMA translation. */ | 268 | /* 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) | 269 | static void pci_4u_free_consistent(struct pci_dev *pdev, size_t size, void *cpu, dma_addr_t dvma) |
271 | { | 270 | { |
272 | struct pcidev_cookie *pcp; | 271 | struct pcidev_cookie *pcp; |
273 | struct pci_iommu *iommu; | 272 | struct pci_iommu *iommu; |
@@ -294,7 +293,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 | 293 | /* Map a single buffer at PTR of SZ bytes for PCI DMA |
295 | * in streaming mode. | 294 | * in streaming mode. |
296 | */ | 295 | */ |
297 | dma_addr_t pci_map_single(struct pci_dev *pdev, void *ptr, size_t sz, int direction) | 296 | static dma_addr_t pci_4u_map_single(struct pci_dev *pdev, void *ptr, size_t sz, int direction) |
298 | { | 297 | { |
299 | struct pcidev_cookie *pcp; | 298 | struct pcidev_cookie *pcp; |
300 | struct pci_iommu *iommu; | 299 | struct pci_iommu *iommu; |
@@ -415,7 +414,7 @@ do_flush_sync: | |||
415 | } | 414 | } |
416 | 415 | ||
417 | /* Unmap a single streaming mode DMA translation. */ | 416 | /* 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) | 417 | static void pci_4u_unmap_single(struct pci_dev *pdev, dma_addr_t bus_addr, size_t sz, int direction) |
419 | { | 418 | { |
420 | struct pcidev_cookie *pcp; | 419 | struct pcidev_cookie *pcp; |
421 | struct pci_iommu *iommu; | 420 | struct pci_iommu *iommu; |
@@ -548,7 +547,7 @@ static inline void fill_sg(iopte_t *iopte, struct scatterlist *sg, | |||
548 | * When making changes here, inspect the assembly output. I was having | 547 | * 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. | 548 | * hard time to kepp this routine out of using stack slots for holding variables. |
550 | */ | 549 | */ |
551 | int pci_map_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int direction) | 550 | static int pci_4u_map_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int direction) |
552 | { | 551 | { |
553 | struct pcidev_cookie *pcp; | 552 | struct pcidev_cookie *pcp; |
554 | struct pci_iommu *iommu; | 553 | struct pci_iommu *iommu; |
@@ -562,9 +561,9 @@ int pci_map_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int | |||
562 | /* Fast path single entry scatterlists. */ | 561 | /* Fast path single entry scatterlists. */ |
563 | if (nelems == 1) { | 562 | if (nelems == 1) { |
564 | sglist->dma_address = | 563 | sglist->dma_address = |
565 | pci_map_single(pdev, | 564 | pci_4u_map_single(pdev, |
566 | (page_address(sglist->page) + sglist->offset), | 565 | (page_address(sglist->page) + sglist->offset), |
567 | sglist->length, direction); | 566 | sglist->length, direction); |
568 | if (unlikely(sglist->dma_address == PCI_DMA_ERROR_CODE)) | 567 | if (unlikely(sglist->dma_address == PCI_DMA_ERROR_CODE)) |
569 | return 0; | 568 | return 0; |
570 | sglist->dma_length = sglist->length; | 569 | sglist->dma_length = sglist->length; |
@@ -635,7 +634,7 @@ bad_no_ctx: | |||
635 | } | 634 | } |
636 | 635 | ||
637 | /* Unmap a set of streaming mode DMA translations. */ | 636 | /* Unmap a set of streaming mode DMA translations. */ |
638 | void pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int direction) | 637 | static void pci_4u_unmap_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int direction) |
639 | { | 638 | { |
640 | struct pcidev_cookie *pcp; | 639 | struct pcidev_cookie *pcp; |
641 | struct pci_iommu *iommu; | 640 | struct pci_iommu *iommu; |
@@ -695,7 +694,7 @@ void pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, | |||
695 | /* Make physical memory consistent for a single | 694 | /* Make physical memory consistent for a single |
696 | * streaming mode DMA translation after a transfer. | 695 | * streaming mode DMA translation after a transfer. |
697 | */ | 696 | */ |
698 | void pci_dma_sync_single_for_cpu(struct pci_dev *pdev, dma_addr_t bus_addr, size_t sz, int direction) | 697 | static void pci_4u_dma_sync_single_for_cpu(struct pci_dev *pdev, dma_addr_t bus_addr, size_t sz, int direction) |
699 | { | 698 | { |
700 | struct pcidev_cookie *pcp; | 699 | struct pcidev_cookie *pcp; |
701 | struct pci_iommu *iommu; | 700 | struct pci_iommu *iommu; |
@@ -735,7 +734,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 | 734 | /* Make physical memory consistent for a set of streaming |
736 | * mode DMA translations after a transfer. | 735 | * mode DMA translations after a transfer. |
737 | */ | 736 | */ |
738 | void pci_dma_sync_sg_for_cpu(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int direction) | 737 | static void pci_4u_dma_sync_sg_for_cpu(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int direction) |
739 | { | 738 | { |
740 | struct pcidev_cookie *pcp; | 739 | struct pcidev_cookie *pcp; |
741 | struct pci_iommu *iommu; | 740 | struct pci_iommu *iommu; |
@@ -776,6 +775,17 @@ void pci_dma_sync_sg_for_cpu(struct pci_dev *pdev, struct scatterlist *sglist, i | |||
776 | spin_unlock_irqrestore(&iommu->lock, flags); | 775 | spin_unlock_irqrestore(&iommu->lock, flags); |
777 | } | 776 | } |
778 | 777 | ||
778 | struct pci_iommu_ops pci_sun4u_iommu_ops = { | ||
779 | .alloc_consistent = pci_4u_alloc_consistent, | ||
780 | .free_consistent = pci_4u_free_consistent, | ||
781 | .map_single = pci_4u_map_single, | ||
782 | .unmap_single = pci_4u_unmap_single, | ||
783 | .map_sg = pci_4u_map_sg, | ||
784 | .unmap_sg = pci_4u_unmap_sg, | ||
785 | .dma_sync_single_for_cpu = pci_4u_dma_sync_single_for_cpu, | ||
786 | .dma_sync_sg_for_cpu = pci_4u_dma_sync_sg_for_cpu, | ||
787 | }; | ||
788 | |||
779 | static void ali_sound_dma_hack(struct pci_dev *pdev, int set_bit) | 789 | static void ali_sound_dma_hack(struct pci_dev *pdev, int set_bit) |
780 | { | 790 | { |
781 | struct pci_dev *ali_isa_bridge; | 791 | struct pci_dev *ali_isa_bridge; |