diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86_64/kernel/pci-calgary.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/arch/x86_64/kernel/pci-calgary.c b/arch/x86_64/kernel/pci-calgary.c index d10fee8c2418..86927d5b8463 100644 --- a/arch/x86_64/kernel/pci-calgary.c +++ b/arch/x86_64/kernel/pci-calgary.c | |||
@@ -321,7 +321,7 @@ error: | |||
321 | return bad_dma_address; | 321 | return bad_dma_address; |
322 | } | 322 | } |
323 | 323 | ||
324 | static void __iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr, | 324 | static void iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr, |
325 | unsigned int npages) | 325 | unsigned int npages) |
326 | { | 326 | { |
327 | unsigned long entry; | 327 | unsigned long entry; |
@@ -359,12 +359,6 @@ static void __iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr, | |||
359 | spin_unlock_irqrestore(&tbl->it_lock, flags); | 359 | spin_unlock_irqrestore(&tbl->it_lock, flags); |
360 | } | 360 | } |
361 | 361 | ||
362 | static void iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr, | ||
363 | unsigned int npages) | ||
364 | { | ||
365 | __iommu_free(tbl, dma_addr, npages); | ||
366 | } | ||
367 | |||
368 | static inline struct iommu_table *find_iommu_table(struct device *dev) | 362 | static inline struct iommu_table *find_iommu_table(struct device *dev) |
369 | { | 363 | { |
370 | struct pci_dev *pdev; | 364 | struct pci_dev *pdev; |
@@ -387,9 +381,14 @@ static inline struct iommu_table *find_iommu_table(struct device *dev) | |||
387 | return tbl; | 381 | return tbl; |
388 | } | 382 | } |
389 | 383 | ||
390 | static void __calgary_unmap_sg(struct iommu_table *tbl, | 384 | static void calgary_unmap_sg(struct device *dev, |
391 | struct scatterlist *sglist, int nelems, int direction) | 385 | struct scatterlist *sglist, int nelems, int direction) |
392 | { | 386 | { |
387 | struct iommu_table *tbl = find_iommu_table(dev); | ||
388 | |||
389 | if (!translate_phb(to_pci_dev(dev))) | ||
390 | return; | ||
391 | |||
393 | while (nelems--) { | 392 | while (nelems--) { |
394 | unsigned int npages; | 393 | unsigned int npages; |
395 | dma_addr_t dma = sglist->dma_address; | 394 | dma_addr_t dma = sglist->dma_address; |
@@ -399,22 +398,11 @@ static void __calgary_unmap_sg(struct iommu_table *tbl, | |||
399 | break; | 398 | break; |
400 | 399 | ||
401 | npages = num_dma_pages(dma, dmalen); | 400 | npages = num_dma_pages(dma, dmalen); |
402 | __iommu_free(tbl, dma, npages); | 401 | iommu_free(tbl, dma, npages); |
403 | sglist++; | 402 | sglist++; |
404 | } | 403 | } |
405 | } | 404 | } |
406 | 405 | ||
407 | void calgary_unmap_sg(struct device *dev, struct scatterlist *sglist, | ||
408 | int nelems, int direction) | ||
409 | { | ||
410 | struct iommu_table *tbl = find_iommu_table(dev); | ||
411 | |||
412 | if (!translate_phb(to_pci_dev(dev))) | ||
413 | return; | ||
414 | |||
415 | __calgary_unmap_sg(tbl, sglist, nelems, direction); | ||
416 | } | ||
417 | |||
418 | static int calgary_nontranslate_map_sg(struct device* dev, | 406 | static int calgary_nontranslate_map_sg(struct device* dev, |
419 | struct scatterlist *sg, int nelems, int direction) | 407 | struct scatterlist *sg, int nelems, int direction) |
420 | { | 408 | { |
@@ -466,7 +454,7 @@ static int calgary_map_sg(struct device *dev, struct scatterlist *sg, | |||
466 | 454 | ||
467 | return nelems; | 455 | return nelems; |
468 | error: | 456 | error: |
469 | __calgary_unmap_sg(tbl, sg, nelems, direction); | 457 | calgary_unmap_sg(dev, sg, nelems, direction); |
470 | for (i = 0; i < nelems; i++) { | 458 | for (i = 0; i < nelems; i++) { |
471 | sg[i].dma_address = bad_dma_address; | 459 | sg[i].dma_address = bad_dma_address; |
472 | sg[i].dma_length = 0; | 460 | sg[i].dma_length = 0; |