internal static MpBusEntry Parse(IoMemory region, int length, ref int offset) { Debug.Assert(length >= offset + Length); Debug.Assert(region.Read8(offset + 0) == EntryType); MpBusEntry e = new MpBusEntry(); e.BusId = region.Read8(offset + 1); e.BusType = BusType.UNKNOWN; string name = region.ReadAsciiZeroString(offset + 2, 6); e.BusType = BusType.UNKNOWN; for (int i = 0; i <= (int)BusType.LAST; i++) { if (name == busNames[i]) { e.BusType = (BusType)i; break; } } e.DebugPrint(); offset += Length; return(e); }
private void InitializeMpResourceEntries() { if (MpResources.FloatingPointer != null) { DebugStub.Print("Initializing Apic redirections from MpResources\n"); foreach (MpInterruptEntry e in MpResources.IoInterruptEntries) { IoApic ioApic = GetIoApic(e.ApicId); if (ioApic == null) { DebugStub.Print("Could not find I/O Apic with id {0}\n", __arglist(e.ApicId)); continue; } MpBusEntry be = MpResources.GetBusEntryById(e.BusId); if (be == null) { DebugStub.Print("Unknown bus device id {0:x2}\n", __arglist(e.BusId)); continue; } if (be.BusType == BusType.ISA) { ConfigureIsaInterrupt(ioApic, e); } else if (be.BusType == BusType.PCI) { ConfigurePciInterrupt(ioApic, e); } else { DebugStub.Print("Unhandled device on bus {0:x2}\n", __arglist(e.BusId)); continue; } } } else { DebugStub.Print("Initializing Apic redirections to defaults\n"); // If there are no MP tables, set up a standard mapping for the IRQs on CPU 0 uint end = 16; IoBits stdBits = (IoBits.DstPhysical | IoBits.DelModFixed | IoBits.IrqMask | IoBits.IntPolActiveLow | IoBits.TriggerModeEdge); for (uint z = 0; z < end; z++) { RedirectionEntry re = new RedirectionEntry(this.Id, stdBits, IrqToInterrupt((byte)z)); ioApics[0].SetRedirectionEntry((byte)z, ref re); } } PrintIoApics(); }
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; } } }