Linux kernel 只能实例化1个通用uio设备
我试图使用uio_pdrv_genirq驱动程序向用户空间公开中断。但是,我只能在devicetree中实例化1个设备,所有后续设备都会使探测失败。 系统为zynq-7000,内核版本为3.9.0-xilinx 设备树:Linux kernel 只能实例化1个通用uio设备,linux-kernel,zynq,Linux Kernel,Zynq,我试图使用uio_pdrv_genirq驱动程序向用户空间公开中断。但是,我只能在devicetree中实例化1个设备,所有后续设备都会使探测失败。 系统为zynq-7000,内核版本为3.9.0-xilinx 设备树: / { ... amba@0 { ... gic: intc@f8f01000 { interrupt-controller; compatible = "arm,cortex-a9-gic"; #interru
/ {
...
amba@0 {
...
gic: intc@f8f01000 {
interrupt-controller;
compatible = "arm,cortex-a9-gic";
#interrupt-cells = <3>;
reg = <0xf8f01000 0x1000>,
<0xf8f00100 0x0100>;
};
interrupt_91@0x43C90000 {
compatible = "generic-uio";
reg = < 0x43C90000 0x1000 >;
interrupts = < 0 59 1 >; //add 32 to get the interrupt number
interrupt-parent = <&gic>;
} ;
interrupter_90@0x43CA0000 {
compatible = "generic-uio";
reg = < 0x43CA0000 0x1000 >;
interrupts = < 0 58 1 >; //add 32 to get the interrupt number
interrupt-parent = <&gic>;
} ;
...
};
内核配置:
CONFIG_UIO=y
# CONFIG_UIO_CIF is not set
CONFIG_UIO_PDRV_GENIRQ=y
# CONFIG_UIO_DMEM_GENIRQ is not set
# CONFIG_UIO_AEC is not set
# CONFIG_UIO_SERCOS3 is not set
# CONFIG_UIO_PCI_GENERIC is not set
# CONFIG_UIO_NETX is not set
我确信我之前在Zedboard上得到了这个结果,我不知道这里会出现什么问题。好的,这是我使用的内核源代码中的一个问题 台词:
if (ret)
goto err_get_minor;
在drivers/uio/uio.c和以下行中:
if (ret) {
dev_err(&pdev->dev, "unable to register uio device\n");
goto bad1;
}
在drivers/uio/uio_pdrv_genirq.c中,必须同时更改两者,以便if语句读取if(ret<0)
原因是uio_get_minor
函数(其返回值ret,他们正在使用)返回分配的minor编号。这是0,1,2,…,等等。很明显,第一个设备(次要id=0)注册良好,但第二个设备(次要id=1)失败。这解释了错误消息“failed with error 1”,它是次要id,而不是我最初假设的EPERM
我使用的存储库仅供将来参考
编辑:实际上,主线内核中也存在同样的问题,我将发布一个补丁
if (ret) {
dev_err(&pdev->dev, "unable to register uio device\n");
goto bad1;
}