mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-22 06:13:59 +00:00
MIPS: DMA: Fix computation of DMA flags from device's coherent_dma_mask.
This only matters for ISA devices with a 24-bit DMA limit or for devices with a 32-bit DMA limit on systems with ZONE_DMA32 enabled. The latter currently only affects 32-bit PCI cards on Sibyte-based systems with more than 1GB RAM installed. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
parent
244599469f
commit
a2e715a86c
1 changed files with 20 additions and 8 deletions
|
@ -44,27 +44,39 @@ static inline int cpu_is_noncoherent_r10000(struct device *dev)
|
||||||
|
|
||||||
static gfp_t massage_gfp_flags(const struct device *dev, gfp_t gfp)
|
static gfp_t massage_gfp_flags(const struct device *dev, gfp_t gfp)
|
||||||
{
|
{
|
||||||
|
gfp_t dma_flag;
|
||||||
|
|
||||||
/* ignore region specifiers */
|
/* ignore region specifiers */
|
||||||
gfp &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM);
|
gfp &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM);
|
||||||
|
|
||||||
#ifdef CONFIG_ZONE_DMA
|
#ifdef CONFIG_ISA
|
||||||
if (dev == NULL)
|
if (dev == NULL)
|
||||||
gfp |= __GFP_DMA;
|
dma_flag = __GFP_DMA;
|
||||||
else if (dev->coherent_dma_mask < DMA_BIT_MASK(24))
|
|
||||||
gfp |= __GFP_DMA;
|
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_ZONE_DMA32
|
#if defined(CONFIG_ZONE_DMA32) && defined(CONFIG_ZONE_DMA)
|
||||||
if (dev->coherent_dma_mask < DMA_BIT_MASK(32))
|
if (dev->coherent_dma_mask < DMA_BIT_MASK(32))
|
||||||
gfp |= __GFP_DMA32;
|
dma_flag = __GFP_DMA;
|
||||||
|
else if (dev->coherent_dma_mask < DMA_BIT_MASK(64))
|
||||||
|
dma_flag = __GFP_DMA32;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
;
|
#if defined(CONFIG_ZONE_DMA32) && !defined(CONFIG_ZONE_DMA)
|
||||||
|
if (dev->coherent_dma_mask < DMA_BIT_MASK(64))
|
||||||
|
dma_flag = __GFP_DMA32;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
#if defined(CONFIG_ZONE_DMA) && !defined(CONFIG_ZONE_DMA32)
|
||||||
|
if (dev->coherent_dma_mask < DMA_BIT_MASK(64))
|
||||||
|
dma_flag = __GFP_DMA;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
dma_flag = 0;
|
||||||
|
|
||||||
/* Don't invoke OOM killer */
|
/* Don't invoke OOM killer */
|
||||||
gfp |= __GFP_NORETRY;
|
gfp |= __GFP_NORETRY;
|
||||||
|
|
||||||
return gfp;
|
return gfp | dma_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *dma_alloc_noncoherent(struct device *dev, size_t size,
|
void *dma_alloc_noncoherent(struct device *dev, size_t size,
|
||||||
|
|
Loading…
Add table
Reference in a new issue