47volatile UINT64 mTimerPeriod = 0;
64 IoWrite8 (TIMER0_COUNT_PORT, (UINT8)(Count & 0xff));
65 IoWrite8 (TIMER0_COUNT_PORT, (UINT8)((Count >> 8) & 0xff));
86 mLegacy8259->EndOfInterrupt (mLegacy8259, Efi8259Irq0);
88 if (mTimerNotifyFunction !=
NULL) {
92 mTimerNotifyFunction (mTimerPeriod);
140 return EFI_INVALID_PARAMETER;
144 return EFI_ALREADY_STARTED;
184 IN UINT64 TimerPeriod
203 if (TimerPeriod == 0) {
207 mLegacy8259->DisableIrq (mLegacy8259, Efi8259Irq0);
217 if (TimerCount >= 65536) {
219 TimerPeriod = MAX_TIMER_TICK_DURATION;
230 mLegacy8259->EnableIrq (mLegacy8259, Efi8259Irq0,
FALSE);
236 mTimerPeriod = TimerPeriod;
261 OUT UINT64 *TimerPeriod
264 if (TimerPeriod ==
NULL) {
265 return EFI_INVALID_PARAMETER;
268 *TimerPeriod = mTimerPeriod;
303 Status = mLegacy8259->GetMask (mLegacy8259,
NULL,
NULL, &IRQMask,
NULL);
305 if ((IRQMask & 0x1) == 0) {
309 OriginalTPL =
gBS->RaiseTPL (TPL_HIGH_LEVEL);
311 if (mTimerNotifyFunction !=
NULL) {
315 mTimerNotifyFunction (mTimerPeriod);
318 gBS->RestoreTPL (OriginalTPL);
320 return EFI_UNSUPPORTED;
350 mTimerNotifyFunction =
NULL;
360 Status =
gBS->LocateProtocol (&gEfiCpuArchProtocolGuid,
NULL, (VOID **)&mCpu);
366 Status =
gBS->LocateProtocol (&gEfiLegacy8259ProtocolGuid,
NULL, (VOID **)&mLegacy8259);
379 Status = mLegacy8259->GetVector (mLegacy8259, Efi8259Irq0, (UINT8 *)&TimerVector);
397 Status =
gBS->InstallMultipleProtocolInterfaces (
399 &gEfiTimerArchProtocolGuid,
UINT64 EFIAPI DivU64x32(IN UINT64 Dividend, IN UINT32 Divisor)
UINT64 EFIAPI MultU64x32(IN UINT64 Multiplicand, IN UINT32 Multiplier)
#define ASSERT_EFI_ERROR(StatusParameter)
#define ASSERT_PROTOCOL_ALREADY_INSTALLED(Handle, Guid)
UINT8 EFIAPI IoWrite8(IN UINTN Port, IN UINT8 Value)
VOID(EFIAPI * EFI_TIMER_NOTIFY)(IN UINT64 Time)
VOID EFIAPI NestedInterruptRestoreTPL(IN EFI_TPL InterruptedTPL, IN OUT EFI_SYSTEM_CONTEXT SystemContext, IN OUT NESTED_INTERRUPT_STATE *IsrState)
EFI_TPL EFIAPI NestedInterruptRaiseTPL(VOID)
EFI_STATUS EFIAPI TimerDriverInitialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
VOID SetPitCount(IN UINT16 Count)
EFI_STATUS EFIAPI TimerDriverRegisterHandler(IN EFI_TIMER_ARCH_PROTOCOL *This, IN EFI_TIMER_NOTIFY NotifyFunction)
EFI_STATUS EFIAPI TimerDriverGetTimerPeriod(IN EFI_TIMER_ARCH_PROTOCOL *This, OUT UINT64 *TimerPeriod)
EFI_STATUS EFIAPI TimerDriverSetTimerPeriod(IN EFI_TIMER_ARCH_PROTOCOL *This, IN UINT64 TimerPeriod)
EFI_STATUS EFIAPI TimerDriverGenerateSoftInterrupt(IN EFI_TIMER_ARCH_PROTOCOL *This)
VOID EFIAPI TimerInterruptHandler(IN EFI_EXCEPTION_TYPE InterruptType, IN EFI_SYSTEM_CONTEXT SystemContext)
VOID EFIAPI NotifyFunction(IN EFI_EVENT Event, IN VOID *Context)