Beispiel #1
0
 internal static void Setup()
 {
     System.DebugStub.Print("Dma.Setup 1. ");
     try {
         CompilerIntrinsics.Cli();
         ioMemory   = NucleusCalls.PciDmaBuffer();
         ioPhysical = NucleusCalls.PciDmaPhysicalAddr();
         // The IO-MMU tables map 2MB, aligned by 2MB
         uint superPageSize = 0x200000;
         uint ioSuperPage   = (ioPhysical + 2 * superPageSize) - (ioPhysical & (superPageSize - 1));
         allocOffset = (int)(ioSuperPage - ioPhysical);
     }
     finally {
         CompilerIntrinsics.Sti();
     }
     System.DebugStub.Print("Dma.Setup 2. ioPhysical = 0x" + ioPhysical.ToString("X") + " allocOffset = 0x" + allocOffset.ToString("X") + ". ");
 }
Beispiel #2
0
        public override void Run()
        {
            System.DebugStub.Print(" PLASMA Verve.  ");
            System.DebugStub.Print("IoThread@" + Kernel.CurrentThread + ". ");
            byte[] pciDmaBuffer;
            try {
                CompilerIntrinsics.Cli();
                pciDmaBuffer = NucleusCalls.PciDmaBuffer();
            } finally {
                CompilerIntrinsics.Sti();
            }

            if (pciDmaBuffer == null)
            {
                System.DebugStub.Print("No IO-MMU. ");
                Kernel.kernel.NewSemaphore(0).Wait();
                return;
            }

            // Establish DMA buffer area
            Microsoft.Singularity.Io.DmaMemory.Setup();

            // Enumerate and initialize PCI devices
            for (uint id = 0; id < 65536; id += 8)
            {
                uint v;
                try {
                    CompilerIntrinsics.Cli();
                    v = NucleusCalls.PciConfigRead32(id, 0);
                } finally {
                    CompilerIntrinsics.Sti();
                }
                if (v == 0x107c8086)
                {
                    // Intel NIC
                    System.DebugStub.Print("Found Intel NIC. ");
                }
            }
            System.DebugStub.Print("IoThread done. ");
            Kernel.kernel.NewSemaphore(0).Wait();
        }
Beispiel #3
0
        public override void Run()
        {
            System.DebugStub.Print("IoThread@" + Kernel.CurrentThread + ". ");
            byte[] pciDmaBuffer;
            try {
                CompilerIntrinsics.Cli();
                pciDmaBuffer = NucleusCalls.PciDmaBuffer();
            } finally {
                CompilerIntrinsics.Sti();
            }

            if (pciDmaBuffer == null)
            {
                System.DebugStub.Print("No IO-MMU. ");
                Kernel.kernel.NewSemaphore(0).Wait();
                return;
            }
            // Set up networking
            Microsoft.Singularity.NetStack2.ARP arp =
                new Microsoft.Singularity.NetStack2.ARP();
            Microsoft.Singularity.NetStack2.IP.Initialize(arp);
            Microsoft.Singularity.NetStack2.Ethernet.Initialize(arp);

            //Microsoft.Singularity.NetStack2.Channels.Private.RoutingExpManager routingManager =
            //    new Microsoft.Singularity.NetStack2.Channels.Private.RoutingExpManager();
            Microsoft.Singularity.NetStack2.Channels.Private.IPContract ipManager =
                new Microsoft.Singularity.NetStack2.Channels.Private.IPContract();

            // Establish DMA buffer area
            Microsoft.Singularity.Io.DmaMemory.Setup();

            // Enumerate and initialize PCI devices
            for (uint id = 0; id < 65536; id += 8)
            {
                uint v;
                try {
                    CompilerIntrinsics.Cli();
                    v = NucleusCalls.PciConfigRead32(id, 0);
                } finally {
                    CompilerIntrinsics.Sti();
                }
                if (v == 0x107c8086)
                {
                    // Intel NIC
                    System.DebugStub.Print("Found Intel NIC. ");
                    Microsoft.Singularity.Drivers.Network.Intel.Intel intel =
                        new Microsoft.Singularity.Drivers.Network.Intel.Intel(
                            new Microsoft.Singularity.Io.PciDeviceConfig((ushort)id),
                            new Microsoft.Singularity.Io.PciMemory(id),
                            "82541 PI",
                            Microsoft.Singularity.Drivers.Network.Intel.CardType.I82541PI);
                    intel.Initialize();
                    Microsoft.Singularity.Io.Net.NicDeviceContract nicDev =
                        new Microsoft.Singularity.Drivers.Network.Intel.IntelDeviceChannel(intel);
                    bool ok = Microsoft.Singularity.NetStack2.Channels.Nic.Nic.CreateAndRegister(
                        nicDev, "/nic0");
                    System.VTable.Assert(ok);
                    ipManager.StartDhcp("/nic0");
                }
            }
            System.DebugStub.Print("IoThread done. ");
            Kernel.kernel.NewSemaphore(0).Wait();
        }