hw_x86_64: read number of I/O redirection table entries from IOAPIC

Fixes #2475
This commit is contained in:
Christian Prochaska 2017-08-07 15:14:30 +02:00 committed by Christian Helmuth
parent 47dc708887
commit 60ae6721db
2 changed files with 11 additions and 7 deletions

View File

@ -170,6 +170,9 @@ Irte::access_t Ioapic::_create_irt_entry(unsigned const irq)
Ioapic::Ioapic() : Mmio(Platform::mmio_to_virt(Hw::Cpu_memory_map::MMIO_IOAPIC_BASE))
{
write<Ioregsel>(IOAPICVER);
_irte_count = read<Iowin::Maximum_redirection_entry>() + 1;
for (unsigned i = 0; i < IRQ_COUNT; i++)
{
/* set legacy/ISA IRQs to edge, high */
@ -182,7 +185,7 @@ Ioapic::Ioapic() : Mmio(Platform::mmio_to_virt(Hw::Cpu_memory_map::MMIO_IOAPIC_B
}
/* remap all IRQs managed by I/O APIC */
if (i < IRTE_COUNT) {
if (i < _irte_count) {
Irte::access_t irte = _create_irt_entry(i);
write<Ioregsel>(IOREDTBL + 2 * i + 1);
write<Iowin>(irte >> Iowin::ACCESS_WIDTH);
@ -198,7 +201,7 @@ void Ioapic::toggle_mask(unsigned const vector, bool const set)
/*
* Ignore toggle requests for vectors not handled by the I/O APIC.
*/
if (vector < REMAP_BASE || vector >= REMAP_BASE + IRTE_COUNT) {
if (vector < REMAP_BASE || vector >= REMAP_BASE + _irte_count) {
return;
}

View File

@ -53,12 +53,10 @@ class Genode::Ioapic : public Mmio
enum { REMAP_BASE = Board::VECTOR_REMAP_BASE };
uint8_t _irt_count;
/* Number of Redirection Table entries */
unsigned _irte_count;
enum {
/* Number of Redirection Table entries */
IRTE_COUNT = 24,
/* Register selectors */
IOAPICVER = 0x01,
IOREDTBL = 0x10,
@ -130,7 +128,10 @@ class Genode::Ioapic : public Mmio
*/
struct Ioregsel : Register<0x00, 32> { };
struct Iowin : Register<0x10, 32> { };
struct Iowin : Register<0x10, 32>
{
struct Maximum_redirection_entry : Bitfield<16, 8> { };
};
};
class Genode::Pic : public Mmio