PatchworkOS  966e257
A non-POSIX operating system.
Loading...
Searching...
No Matches
irq.c File Reference
#include <kernel/cpu/irq.h>
#include <kernel/cpu/cpu.h>
#include <kernel/cpu/gdt.h>
#include <kernel/cpu/interrupt.h>
#include <kernel/log/log.h>
#include <kernel/log/panic.h>
#include <kernel/sync/rwlock.h>
#include <assert.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/bitmap.h>
#include <sys/list.h>
#include <sys/math.h>
Include dependency graph for irq.c:

Go to the source code of this file.

Functions

static irq_tirq_get (irq_virt_t virt)
 
static uint64_t irq_update (irq_t *irq)
 
static irq_domain_tirq_domain_lookup (irq_phys_t phys)
 
static uint64_t irq_domain_rebind_orphaned_irqs (irq_domain_t *newDomain)
 
void irq_init (void)
 Initialize the IRQ subsystem.
 
void irq_dispatch (interrupt_frame_t *frame, cpu_t *self)
 Dispatch an IRQ.
 
uint64_t irq_virt_alloc (irq_virt_t *out, irq_phys_t phys, irq_flags_t flags, cpu_t *cpu)
 Allocate a virtual IRQ mapped to the given physical IRQ.
 
void irq_virt_free (irq_virt_t virt)
 Free a previously allocated virtual IRQ.
 
uint64_t irq_virt_set_affinity (irq_virt_t virt, cpu_t *cpu)
 Change the CPU responsible for an IRQ.
 
uint64_t irq_chip_register (irq_chip_t *chip, irq_phys_t start, irq_phys_t end, void *private)
 Register an IRQ chip for a range of physical IRQs.
 
void irq_chip_unregister (irq_chip_t *chip, irq_phys_t start, irq_phys_t end)
 Unregister all instances of the given IRQ chip within the specified range.
 
uint64_t irq_chip_amount (void)
 Get the number of registered IRQ chips.
 
uint64_t irq_handler_register (irq_virt_t virt, irq_func_t func, void *private)
 Register an IRQ handler for a virtual IRQ.
 
void irq_handler_unregister (irq_func_t func, irq_virt_t virt)
 Unregister an IRQ handler.
 

Variables

static irq_t irqs [VECTOR_EXTERNAL_AMOUNT] = {0}
 
static list_t domains = LIST_CREATE(domains)
 
static rwlock_t domainsLock = RWLOCK_CREATE()
 

Function Documentation

◆ irq_get()

static irq_t * irq_get ( irq_virt_t  virt)
static

Definition at line 23 of file irq.c.

Here is the caller graph for this function:

◆ irq_update()

static uint64_t irq_update ( irq_t irq)
static

Definition at line 33 of file irq.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ irq_domain_lookup()

static irq_domain_t * irq_domain_lookup ( irq_phys_t  phys)
static

Definition at line 50 of file irq.c.

Here is the caller graph for this function:

◆ irq_domain_rebind_orphaned_irqs()

static uint64_t irq_domain_rebind_orphaned_irqs ( irq_domain_t newDomain)
static

Definition at line 64 of file irq.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ irqs

irq_t irqs[VECTOR_EXTERNAL_AMOUNT] = {0}
static

Definition at line 17 of file irq.c.

◆ domains

list_t domains = LIST_CREATE(domains)
static
Todo:
Optimize domain lookup?

Definition at line 20 of file irq.c.

◆ domainsLock

rwlock_t domainsLock = RWLOCK_CREATE()
static

Definition at line 21 of file irq.c.