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