IOAPIC: Difference between revisions

no edit summary
[unchecked revision][unchecked revision]
mNo edit summary
No edit summary
Line 30:
io_apic_set_reg(address, reg); // set reg
return *(uint32*)(address + 0x10);
}
 
Before proceeding too far into getting IO interrupts enabled, the IO interrupts should be disabled in the IO Redirection Table (registers 0x10-0x3F). This can be accomplished by setting bit 16 (Interrupt Mask) in the IOREDTBL(x) registers. The register 0x01 bits 16-23 (Maximum Redirection Entry) will tell you how many Redirection Entries there is in the current IO APIC. This value will be used to loop through the IO Redirections in order to mask them all to start with.
 
uint8 io_apic_read_max_redirects(uint32 address)
{
io_apic_set_reg(address, 1);
return (uint8)((*(uint32*)(address + 0x10) >> 16) & 0xFF);
}
void io_apic_mask_all_redirects(uint32 address)
{
uint16 i;
for(i = 0; i < io_apic_read_max_redirects(address); i++)
{
io_apic_write_64(address, 0x10 + (i * 2), 0x00000000, (0x00010000 | 0x20)); // mask all, vect: 0x20
}
}
 
Anonymous user