ia64/xen-unstable

changeset 9501:ebec4edfa8e4

[IA64] dom0 vp model linux part: import dma-mapping.h from linux-2.6.16-rc3

[note: verified same as linux-2.6.16]

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author awilliam@xenbuild.aw
date Fri Apr 07 14:04:28 2006 -0600 (2006-04-07)
parents e311941eb7be
children 70467f5491d8
files linux-2.6-xen-sparse/include/asm-ia64/dma-mapping.h
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/dma-mapping.h	Fri Apr 07 14:04:28 2006 -0600
     1.3 @@ -0,0 +1,65 @@
     1.4 +#ifndef _ASM_IA64_DMA_MAPPING_H
     1.5 +#define _ASM_IA64_DMA_MAPPING_H
     1.6 +
     1.7 +/*
     1.8 + * Copyright (C) 2003-2004 Hewlett-Packard Co
     1.9 + *	David Mosberger-Tang <davidm@hpl.hp.com>
    1.10 + */
    1.11 +#include <linux/config.h>
    1.12 +#include <asm/machvec.h>
    1.13 +
    1.14 +#define dma_alloc_coherent	platform_dma_alloc_coherent
    1.15 +#define dma_alloc_noncoherent	platform_dma_alloc_coherent	/* coherent mem. is cheap */
    1.16 +#define dma_free_coherent	platform_dma_free_coherent
    1.17 +#define dma_free_noncoherent	platform_dma_free_coherent
    1.18 +#define dma_map_single		platform_dma_map_single
    1.19 +#define dma_map_sg		platform_dma_map_sg
    1.20 +#define dma_unmap_single	platform_dma_unmap_single
    1.21 +#define dma_unmap_sg		platform_dma_unmap_sg
    1.22 +#define dma_sync_single_for_cpu	platform_dma_sync_single_for_cpu
    1.23 +#define dma_sync_sg_for_cpu	platform_dma_sync_sg_for_cpu
    1.24 +#define dma_sync_single_for_device platform_dma_sync_single_for_device
    1.25 +#define dma_sync_sg_for_device	platform_dma_sync_sg_for_device
    1.26 +#define dma_mapping_error	platform_dma_mapping_error
    1.27 +
    1.28 +#define dma_map_page(dev, pg, off, size, dir)				\
    1.29 +	dma_map_single(dev, page_address(pg) + (off), (size), (dir))
    1.30 +#define dma_unmap_page(dev, dma_addr, size, dir)			\
    1.31 +	dma_unmap_single(dev, dma_addr, size, dir)
    1.32 +
    1.33 +/*
    1.34 + * Rest of this file is part of the "Advanced DMA API".  Use at your own risk.
    1.35 + * See Documentation/DMA-API.txt for details.
    1.36 + */
    1.37 +
    1.38 +#define dma_sync_single_range_for_cpu(dev, dma_handle, offset, size, dir)	\
    1.39 +	dma_sync_single_for_cpu(dev, dma_handle, size, dir)
    1.40 +#define dma_sync_single_range_for_device(dev, dma_handle, offset, size, dir)	\
    1.41 +	dma_sync_single_for_device(dev, dma_handle, size, dir)
    1.42 +
    1.43 +#define dma_supported		platform_dma_supported
    1.44 +
    1.45 +static inline int
    1.46 +dma_set_mask (struct device *dev, u64 mask)
    1.47 +{
    1.48 +	if (!dev->dma_mask || !dma_supported(dev, mask))
    1.49 +		return -EIO;
    1.50 +	*dev->dma_mask = mask;
    1.51 +	return 0;
    1.52 +}
    1.53 +
    1.54 +extern int dma_get_cache_alignment(void);
    1.55 +
    1.56 +static inline void
    1.57 +dma_cache_sync (void *vaddr, size_t size, enum dma_data_direction dir)
    1.58 +{
    1.59 +	/*
    1.60 +	 * IA-64 is cache-coherent, so this is mostly a no-op.  However, we do need to
    1.61 +	 * ensure that dma_cache_sync() enforces order, hence the mb().
    1.62 +	 */
    1.63 +	mb();
    1.64 +}
    1.65 +
    1.66 +#define dma_is_consistent(dma_handle)	(1)	/* all we do is coherent memory... */
    1.67 +
    1.68 +#endif /* _ASM_IA64_DMA_MAPPING_H */