| 420 | } |
| 421 | |
| 422 | int |
| 423 | intr_setaffinity(int irq, int mode, void *m) |
| 424 | { |
| 425 | struct intr_event *ie; |
| 426 | cpuset_t *mask; |
| 427 | int cpu, n; |
| 428 | |
| 429 | mask = m; |
| 430 | cpu = NOCPU; |
| 431 | /* |
| 432 | * If we're setting all cpus we can unbind. Otherwise make sure |
| 433 | * only one cpu is in the set. |
| 434 | */ |
| 435 | if (CPU_CMP(cpuset_root, mask)) { |
| 436 | for (n = 0; n < CPU_SETSIZE; n++) { |
| 437 | if (!CPU_ISSET(n, mask)) |
| 438 | continue; |
| 439 | if (cpu != NOCPU) |
| 440 | return (EINVAL); |
| 441 | cpu = n; |
| 442 | } |
| 443 | } |
| 444 | ie = intr_lookup(irq); |
| 445 | if (ie == NULL) |
| 446 | return (ESRCH); |
| 447 | switch (mode) { |
| 448 | case CPU_WHICH_IRQ: |
| 449 | return (intr_event_bind(ie, cpu)); |
| 450 | case CPU_WHICH_INTRHANDLER: |
| 451 | return (intr_event_bind_irqonly(ie, cpu)); |
| 452 | case CPU_WHICH_ITHREAD: |
| 453 | return (intr_event_bind_ithread(ie, cpu)); |
| 454 | default: |
| 455 | return (EINVAL); |
| 456 | } |
| 457 | } |
| 458 | |
| 459 | int |
| 460 | intr_getaffinity(int irq, int mode, void *m) |
no test coverage detected