The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/arm64/include/bus_dma.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* $FreeBSD$ */
    2 
    3 #ifndef _MACHINE_BUS_DMA_H_
    4 #define _MACHINE_BUS_DMA_H_
    5 
    6 #define WANT_INLINE_DMAMAP
    7 #include <sys/bus_dma.h>
    8 
    9 #include <machine/bus_dma_impl.h>
   10 
   11 /*
   12  * Is DMA address 1:1 mapping of physical address
   13  */
   14 static inline bool
   15 bus_dma_id_mapped(bus_dma_tag_t dmat, vm_paddr_t buf, bus_size_t buflen)
   16 {
   17         struct bus_dma_tag_common *tc;
   18 
   19         tc = (struct bus_dma_tag_common *)dmat;
   20         return (tc->impl->id_mapped(dmat, buf, buflen));
   21 }
   22 
   23 /*
   24  * Allocate a handle for mapping from kva/uva/physical
   25  * address space into bus device space.
   26  */
   27 static inline int
   28 bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp)
   29 {
   30         struct bus_dma_tag_common *tc;
   31 
   32         tc = (struct bus_dma_tag_common *)dmat;
   33         return (tc->impl->map_create(dmat, flags, mapp));
   34 }
   35 
   36 /*
   37  * Destroy a handle for mapping from kva/uva/physical
   38  * address space into bus device space.
   39  */
   40 static inline int
   41 bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map)
   42 {
   43         struct bus_dma_tag_common *tc;
   44 
   45         tc = (struct bus_dma_tag_common *)dmat;
   46         return (tc->impl->map_destroy(dmat, map));
   47 }
   48 
   49 /*
   50  * Allocate a piece of memory that can be efficiently mapped into
   51  * bus device space based on the constraints listed in the dma tag.
   52  * A dmamap to for use with dmamap_load is also allocated.
   53  */
   54 static inline int
   55 bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
   56     bus_dmamap_t *mapp)
   57 {
   58         struct bus_dma_tag_common *tc;
   59 
   60         tc = (struct bus_dma_tag_common *)dmat;
   61         return (tc->impl->mem_alloc(dmat, vaddr, flags, mapp));
   62 }
   63 
   64 /*
   65  * Free a piece of memory and it's allociated dmamap, that was allocated
   66  * via bus_dmamem_alloc.  Make the same choice for free/contigfree.
   67  */
   68 static inline void
   69 bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
   70 {
   71         struct bus_dma_tag_common *tc;
   72 
   73         tc = (struct bus_dma_tag_common *)dmat;
   74         tc->impl->mem_free(dmat, vaddr, map);
   75 }
   76 
   77 /*
   78  * Release the mapping held by map.
   79  */
   80 static inline void
   81 bus_dmamap_unload(bus_dma_tag_t dmat, bus_dmamap_t map)
   82 {
   83         struct bus_dma_tag_common *tc;
   84 
   85         tc = (struct bus_dma_tag_common *)dmat;
   86         tc->impl->map_unload(dmat, map);
   87 }
   88 
   89 static inline void
   90 bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op)
   91 {
   92         struct bus_dma_tag_common *tc;
   93 
   94         tc = (struct bus_dma_tag_common *)dmat;
   95         tc->impl->map_sync(dmat, map, op);
   96 }
   97 
   98 static inline int
   99 _bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_dmamap_t map, vm_paddr_t buf,
  100     bus_size_t buflen, int flags, bus_dma_segment_t *segs, int *segp)
  101 {
  102         struct bus_dma_tag_common *tc;
  103 
  104         tc = (struct bus_dma_tag_common *)dmat;
  105         return (tc->impl->load_phys(dmat, map, buf, buflen, flags, segs,
  106             segp));
  107 }
  108 
  109 static inline int
  110 _bus_dmamap_load_ma(bus_dma_tag_t dmat, bus_dmamap_t map, struct vm_page **ma,
  111     bus_size_t tlen, int ma_offs, int flags, bus_dma_segment_t *segs,
  112     int *segp)
  113 {
  114         struct bus_dma_tag_common *tc;
  115 
  116         tc = (struct bus_dma_tag_common *)dmat;
  117         return (tc->impl->load_ma(dmat, map, ma, tlen, ma_offs, flags,
  118             segs, segp));
  119 }
  120 
  121 static inline int
  122 _bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
  123     bus_size_t buflen, struct pmap *pmap, int flags, bus_dma_segment_t *segs,
  124     int *segp)
  125 {
  126         struct bus_dma_tag_common *tc;
  127 
  128         tc = (struct bus_dma_tag_common *)dmat;
  129         return (tc->impl->load_buffer(dmat, map, buf, buflen, pmap, flags, segs,
  130             segp));
  131 }
  132 
  133 static inline void
  134 _bus_dmamap_waitok(bus_dma_tag_t dmat, bus_dmamap_t map,
  135     struct memdesc *mem, bus_dmamap_callback_t *callback, void *callback_arg)
  136 {
  137         struct bus_dma_tag_common *tc;
  138 
  139         tc = (struct bus_dma_tag_common *)dmat;
  140         tc->impl->map_waitok(dmat, map, mem, callback, callback_arg);
  141 }
  142 
  143 static inline bus_dma_segment_t *
  144 _bus_dmamap_complete(bus_dma_tag_t dmat, bus_dmamap_t map,
  145     bus_dma_segment_t *segs, int nsegs, int error)
  146 {
  147         struct bus_dma_tag_common *tc;
  148 
  149         tc = (struct bus_dma_tag_common *)dmat;
  150         return (tc->impl->map_complete(dmat, map, segs, nsegs, error));
  151 }
  152 
  153 #endif /* !_MACHINE_BUS_DMA_H_ */

Cache object: 051ba98a1616c389010171f4a0695e64


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.