Commit 14a9aad7 authored by Christoph Hellwig's avatar Christoph Hellwig

x86/pci-nommu: implement ->mapping_error

DMA_ERROR_CODE is going to go away, so don't rely on it.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 6009faa4
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#include <asm/iommu.h> #include <asm/iommu.h>
#include <asm/dma.h> #include <asm/dma.h>
#define NOMMU_MAPPING_ERROR 0
static int static int
check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size) check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size)
{ {
...@@ -33,7 +35,7 @@ static dma_addr_t nommu_map_page(struct device *dev, struct page *page, ...@@ -33,7 +35,7 @@ static dma_addr_t nommu_map_page(struct device *dev, struct page *page,
dma_addr_t bus = page_to_phys(page) + offset; dma_addr_t bus = page_to_phys(page) + offset;
WARN_ON(size == 0); WARN_ON(size == 0);
if (!check_addr("map_single", dev, bus, size)) if (!check_addr("map_single", dev, bus, size))
return DMA_ERROR_CODE; return NOMMU_MAPPING_ERROR;
flush_write_buffers(); flush_write_buffers();
return bus; return bus;
} }
...@@ -88,6 +90,11 @@ static void nommu_sync_sg_for_device(struct device *dev, ...@@ -88,6 +90,11 @@ static void nommu_sync_sg_for_device(struct device *dev,
flush_write_buffers(); flush_write_buffers();
} }
static int nommu_mapping_error(struct device *dev, dma_addr_t dma_addr)
{
return dma_addr == NOMMU_MAPPING_ERROR;
}
const struct dma_map_ops nommu_dma_ops = { const struct dma_map_ops nommu_dma_ops = {
.alloc = dma_generic_alloc_coherent, .alloc = dma_generic_alloc_coherent,
.free = dma_generic_free_coherent, .free = dma_generic_free_coherent,
...@@ -96,4 +103,5 @@ const struct dma_map_ops nommu_dma_ops = { ...@@ -96,4 +103,5 @@ const struct dma_map_ops nommu_dma_ops = {
.sync_single_for_device = nommu_sync_single_for_device, .sync_single_for_device = nommu_sync_single_for_device,
.sync_sg_for_device = nommu_sync_sg_for_device, .sync_sg_for_device = nommu_sync_sg_for_device,
.is_phys = 1, .is_phys = 1,
.mapping_error = nommu_mapping_error,
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment