Пример #1
0
        // Constructor
        internal RTClockApic(PnpConfig config, Apic apic)
        {
            int cpuId;

            Microsoft.Singularity.Hal.Platform p = Microsoft.Singularity.Hal.Platform.ThePlatform;
            cpuId = p.ApicId;

            DebugStub.Print("RTClock: create\n");

            // /pnp/08/03/01/PNP0B00 0003 cfg dis : ISA RTC Controller : AT RTC
            // IRQ mask=0100 type=47
            // I/O Port inf=01 min=0070 max=0070 aln=01 len=02 0070..0071

            this.config      = config;
            this.irq         = ((IoIrqRange)config.DynamicRanges[1]).Irq;
            this.apic        = apic;
            this.rtcSpinLock = new SpinLock(SpinLock.Types.RTClock);

            rtcadd = ((IoPortRange)config.DynamicRanges[0])
                     .PortAtOffset(0, 1, Access.ReadWrite);
            rtcdat = ((IoPortRange)config.DynamicRanges[0])
                     .PortAtOffset(1, 1, Access.ReadWrite);

            if (cpuId == 0)
            {
                this.interrupt = Initialize();
                DebugStub.Print("RTClock: interrupt {0:x2}\n",
                                __arglist(this.interrupt));
            }
        }
Пример #2
0
        uint capabilities;          // bits 0-31 at offset 0

        internal Hpet(PnpConfig config)
        {
            int cpuId;

            Microsoft.Singularity.Hal.Platform p = Microsoft.Singularity.Hal.Platform.ThePlatform;
            cpuId = p.ApicId;

            this.config = config;
            IoMemoryRange imr = (IoMemoryRange)config.DynamicRanges[0];

            this.region = imr.MemoryAtOffset(0, (int)imr.Length.ToUInt32(),
                                             Access.ReadWrite);

            capabilities = region.Read32(0x00);
            periodFs     = region.Read32(0x04);

            if (cpuId == 0)
            {
                DebugStub.Print("new Hpet writing regions\n");
                // Disable interrupts on timers
                for (uint i = 0; i <= MaxCounterIndex; i++)
                {
                    DisableInterrupt(i);
                }

                uint gc = region.Read32(0x10) & ~3u;    // Clear legacy bits
                region.Write32(0x10, gc | 1);           // Enable main counter
            }
        }
Пример #3
0
        public override void ClearInterrupt()
        {
            Microsoft.Singularity.Hal.Platform p = Microsoft.Singularity.Hal.Platform.ThePlatform;

            if (hpetClock == null)
            {
                pmClock.Update();
            }
            else
            {
                hpetClock.Update();
            }
            rtClock.ClearInterrupt();
            tscSnapshotValid = false;
        }
Пример #4
0
 public override void ClearInterrupt()
 {
     bool en = Processor.DisableInterrupts();
     this.AcquireLock();
     try {
         Microsoft.Singularity.Hal.Platform p = Microsoft.Singularity.Hal.Platform.ThePlatform;
         if (hpetClock == null) {
             pmClock.Update();
         }
         else {
             hpetClock.Update();
         }
         rtClock.ClearInterrupt();
     }
     finally {
         this.ReleaseLock();
         Processor.RestoreInterrupts(en);
     }
 }
Пример #5
0
        internal void BroadcastFreezeIPI()
        {
            unsafe {
                Microsoft.Singularity.Hal.Platform p = Microsoft.Singularity.Hal.Platform.ThePlatform;
                int cpuId = p.ApicId;

                for (uint i = 0; i < Processor.GetProcessorCount(); i++)
                {
                    uint to = i;
                    if (to != cpuId)
                    {
                        Write(ApicOffset.IcrHi, 0);
                        SendIPI((((uint)to & 0x0ff) << 24),
                                IcrFlags.NoShortHand | IcrFlags.Assert |
                                IcrFlags.NMI | IcrFlags.Physical);
                    }
                }
            }
        }
Пример #6
0
 public override void ClearInterrupt()
 {
     Microsoft.Singularity.Hal.Platform p = Microsoft.Singularity.Hal.Platform.ThePlatform;
     apic.AckIrq(Apic.TimerIrq);
     SetNextInterrupt(maxInterruptInterval);
 }