internal static void Parse(IoMemory region, int length, uint entryCount) { int offset = 0; for (int i = 0; i < entryCount; i++) { switch (region.Read8(offset)) { case MpProcessorEntry.EntryType: ProcessorEntries.Add( MpProcessorEntry.Parse(region, length, ref offset) ); break; case MpBusEntry.EntryType: BusEntries.Add( MpBusEntry.Parse(region, length, ref offset) ); break; case MpIoApicEntry.EntryType: IoApicEntries.Add( MpIoApicEntry.Parse(region, length, ref offset) ); break; case MpInterruptEntry.IoEntryType: IoInterruptEntries.Add( MpInterruptEntry.Parse(region, length, ref offset) ); break; case MpInterruptEntry.LocalEntryType: LocalInterruptEntries.Add( MpInterruptEntry.Parse(region, length, ref offset) ); break; } } }
internal void ConfigurePciInterrupt(IoApic ioApic, MpInterruptEntry e) { byte vector = IrqToInterrupt(e.ApicLine); IoBits iobits = (e.PolarityType == Polarity.ActiveHigh) ? IoBits.IntPolActiveHigh : IoBits.IntPolActiveLow; iobits |= (e.TriggerType == Trigger.Edge) ? IoBits.TriggerModeEdge : IoBits.TriggerModeLevel; iobits |= IoBits.DstPhysical; iobits |= IoBits.DelModFixed; iobits |= IoBits.IrqMask; RedirectionEntry r = new RedirectionEntry(this.Id, iobits, vector); ioApic.SetRedirectionEntry(e.ApicLine, ref r); #if PRINT_IO_APICS DebugStub.Print("Added PCI interrupt for apic 0x{0:x}: Line 0x{1:x} => 0x{2:x}\n", __arglist(ioApic.GetId(), e.ApicLine, vector)); #endif }
internal static MpInterruptEntry Parse(IoMemory region, int length, ref int offset) { Debug.Assert(length >= offset + Length); byte entry = region.Read8(offset + 0); Debug.Assert(entry == IoEntryType || entry == LocalEntryType); MpInterruptEntry e = new MpInterruptEntry(); e.EntryType = entry; e.Interrupt = region.Read8(offset + 1); e.Flags = region.Read16(offset + 2); e.BusId = region.Read8(offset + 4); e.BusIrq = region.Read8(offset + 5); e.ApicId = region.Read8(offset + 6); e.ApicLine = region.Read8(offset + 7); e.DebugPrint(); offset += Length; return(e); }