7

我正在移植/调试设备驱动程序(由另一个内核模块使用)并面临死胡同,因为 dma_sync_single_for_device() 因内核 oops 而失败。

我不知道该功能应该做什么,谷歌搜索并没有真正的帮助,所以我可能需要全面了解这些东西。

问题是,从哪里开始?

哦,是的,如果相关的话,代码应该在 PowerPC 上运行(而 linux 是 OpenWRT)

编辑:最好是在线资源(书籍需要几天才能交付:)

4

3 回答 3

11

在线的:

Linux 平板分配器剖析

了解 Linux 虚拟内存管理器

Linux 设备驱动程序,第三版

Linux 内核模块编程指南

在 Linux 中编写设备驱动程序:简要教程

图书:

Linux 内核开发(第 2 版)

基本 Linux 设备驱动程序 (仅前 4-5 章)

有用的资源:

Linux 交叉参考(所有内核的可搜索内核源)

2.6内核系列的API变化


dma_sync_single_for_device在文件中调用dma_sync_single_range_for_cpu了一点,这是源文档(我假设即使这是用于 arm 的接口和行为是相同的):

/**
 380 * dma_sync_single_range_for_cpu
 381 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
 382 * @handle: DMA address of buffer
 383 * @offset: offset of region to start sync
 384 * @size: size of region to sync
 385 * @dir: DMA transfer direction (same as passed to dma_map_single)
 386 *
 387 * Make physical memory consistent for a single streaming mode DMA
 388 * translation after a transfer.
 389 *
 390 * If you perform a dma_map_single() but wish to interrogate the
 391 * buffer using the cpu, yet do not wish to teardown the PCI dma
 392 * mapping, you must call this function before doing so.  At the
 393 * next point you give the PCI dma address back to the card, you
 394 * must first the perform a dma_sync_for_device, and then the
 395 * device again owns the buffer.
 396 */
于 2010-03-03T08:15:03.760 回答
5

了解 Linux 内核

于 2010-03-03T07:28:45.330 回答
3

Linux Device Drivers book的章节(与Understanding the Linux Kernel 同一系列,由@Matthew Flaschen 推荐)可能有用。

您可以从LWN 网站下载各个章节。第 16 章讨论 DMA。

于 2010-03-03T08:18:17.580 回答