linux -/proc/iomem 的内容

标签 linux linux-kernel linux-device-driver embedded-linux

1) 是否可以访问/proc/iomem 中未定义的物理地址?

2)如果一个设备的物理地址范围没有出现在/proc/iomem中,是否意味着这个设备还没有被使用/初始化?

最佳答案

1) Is it possible to access a physical address which is not defined in /proc/iomem?

是的。
假设内存映射所有直接连接的外设的 ARM 处理器,驱动程序可以执行 ioremap() 操作以将物理内存映射到虚拟内存以供访问。
但是正确编写的驱动程序会首先调用 request_mem_region() 以确保它可以使用(并声称)该物理地址空间。
/proc/iomem 中的信息来自调用 request_mem_region() 的驱动程序。

2) If the physical address range of a device does not appear in /proc/iomem, does it mean that the device has not been utilized/initialized yet?

您必须检查驱动程序代码以确定驱动程序的编写情况。
ioremap()之前是否有request_mem_region()
使用dmesg 命令检查系统日志;可能驱动程序初始化失败。

假设这是一个静态链接的驱动程序而不是一个可加载的模块,那么当每个内核设备驱动程序调用其 init() 例程时,您可以通过添加选项“initcall_debug”来获得跟踪输出“在内核命令行上。如果您使用的是 U-Boot,则应将此选项添加到“bootargs”变量(用于内核命令行)。

关于linux -/proc/iomem 的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18580469/

相关文章:

linux - 添加 header 如何提高可移植性? (系统/时间.h)

Linux 内核抢占级别

linux - 使用作为服务运行的 Hudson 执行 svn 导出时出现问题

linux - 在 morty : backtrace-supported. h 中构建 libgfortran_6.2.bb 配方时出错:没有这样的文件或目录

c - Linux内核如何处理异步I/O(AIO)请求?

linux - Linux内核中浮点的使用

linux - 如何使用git切换到特定版本的Linux源代码?

linux - 通过 VMware 交叉编译 Linux 内核和调试

linux-kernel - 在 SMP 系统上并行运行同一中断的多个实例

linux - 如何计算 iostat 的效用?