linux-mips
[Top] [All Lists]

Re: [PATCH V5 09/18] MIPS: Loongson: Add swiotlb to support big memory (

To: linux-mips@linux-mips.org
Subject: Re: [PATCH V5 09/18] MIPS: Loongson: Add swiotlb to support big memory (>4GB).
From: John Crispin <john@phrozen.org>
Date: Sun, 12 Aug 2012 08:17:15 +0200
In-reply-to: <1344677543-22591-10-git-send-email-chenhc@lemote.com>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
References: <1344677543-22591-1-git-send-email-chenhc@lemote.com> <1344677543-22591-10-git-send-email-chenhc@lemote.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111114 Icedove/3.1.16
> diff --git a/arch/mips/include/asm/mach-loongson/dma-coherence.h 
> b/arch/mips/include/asm/mach-loongson/dma-coherence.h
> index e143305..b1dc286 100644
> --- a/arch/mips/include/asm/mach-loongson/dma-coherence.h
> +++ b/arch/mips/include/asm/mach-loongson/dma-coherence.h

[...]
>  static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
>       dma_addr_t dma_addr)
>  {
> -#if defined(CONFIG_CPU_LOONGSON2F) && defined(CONFIG_64BIT)
> +#if defined(CONFIG_64BIT)
> +#if defined(CONFIG_CPU_LOONGSON3)
> +     return (dma_addr < 0x90000000 && dma_addr >= 0x80000000) ?
> +                     (dma_addr & 0x0fffffff) : dma_addr;
> +#elif defined(CONFIG_CPU_LOONGSON2F)
>       return (dma_addr > 0x8fffffff) ? dma_addr : (dma_addr & 0x0fffffff);
> +#endif /* CONFIG_CPU_LOONGSON3 */
>  #else
>       return dma_addr & 0x7fffffff;
> -#endif
> +#endif /* CONFIG_64BIT */
>  }

This will break if 64bit is defined and neither LOONGSON2F/3 are not
defined.


<Prev in Thread] Current Thread [Next in Thread>