On 2/16/06, Bahadir Balban <bilgehan.balban@xxxxxxxxx> wrote: > Hi, > > As of 2.6.14, in include/linux/irq.h, there are two definitions as below. > > As you see, hw_interrupt_type accepts irq numbers for each irq, > whereas irq_desc does not seem to keep a unique number. How are the > two matched to each other then? Is it the irq_desc array offset that > uniquely identifies each irq? yes its the irq_desc array offset which uniquly identifies the irq. Do see the "do_IRQ()" function. IRQ number received by CPU is pushed on the process specific kernel stack before calling the do_IRQ(), When do_IRQ() is called, it pulls out this number from stack and uses that as an index in array irq_desc strucuture. Each entry in this array is of irq_desc type, which is a structure, each entry contains the pointer to hardware specific structure of function pointers (this is what you mentioned : hw_interrupt_type), its the handle element of irq_desc structure. Function pointers in hardware specific structure are used for enabling, disabling, acknowledging the interrupts to PIC. Hope that clears your doubts. > > I am asking because on some (e.g. smp) architectures, there are > multiple irq controllers and each irq number does `not' represent a > primary key for each irq, because there are multiple instances of the > same irq number on the system, for different irqs. I am not sure if SMP system have one than on set of PICs. As far as I know, there is one set of advanced IO PIC, which actually route the system interrupts to different internal AIOPICs embedded in CPUs. -Gaurav > > Thanks, > Bahadir > > /* > * Interrupt controller descriptor. This is all we need > * to describe about the low-level hardware. > */ > struct hw_interrupt_type { > const char * typename; > unsigned int (*startup)(unsigned int irq); > void (*shutdown)(unsigned int irq); > void (*enable)(unsigned int irq); > void (*disable)(unsigned int irq); > void (*ack)(unsigned int irq); > /*...*/ > }; > > /* > * This is the "IRQ descriptor", which contains various information > * about the irq, including what kind of hardware handling it has, > * whether it is disabled etc etc. > */ > typedef struct irq_desc { > hw_irq_controller *handler; > void *handler_data; > struct irqaction *action; /* IRQ action list */ > unsigned int status; /* IRQ status */ > unsigned int depth; /* nested irq disables */ > unsigned int irq_count; /* For detecting broken interrupts */ > unsigned int irqs_unhandled; > spinlock_t lock; > /* ... */ > } > > -- > Kernelnewbies: Help each other learn about the Linux kernel. > Archive: http://mail.nl.linux.org/kernelnewbies/ > FAQ: http://kernelnewbies.org/faq/ > > -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/