diff options
-rw-r--r-- | include/linux/swiotlb.h | 8 | ||||
-rw-r--r-- | lib/swiotlb.c | 38 |
2 files changed, 0 insertions, 46 deletions
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h index 5b1f2a00491c..965be92c33b5 100644 --- a/include/linux/swiotlb.h +++ b/include/linux/swiotlb.h | |||
@@ -72,14 +72,6 @@ void *swiotlb_alloc(struct device *hwdev, size_t size, dma_addr_t *dma_handle, | |||
72 | void swiotlb_free(struct device *dev, size_t size, void *vaddr, | 72 | void swiotlb_free(struct device *dev, size_t size, void *vaddr, |
73 | dma_addr_t dma_addr, unsigned long attrs); | 73 | dma_addr_t dma_addr, unsigned long attrs); |
74 | 74 | ||
75 | extern void | ||
76 | *swiotlb_alloc_coherent(struct device *hwdev, size_t size, | ||
77 | dma_addr_t *dma_handle, gfp_t flags); | ||
78 | |||
79 | extern void | ||
80 | swiotlb_free_coherent(struct device *hwdev, size_t size, | ||
81 | void *vaddr, dma_addr_t dma_handle); | ||
82 | |||
83 | extern dma_addr_t swiotlb_map_page(struct device *dev, struct page *page, | 75 | extern dma_addr_t swiotlb_map_page(struct device *dev, struct page *page, |
84 | unsigned long offset, size_t size, | 76 | unsigned long offset, size_t size, |
85 | enum dma_data_direction dir, | 77 | enum dma_data_direction dir, |
diff --git a/lib/swiotlb.c b/lib/swiotlb.c index 8b06b4485e65..15954b86f09e 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c | |||
@@ -157,13 +157,6 @@ unsigned long swiotlb_size_or_default(void) | |||
157 | return size ? size : (IO_TLB_DEFAULT_SIZE); | 157 | return size ? size : (IO_TLB_DEFAULT_SIZE); |
158 | } | 158 | } |
159 | 159 | ||
160 | /* Note that this doesn't work with highmem page */ | ||
161 | static dma_addr_t swiotlb_virt_to_bus(struct device *hwdev, | ||
162 | volatile void *address) | ||
163 | { | ||
164 | return phys_to_dma(hwdev, virt_to_phys(address)); | ||
165 | } | ||
166 | |||
167 | static bool no_iotlb_memory; | 160 | static bool no_iotlb_memory; |
168 | 161 | ||
169 | void swiotlb_print_info(void) | 162 | void swiotlb_print_info(void) |
@@ -752,28 +745,6 @@ out_warn: | |||
752 | return NULL; | 745 | return NULL; |
753 | } | 746 | } |
754 | 747 | ||
755 | void * | ||
756 | swiotlb_alloc_coherent(struct device *hwdev, size_t size, | ||
757 | dma_addr_t *dma_handle, gfp_t flags) | ||
758 | { | ||
759 | int order = get_order(size); | ||
760 | unsigned long attrs = (flags & __GFP_NOWARN) ? DMA_ATTR_NO_WARN : 0; | ||
761 | void *ret; | ||
762 | |||
763 | ret = (void *)__get_free_pages(flags, order); | ||
764 | if (ret) { | ||
765 | *dma_handle = swiotlb_virt_to_bus(hwdev, ret); | ||
766 | if (dma_coherent_ok(hwdev, *dma_handle, size)) { | ||
767 | memset(ret, 0, size); | ||
768 | return ret; | ||
769 | } | ||
770 | free_pages((unsigned long)ret, order); | ||
771 | } | ||
772 | |||
773 | return swiotlb_alloc_buffer(hwdev, size, dma_handle, attrs); | ||
774 | } | ||
775 | EXPORT_SYMBOL(swiotlb_alloc_coherent); | ||
776 | |||
777 | static bool swiotlb_free_buffer(struct device *dev, size_t size, | 748 | static bool swiotlb_free_buffer(struct device *dev, size_t size, |
778 | dma_addr_t dma_addr) | 749 | dma_addr_t dma_addr) |
779 | { | 750 | { |
@@ -793,15 +764,6 @@ static bool swiotlb_free_buffer(struct device *dev, size_t size, | |||
793 | return true; | 764 | return true; |
794 | } | 765 | } |
795 | 766 | ||
796 | void | ||
797 | swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr, | ||
798 | dma_addr_t dev_addr) | ||
799 | { | ||
800 | if (!swiotlb_free_buffer(hwdev, size, dev_addr)) | ||
801 | free_pages((unsigned long)vaddr, get_order(size)); | ||
802 | } | ||
803 | EXPORT_SYMBOL(swiotlb_free_coherent); | ||
804 | |||
805 | static void | 767 | static void |
806 | swiotlb_full(struct device *dev, size_t size, enum dma_data_direction dir, | 768 | swiotlb_full(struct device *dev, size_t size, enum dma_data_direction dir, |
807 | int do_panic) | 769 | int do_panic) |