Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux ioremap返回NULL_Linux_Linux Kernel_Kernel_Raspberry Pi_Linux Device Driver - Fatal编程技术网

Linux ioremap返回NULL

Linux ioremap返回NULL,linux,linux-kernel,kernel,raspberry-pi,linux-device-driver,Linux,Linux Kernel,Kernel,Raspberry Pi,Linux Device Driver,我正在尝试为Raspberry PI创建一个定制的UART驱动程序。 我试图重新映射MMIO。但是ioremap返回的总是NULL dmesg转储如下: [ 2906.579848] CPU: 0 PID: 4983 Comm: insmod Tainted: G D W O 3.18.5+ #1 [ 2906.590783] [<c0014b64>] (unwind_backtrace) from [<c00120ec>] (show_stack+0x2

我正在尝试为Raspberry PI创建一个定制的UART驱动程序。 我试图重新映射MMIO。但是ioremap返回的总是NULL

dmesg转储如下:

[ 2906.579848] CPU: 0 PID: 4983 Comm: insmod Tainted: G      D W  O   3.18.5+ #1
[ 2906.590783] [<c0014b64>] (unwind_backtrace) from [<c00120ec>] (show_stack+0x20/0x24)
[ 2906.614046] [<c00120ec>] (show_stack) from [<c0549008>] (dump_stack+0x20/0x28)
[ 2906.624803] [<c0549008>] (dump_stack) from [<c0022620>] (warn_slowpath_common+0x7c/0x9c)
[ 2906.647925] [<c0022620>] (warn_slowpath_common) from [<c002266c>] (warn_slowpath_null+0x2c/0x34)
[ 2906.668656] [<c002266c>] (warn_slowpath_null) from [<c001a888>] (__arm_ioremap_pfn_caller+0x240/0x25c)
[ 2906.691936] [<c001a888>] (__arm_ioremap_pfn_caller) from [<c001a934>] (__arm_ioremap_caller+0x68/0x70)
[ 2906.713171] [<c001a934>] (__arm_ioremap_caller) from [<c001a3d0>] (__arm_ioremap+0x24/0x2c)
[ 2906.735043] [<c001a3d0>] (__arm_ioremap) from [<bf19c028>] (hello_init+0x28/0x88 [domotx])
[ 2906.755780] [<bf19c028>] (hello_init [domotx]) from [<c000873c>] (do_one_initcall+0x94/0x1e4)
[ 2906.778165] [<c000873c>] (do_one_initcall) from [<c0087e70>] (load_module+0x1848/0x1e38)
[ 2906.799410] [<c0087e70>] (load_module) from [<c008854c>] (SyS_init_module+0xec/0xf0)
[ 2906.822660] [<c008854c>] (SyS_init_module) from [<c000e980>] (ret_fast_syscall+0x0/0x48)
[ 2906.844558] ---[ end trace c7cdd8b3d5007a1b ]---
[ 2906.856382] Couldn't remap UART MMIO

我做错了什么?

我找到了上述问题的解决方案。实际上,解决方案有两个方面:

BCM2835数据表不在其数据表中公布物理地址: 外围设备的物理地址范围为0x20000000到0x20FFFFFF。外围设备的总线地址设置为映射到从0x7E000000开始的外围总线地址范围。因此,在总线地址0x7ENNNNN处播发的外围设备在物理地址0x20nnnnnn处可用。 数据表中有一个输入错误: PL011 USRT映射在基本加法器0x7E20100上。PL011 USRT映射到基本加法器0x7E201000上。
你甚至得到了警告!没有足够的上下文来理解警告的内容。最好是获得关于bf19c028、c001a3d0、c001a934和c001a888的代码片段。太好了!如何根据PC查找线路号?有地图文件吗?我运行了objdump-svmlinux,但这似乎不起作用。我已经谈到了uu arm_ioremap_pfn_调用者,但是有几个地方返回NULL。ps:可能已经很清楚了,但我对linux内核驱动程序还不熟悉。
[ 2906.579848] CPU: 0 PID: 4983 Comm: insmod Tainted: G      D W  O   3.18.5+ #1
[ 2906.590783] [<c0014b64>] (unwind_backtrace) from [<c00120ec>] (show_stack+0x20/0x24)
[ 2906.614046] [<c00120ec>] (show_stack) from [<c0549008>] (dump_stack+0x20/0x28)
[ 2906.624803] [<c0549008>] (dump_stack) from [<c0022620>] (warn_slowpath_common+0x7c/0x9c)
[ 2906.647925] [<c0022620>] (warn_slowpath_common) from [<c002266c>] (warn_slowpath_null+0x2c/0x34)
[ 2906.668656] [<c002266c>] (warn_slowpath_null) from [<c001a888>] (__arm_ioremap_pfn_caller+0x240/0x25c)
[ 2906.691936] [<c001a888>] (__arm_ioremap_pfn_caller) from [<c001a934>] (__arm_ioremap_caller+0x68/0x70)
[ 2906.713171] [<c001a934>] (__arm_ioremap_caller) from [<c001a3d0>] (__arm_ioremap+0x24/0x2c)
[ 2906.735043] [<c001a3d0>] (__arm_ioremap) from [<bf19c028>] (hello_init+0x28/0x88 [domotx])
[ 2906.755780] [<bf19c028>] (hello_init [domotx]) from [<c000873c>] (do_one_initcall+0x94/0x1e4)
[ 2906.778165] [<c000873c>] (do_one_initcall) from [<c0087e70>] (load_module+0x1848/0x1e38)
[ 2906.799410] [<c0087e70>] (load_module) from [<c008854c>] (SyS_init_module+0xec/0xf0)
[ 2906.822660] [<c008854c>] (SyS_init_module) from [<c000e980>] (ret_fast_syscall+0x0/0x48)
[ 2906.844558] ---[ end trace c7cdd8b3d5007a1b ]---
[ 2906.856382] Couldn't remap UART MMIO