Changeset 691eb52 in mainline for kernel/generic/src/ddi/irq.c
- Timestamp:
- 2009-02-24T13:30:47Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c0855a0
- Parents:
- 5b0ae4be
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ddi/irq.c
r5b0ae4be r691eb52 73 73 #include <arch/types.h> 74 74 #include <synch/spinlock.h> 75 #include <console/console.h> 75 76 #include <memstr.h> 76 77 #include <arch.h> … … 194 195 } 195 196 196 /** Dispatch the IRQ. 197 * 198 * We assume this function is only called from interrupt 199 * context (i.e. that interrupts are disabled prior to 200 * this call). 201 * 202 * This function attempts to lookup a fitting IRQ 203 * structure. In case of success, return with interrupts 204 * disabled and holding the respective structure. 205 * 206 * @param inr Interrupt number (aka inr or irq). 207 * 208 * @return IRQ structure of the respective device or NULL. 209 */ 210 irq_t *irq_dispatch_and_lock(inr_t inr) 197 /** Search and lock the uspace IRQ hash table. 198 * 199 */ 200 static irq_t *irq_dispatch_and_lock_uspace(inr_t inr) 211 201 { 212 202 link_t *lnk; 213 203 unative_t key[] = { 214 204 (unative_t) inr, 215 (unative_t) -1 205 (unative_t) -1 /* search will use claim() instead of devno */ 216 206 }; 217 207 218 /*219 * Try uspace handlers first.220 */221 208 spinlock_lock(&irq_uspace_hash_table_lock); 222 209 lnk = hash_table_find(&irq_uspace_hash_table, key); … … 229 216 } 230 217 spinlock_unlock(&irq_uspace_hash_table_lock); 231 232 /* 233 * Fallback to kernel handlers. 234 */ 218 219 return NULL; 220 } 221 222 /** Search and lock the kernel IRQ hash table. 223 * 224 */ 225 static irq_t *irq_dispatch_and_lock_kernel(inr_t inr) 226 { 227 link_t *lnk; 228 unative_t key[] = { 229 (unative_t) inr, 230 (unative_t) -1 /* search will use claim() instead of devno */ 231 }; 232 235 233 spinlock_lock(&irq_kernel_hash_table_lock); 236 234 lnk = hash_table_find(&irq_kernel_hash_table, key); … … 243 241 } 244 242 spinlock_unlock(&irq_kernel_hash_table_lock); 245 246 return NULL; 243 244 return NULL; 245 } 246 247 /** Dispatch the IRQ. 248 * 249 * We assume this function is only called from interrupt 250 * context (i.e. that interrupts are disabled prior to 251 * this call). 252 * 253 * This function attempts to lookup a fitting IRQ 254 * structure. In case of success, return with interrupts 255 * disabled and holding the respective structure. 256 * 257 * @param inr Interrupt number (aka inr or irq). 258 * 259 * @return IRQ structure of the respective device or NULL. 260 */ 261 irq_t *irq_dispatch_and_lock(inr_t inr) 262 { 263 irq_t *irq; 264 265 /* 266 * If the kernel console is silenced, 267 * then try first the uspace handlers, 268 * eventually fall back to kernel handlers. 269 * 270 * If the kernel console is active, 271 * then do it the other way around. 272 */ 273 if (silent) { 274 irq = irq_dispatch_and_lock_uspace(inr); 275 if (irq) 276 return irq; 277 return irq_dispatch_and_lock_kernel(inr); 278 } 279 280 irq = irq_dispatch_and_lock_kernel(inr); 281 if (irq) 282 return irq; 283 return irq_dispatch_and_lock_uspace(inr); 247 284 } 248 285
Note:
See TracChangeset
for help on using the changeset viewer.