lkml.org 
[lkml]   [2012]   [Feb]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH V3 2/3] x86: introduce CONFIG_X86_DMA_REMAP
    The default functions phys_to_dma, dma_to_phys implement identity
    mapping as fast inline functions. Some systems, however, may need a
    custom function to implement its own mapping between CPU addresses and
    device addresses. This new configuration option allows the functions
    to be external when needed (such as for the ConneXt device)

    Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
    Acked-by: Giancarlo Asnaghi <giancarlo.asnaghi@st.com>
    Cc: Alan Cox <alan@linux.intel.com>
    ---
    arch/x86/Kconfig | 3 +++
    arch/x86/include/asm/dma-mapping.h | 7 +++++++
    2 files changed, 10 insertions(+), 0 deletions(-)

    diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
    index 1832f0b..16a1a7d 100644
    --- a/arch/x86/Kconfig
    +++ b/arch/x86/Kconfig
    @@ -2238,6 +2238,9 @@ config X86_DEV_DMA_OPS
    bool
    depends on X86_64

    +config X86_DMA_REMAP
    + bool
    +
    source "net/Kconfig"

    source "drivers/Kconfig"
    diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
    index 09aa473..61c0bd2 100644
    --- a/arch/x86/include/asm/dma-mapping.h
    +++ b/arch/x86/include/asm/dma-mapping.h
    @@ -62,6 +62,12 @@ extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
    dma_addr_t *dma_addr, gfp_t flag,
    struct dma_attrs *attrs);

    +#ifdef CONFIG_X86_DMA_REMAP /* Platform code defines bridge-specific code */
    +extern bool dma_capable(struct device *dev, dma_addr_t addr, size_t size);
    +extern dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr);
    +extern phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr);
    +#else
    +
    static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
    {
    if (!dev->dma_mask)
    @@ -79,6 +85,7 @@ static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr)
    {
    return daddr;
    }
    +#endif /* CONFIG_X86_DMA_REMAP */

    static inline void
    dma_cache_sync(struct device *dev, void *vaddr, size_t size,
    --
    1.7.7.2

    \
     
     \ /
      Last update: 2012-02-22 23:17    [W:0.024 / U:0.092 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site