Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 188376
b: refs/heads/master
c: 1be53e0
h: refs/heads/master
v: v3
  • Loading branch information
Michal Simek committed Mar 11, 2010
1 parent b855ba8 commit 033324d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 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: 3a0d7a4dd5b3a6545e5764735b48ab84e64af723
refs/heads/master: 1be53e084a5bd8f59850348e1066d25aa0200031
17 changes: 13 additions & 4 deletions trunk/arch/microblaze/kernel/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,14 @@ static unsigned long get_dma_direct_offset(struct device *dev)
return PCI_DRAM_OFFSET; /* FIXME Not sure if is correct */
}

void *dma_direct_alloc_coherent(struct device *dev, size_t size,
#define NOT_COHERENT_CACHE

static void *dma_direct_alloc_coherent(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t flag)
{
#ifdef NOT_COHERENT_CACHE
return consistent_alloc(flag, size, dma_handle);
#else
void *ret;
struct page *page;
int node = dev_to_node(dev);
Expand All @@ -61,12 +66,17 @@ void *dma_direct_alloc_coherent(struct device *dev, size_t size,
*dma_handle = virt_to_phys(ret) + get_dma_direct_offset(dev);

return ret;
#endif
}

void dma_direct_free_coherent(struct device *dev, size_t size,
static void dma_direct_free_coherent(struct device *dev, size_t size,
void *vaddr, dma_addr_t dma_handle)
{
#ifdef NOT_COHERENT_CACHE
consistent_free(vaddr);
#else
free_pages((unsigned long)vaddr, get_order(size));
#endif
}

static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
Expand Down Expand Up @@ -105,7 +115,6 @@ static inline dma_addr_t dma_direct_map_page(struct device *dev,
enum dma_data_direction direction,
struct dma_attrs *attrs)
{
BUG_ON(direction == DMA_NONE);
__dma_sync_page(page_to_phys(page), offset, size, direction);
return page_to_phys(page) + offset + get_dma_direct_offset(dev);
}
Expand All @@ -121,7 +130,7 @@ static inline void dma_direct_unmap_page(struct device *dev,
* phys_to_virt is here because in __dma_sync_page is __virt_to_phys and
* dma_address is physical address
*/
__dma_sync_page((void *)dma_address, 0 , size, direction);
__dma_sync_page(dma_address, 0 , size, direction);
}

struct dma_map_ops dma_direct_ops = {
Expand Down

0 comments on commit 033324d

Please sign in to comment.