mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 12:16:20 +00:00
powerpc: Fix DMA offset for non-coherent DMA
After Becky's work we can almost have different DMA offsets between on-chip devices and PCI. Almost because there's a problem with the non-coherent DMA code that basically ignores the programmed offset to use the global one for everything. This fixes it. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:
parent
1263965f29
commit
8aa2659009
2 changed files with 7 additions and 3 deletions
|
@ -30,11 +30,15 @@ static unsigned long get_dma_direct_offset(struct device *dev)
|
||||||
void *dma_direct_alloc_coherent(struct device *dev, size_t size,
|
void *dma_direct_alloc_coherent(struct device *dev, size_t size,
|
||||||
dma_addr_t *dma_handle, gfp_t flag)
|
dma_addr_t *dma_handle, gfp_t flag)
|
||||||
{
|
{
|
||||||
|
void *ret;
|
||||||
#ifdef CONFIG_NOT_COHERENT_CACHE
|
#ifdef CONFIG_NOT_COHERENT_CACHE
|
||||||
return __dma_alloc_coherent(size, dma_handle, flag);
|
ret = __dma_alloc_coherent(size, dma_handle, flag);
|
||||||
|
if (ret == NULL)
|
||||||
|
return NULL;
|
||||||
|
*dma_handle += get_dma_direct_offset(dev);
|
||||||
|
return ret;
|
||||||
#else
|
#else
|
||||||
struct page *page;
|
struct page *page;
|
||||||
void *ret;
|
|
||||||
int node = dev_to_node(dev);
|
int node = dev_to_node(dev);
|
||||||
|
|
||||||
/* ignore region specifiers */
|
/* ignore region specifiers */
|
||||||
|
|
|
@ -203,7 +203,7 @@ __dma_alloc_coherent(size_t size, dma_addr_t *handle, gfp_t gfp)
|
||||||
/*
|
/*
|
||||||
* Set the "dma handle"
|
* Set the "dma handle"
|
||||||
*/
|
*/
|
||||||
*handle = page_to_bus(page);
|
*handle = page_to_phys(page);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
BUG_ON(!pte_none(*pte));
|
BUG_ON(!pte_none(*pte));
|
||||||
|
|
Loading…
Reference in a new issue