History

dma-mapping: move the dma_declare_coherent_memory documentation

dma_declare_coherent_memory should not be in a DMA API guide aimed at driver writers (that is consumers of the API). Move it to a comment near the function instead.

Christoph Hellwig committed 6 years ago

Commit a92df4f1 parent 545d2922 files · +17 −24Browse files

Unified · Split

2 files
  1. Documentation/core-api/dma-api.rst +0 −24
  2. kernel/dma/coherent.c +17 −0
Documentation/core-api/dma-api.rst+0−24
@@ -586,30 +586,6 @@ the DMA_ATTR_NON_CONSISTENT flag starting at virtual address vaddr and · 585 unmodified lines
586586 continuing on for size. Again, you *must* observe the cache line
587587 boundaries when doing this.
588588
589−::
590−
591− int
592− dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
593− dma_addr_t device_addr, size_t size);
594−
595−Declare region of memory to be handed out by dma_alloc_coherent() when
596−it's asked for coherent memory for this device.
597−
598−phys_addr is the CPU physical address to which the memory is currently
599−assigned (this will be ioremapped so the CPU can access the region).
600−
601−device_addr is the DMA address the device needs to be programmed
602−with to actually address this memory (this will be handed out as the
603−dma_addr_t in dma_alloc_coherent()).
604−
605−size is the size of the area (must be multiples of PAGE_SIZE).
606−
607−As a simplification for the platforms, only *one* such region of
608−memory may be declared per device.
609−
610−For reasons of efficiency, most platforms choose to track the declared
611−region only at the granularity of a page. For smaller allocations,
612−you should use the dma_pool() API.
613589
614590 Part III - Debug drivers use of the DMA-API
615591 -------------------------------------------
kernel/dma/coherent.c+17−0
@@ -107,6 +107,23 @@ static int dma_assign_coherent_memory(struct device *dev, · 106 unmodified lines
107107 return 0;
108108 }
109109
110+/*
111+ * Declare a region of memory to be handed out by dma_alloc_coherent() when it
112+ * is asked for coherent memory for this device. This shall only be used
113+ * from platform code, usually based on the device tree description.
114+ *
115+ * phys_addr is the CPU physical address to which the memory is currently
116+ * assigned (this will be ioremapped so the CPU can access the region).
117+ *
118+ * device_addr is the DMA address the device needs to be programmed with to
119+ * actually address this memory (this will be handed out as the dma_addr_t in
120+ * dma_alloc_coherent()).
121+ *
122+ * size is the size of the area (must be a multiple of PAGE_SIZE).
123+ *
124+ * As a simplification for the platforms, only *one* such region of memory may
125+ * be declared per device.
126+ */
110127 int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
111128 dma_addr_t device_addr, size_t size)
112129 {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t