/proc/iomem 的内容 [英] Content of /proc/iomem
问题描述
1) 是否可以访问/proc/iomem 中未定义的物理地址?
1) Is it possible to access a physical address which is not defined in /proc/iomem?
2) 如果/proc/iomem 中没有出现设备的物理地址范围,是否表示该设备还没有被使用/初始化?
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?
推荐答案
1) 是否可以访问/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()
的驱动程序.
Yes.
Assuming an ARM processor which memory maps all directly-connected periperals, the driver could perform an ioremap()
operation to map the physical memory to virtual memory for access.
But a properly written driver would first call request_mem_region()
to ensure that it can use (and lay claim to) that physical address space.
The information in /proc/iomem
comes from drivers calling request_mem_region()
.
2) 如果一个设备的物理地址范围没有出现在/proc/iomem 中,是否表示该设备还没有被使用/初始化?
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
命令检查系统日志;可能驱动初始化失败.
You would have to inspect the driver code to determine how well written the driver is.
Is there a request_mem_region()
before the ioremap()
?
Check the system log using the dmesg
command; perhaps driver initialization failed.
假设这是一个静态链接的驱动程序而不是一个可加载的模块,那么由于每个内核设备驱动程序都调用了它的 init()
例程,您可以通过添加选项initcall_debug"来获得跟踪输出" 在内核命令行上.如果您使用的是 U-Boot,则应将此选项添加到bootargs"变量(用于内核命令行).
Assuming that this is a statically-linked driver rather than a loadable module, then as each kernel device driver has its init()
routine called you can get trace output by having added the option "initcall_debug" on the kernel command line. If you are using U-Boot, then this option should be added to the "bootargs" variable (which is used for the kernel command line).
这篇关于/proc/iomem 的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!