diff --git "a/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\347\241\254\344\270\255\346\226\255--\346\225\260\346\215\256\347\273\223\346\236\204.md" "b/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\347\241\254\344\270\255\346\226\255--\346\225\260\346\215\256\347\273\223\346\236\204.md" index 338a4a0..45ddd4a 100755 --- "a/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\347\241\254\344\270\255\346\226\255--\346\225\260\346\215\256\347\273\223\346\236\204.md" +++ "b/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\347\241\254\344\270\255\346\226\255--\346\225\260\346\215\256\347\273\223\346\236\204.md" @@ -103,5 +103,32 @@ struct irq_chip { unsigned long flags; }; + +struct irq_domain { + struct list_head link; // 常规操作,所有的 irq_domain 连接到全局链表上 + const char *name; + const struct irq_domain_ops *ops; // 这个应该是不同的控制器操作函数不同 + void *host_data; + unsigned int flags; + unsigned int mapcount; // 管理的中断源数量 + + /* Optional data */ + struct fwnode_handle *fwnode; // 从 DTS 或 ACPI 获取的 + enum irq_domain_bus_token bus_token; + struct irq_domain_chip_generic *gc; +#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY + struct irq_domain *parent; // 这个应该就是多个中断控制器级联成树状结构 +#endif + + /* reverse map data. The linear map gets appended to the irq_domain */ + irq_hw_number_t hwirq_max; // 最大支持的中断数量 + unsigned int revmap_size; // 线性映射的大小 + struct radix_tree_root revmap_tree; // 基数树映射的根节点 + struct mutex revmap_mutex; + struct irq_data __rcu *revmap[]; // 线性映射用到的查找表 +}; ``` -![alt text](../../../../medias/images_0/硬中断--数据结构_image.png) \ No newline at end of file +![alt text](../../../../medias/images_0/硬中断--数据结构_image.png) + +图的左侧紫色部分,主要在中断控制器驱动中进行初始化设置,包括各个结构中函数指针的指向等,其中 struct irq_chip 用于对中断控制器的硬件操作,struct irq_domain 与中断控制器对应,完成的工作是硬件中断号到 irq 的映射; +![alt text](../../../../medias/images_0/硬中断--数据结构_image-1.png) \ No newline at end of file diff --git "a/\347\241\254\344\273\266\347\233\270\345\205\263/pcie/PCIe ECAM\344\273\213\347\273\215.md" "b/\347\241\254\344\273\266\347\233\270\345\205\263/pcie/PCIe ECAM\344\273\213\347\273\215.md" index ac05696..95cda99 100755 --- "a/\347\241\254\344\273\266\347\233\270\345\205\263/pcie/PCIe ECAM\344\273\213\347\273\215.md" +++ "b/\347\241\254\344\273\266\347\233\270\345\205\263/pcie/PCIe ECAM\344\273\213\347\273\215.md" @@ -29,7 +29,7 @@ devmem 0xd0100000就是访问01:00.0 设备偏移0寄存器 drivers/pci/ecam.c实现ECAM配置访问 -# qemu 软件仿真shixian +# qemu 软件仿真实现 ```c /* * PCI express ECAM (Enhanced Configuration Address Mapping) format.