public override bool InitServer() { System.Diagnostics.Debugger.Log(0, "bga", "BGA driver started"); // Interpret properties pciconf = pci.PCIConfiguration.GetPCIConf(root); ios.Init(root); index = ios.Contains(VBE_DISPI_IOPORT_INDEX, 2); data = ios.Contains(VBE_DISPI_IOPORT_DATA, 2); foreach (var prop in root) { if (prop.Name == "vmem" && (prop.Value is tysos.VirtualMemoryResource64)) { vmem = prop.Value as tysos.VirtualMemoryResource64; break; } } if (pciconf == null) { System.Diagnostics.Debugger.Log(0, "bga", "no pci configuration provided"); return(false); } if (vmem == null) { System.Diagnostics.Debugger.Log(0, "bga", "no virtual memory space provided"); return(false); } if (index == null) { System.Diagnostics.Debugger.Log(0, "bga", "index port not provided"); return(false); } if (data == null) { System.Diagnostics.Debugger.Log(0, "bga", "data port not provided"); return(false); } /* Determine the version of the BGA */ ushort ver = ReadRegister(VBE_DISPI_INDEX_ID); System.Diagnostics.Debugger.Log(0, "bga", "BGA version " + ver.ToString("X4") + " detected"); if (ver < 0xb0c2) { System.Diagnostics.Debugger.Log(0, null, "Unsupported BGA version"); return(false); } /* Set a reasonable resolution */ if (SetMode(1024, 768, 32) == false) { System.Diagnostics.Debugger.Log(0, "bga", "failed to set 1024x768x32"); return(false); } /* Identify ourselves as a framebuffer device */ root.Add(new tysos.lib.File.Property { Name = "class", Value = "framebuffer" }); Tags.Add("class"); read_fbd(); return(true); }
public override bool InitServer() { System.Diagnostics.Debugger.Log(0, "pciide", "PCI IDE driver started"); pciconf = pci.PCIConfiguration.GetPCIConf(root); if (pciconf == null) { System.Diagnostics.Debugger.Log(0, "pciide", "no PCI configuration provided"); return(false); } if (dt == DriverType.Unknown) { /* Get the type from PCI config space */ uint conf_8 = pciconf.ReadConfig(0x8); uint progIF = (conf_8 >> 8) & 0xffU; if ((progIF & 0x5) == 0x5) { dt = DriverType.PCINative; } else { dt = DriverType.Legacy; } } /* Get IO port ranges */ var pri_cmd = pciconf.GetBAR(0); var pri_ctrl = pciconf.GetBAR(1); var sec_cmd = pciconf.GetBAR(2); var sec_ctrl = pciconf.GetBAR(3); /* Get IRQ ports */ tysos.Resources.InterruptLine pri_int = null, sec_int = null; switch (dt) { case DriverType.Legacy: foreach (var r in root) { if (r.Name == "interrupt" && (r.Value is tysos.Resources.InterruptLine)) { var r_int = r.Value as tysos.Resources.InterruptLine; if (r_int.ShortName == "IRQ14") { pri_int = r_int; } else if (r_int.ShortName == "IRQ15") { sec_int = r_int; } } } break; case DriverType.PCINative: foreach (var r in root) { if (r.Name == "interrupt" && (r.Value is tysos.Resources.InterruptLine)) { var r_int = r.Value as tysos.Resources.InterruptLine; if (r_int.ShortName.StartsWith("PCI")) { pri_int = r_int; sec_int = r_int; break; } } } break; } /* Create child devices */ if (pri_cmd.Length64 != 0 && pri_ctrl.Length64 != 0 && pri_int != null) { CreateChannel(0, pri_cmd, pri_ctrl, pri_int); } if (sec_cmd.Length64 != 0 && sec_ctrl.Length64 != 0 && sec_int != null) { CreateChannel(1, sec_cmd, sec_ctrl, sec_int); } root.Add(new File.Property { Name = "class", Value = "bus" }); Tags.Add("class"); return(true); }