Kernel/drivers/of/irq.c
unsignedint irq_of_parse_and_map(structdevice_node *dev, int index)
{
struct of_irq oirq;
if(strcmp(dev->name,"usb")== 0)
{
pr_err("zll----0-dev->name=%s !\n",dev->name);
dump_stack();
}
pr_err("zll----1-dev->name=%s !\n",dev->name);
if (of_irq_map_one(dev, index, &oirq))
return 0;
return irq_create_of_mapping(oirq.controller, oirq.specifier,
oirq.size);
}
[ 0.384286]@5 zll----0-dev->name=usb!
[ 0.384301]@5 CPU: 0 PID: 1 Comm: swapper/0Not tainted 3.10.84-gc02f4f9-03169-gedf9c45-dirty #68
[ 0.384310]@5 Call trace:
[ 0.384333]@5 [<ffffffc000206b18>]dump_backtrace+0x0/0x270
[ 0.384345]@5 [<ffffffc000206d98>]show_stack+0x10/0x1c
[ 0.384360]@5 [<ffffffc000d19a54>]dump_stack+0x1c/0x28
[ 0.384376]@5 [<ffffffc000968604>]irq_of_parse_and_map+0x40/0x94
[ 0.384388]@5 [<ffffffc000968678>]of_irq_to_resource+0x20/0x88
[ 0.384400]@5 [<ffffffc00096875c>]of_irq_count+0x20/0x40
[ 0.384411]@5 [<ffffffc000968d64>]of_device_alloc+0x78/0x178
[ 0.384424]@5 [<ffffffc000968e94>]of_platform_device_create_pdata+0x30/0x78
[ 0.384435]@5 [<ffffffc000969144>]of_platform_bus_create+0x24c/0x2f4
[ 0.384447]@5 [<ffffffc0009691b8>]of_platform_bus_create+0x2c0/0x2f4
[ 0.384459]@5 [<ffffffc00096935c>]of_platform_populate+0x68/0x90
[ 0.384475]@5 [<ffffffc001603004>]arm64_device_init+0x1c/0x2c
[ 0.384486]@5 [<ffffffc000200804>]do_one_initcall+0xb0/0x14c
[ 0.384498]@5 [<ffffffc001600974>]kernel_init_freeable+0x140/0x1e0
[ 0.384512]@5 [<ffffffc000d0f60c>]kernel_init+0x10/0xcc
kernel_init //-----------------------kernel\init\main.c
-->kernel_init_freeable
-->do_basic_setup
-->do_initcalls
-->do_initcall_level
-->do_one_initcall
-->arch_initcall(arm64_device_init) //--------------------------kernel\arch\arm64\kernel\setup.c
-->arm64_device_init
-->of_platform_populate(NULL, of_default_bus_match_table, NULL,NULL) //----------------------------kernel\drivers\of\platform.c
-->of_platform_bus_create
-->of_platform_bus_create(child, matches, lookup, &dev->dev,strict);
-->of_platform_device_create_pdata(bus, bus_id,platform_data, parent);
-->of_device_alloc(np, bus_id, parent);
-->of_irq_count //----------------------------------kernel\drivers\of\irq.c
-->of_irq_to_resource_table//----------此函数与上一级函数都调用下一级函数
-->of_irq_to_resource
-->irq_ of_parse_and_map
-->of_irq_map_one
-->of_get_property(device, "interrupts",&intlen)
-->of_irq_map_raw(p, intspec + index * intsize, intsize, addr, out_irq);
//------------------------此函数会打印出来dts中的中断号
int of_irq_map_raw(structdevice_node *parent, const __be32 *intspec, u32 ointsize, const __be32 *addr, struct of_irq *out_irq)
{
struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL;
const __be32 *tmp, *imap, *imask;
u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0;
int imaplen, match, i;
pr_err("of_irq_map_raw:par=%s,intspec=[0x%08x 0x%08x...],ointsize=%d\n", parent->full_name,be32_to_cpup(intspec),
be32_to_cpup(intspec + 1), ointsize);
…...
}
[ 0.382812]@4 zll----00--intspec=ffffffc001e1fbbc----intlen=6 !
[ 0.382851]@4 of_irq_map_raw:par=/soc/interrupt-controller@b000000,intspec=[0x00000000 0x00000086...],ointsize=3
[ 0.382862]@4 zll----00-dev->name=interrupt-controller !
[ 0.382873]@4 zll----00--intspec=ffffffc001e1fbbc----intlen=6 !
[ 0.382910]@4 of_irq_map_raw:par=/soc/interrupt-controller@b000000,intspec=[0x00000000 0x0000008c...],ointsize=3
[ 0.382921]@4 zll----00-dev->name=interrupt-controller !
上面两个值对应10进制为134和140
int of_irq_map_raw(structdevice_node *parent, const __be32 *intspec, u32 ointsize, const __be32 *addr, struct of_irq *out_irq)
{
。。。。。。。。。。。。。。。。
while (ipar != NULL){
/* Now check if cursor is an interrupt-controller and if it is
* then we are done
*/
if (of_get_property(ipar, "interrupt-controller", NULL) !=
NULL) {
pr_debug(" -> got it !\n");
for (i = 0; i < intsize; i++){
out_irq->specifier[i] =
of_read_number(intspec +i, 1);
+if(out_irq->specifier[1]>130&& out_irq->specifier[1]<180)
+pr_err("zll----@@@-----out_irq->specifier[%d]=%d intspec=%d\n",i,out_irq->specifier[1],intspec);
}
out_irq->size = intsize;
out_irq->controller = ipar;
of_node_put(old);
return 0;
}
。。。。。。。。。。。。。。。。。。
}
Line 452: [ 0.382335]@5 zll----@@@-----out_irq->specifier[0]=134 intspec=31587272
Line 453: [ 0.382343]@5 zll----@@@-----out_irq->specifier[1]=140 intspec=31587272