- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to build a kernel with support for SL811, but I am having trouble defining the stubs for dma_mapping.h
I have checked the other threads in this forum, but there are no explicit examples of adding the dma stubs. Also, where should I add the stubs, include\nios2-nommu\dma_mapping.h ?Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
add the following to asm/dma_mapping.h:
static inline dma_addr_t
dma_map_single(struct device *dev, void *cpu_addr, size_t size,
enum dma_data_direction dir)
{
cache_push ((unsigned long)cpu_addr, size);
return virt_to_bus((unsigned long)cpu_addr);
}
/**
* dma_unmap_single - unmap a single buffer previously mapped
* @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
* @handle: DMA address of buffer
* @size: size of buffer to map
* @dir: DMA transfer direction
*
* Unmap a single streaming mode DMA translation. The handle and size
* must match what was provided in the previous dma_map_single() call.
* All other usages are undefined.
*
* After this call, reads by the CPU to the buffer are guaranteed to see
* whatever the device wrote there.
*/
static inline void
dma_unmap_single(struct device *dev, dma_addr_t handle, size_t size,
enum dma_data_direction dir)
{
cache_clear((unsigned long)bus_to_virt(handle), size);
}
/**
* dma_map_sg - map a set of SG buffers for streaming mode DMA
* @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
* @sg: list of buffers
* @nents: number of buffers to map
* @dir: DMA transfer direction
*
* Map a set of buffers described by scatterlist in streaming
* mode for DMA. This is the scatter-gather version of the
* above dma_map_single interface. Here the scatter gather list
* elements are each tagged with the appropriate dma address
* and length. They are obtained via sg_dma_{address,length}(SG).
*
* NOTE: An implementation may be able to use a smaller number of
* DMA address/length pairs than there are SG table elements.
* (for example via virtual mapping capabilities)
* The routine returns the number of addr/length pairs actually
* used, at most nents.
*
* Device ownership issues as mentioned above for dma_map_single are
* the same here.
*/
static inline int
dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
enum dma_data_direction dir)
{
int i;
for (i = 0; i < nents; i++, sg++) {
char *virt;
sg->dma_address = page_to_bus(sg->page) + sg->offset;
virt = page_address(sg->page) + sg->offset;
cache_push ((unsigned long)virt, sg->length);
}
return nents;
}
/**
* dma_unmap_sg - unmap a set of SG buffers mapped by dma_map_sg
* @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
* @sg: list of buffers
* @nents: number of buffers to map
* @dir: DMA transfer direction
*
* Unmap a set of streaming mode DMA translations.
* Again, CPU read rules concerning calls here are the same as for
* dma_unmap_single() above.
*/
static inline void
dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
enum dma_data_direction dir)
{
int i;
for (i = 0; i < nents; i++, sg++) {
char *virt;
virt = page_address(sg->page) + sg->offset;
cache_clear ((unsigned long)virt, sg->length);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is this going to be in the next release?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Wentau.
You will have to stay with me here. I am not too experienced with uClinux. First off, when you suggest adding to asm/dma-mapping.h , does the asm somehow get expanded to asm-nios2nommu ? I guessed this might be the case, so I added the code to asm-nios2nommu/dma-mapping.h Now I get a series of compilation warnings and errors, here's a snippet;include2/asm/dma-mapping.h: In function `dma_map_single':
include2/asm/dma-mapping.h:30: warning: implicit declaration of function `cache_push'
include2/asm/dma-mapping.h:31: warning: implicit declaration of function `virt_to_bus'
include2/asm/dma-mapping.h: In function `dma_unmap_single':
include2/asm/dma-mapping.h:52: warning: implicit declaration of function `cache_clear'
include2/asm/dma-mapping.h:52: warning: implicit declaration of function `bus_to_virt'
include2/asm/dma-mapping.h: At top level:
include2/asm/dma-mapping.h:79: warning: "struct scatterlist" declared inside parameter list
include2/asm/dma-mapping.h:79: warning: its scope is only this definition or declaration,
Figuring that there must be an include file that I could reference for the undeclared functions, I did a grep on cache_clear, with no results. How do I reference these undeclared functions, and structures? Thanks, Steve.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes clansdown, they will be in the next release.
Hi sfielding, yes I mean asm-nios2nommu/dma-mapping.h. Please add the following to the beginning of the file:#include <asm/scatterlist.h># include <linux/mm.h># include <asm/io.h># include <asm/cacheflush.h>
You also need to add the following line to the file cacheflush.h in the same directory: extern void cache_clear (unsigned long paddr, int len);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Wentao, the kernel now compiles just fine

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page