diff options
author | jhb <jhb@FreeBSD.org> | 2007-05-08 21:29:14 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2007-05-08 21:29:14 +0000 |
commit | 23cec608a68684526dc8d307c87222af3aa2e0bf (patch) | |
tree | b0dfc79e653fe3855596822772a53089b1187f41 /sys/i386/include/intr_machdep.h | |
parent | 3b37bd02b406660a3b4ae896f7eb37e0450a6ada (diff) | |
download | FreeBSD-src-23cec608a68684526dc8d307c87222af3aa2e0bf.zip FreeBSD-src-23cec608a68684526dc8d307c87222af3aa2e0bf.tar.gz |
Minor fixes and tweaks to the x86 interrupt code:
- Split the intr_table_lock into an sx lock used for most things, and a
spin lock to protect intrcnt_index. Originally I had this as a spin lock
so interrupt code could use it to lookup sources. However, we don't
actually do that because it would add a lot of overhead to interrupts,
and if we ever do support removing interrupt sources, we can use other
means to safely do so w/o locking in the interrupt handling code.
- Replace is_enabled (boolean) with is_handlers (a count of handlers) to
determine if a source is enabled or not. This allows us to notice when
a source is no longer in use. When that happens, we now invoke a new
PIC method (pic_disable_intr()) to inform the PIC driver that the
source is no longer in use. The I/O APIC driver frees the APIC IDT
vector when this happens. The MSI driver no longer needs to have a
hack to clear is_enabled during msi_alloc() and msix_alloc() as a result
of this change as well.
- Add an apic_disable_vector() to reset an IDT vector back to Xrsvd to
complement apic_enable_vector() and use it in the I/O APIC and MSI code
when freeing an IDT vector.
- Add a new nexus hook: nexus_add_irq() to ask the nexus driver to add an
IRQ to its irq_rman. The MSI code uses this when it creates new
interrupt sources to let the nexus know about newly valid IRQs.
Previously the msi_alloc() and msix_alloc() passed some extra stuff
back to the nexus methods which then added the IRQs. This approach is
a bit cleaner.
- Change the MSI sx lock to a mutex. If we need to create new sources,
drop the lock, create the required number of sources, then get the lock
and try the allocation again.
Diffstat (limited to 'sys/i386/include/intr_machdep.h')
-rw-r--r-- | sys/i386/include/intr_machdep.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/i386/include/intr_machdep.h b/sys/i386/include/intr_machdep.h index f8f0c8a..4e6d070 100644 --- a/sys/i386/include/intr_machdep.h +++ b/sys/i386/include/intr_machdep.h @@ -86,6 +86,7 @@ struct pic { void (*pic_disable_source)(struct intsrc *, int); void (*pic_eoi_source)(struct intsrc *); void (*pic_enable_intr)(struct intsrc *); + void (*pic_disable_intr)(struct intsrc *); int (*pic_vector)(struct intsrc *); int (*pic_source_pending)(struct intsrc *); void (*pic_suspend)(struct pic *); @@ -114,7 +115,7 @@ struct intsrc { u_long *is_count; u_long *is_straycount; u_int is_index; - u_int is_enabled:1; + u_int is_handlers; }; struct trapframe; @@ -142,12 +143,12 @@ int intr_remove_handler(void *cookie); void intr_resume(void); void intr_suspend(void); void intrcnt_add(const char *name, u_long **countp); -int msi_alloc(device_t dev, int count, int maxcount, int *irqs, int *newirq, - int *newcount); +void nexus_add_irq(u_long irq); +int msi_alloc(device_t dev, int count, int maxcount, int *irqs); void msi_init(void); int msi_map(int irq, uint64_t *addr, uint32_t *data); int msi_release(int* irqs, int count); -int msix_alloc(device_t dev, int *irq, int *new); +int msix_alloc(device_t dev, int *irq); int msix_release(int irq); #endif /* !LOCORE */ |