示例#1
0
文件: Factory.cs 项目: jncronin/tysos
        public RPCResult <tysos.Interfaces.IFileSystem> CreateFSHandler(tysos.lib.File src)
        {
            // Get the properties of the source file
            tysos.lib.File.Property[] props = src.GetAllProperties();
            if (props == null)
            {
                props = new tysos.lib.File.Property[] { }
            }
            ;

            // Ensure the device is a PCI device
            tysos.lib.File.Property driver = src.GetPropertyByName("driver");
            if (driver == null || driver.Value == null || !(driver.Value is string) || ((string)driver.Value).Equals("pci") == false)
            {
                System.Diagnostics.Debugger.Log(0, "pci", "driver property is invalid");
                return(null);
            }

            // Get the subdriver
            string subdriver_str = "";

            tysos.lib.File.Property subdriver = src.GetPropertyByName("subdriver");
            if (subdriver != null && subdriver.Value != null && (subdriver.Value is string))
            {
                subdriver_str = subdriver.Value as string;
            }

            if (subdriver_str == "hostbridge")
            {
                // Create and execute a handler in a separate address space
                hostbridge    fs = new hostbridge(props);
                tysos.Process p  = tysos.Process.CreateProcess("pci: " + src.Name,
                                                               new System.Threading.ThreadStart(fs.MessageLoop), new object[] { fs });
                p.Start();

                System.Diagnostics.Debugger.Log(0, "pci", "Created FS handler\n");
                return(fs);
            }

            System.Diagnostics.Debugger.Log(0, "pci", "subdriver " + subdriver_str + " not found");
            return(null);
        }
    }
示例#2
0
文件: PCI_IDs.cs 项目: jncronin/tysos
        static internal void InitDeviceDB(hostbridge hb)
        {
            db_vdr = new Dictionary <DeviceDBKey, DeviceDBEntry>(new VendorDeviceRevisionComparer());
            db_vd  = new Dictionary <DeviceDBKey, DeviceDBEntry>(new VendorDeviceComparer());
            db_csp = new Dictionary <DeviceDBKey, DeviceDBEntry>(new ClassSubclassProgIFComparer());
            db_cs  = new Dictionary <DeviceDBKey, DeviceDBEntry>(new ClassSubclassComparer());

            // Some defines that are used in more than one entry
            DeviceDBEntry pciide_legacy = new DeviceDBEntry
            {
                DriverName            = "pciide",
                HumanManufacturerName = "Generic",
                HumanDeviceName       = "PCI IDE Controller (legacy mode)",

                BAROverrides = new BAROverride[] {
                    new BAROverride {
                        Value = 0x1f0, Length = 8, Type = 1
                    },
                    new BAROverride {
                        Value = 0x3f6, Length = 1, Type = 1
                    },
                    new BAROverride {
                        Value = 0x170, Length = 8, Type = 1
                    },
                    new BAROverride {
                        Value = 0x376, Length = 1, Type = 1
                    }
                },

                ExtraResources = new List <tysos.Resource>()
            };

            if (hb.isa_irqs.ContainsKey(14))
            {
                pciide_legacy.ExtraResources.Add(hb.isa_irqs[14]);
            }
            if (hb.isa_irqs.ContainsKey(15))
            {
                pciide_legacy.ExtraResources.Add(hb.isa_irqs[15]);
            }

            DeviceDBEntry pcnet32 = new DeviceDBEntry()
            {
                DriverName            = "pcnet32",
                HumanManufacturerName = "AMD",
                HumanDeviceName       = "79c970 [PCnet32 LANCE]",

                ExtraResources = new List <tysos.Resource> {
                    hb.vmems.Alloc(0x10000)
                }
            };

            // Device database

            // The following match on vendor ID and device ID
            db_vd.Add(new DeviceDBKey {
                VendorID = 0x8086, DeviceID = 0x1237
            }, new DeviceDBEntry {
                DriverName = "pci", HumanManufacturerName = "Intel", HumanDeviceName = "440FX - 82441FX PCI and Memory Controller"
            });
            db_vd.Add(new DeviceDBKey {
                VendorID = 0x8086, DeviceID = 0x2415
            }, new DeviceDBEntry {
                DriverName = "ac97", HumanManufacturerName = "Intel", HumanDeviceName = "82801AA AC'97 Audio Controller"
            });
            db_vd.Add(new DeviceDBKey {
                VendorID = 0x8086, DeviceID = 0x7000
            }, new DeviceDBEntry {
                DriverName = null, HumanManufacturerName = "Intel", HumanDeviceName = "82371SB PIIX3 ISA"
            });

            db_vd.Add(new DeviceDBKey {
                VendorID = 0x8086, DeviceID = 0x7113
            }, new DeviceDBEntry {
                DriverName = null, HumanManufacturerName = "Intel", HumanDeviceName = "82371AB/EB/MB PIIX4 ACPI"
            });

            db_vd.Add(new DeviceDBKey {
                VendorID = 0x80ee, DeviceID = 0xbeef
            }, new DeviceDBEntry {
                DriverName     = "bga", HumanManufacturerName = "Oracle", HumanDeviceName = "VirtualBox Graphics Adapter",
                ExtraResources = new tysos.Resource[] { hb.ios.AllocFixed(0x1ce, 2, true), hb.ios.AllocFixed(0x1cf, 2, true), hb.vmems.Alloc(0x2000000) }
            });

            db_vd.Add(new DeviceDBKey {
                VendorID = 0x1022, DeviceID = 0x2000
            }, pcnet32);
            db_vd.Add(new DeviceDBKey {
                VendorID = 0x1022, DeviceID = 0x2001
            }, pcnet32);

            // The following match on vendor ID, device ID and revision ID


            // The following match on class and subclass
            db_cs.Add(new DeviceDBKey {
                ClassCode = 0x01, SubclassCode = 0x01
            }, new DeviceDBEntry {
                DriverName = "pciide", HumanManufacturerName = "Generic", HumanDeviceName = "PCI IDE Controller"
            });


            // The following match on class, subclass and progIF
            db_csp.Add(new DeviceDBKey {
                ClassCode = 0x01, SubclassCode = 0x01, ProgIF = 0x00
            }, pciide_legacy);
            db_csp.Add(new DeviceDBKey {
                ClassCode = 0x01, SubclassCode = 0x01, ProgIF = 0x0a
            }, pciide_legacy);
            db_csp.Add(new DeviceDBKey {
                ClassCode = 0x01, SubclassCode = 0x01, ProgIF = 0x80
            }, pciide_legacy);
            db_csp.Add(new DeviceDBKey {
                ClassCode = 0x01, SubclassCode = 0x01, ProgIF = 0x8a
            }, pciide_legacy);

            db_csp.Add(new DeviceDBKey {
                ClassCode = 0x03, SubclassCode = 0x00, ProgIF = 0x00
            }, new DeviceDBEntry {
                DriverName = "vga", HumanManufacturerName = "Generic", HumanDeviceName = "Standard VGA Controller"
            });
            db_csp.Add(new DeviceDBKey {
                ClassCode = 0x0c, SubclassCode = 0x03, ProgIF = 0x00
            }, new DeviceDBEntry {
                DriverName = "uhci", HumanManufacturerName = "Generic", HumanDeviceName = "UHCI Controller"
            });
            db_csp.Add(new DeviceDBKey {
                ClassCode = 0x0c, SubclassCode = 0x03, ProgIF = 0x10
            }, new DeviceDBEntry {
                DriverName = "ohci", HumanManufacturerName = "Generic", HumanDeviceName = "OHCI Controller"
            });
            db_csp.Add(new DeviceDBKey {
                ClassCode = 0x0c, SubclassCode = 0x03, ProgIF = 0x20
            }, new DeviceDBEntry {
                DriverName = "ehci", HumanManufacturerName = "Generic", HumanDeviceName = "EHCI Controller"
            });
            db_csp.Add(new DeviceDBKey {
                ClassCode = 0x0c, SubclassCode = 0x03, ProgIF = 0x30
            }, new DeviceDBEntry {
                DriverName = "xhci", HumanManufacturerName = "Generic", HumanDeviceName = "xHCI Controller"
            });
        }