Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
ioapic.c File Reference
#include "libk/io.h"
#include "type.h"
#include <hal/apic/ioapic.h>

Go to the source code of this file.

Macros

#define IOAPICVER   0x01
 
#define IOAPICARB   0x02
 
#define IOAPICREDTBL(n)
 

Functions

static void write_ioapic_register (const uintptr_t apic_base, const uint8_t offset, const uint32_t val)
 
static uint32_t read_ioapic_register (const uintptr_t apic_base, const uint8_t offset)
 
uint32_t ioapic_isr_get_vector (uint8_t irq)
 
 __attribute__ ((used, visibility("default"), section(".export")))
 This function handles memory allocation for a new dentry using the slab allocator.
 
void vxIOAPICMapISR (uint8_t irq, uint8_t vector, uint8_t apic_id)
 
void ioapic_setup (uintptr_t ioapic_addr)
 
void ioapic_add_irq_gsi_map (uint8_t irq, uint32_t gsi, uint16_t flags)
 

Variables

static struct irq_gsi_map irq_gsi_table [32] = {0}
 
static uintptr_t ioapic_base_addr = 0
 

Macro Definition Documentation

◆ IOAPICARB

#define IOAPICARB   0x02

Definition at line 8 of file ioapic.c.

◆ IOAPICREDTBL

#define IOAPICREDTBL ( n)
Value:
(0x10 + 2 * n)

Definition at line 9 of file ioapic.c.

Referenced by __attribute__(), ioapic_isr_get_vector(), ioapic_setup(), and vxIOAPICMapISR().

◆ IOAPICVER

#define IOAPICVER   0x01

Definition at line 7 of file ioapic.c.

Function Documentation

◆ __attribute__()

__attribute__ ( (used, visibility("default"), section(".export")) )

This function handles memory allocation for a new dentry using the slab allocator.

It also links the dentry to its corresponding VNode (if provided).

Note
This function performs lazy initialization of the dentry slab cache if it does not exist yet.
Parameters
nameThe name of the file or directory.
vnodePointer to the associated VNode (inode data). Pass NULL if the VNode is not yet available.
Returns
dentry_ptr A pointer to the newly allocated and initialized dentry.

Definition at line 31 of file ioapic.c.

◆ ioapic_add_irq_gsi_map()

void ioapic_add_irq_gsi_map ( uint8_t irq,
uint32_t gsi,
uint16_t flags )

Definition at line 79 of file ioapic.c.

References flags, gsi, and irq_gsi_table.

Referenced by parsing_madt().

◆ ioapic_isr_get_vector()

uint32_t ioapic_isr_get_vector ( uint8_t irq)

Definition at line 26 of file ioapic.c.

References ioapic_base_addr, IOAPICREDTBL, read_ioapic_register(), and reg.

◆ ioapic_setup()

void ioapic_setup ( uintptr_t ioapic_addr)

Definition at line 55 of file ioapic.c.

References ioapic_base_addr, IOAPICREDTBL, and write_ioapic_register().

Referenced by parsing_madt().

◆ read_ioapic_register()

static uint32_t read_ioapic_register ( const uintptr_t apic_base,
const uint8_t offset )
static

Definition at line 21 of file ioapic.c.

References mmio_inl(), mmio_outl(), and offset.

Referenced by __attribute__(), and ioapic_isr_get_vector().

◆ vxIOAPICMapISR()

void vxIOAPICMapISR ( uint8_t irq,
uint8_t vector,
uint8_t apic_id )

Definition at line 36 of file ioapic.c.

References ioapic_base_addr, IOAPICREDTBL, vector, and write_ioapic_register().

Referenced by __attribute__().

◆ write_ioapic_register()

static void write_ioapic_register ( const uintptr_t apic_base,
const uint8_t offset,
const uint32_t val )
static

Definition at line 14 of file ioapic.c.

References mmio_outl(), and offset.

Referenced by ioapic_setup(), and vxIOAPICMapISR().

Variable Documentation

◆ ioapic_base_addr

uintptr_t ioapic_base_addr = 0
static

Definition at line 12 of file ioapic.c.

Referenced by __attribute__(), ioapic_isr_get_vector(), ioapic_setup(), and vxIOAPICMapISR().

◆ irq_gsi_table

struct irq_gsi_map irq_gsi_table[32] = {0}
static

Definition at line 5 of file ioapic.c.

Referenced by ioapic_add_irq_gsi_map().