Rev 3947 | Rev 3964 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3947 | Rev 3950 | ||
|---|---|---|---|
| Line 80... | Line 80... | ||
| 80 | 80 | ||
| 81 | /** |
81 | /** |
| 82 | * Spinlock protecting the kernel IRQ hash table. |
82 | * Spinlock protecting the kernel IRQ hash table. |
| 83 | * This lock must be taken only when interrupts are disabled. |
83 | * This lock must be taken only when interrupts are disabled. |
| 84 | */ |
84 | */ |
| 85 | static SPINLOCK_INITIALIZE(irq_kernel_hash_table_lock); |
85 | SPINLOCK_INITIALIZE(irq_kernel_hash_table_lock); |
| 86 | /** The kernel IRQ hash table. */ |
86 | /** The kernel IRQ hash table. */ |
| 87 | static hash_table_t irq_kernel_hash_table; |
87 | static hash_table_t irq_kernel_hash_table; |
| 88 | 88 | ||
| 89 | /** |
89 | /** |
| 90 | * Spinlock protecting the uspace IRQ hash table. |
90 | * Spinlock protecting the uspace IRQ hash table. |
| Line 176... | Line 176... | ||
| 176 | * @param irq IRQ structure belonging to a device. |
176 | * @param irq IRQ structure belonging to a device. |
| 177 | * @return True on success, false on failure. |
177 | * @return True on success, false on failure. |
| 178 | */ |
178 | */ |
| 179 | void irq_register(irq_t *irq) |
179 | void irq_register(irq_t *irq) |
| 180 | { |
180 | { |
| 181 | spinlock_t *lock = &irq_kernel_hash_table_lock; |
- | |
| 182 | hash_table_t *table = &irq_kernel_hash_table; |
- | |
| 183 | ipl_t ipl; |
181 | ipl_t ipl; |
| 184 | unative_t key[] = { |
182 | unative_t key[] = { |
| 185 | (unative_t) irq->inr, |
183 | (unative_t) irq->inr, |
| 186 | (unative_t) irq->devno |
184 | (unative_t) irq->devno |
| 187 | }; |
185 | }; |
| 188 | 186 | ||
| 189 | ipl = interrupts_disable(); |
187 | ipl = interrupts_disable(); |
| 190 | spinlock_lock(lock); |
188 | spinlock_lock(&irq_kernel_hash_table_lock); |
| 191 | spinlock_lock(&irq->lock); |
189 | spinlock_lock(&irq->lock); |
| 192 | hash_table_insert(table, key, &irq->link); |
190 | hash_table_insert(&irq_kernel_hash_table, key, &irq->link); |
| 193 | spinlock_unlock(&irq->lock); |
191 | spinlock_unlock(&irq->lock); |
| 194 | spinlock_unlock(lock); |
192 | spinlock_unlock(&irq_kernel_hash_table_lock); |
| 195 | interrupts_restore(ipl); |
193 | interrupts_restore(ipl); |
| 196 | } |
194 | } |
| 197 | 195 | ||
| 198 | /** Dispatch the IRQ. |
196 | /** Dispatch the IRQ. |
| 199 | * |
197 | * |