Skip to content

Commit

Permalink
Update submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
sisyphus12 committed Nov 22, 2024
1 parent 6128a48 commit 79d428d
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions linux/内核-驱动/中断/硬中断--数据结构.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,56 @@ struct irq_chip {
unsigned long flags;
};


/**
* struct irq_domain_ops - Methods for irq_domain objects
* @match: Match an interrupt controller device node to a host, returns
* 1 on a match
* match是判断一个指定的 interrupt controller(node 参数)是否和一个irq domain 匹配(d 参数),
* 如果匹配的话, 返回 1. 实际上, 内核中很少定义这个 callback 函数(!!!),
* 实际上struct irq_domain中有一个of_node指向了对应的 interrupt controller的device node,
* 因此, 如果不提供该函数, 那么default 的匹配函数其实就是判断 irq domain的of_node 成员是否等于传入的node 参数.
*
* @map: Create or update a mapping between a virtual irq number and a hw
* irq number. This is called only once for a given mapping.
* @unmap: Dispose of such a mapping
* @xlate: Given a device tree node and interrupt specifier, decode
* the hardware irq number and linux irq type value.
*
* Functions below are provided by the driver and called whenever a new mapping
* is created or an old mapping is disposed. The driver can then proceed to
* whatever internal data structures management is required. It also needs
* to setup the irq_desc when returning from map().
*
*在 __irq_domain_add 中将ops 传递给domain
*/
struct irq_domain_ops {
int (*match)(struct irq_domain *d, struct device_node *node,
enum irq_domain_bus_token bus_token);
int (*select)(struct irq_domain *d, struct irq_fwspec *fwspec,
enum irq_domain_bus_token bus_token);
int (*map)(struct irq_domain *d, unsigned int virq, irq_hw_number_t hw);
void (*unmap)(struct irq_domain *d, unsigned int virq);
int (*xlate)(struct irq_domain *d, struct device_node *node,
const u32 *intspec, unsigned int intsize,
unsigned long *out_hwirq, unsigned int *out_type);
#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
/* extended V2 interfaces to support hierarchy irq_domains */
int (*alloc)(struct irq_domain *d, unsigned int virq,
unsigned int nr_irqs, void *arg);
void (*free)(struct irq_domain *d, unsigned int virq,
unsigned int nr_irqs);
int (*activate)(struct irq_domain *d, struct irq_data *irqd, bool reserve);
void (*deactivate)(struct irq_domain *d, struct irq_data *irq_data);
int (*translate)(struct irq_domain *d, struct irq_fwspec *fwspec,
unsigned long *out_hwirq, unsigned int *out_type);
#endif
#ifdef CONFIG_GENERIC_IRQ_DEBUGFS
void (*debug_show)(struct seq_file *m, struct irq_domain *d,
struct irq_data *irqd, int ind);
#endif
};

struct irq_domain {
struct list_head link; // 常规操作,所有的 irq_domain 连接到全局链表上
const char *name;
Expand Down

0 comments on commit 79d428d

Please sign in to comment.