Example #1
0
        /// <summary>
        /// Creates the partition devices.
        /// </summary>
        private void CreatePCIDevices(Device device, IPCIControllerLegacy pciController)
        {
            // For each controller
            for (int bus = 0; bus < 255; bus++)
            {
                for (int slot = 0; slot < 16; slot++)
                {
                    for (int fun = 0; fun < 7; fun++)
                    {
                        if (!ProbeDevice(pciController, (byte)bus, (byte)slot, (byte)fun))
                        {
                            continue;
                        }

                        // TODO: Check for duplicate

                        var configuration = new PCIDeviceConfiguration()
                        {
                            Bus      = (byte)bus,
                            Slot     = (byte)slot,
                            Function = (byte)fun
                        };

                        DeviceService.Initialize(new PCIDevice(), device, true, configuration, null, null);
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        /// Creates the partition devices.
        /// </summary>
        public void CreatePCIDevices()
        {
            // Find PCI controller devices
            var devices = deviceManager.GetDevices <IPCIController>(DeviceStatus.Online);

            if (devices.Count == 0)
            {
                return;
            }

            var pciController = devices[0].DeviceDriver as IPCIController;

            // For each controller
            for (int bus = 0; bus < 255; bus++)
            {
                for (int slot = 0; slot < 16; slot++)
                {
                    for (int fun = 0; fun < 7; fun++)
                    {
                        if (ProbeDevice(pciController, (byte)bus, (byte)slot, (byte)fun))
                        {
                            var configuration = new PCIDeviceConfiguration()
                            {
                                Bus      = (byte)bus,
                                Slot     = (byte)slot,
                                Function = (byte)fun
                            };

                            deviceManager.Initialize(new PCIDevice(), devices[0], configuration, null, null);
                        }
                    }
                }
            }
        }