1*f439973dSWarner Losh /** @file 2*f439973dSWarner Losh Metronome Architectural Protocol as defined in PI SPEC VOLUME 2 DXE 3*f439973dSWarner Losh 4*f439973dSWarner Losh This code abstracts the DXE core to provide delay services. 5*f439973dSWarner Losh 6*f439973dSWarner Losh Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> 7*f439973dSWarner Losh SPDX-License-Identifier: BSD-2-Clause-Patent 8*f439973dSWarner Losh 9*f439973dSWarner Losh **/ 10*f439973dSWarner Losh 11*f439973dSWarner Losh #ifndef __ARCH_PROTOCOL_METRONOME_H__ 12*f439973dSWarner Losh #define __ARCH_PROTOCOL_METRONOME_H__ 13*f439973dSWarner Losh 14*f439973dSWarner Losh /// 15*f439973dSWarner Losh /// Global ID for the Metronome Architectural Protocol 16*f439973dSWarner Losh /// 17*f439973dSWarner Losh #define EFI_METRONOME_ARCH_PROTOCOL_GUID \ 18*f439973dSWarner Losh { 0x26baccb2, 0x6f42, 0x11d4, {0xbc, 0xe7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } } 19*f439973dSWarner Losh 20*f439973dSWarner Losh /// 21*f439973dSWarner Losh /// Declare forward reference for the Metronome Architectural Protocol 22*f439973dSWarner Losh /// 23*f439973dSWarner Losh typedef struct _EFI_METRONOME_ARCH_PROTOCOL EFI_METRONOME_ARCH_PROTOCOL; 24*f439973dSWarner Losh 25*f439973dSWarner Losh /** 26*f439973dSWarner Losh The WaitForTick() function waits for the number of ticks specified by 27*f439973dSWarner Losh TickNumber from a known time source in the platform. If TickNumber of 28*f439973dSWarner Losh ticks are detected, then EFI_SUCCESS is returned. The actual time passed 29*f439973dSWarner Losh between entry of this function and the first tick is between 0 and 30*f439973dSWarner Losh TickPeriod 100 nS units. If you want to guarantee that at least TickPeriod 31*f439973dSWarner Losh time has elapsed, wait for two ticks. This function waits for a hardware 32*f439973dSWarner Losh event to determine when a tick occurs. It is possible for interrupt 33*f439973dSWarner Losh processing, or exception processing to interrupt the execution of the 34*f439973dSWarner Losh WaitForTick() function. Depending on the hardware source for the ticks, it 35*f439973dSWarner Losh is possible for a tick to be missed. This function cannot guarantee that 36*f439973dSWarner Losh ticks will not be missed. If a timeout occurs waiting for the specified 37*f439973dSWarner Losh number of ticks, then EFI_TIMEOUT is returned. 38*f439973dSWarner Losh 39*f439973dSWarner Losh @param This The EFI_METRONOME_ARCH_PROTOCOL instance. 40*f439973dSWarner Losh @param TickNumber Number of ticks to wait. 41*f439973dSWarner Losh 42*f439973dSWarner Losh @retval EFI_SUCCESS The wait for the number of ticks specified by TickNumber 43*f439973dSWarner Losh succeeded. 44*f439973dSWarner Losh @retval EFI_TIMEOUT A timeout occurred waiting for the specified number of ticks. 45*f439973dSWarner Losh 46*f439973dSWarner Losh **/ 47*f439973dSWarner Losh typedef 48*f439973dSWarner Losh EFI_STATUS 49*f439973dSWarner Losh (EFIAPI *EFI_METRONOME_WAIT_FOR_TICK)( 50*f439973dSWarner Losh IN EFI_METRONOME_ARCH_PROTOCOL *This, 51*f439973dSWarner Losh IN UINT32 TickNumber 52*f439973dSWarner Losh ); 53*f439973dSWarner Losh 54*f439973dSWarner Losh /// 55*f439973dSWarner Losh /// This protocol provides access to a known time source in the platform to the 56*f439973dSWarner Losh /// core. The core uses this known time source to produce core services that 57*f439973dSWarner Losh /// require calibrated delays. 58*f439973dSWarner Losh /// 59*f439973dSWarner Losh struct _EFI_METRONOME_ARCH_PROTOCOL { 60*f439973dSWarner Losh EFI_METRONOME_WAIT_FOR_TICK WaitForTick; 61*f439973dSWarner Losh 62*f439973dSWarner Losh /// 63*f439973dSWarner Losh /// The period of platform's known time source in 100 nS units. 64*f439973dSWarner Losh /// This value on any platform must be at least 10 uS, and must not 65*f439973dSWarner Losh /// exceed 200 uS. The value in this field is a constant that must 66*f439973dSWarner Losh /// not be modified after the Metronome architectural protocol is 67*f439973dSWarner Losh /// installed. All consumers must treat this as a read-only field. 68*f439973dSWarner Losh /// 69*f439973dSWarner Losh UINT32 TickPeriod; 70*f439973dSWarner Losh }; 71*f439973dSWarner Losh 72*f439973dSWarner Losh extern EFI_GUID gEfiMetronomeArchProtocolGuid; 73*f439973dSWarner Losh 74*f439973dSWarner Losh #endif 75