• Home
  • Raw
  • Download

Lines Matching +full:i +full:- +full:cache +full:- +full:block +full:- +full:size

8 of the API (and actual examples), see Documentation/DMA-API-HOWTO.txt.
10 This API is split into two pieces. Part I describes the basic API.
11 Part II describes extensions for supporting non-consistent memory
13 non-consistent platforms (this is usually only legacy platforms) you
14 should only use the API described in part I.
16 Part I - dma_API
17 ----------------
19 To get the dma_API, you must #include <linux/dma-mapping.h>. This
27 Part Ia - Using large DMA-coherent buffers
28 ------------------------------------------
33 dma_alloc_coherent(struct device *dev, size_t size,
42 This routine allocates a region of <size> bytes of consistent memory.
64 dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
68 size and dma_handle must all be the same as those passed into
76 Part Ib - Using small DMA-coherent buffers
77 ------------------------------------------
81 Many drivers need lots of small DMA-coherent memory regions for DMA
82 descriptors or I/O buffers. Rather than allocating in units of a page
84 much like a struct kmem_cache, except that they use the DMA-coherent allocator,
86 for alignment, like queue heads needing to be aligned on N-byte boundaries.
93 size_t size, size_t align, size_t alloc);
95 dma_pool_create() initializes a pool of DMA-coherent buffers
99 The "name" is for diagnostics (like a struct kmem_cache name); dev and size
123 size and alignment requirements specified at creation time. Pass
150 Part Ic - DMA addressing limitations
151 ------------------------------------
203 Returns the maximum size of a mapping for the device. The size parameter
215 Part Id - Streaming DMA mappings
216 --------------------------------
221 dma_map_single(struct device *dev, void *cpu_addr, size_t size,
243 capability, it will fail if the user tries to map a non-physically
250 addressable region for the device, i.e., if the DMA address of
254 the driver may specify various platform-dependent flags to restrict
261 maps an I/O DMA address to a physical memory address). However, to be
267 Memory coherency operates at a granularity called the cache
269 correctly, the mapped region must begin exactly on a cache line
271 regions from sharing a single cache line). Since the cache line size
274 don't take special care to determine the cache line size at run time
276 are guaranteed also to be cache line boundaries).
281 primitive should be treated as read-only by the device. If the device
287 be treated as read-only by the driver. If the driver needs to write
297 cache lines are updated with data that the device may have changed).
302 dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
313 unsigned long offset, size_t size,
317 dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
322 and <size> parameters are provided to do partial page mapping, it is
324 cache width is.
329 dma_map_resource(struct device *dev, phys_addr_t phys_addr, size_t size,
333 dma_unmap_resource(struct device *dev, dma_addr_t addr, size_t size,
347 the returned DMA address with dma_mapping_error(). A non-zero return value
367 critical that the driver do something, in the case of a block driver
373 int i, count = dma_map_sg(dev, sglist, nents, direction);
376 for_each_sg(sglist, sg, count, i) {
377 hw_address[i] = sg_dma_address(sg);
378 hw_len[i] = sg_dma_len(sg);
390 accessed sg->address and sg->length as shown above.
409 size_t size,
414 size_t size,
430 you can use dma_handle and size parameters that aren't identical to
438 - Before reading values that have been written by DMA from the device
440 - After writing values that will be written to the device using DMA
442 - before *and* after handing memory to the device if the memory is
450 dma_map_single_attrs(struct device *dev, void *cpu_addr, size_t size,
456 size_t size, enum dma_data_direction dir,
473 The interpretation of DMA attributes is architecture-specific, and
474 each attribute should be documented in Documentation/DMA-attributes.txt.
485 #include <linux/dma-mapping.h>
486 /* DMA_ATTR_FOO should be defined in linux/dma-mapping.h and
487 * documented in Documentation/DMA-attributes.txt */
501 size_t size, enum dma_data_direction dir,
511 Part II - Advanced dma usage
512 ----------------------------
518 If you don't understand how cache line coherency works between a
519 processor and an I/O device, you should not be using this part of the
525 dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle,
530 platform will choose to return either consistent or non-consistent memory
533 in the driver should it choose to return non-consistent memory.
538 Warning: Handling non-consistent memory is a real pain. You should
540 required to work on one of the rare (usually non-PCI) architectures
546 dma_free_attrs(struct device *dev, size_t size, void *cpu_addr,
559 Returns the processor cache alignment. This is the absolute minimum
565 This API may return a number *larger* than the actual cache
566 line, but it will guarantee that one or more cache lines fit exactly
573 dma_cache_sync(struct device *dev, void *vaddr, size_t size,
578 continuing on for size. Again, you *must* observe the cache line
585 dma_addr_t device_addr, size_t size);
597 size is the size of the area (must be multiples of PAGE_SIZE).
606 Part III - Debug drivers use of the DMA-API
607 -------------------------------------------
609 The DMA-API as described above has some constraints. DMA addresses must be
610 released with the corresponding function with the same size for example. With
615 To debug drivers and find bugs in the usage of the DMA-API checking code can
618 debugging of DMA-API usage" option in your kernel configuration. Enabling this
626 WARNING: at /data2/repos/linux-2.6-iommu/lib/dma-debug.c:448
629 forcedeth 0000:00:08.0: DMA-API: device driver frees DMA memory with wrong
630 function [device address=0x00000000640444be] [size=66 bytes] [mapped as
633 Pid: 0, comm: swapper Tainted: G W 2.6.28-dmatest-09289-g8bb99c0 #1
654 <EOI> <4>---[ end trace f6435a98e2a38c0e ]---
657 of the DMA-API call which caused this warning.
665 The debugfs directory for the DMA-API debugging code is called dma-api/. In
669 dma-api/all_errors This file contains a numeric value. If this
675 dma-api/disabled This read-only file contains the character 'Y'
680 dma-api/dump This read-only file contains current DMA
683 dma-api/error_count This file is read-only and shows the total
686 dma-api/num_errors The number in this file shows how many
692 dma-api/min_free_entries This read-only file can be read to get the
698 dma-api/num_free_entries The current number of free dma_debug_entries
701 dma-api/nr_total_entries The total number of dma_debug_entries in the
704 dma-api/driver_filter You can write a name of a driver into this file
713 'dma_debug=off' as a boot parameter. This will disable DMA-API debugging.
723 out of dma_debug_entries and was unable to allocate more on-demand. 65536
724 entries are preallocated at boot - if this is too low for you boot with
730 larger preallocation size may be appropriate, or if it happens continually
738 dma-debug interface debug_dma_mapping_error() to debug drivers that fail