|
ginnOS
The reference: libc, the libraries and the kernel
|
kernel IRQ handler manager: shared lines, per-handler control. More...
Go to the source code of this file.
Macros | |
| #define | IRQ_MAX_SHARED 4 |
| #define | IRQ_FLAG_NONE 0u |
Typedefs | |
| typedef struct irq_handler_entry | irq_handle_t |
Functions | |
| void | irq_manager_init (void) |
| initialize the IRQ manager. | |
| irq_handle_t * | irq_request (uint32_t irq, irq_handler_fn handler, uint32_t flags, const char *name) |
| register a handler on an IRQ line, sharing it with any existing handlers. | |
| void | irq_free (irq_handle_t *handle) |
| remove a previously requested handler. | |
| void | irq_handler_set_enabled (irq_handle_t *handle, bool enabled) |
| enable or disable a single handler without removing it. | |
| void | irq_dump (void) |
| print the registered handlers per line (debugging aid). | |
| bool | irq_set_cpu (uint32_t irq, uint32_t cpu) |
| send the interrupts of an IRQ line to a core (arch_irq_set_cpu). | |
| uint32_t | irq_line_cpu (uint32_t irq) |
| the core that handles an IRQ line. | |
| void | irq_spread (void) |
| spread the device interrupts over the cores that run the scheduler: each IRQ line that has a handler, and each PCI device that uses MSI or MSI-X, goes to the next core in turn, as Linux gives each interrupt one core. | |
kernel IRQ handler manager: shared lines, per-handler control.
sits on top of the arch-neutral IRQ primitives (arch/arch_irq.h). where the arch layer allows one handler per line, this manager keeps a list of handlers per line so several devices can share an IRQ, lets each handler be enabled/disabled independently, and tracks a name per handler for debugging.
drivers call irq_request()/irq_free() instead of arch_irq_register() directly. the manager owns line masking: a line is unmasked while it has at least one enabled handler and masked otherwise.
| #define IRQ_MAX_SHARED 4 |
| #define IRQ_FLAG_NONE 0u |
| typedef struct irq_handler_entry irq_handle_t |
| void irq_manager_init | ( | void | ) |
initialize the IRQ manager.
must run before any irq_request() call.
| irq_handle_t * irq_request | ( | uint32_t | irq, |
| irq_handler_fn | handler, | ||
| uint32_t | flags, | ||
| const char * | name ) |
register a handler on an IRQ line, sharing it with any existing handlers.
the handler starts enabled and the line is unmasked automatically.
| irq | the IRQ line. |
| handler | the function to call when the line fires. |
| flags | reserved for future use; pass IRQ_FLAG_NONE. |
| name | short human-readable owner name (for debugging), may be NULL. |
| void irq_free | ( | irq_handle_t * | handle | ) |
remove a previously requested handler.
if it was the last enabled handler on its line, the line is masked.
| handle | the handle returned by irq_request() (NULL is ignored). |
| void irq_handler_set_enabled | ( | irq_handle_t * | handle, |
| bool | enabled ) |
enable or disable a single handler without removing it.
masks the line when no enabled handlers remain, unmasks it otherwise.
| handle | the handler to toggle. |
| enabled | true to enable, false to disable. |
| void irq_dump | ( | void | ) |
print the registered handlers per line (debugging aid).
send the interrupts of an IRQ line to a core (arch_irq_set_cpu).
| irq | the IRQ line (0 to 15). |
| cpu | the index of the core (cpu_t.index). |
the core that handles an IRQ line.
| irq | the IRQ line (0 to 15). |
| void irq_spread | ( | void | ) |
spread the device interrupts over the cores that run the scheduler: each IRQ line that has a handler, and each PCI device that uses MSI or MSI-X, goes to the next core in turn, as Linux gives each interrupt one core.
IRQ 0 (the PIT) stays on the boot core. call it once, after smp_init().