Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 42231
b: refs/heads/master
c: 92b20c4
h: refs/heads/master
i:
  42229: 7a0c85a
  42227: c1b856b
  42223: aaacb50
v: v3
  • Loading branch information
Benjamin Herrenschmidt authored and Paul Mackerras committed Dec 4, 2006
1 parent 267ece4 commit 8b4a73d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3bc0f40c287a435805b0545ffc44ea41f11cd43e
refs/heads/master: 92b20c40dcca2d441f367da57e7665cce15c492a
11 changes: 8 additions & 3 deletions trunk/arch/powerpc/kernel/dma_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ EXPORT_SYMBOL(dma_iommu_ops);

/*
* Generic direct DMA implementation
*
* This implementation supports a global offset that can be applied if
* the address at which memory is visible to devices is not 0.
*/
unsigned long dma_direct_offset;

static void *dma_direct_alloc_coherent(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t flag)
Expand All @@ -122,7 +126,7 @@ static void *dma_direct_alloc_coherent(struct device *dev, size_t size,
ret = (void *)__get_free_pages(flag, get_order(size));
if (ret != NULL) {
memset(ret, 0, size);
*dma_handle = virt_to_abs(ret);
*dma_handle = virt_to_abs(ret) | dma_direct_offset;
}
return ret;
}
Expand All @@ -137,7 +141,7 @@ static dma_addr_t dma_direct_map_single(struct device *dev, void *ptr,
size_t size,
enum dma_data_direction direction)
{
return virt_to_abs(ptr);
return virt_to_abs(ptr) | dma_direct_offset;
}

static void dma_direct_unmap_single(struct device *dev, dma_addr_t dma_addr,
Expand All @@ -152,7 +156,8 @@ static int dma_direct_map_sg(struct device *dev, struct scatterlist *sg,
int i;

for (i = 0; i < nents; i++, sg++) {
sg->dma_address = page_to_phys(sg->page) + sg->offset;
sg->dma_address = (page_to_phys(sg->page) + sg->offset) |
dma_direct_offset;
sg->dma_length = sg->length;
}

Expand Down
2 changes: 2 additions & 0 deletions trunk/include/asm-powerpc/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
extern struct dma_mapping_ops dma_iommu_ops;
extern struct dma_mapping_ops dma_direct_ops;

extern unsigned long dma_direct_offset;

#else /* CONFIG_PPC64 */

#define dma_supported(dev, mask) (1)
Expand Down

0 comments on commit 8b4a73d

Please sign in to comment.