Пример #1
0
/**
  Initialize CPU local APIC timer.

**/
VOID
InitializeDebugTimer (
  VOID
  )
{
  UINTN       ApicTimerDivisor;
  UINT32      InitialCount;

  GetApicTimerState (&ApicTimerDivisor, NULL, NULL);

  //
  // Cpu Local Apic timer interrupt frequency, it is set to 0.1s
  //
  InitialCount = (UINT32)DivU64x32 (
                   MultU64x64 (
                     PcdGet32(PcdFSBClock) / (UINT32)ApicTimerDivisor,
                     100
                     ),
                   1000
                   );

  InitializeApicTimer (ApicTimerDivisor, InitialCount, TRUE, DEBUG_TIMER_VECTOR);

  if (MultiProcessorDebugSupport) {
    mDebugMpContext.DebugTimerInitCount = InitialCount;
  }
}
Пример #2
0
EFIAPI
SecPlatformMain (
  IN OUT   EFI_SEC_PEI_HAND_OFF        *SecCoreData
  )
{
  EFI_PEI_PPI_DESCRIPTOR      *PpiList;

  InitializeApicTimer (0, (UINT32) -1, TRUE, 5);

  PpiList = &mPeiSecPlatformPpi[0];

  return PpiList;
}
/**
  Initialize CPU local APIC timer.

  @param[out] TimerFrequency  Local APIC timer frequency returned.
  @param[in]  DumpFlag        If TRUE, dump Local APIC timer's parameter.

  @return   32-bit Local APIC timer init count.
**/
UINT32
InitializeDebugTimer (
  OUT UINT32     *TimerFrequency,
  IN  BOOLEAN    DumpFlag
  )
{
  UINTN       ApicTimerDivisor;
  UINT32      InitialCount;
  UINT32      ApicTimerFrequency;

  InitializeLocalApicSoftwareEnable (TRUE);
  GetApicTimerState (&ApicTimerDivisor, NULL, NULL);
  ApicTimerFrequency = PcdGet32(PcdFSBClock) / (UINT32)ApicTimerDivisor;
  //
  // Cpu Local Apic timer interrupt frequency, it is set to 0.1s
  //
  InitialCount = (UINT32)DivU64x32 (
                   MultU64x64 (
                     ApicTimerFrequency,
                     DEBUG_TIMER_INTERVAL
                     ),
                   1000000u
                   );

  InitializeApicTimer (ApicTimerDivisor, InitialCount, TRUE, DEBUG_TIMER_VECTOR);
  //
  // Disable Debug Timer interrupt to avoid it is delivered before Debug Port
  // is initialized
  //
  DisableApicTimerInterrupt ();

  if (DumpFlag) {
    DEBUG ((EFI_D_INFO, "Debug Timer: FSB Clock    = %d\n", PcdGet32(PcdFSBClock)));
    DEBUG ((EFI_D_INFO, "Debug Timer: Divisor      = %d\n", ApicTimerDivisor));
    DEBUG ((EFI_D_INFO, "Debug Timer: Frequency    = %d\n", ApicTimerFrequency));
    DEBUG ((EFI_D_INFO, "Debug Timer: InitialCount = %d\n", InitialCount));
  }
  if (TimerFrequency != NULL) {
    *TimerFrequency = ApicTimerFrequency;
  }
  return InitialCount;
}